xrocusOS_ADXL355 version

Dependencies:   mbed SDFileSystem

Committer:
APS_Lab
Date:
Fri Jul 05 02:09:06 2019 +0000
Revision:
20:2f2687580ecb
Parent:
19:36072b9b79f3
Ver0.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Inscape_ao 2:a694440145e9 1 /** --- Includes --- */
Inscape_ao 2:a694440145e9 2 #include "mbed.h"
Inscape_ao 2:a694440145e9 3 #include "TimeManager.h"
Inscape_ao 2:a694440145e9 4 #include "UartReceiver.h"
Inscape_ao 2:a694440145e9 5 #include "CommandParser.h"
Inscape_ao 2:a694440145e9 6 #include "global.h"
Inscape_ao 2:a694440145e9 7 #include "string.h"
Inscape_ao 2:a694440145e9 8
Inscape_ao 2:a694440145e9 9 static int sampleHanlder(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 10 static int softResetHanlder(CommandParser *pC, char *arg, int exarg);
Inscape_ao 2:a694440145e9 11 static int setTimeHanlder(CommandParser *pC, char *arg, int exarg);
Inscape_ao 2:a694440145e9 12 static int getTimeHanlder(CommandParser *pC, char *arg, int exarg);
Inscape_ao 5:a37e3a15444b 13 static int startSDStore(CommandParser *pC, char *arg, int exarg);
Inscape_ao 5:a37e3a15444b 14 static int endSDStore(CommandParser *pC, char *arg, int exarg);
Inscape_ao 5:a37e3a15444b 15 static int writeSDStore(CommandParser *pC, char *arg, int exarg);
Inscape_ao 2:a694440145e9 16
Inscape_ao 7:9ab8809f9693 17 static int configIDHandler(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 18 static int configWriteHandler(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 19 static int configReadHandler(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 20
Inscape_ao 7:9ab8809f9693 21 static int startRunHandler(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 22 static int stopReqHandler(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 23 static int checkRunStatHandler(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 24 static int setRepeatCountHandler(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 25 static int setRepeatStrideHandler(CommandParser *pC, char *arg, int exarg);
Inscape_ao 17:c2709a9c0a68 26 static int setRepeatSingleShotMode(CommandParser *pC, char *arg, int exarg);
Inscape_ao 7:9ab8809f9693 27
Inscape_ao 2:a694440145e9 28 /* Event Hankder */
Inscape_ao 2:a694440145e9 29 CmdParseRule rules[] = {
Inscape_ao 7:9ab8809f9693 30 /* -- sample -- */
Inscape_ao 2:a694440145e9 31 {"CMD", sampleHanlder, 0},
Inscape_ao 7:9ab8809f9693 32 /* Control SD-Card(NOT-SDHC) */
Inscape_ao 5:a37e3a15444b 33 {"SDS", startSDStore, 0},
Inscape_ao 5:a37e3a15444b 34 {"SDE", endSDStore, 0},
Inscape_ao 5:a37e3a15444b 35 {"SDW", writeSDStore, 0}, /* for TEST */
Inscape_ao 7:9ab8809f9693 36 /* Get Timestamp */
Inscape_ao 2:a694440145e9 37 {"GTS", getTimeHanlder, 0},
Inscape_ao 7:9ab8809f9693 38 /* Set Timestamp */
Inscape_ao 2:a694440145e9 39 {"TYR", setTimeHanlder, TimeManager::SetTimeMethod::Year},
Inscape_ao 2:a694440145e9 40 {"TMO", setTimeHanlder, TimeManager::SetTimeMethod::Month},
Inscape_ao 2:a694440145e9 41 {"TDA", setTimeHanlder, TimeManager::SetTimeMethod::Day},
Inscape_ao 2:a694440145e9 42 {"THR", setTimeHanlder, TimeManager::SetTimeMethod::Hour},
Inscape_ao 2:a694440145e9 43 {"TMI", setTimeHanlder, TimeManager::SetTimeMethod::Min},
Inscape_ao 2:a694440145e9 44 {"TSE", setTimeHanlder, TimeManager::SetTimeMethod::Sec},
Inscape_ao 7:9ab8809f9693 45 /* Sensing Control */
Inscape_ao 7:9ab8809f9693 46 {"CRS", startRunHandler, 0}, /* Run(start) */
Inscape_ao 7:9ab8809f9693 47 {"CRE", stopReqHandler, 0}, /* Stop -- req */
Inscape_ao 7:9ab8809f9693 48 {"CPS", checkRunStatHandler, 0}, /* Check ReadyToRun */
Inscape_ao 7:9ab8809f9693 49 {"RRP", setRepeatCountHandler, 0}, /* set repeat setting => Count */
Inscape_ao 7:9ab8809f9693 50 {"RMC", setRepeatStrideHandler, 0}, /* set repeat setting => Stride */
Inscape_ao 17:c2709a9c0a68 51 {"RSH", setRepeatSingleShotMode, 0}, /* set repeat setting => SingleShot */
Inscape_ao 7:9ab8809f9693 52 /* Device Control */
Inscape_ao 7:9ab8809f9693 53 {"SRS", softResetHanlder, 0}, /* TODO: Software Reset */
Inscape_ao 7:9ab8809f9693 54 {"CID", configIDHandler, 0}, /* Config ID Access */
Inscape_ao 7:9ab8809f9693 55 {"CFW", configWriteHandler, 0}, /* Config Write */
Inscape_ao 7:9ab8809f9693 56 {"CFR", configReadHandler, 0}, /* Config Read */
Inscape_ao 2:a694440145e9 57 };
Inscape_ao 2:a694440145e9 58
Inscape_ao 2:a694440145e9 59 int getNumOfRules = sizeof(rules)/sizeof(CmdParseRule);
Inscape_ao 2:a694440145e9 60
Inscape_ao 7:9ab8809f9693 61 /****************************************************/
Inscape_ao 7:9ab8809f9693 62 /* Event Handlers (Device Control) */
Inscape_ao 7:9ab8809f9693 63 /****************************************************/
Inscape_ao 7:9ab8809f9693 64 static int startRunHandler(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 65 {
Inscape_ao 7:9ab8809f9693 66 bool success;
Inscape_ao 7:9ab8809f9693 67 success = pDevRept->start();
Inscape_ao 7:9ab8809f9693 68 if (!success) {
Inscape_ao 19:36072b9b79f3 69 pC->reply(false, CommandParser::NakCode::NAK_IN_RUNNING);
Inscape_ao 7:9ab8809f9693 70 return 1;
Inscape_ao 7:9ab8809f9693 71 }
Inscape_ao 7:9ab8809f9693 72 pC->reply();
Inscape_ao 7:9ab8809f9693 73 return 0;
Inscape_ao 7:9ab8809f9693 74 }
Inscape_ao 7:9ab8809f9693 75
Inscape_ao 7:9ab8809f9693 76 static int stopReqHandler(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 77 {
Inscape_ao 7:9ab8809f9693 78 bool success;
Inscape_ao 7:9ab8809f9693 79 success = pDevRept->stop();
Inscape_ao 7:9ab8809f9693 80 if (!success) {
Inscape_ao 19:36072b9b79f3 81 pC->reply(false, CommandParser::NakCode::NAK_IN_STOPPED);
Inscape_ao 7:9ab8809f9693 82 return 1;
Inscape_ao 7:9ab8809f9693 83 }
Inscape_ao 7:9ab8809f9693 84 pC->reply();
Inscape_ao 7:9ab8809f9693 85 return 0;
Inscape_ao 7:9ab8809f9693 86 }
Inscape_ao 7:9ab8809f9693 87
Inscape_ao 7:9ab8809f9693 88 static int checkRunStatHandler(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 89 {
Inscape_ao 7:9ab8809f9693 90 bool success;
Inscape_ao 7:9ab8809f9693 91 success = pDevRept->readyToStart();
Inscape_ao 7:9ab8809f9693 92 if (!success) {
Inscape_ao 19:36072b9b79f3 93 pC->reply(false, CommandParser::NakCode::NAK_IN_RUNNING);
Inscape_ao 7:9ab8809f9693 94 return 1;
Inscape_ao 7:9ab8809f9693 95 }
Inscape_ao 7:9ab8809f9693 96 pC->reply();
Inscape_ao 7:9ab8809f9693 97 return 0;
Inscape_ao 7:9ab8809f9693 98 }
Inscape_ao 7:9ab8809f9693 99
Inscape_ao 7:9ab8809f9693 100 static int setRepeatCountHandler(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 101 {
Inscape_ao 7:9ab8809f9693 102 bool success;
Inscape_ao 7:9ab8809f9693 103 int setvalue = atoi(arg);
Inscape_ao 7:9ab8809f9693 104 success = pDevRept->setRepeatCount(setvalue);
Inscape_ao 7:9ab8809f9693 105 if (!success) {
Inscape_ao 19:36072b9b79f3 106 pC->reply(false, CommandParser::NakCode::NAK_IN_RUNNING);
Inscape_ao 7:9ab8809f9693 107 return 1;
Inscape_ao 7:9ab8809f9693 108 }
Inscape_ao 7:9ab8809f9693 109 pC->reply();
Inscape_ao 7:9ab8809f9693 110 return 0;
Inscape_ao 7:9ab8809f9693 111 }
Inscape_ao 7:9ab8809f9693 112 static int setRepeatStrideHandler(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 113 {
Inscape_ao 7:9ab8809f9693 114 bool success;
Inscape_ao 7:9ab8809f9693 115 char msflag = arg[3];
Inscape_ao 7:9ab8809f9693 116 char valsrc[4] = {0};
Inscape_ao 7:9ab8809f9693 117 int setvalue;
Inscape_ao 7:9ab8809f9693 118
Inscape_ao 7:9ab8809f9693 119 /* this Argment is "xxxs" or "xxxm" */
Inscape_ao 7:9ab8809f9693 120 memcpy(valsrc, arg, 3);
Inscape_ao 7:9ab8809f9693 121 setvalue = atoi(valsrc);
Inscape_ao 7:9ab8809f9693 122
Inscape_ao 7:9ab8809f9693 123 if (msflag == 'm') {
Inscape_ao 7:9ab8809f9693 124 setvalue *= 60; /* setvalue x 60(min to sec)*/
Inscape_ao 7:9ab8809f9693 125 } else if (msflag == 's') {
Inscape_ao 7:9ab8809f9693 126 /* NOP setvalue = setvalue */
Inscape_ao 7:9ab8809f9693 127 } else {
Inscape_ao 7:9ab8809f9693 128 /* invalid format */
Inscape_ao 19:36072b9b79f3 129 pC->reply(false, CommandParser::NakCode::NAK_INVAL_PARAM);
Inscape_ao 7:9ab8809f9693 130 return 1;
Inscape_ao 7:9ab8809f9693 131 }
Inscape_ao 7:9ab8809f9693 132 success = pDevRept->setRepeatStride(setvalue);
Inscape_ao 7:9ab8809f9693 133 if (!success) {
Inscape_ao 19:36072b9b79f3 134 pC->reply(false, CommandParser::NakCode::NAK_IN_RUNNING);
Inscape_ao 7:9ab8809f9693 135 return 1;
Inscape_ao 7:9ab8809f9693 136 }
Inscape_ao 7:9ab8809f9693 137 pC->reply();
Inscape_ao 7:9ab8809f9693 138 return 0;
Inscape_ao 7:9ab8809f9693 139 }
Inscape_ao 8:b18a8764ecae 140
Inscape_ao 17:c2709a9c0a68 141 static int setRepeatSingleShotMode(CommandParser *pC, char *arg, int exarg)
Inscape_ao 17:c2709a9c0a68 142 {
Inscape_ao 17:c2709a9c0a68 143 bool setMode = true;
Inscape_ao 17:c2709a9c0a68 144 bool success;
Inscape_ao 17:c2709a9c0a68 145 if (strcmp("SET1", arg) == 0) {
Inscape_ao 17:c2709a9c0a68 146 setMode = true;
Inscape_ao 17:c2709a9c0a68 147 } else if (strcmp("CLR0", arg) == 0) {
Inscape_ao 17:c2709a9c0a68 148 setMode = false;
Inscape_ao 17:c2709a9c0a68 149 } else {
Inscape_ao 17:c2709a9c0a68 150 /* INVALID COMMAND */
Inscape_ao 19:36072b9b79f3 151 pC->reply(false, CommandParser::NakCode::NAK_INVAL_PARAM);
Inscape_ao 17:c2709a9c0a68 152 return 1;
Inscape_ao 17:c2709a9c0a68 153 }
Inscape_ao 17:c2709a9c0a68 154 success = pDevRept->setRepeatSingleShot(setMode);
Inscape_ao 17:c2709a9c0a68 155 if (success != true) {
Inscape_ao 17:c2709a9c0a68 156 /* INVALID COMMAND in SetMode */
Inscape_ao 19:36072b9b79f3 157 pC->reply(false, CommandParser::NakCode::NAK_IN_RUNNING);
Inscape_ao 17:c2709a9c0a68 158 return 1;
Inscape_ao 17:c2709a9c0a68 159 }
Inscape_ao 17:c2709a9c0a68 160 pC->reply();
Inscape_ao 17:c2709a9c0a68 161 return 0;
Inscape_ao 17:c2709a9c0a68 162 }
Inscape_ao 17:c2709a9c0a68 163
Inscape_ao 7:9ab8809f9693 164 /****************************************************/
Inscape_ao 7:9ab8809f9693 165 /* Event Handlers (Device Control) */
Inscape_ao 7:9ab8809f9693 166 /****************************************************/
Inscape_ao 7:9ab8809f9693 167 static int configIDHandler(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 168 {
Inscape_ao 7:9ab8809f9693 169 bool success;
Inscape_ao 7:9ab8809f9693 170 int setvalue = strtol(arg, NULL, 16);
Inscape_ao 7:9ab8809f9693 171 success = pDevRept->setConfigId(setvalue);
Inscape_ao 7:9ab8809f9693 172 if (!success) {
Inscape_ao 19:36072b9b79f3 173 pC->reply(false, CommandParser::NakCode::NAK_INVAL_SEQ);
Inscape_ao 7:9ab8809f9693 174 return 1;
Inscape_ao 7:9ab8809f9693 175 }
Inscape_ao 7:9ab8809f9693 176 pC->reply();
Inscape_ao 7:9ab8809f9693 177 return 0;
Inscape_ao 7:9ab8809f9693 178 }
Inscape_ao 7:9ab8809f9693 179
Inscape_ao 7:9ab8809f9693 180 static int configWriteHandler(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 181 {
Inscape_ao 7:9ab8809f9693 182 bool success;
Inscape_ao 7:9ab8809f9693 183 int setvalue = strtol(arg, NULL, 16);
Inscape_ao 7:9ab8809f9693 184 success = pDevRept->setConfigValue(setvalue);
Inscape_ao 7:9ab8809f9693 185 if (!success) {
Inscape_ao 19:36072b9b79f3 186 pC->reply(false, CommandParser::NakCode::NAK_INVAL_SEQ);
Inscape_ao 7:9ab8809f9693 187 return 1;
Inscape_ao 7:9ab8809f9693 188 }
Inscape_ao 7:9ab8809f9693 189 pC->reply();
Inscape_ao 7:9ab8809f9693 190 return 0;
Inscape_ao 7:9ab8809f9693 191 }
Inscape_ao 7:9ab8809f9693 192
Inscape_ao 7:9ab8809f9693 193 static int configReadHandler(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 194 {
Inscape_ao 7:9ab8809f9693 195 bool success;
Inscape_ao 7:9ab8809f9693 196 int getvalue;
Inscape_ao 7:9ab8809f9693 197 Serial *pUart = pC->getCurrentUart();
Inscape_ao 7:9ab8809f9693 198
Inscape_ao 7:9ab8809f9693 199 success = pDevRept->getConfigValue(&getvalue);
Inscape_ao 7:9ab8809f9693 200 if (!success) {
Inscape_ao 19:36072b9b79f3 201 pC->reply(false, CommandParser::NakCode::NAK_INVAL_SEQ);
Inscape_ao 7:9ab8809f9693 202 return 1;
Inscape_ao 7:9ab8809f9693 203 }
Inscape_ao 13:7cda5bef6390 204 uprintf(":%d CFG 0004 %04x\n", pC->getDeviceID(), getvalue);
Inscape_ao 7:9ab8809f9693 205 return 0;
Inscape_ao 7:9ab8809f9693 206 }
Inscape_ao 7:9ab8809f9693 207
Inscape_ao 7:9ab8809f9693 208 static int softResetHanlder(CommandParser *pC, char *arg, int exarg)
Inscape_ao 7:9ab8809f9693 209 {
Inscape_ao 7:9ab8809f9693 210 bool success;
Inscape_ao 7:9ab8809f9693 211 success = pDevRept->resetAllStatus();
Inscape_ao 7:9ab8809f9693 212 if (!success) {
Inscape_ao 7:9ab8809f9693 213 pC->reply(false, 3);
Inscape_ao 7:9ab8809f9693 214 return 1;
Inscape_ao 7:9ab8809f9693 215 }
Inscape_ao 7:9ab8809f9693 216 pC->reply();
Inscape_ao 7:9ab8809f9693 217 return 0;
Inscape_ao 7:9ab8809f9693 218 }
Inscape_ao 2:a694440145e9 219
Inscape_ao 2:a694440145e9 220 /****************************************************/
Inscape_ao 2:a694440145e9 221 /* Event Handlers */
Inscape_ao 2:a694440145e9 222 /****************************************************/
Inscape_ao 2:a694440145e9 223 /* Sample Command */
Inscape_ao 2:a694440145e9 224 static int sampleHanlder(CommandParser *pC, char *arg, int exarg)
Inscape_ao 2:a694440145e9 225 {
Inscape_ao 19:36072b9b79f3 226 wait(1);
Inscape_ao 19:36072b9b79f3 227 NVIC_SystemReset();
Inscape_ao 19:36072b9b79f3 228 /* Never Reached. */
Inscape_ao 19:36072b9b79f3 229 pC->reply(false, CommandParser::NakCode::NAK_INVAL_SEQ);
Inscape_ao 19:36072b9b79f3 230 return 1;
Inscape_ao 2:a694440145e9 231 }
Inscape_ao 2:a694440145e9 232
Inscape_ao 5:a37e3a15444b 233 /****************************************************/
Inscape_ao 5:a37e3a15444b 234 /* Event Handlers (SD Control) */
Inscape_ao 5:a37e3a15444b 235 /****************************************************/
Inscape_ao 5:a37e3a15444b 236 static int startSDStore(CommandParser *pC, char *arg, int exarg)
Inscape_ao 5:a37e3a15444b 237 {
Inscape_ao 5:a37e3a15444b 238 if (pSds->startFileWithTimeStamp("","txt") != true) {
Inscape_ao 19:36072b9b79f3 239 pC->reply(false, CommandParser::NakCode::NAK_INTERNAL_ERR);
Inscape_ao 5:a37e3a15444b 240 return 1;
Inscape_ao 5:a37e3a15444b 241 }
Inscape_ao 5:a37e3a15444b 242 pC->reply();
Inscape_ao 5:a37e3a15444b 243 return 0;
Inscape_ao 5:a37e3a15444b 244 }
Inscape_ao 5:a37e3a15444b 245
Inscape_ao 5:a37e3a15444b 246 static int endSDStore(CommandParser *pC, char *arg, int exarg)
Inscape_ao 5:a37e3a15444b 247 {
Inscape_ao 5:a37e3a15444b 248 FILE *fp;
Inscape_ao 5:a37e3a15444b 249 if ((fp = pSds->getFilePointer()) == NULL) {
Inscape_ao 5:a37e3a15444b 250 /* NOP */
Inscape_ao 5:a37e3a15444b 251 pC->reply(false, 2);
Inscape_ao 5:a37e3a15444b 252 return 2;
Inscape_ao 5:a37e3a15444b 253 }
Inscape_ao 5:a37e3a15444b 254 fprintf(fp, "call endSDStore(%s)\n", pSds->getFileName());
Inscape_ao 5:a37e3a15444b 255 pSds->syncFile();
Inscape_ao 5:a37e3a15444b 256 pSds->closeFile();
Inscape_ao 5:a37e3a15444b 257 pC->reply();
Inscape_ao 5:a37e3a15444b 258 return 0;
Inscape_ao 5:a37e3a15444b 259 }
Inscape_ao 5:a37e3a15444b 260
Inscape_ao 5:a37e3a15444b 261 static int writeSDStore(CommandParser *pC, char *arg, int exarg)
Inscape_ao 5:a37e3a15444b 262 {
Inscape_ao 5:a37e3a15444b 263 FILE *fp;
Inscape_ao 5:a37e3a15444b 264 char curr[TimeManager::TimeStampLength + 1] = {0};
Inscape_ao 5:a37e3a15444b 265
Inscape_ao 5:a37e3a15444b 266 if ((fp = pSds->getFilePointer()) == NULL) {
Inscape_ao 5:a37e3a15444b 267 /* NOP */
Inscape_ao 19:36072b9b79f3 268 pC->reply(false, CommandParser::NakCode::NAK_INVAL_SEQ);
Inscape_ao 5:a37e3a15444b 269 return 2;
Inscape_ao 5:a37e3a15444b 270 }
Inscape_ao 5:a37e3a15444b 271 pTM->getTimeStamp(curr);
Inscape_ao 5:a37e3a15444b 272 fprintf(fp, "call writeSDStore at %s\n", curr);
Inscape_ao 5:a37e3a15444b 273 pSds->syncFile();
Inscape_ao 5:a37e3a15444b 274 pC->reply();
Inscape_ao 5:a37e3a15444b 275 return 0;
Inscape_ao 5:a37e3a15444b 276 }
Inscape_ao 5:a37e3a15444b 277
Inscape_ao 5:a37e3a15444b 278 /****************************************************/
Inscape_ao 5:a37e3a15444b 279 /* Event Handlers (Time Control) */
Inscape_ao 5:a37e3a15444b 280 /****************************************************/
Inscape_ao 2:a694440145e9 281 /* Time Set Command */
Inscape_ao 2:a694440145e9 282 static int setTimeHanlder(CommandParser *pC, char *arg, int exarg)
Inscape_ao 2:a694440145e9 283 {
Inscape_ao 2:a694440145e9 284 bool success = false;
Inscape_ao 2:a694440145e9 285 int setvalue = atoi(arg);
Inscape_ao 2:a694440145e9 286
Inscape_ao 2:a694440145e9 287 switch (exarg) {
Inscape_ao 2:a694440145e9 288 case TimeManager::SetTimeMethod::Year:
Inscape_ao 2:a694440145e9 289 case TimeManager::SetTimeMethod::Month:
Inscape_ao 2:a694440145e9 290 case TimeManager::SetTimeMethod::Day:
Inscape_ao 2:a694440145e9 291 case TimeManager::SetTimeMethod::Hour:
Inscape_ao 2:a694440145e9 292 case TimeManager::SetTimeMethod::Min:
Inscape_ao 2:a694440145e9 293 case TimeManager::SetTimeMethod::Sec:
Inscape_ao 2:a694440145e9 294 success = pTM->setCurrentTime(exarg,setvalue);
Inscape_ao 2:a694440145e9 295 break;
Inscape_ao 2:a694440145e9 296 }
Inscape_ao 19:36072b9b79f3 297 pC->reply(success, (success)? 0 : CommandParser::NakCode::NAK_INVAL_PARAM );
Inscape_ao 2:a694440145e9 298 return 0;
Inscape_ao 2:a694440145e9 299 }
Inscape_ao 2:a694440145e9 300
Inscape_ao 2:a694440145e9 301 /* Time Get Command */
Inscape_ao 2:a694440145e9 302 static int getTimeHanlder(CommandParser *pC, char *arg, int exarg)
Inscape_ao 2:a694440145e9 303 {
Inscape_ao 2:a694440145e9 304 int len;
Inscape_ao 2:a694440145e9 305 char timestamp[TimeManager::TimeStampLength + 1] = {0};
Inscape_ao 2:a694440145e9 306 Serial *pUart = pC->getCurrentUart();
Inscape_ao 2:a694440145e9 307 len = pTM->getTimeStamp(timestamp);
Inscape_ao 13:7cda5bef6390 308 uprintf(":%d RTS %04d %s\n", pC->getDeviceID(), len, timestamp);
Inscape_ao 2:a694440145e9 309 return 0;
Inscape_ao 2:a694440145e9 310 }