Teseo Location demo for GPSProvider using ST GNSS driver.

Dependencies:   GPS_Provider X_NUCLEO_GNSS1A1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

Go to the documentation of this file.
00001 /**
00002 *******************************************************************************
00003 * @file    main.cpp
00004 * @author  AST / Central Lab
00005 * @version V1.0.0
00006 * @date    June-2017
00007 * @brief   Teseo Location Hello World
00008 *
00009 *******************************************************************************
00010 * @attention
00011 *
00012 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
00013 *
00014 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00015 * You may not use this file except in compliance with the License.
00016 * You may obtain a copy of the License at:
00017 *
00018 *        http://www.st.com/software_license_agreement_liberty_v2
00019 *
00020 * Redistribution and use in source and binary forms, with or without modification,
00021 * are permitted provided that the following conditions are met:
00022 *   1. Redistributions of source code must retain the above copyright notice,
00023 *      this list of conditions and the following disclaimer.
00024 *   2. Redistributions in binary form must reproduce the above copyright notice,
00025 *      this list of conditions and the following disclaimer in the documentation
00026 *      and/or other materials provided with the distribution.
00027 *   3. Neither the name of STMicroelectronics nor the names of its contributors
00028 *      may be used to endorse or promote products derived from this software
00029 *      without specific prior written permission.
00030 *
00031 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00032 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00033 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00034 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00035 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00036 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00037 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00038 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00039 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00040 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00041 *
00042 ********************************************************************************
00043 */
00044 
00045 #include "mbed.h"
00046 #include "Teseo.h"
00047 #include "GPSProvider.h"
00048 
00049 #include "geofence_config.h"
00050 
00051 #define DEBUG_RX_PIN   D0
00052 #define DEBUG_TX_PIN   D1
00053 
00054 /* appliation commands */
00055 typedef enum AppCmd {
00056     APP_CMD_IDLE,           // No special command
00057     APP_CMD_HELP,           // Show the supported commands
00058     APP_CMD_START,          // Start location
00059     APP_CMD_STOP,           // Stop location
00060     APP_CMD_GETLASTLOC,     // Get last location
00061     APP_CMD_ENGEOFENCE,     // Enable Geofence
00062     APP_CMD_CONFGEOFENCE,   // Config Geofence
00063     APP_CMD_GEOFENCEREQ,    // Request Geofence status
00064     APP_CMD_ENODO,          // Enable Odometer
00065     APP_CMD_STARTODO,       // Start Odometer system
00066     APP_CMD_STOPODO,        // Stop Odometer system
00067     APP_CMD_ENDATALOG,      // Enable Datalog
00068     APP_CMD_CONFDATALOG,    // Config Datalog
00069     APP_CMD_STARTDATALOG,   // Start Datalog
00070     APP_CMD_STOPDATALOG,    // Stop Datalog
00071     APP_CMD_ERASEDATALOG,   // Erase Datalog
00072     APP_CMD_VERBOSE,        // Enable verbose mode
00073     APP_CMD_RESET,          // Debug command, pull reset pin high level
00074     APP_CMD_GET_DEVICE_INFO // Get Device Info
00075 } eAppCmd;
00076 
00077 static void _AppShowCmd(void);
00078 static void _ConsoleRxHandler(void);
00079 static void _AppCmdProcess(char *pCmd);
00080 static void _AppShowLastPosition(const GPSProvider::LocationUpdateParams_t *lastLoc);
00081 static void _AppEnGeofence(const bool isGeofenceSupported);
00082 static void _AppGeofenceCfg(void);
00083 static void _AppEnOdometer(const bool isOdometerSupported);
00084 static void _AppEnDatalogging(const bool isDataloggingSupported);
00085 static void _AppDatalogCfg(void);
00086 
00087 static void _ExecAppCmd(void);
00088 
00089 static int sAppCmd = APP_CMD_IDLE;
00090 static eGeofenceId geofenceId;
00091 
00092 static BufferedSerial serialDebug(DEBUG_TX_PIN, DEBUG_RX_PIN, 115200);
00093 #define TESEO_APP_LOG_INFO(...) printf(__VA_ARGS__)
00094 
00095 #define WARNING_NOT_RUN_MSG TESEO_APP_LOG_INFO("GNSS is not running. Please, type 'start' to make it runnable.\r\n");
00096 #define WARNING_ALREADY_RUN_MSG TESEO_APP_LOG_INFO("GNSS is already running.\r\n");
00097 
00098 static GPSProvider gnss;
00099 static bool gnssRunning = false;
00100 static int level = 1;
00101 
00102 FileHandle *mbed::mbed_override_console(int fd)
00103 {
00104     return &serialDebug;
00105 }
00106 
00107 void
00108 locationHandler(const GPSProvider::LocationUpdateParams_t *params)
00109 {
00110   if (params->valid) {
00111     /* application specific handling of location data; */
00112     TESEO_APP_LOG_INFO("locationHandler...\r\n");
00113   }
00114 }
00115 
00116 void
00117 geofenceCfg(int ret_code)
00118 {
00119   TESEO_APP_LOG_INFO("geofenceCfg...\r\n");
00120 }
00121 
00122 void
00123 geofenceStatus(const GPSProvider::GeofenceStatusParams_t *params, int ret_code)
00124 {
00125   /* application specific handling of geofencing status data; */
00126   TESEO_APP_LOG_INFO("geofenceStatus...\r\n");
00127 }
00128 
00129 static void
00130 _ConsoleRxHandler(void)
00131 {
00132   static char cmd[32] = {0};
00133   char        ch;
00134   char        nl = '\n';
00135 
00136   while(true) {
00137         while (!serialDebug.readable()) {
00138             ThisThread::yield(); // Allow other threads to run
00139         }
00140         serialDebug.read(&ch, 1);
00141         serialDebug.write((const void *)&ch, 1);
00142         if (ch == '\r') {
00143             serialDebug.write((const void *)&nl, 1);
00144             if (strlen(cmd) > 0) {
00145                 _AppCmdProcess(cmd);
00146                 memset(cmd, 0, sizeof(cmd));
00147             }
00148         } else {
00149             cmd[strlen(cmd)] = ch;
00150         }
00151   }
00152 }
00153 
00154 static
00155 void
00156 _ExecAppCmd(void)
00157 {
00158   while (true) {
00159     //TESEO_APP_LOG_INFO("main thread!!!\r\n");
00160     switch (sAppCmd) {
00161     case APP_CMD_HELP:
00162       sAppCmd = APP_CMD_IDLE;
00163       _AppShowCmd();
00164       break;
00165 
00166     case APP_CMD_IDLE:
00167       if(gnssRunning) {
00168         //TESEO_APP_LOG_INFO("process.\r\n");
00169         gnss.process();
00170       }
00171       break;
00172 
00173     case APP_CMD_START:
00174       sAppCmd = APP_CMD_IDLE;
00175       if(gnssRunning) {
00176         WARNING_ALREADY_RUN_MSG;
00177       } else {
00178         TESEO_APP_LOG_INFO("start gnss.\r\n");
00179         gnss.start();
00180         gnssRunning = true;
00181       }
00182       break;
00183     case APP_CMD_STOP:
00184       sAppCmd = APP_CMD_IDLE;
00185       if(!gnssRunning) {
00186         WARNING_NOT_RUN_MSG;
00187       } else {
00188         TESEO_APP_LOG_INFO("stop gnss.\r\n");
00189         gnss.stop();
00190         gnssRunning = false;
00191       }
00192       break;
00193     case APP_CMD_RESET:
00194       sAppCmd = APP_CMD_IDLE;
00195       if(!gnssRunning) {
00196         WARNING_NOT_RUN_MSG;
00197       } else {
00198         TESEO_APP_LOG_INFO("reset on.\r\n");
00199         gnss.reset();
00200       }
00201       break;
00202     case APP_CMD_GETLASTLOC:
00203       sAppCmd = APP_CMD_IDLE;
00204       if(!gnssRunning) {
00205         WARNING_NOT_RUN_MSG;
00206       } else {
00207         TESEO_APP_LOG_INFO("get last loc.\r\n");
00208         _AppShowLastPosition(gnss.getLastLocation());
00209       }
00210       break;
00211     case APP_CMD_ENGEOFENCE:
00212       sAppCmd = APP_CMD_IDLE;
00213       if(!gnssRunning) {
00214         WARNING_NOT_RUN_MSG;
00215       } else {
00216         TESEO_APP_LOG_INFO("enable geofence.\r\n");
00217         _AppEnGeofence(gnss.isGeofencingSupported());
00218       }
00219       break;
00220     case APP_CMD_CONFGEOFENCE:
00221       sAppCmd = APP_CMD_IDLE;
00222       if(!gnssRunning) {
00223         WARNING_NOT_RUN_MSG;
00224       } else {
00225         TESEO_APP_LOG_INFO("config geofence.\r\n");
00226         _AppGeofenceCfg();
00227       }
00228       break;
00229     case APP_CMD_GEOFENCEREQ:
00230       sAppCmd = APP_CMD_IDLE;
00231       if(!gnssRunning) {
00232         WARNING_NOT_RUN_MSG;
00233       } else {
00234         TESEO_APP_LOG_INFO("request geofence status.\r\n");
00235         gnss.geofenceReq();
00236       }
00237       break;
00238     case APP_CMD_ENODO:
00239       sAppCmd = APP_CMD_IDLE;
00240       if(!gnssRunning) {
00241         WARNING_NOT_RUN_MSG;
00242       } else {
00243         TESEO_APP_LOG_INFO("enable odometer.\r\n");
00244         _AppEnOdometer(gnss.isOdometerSupported());
00245       }
00246       break;
00247     case APP_CMD_STARTODO:
00248       sAppCmd = APP_CMD_IDLE;
00249       if(!gnssRunning) {
00250         WARNING_NOT_RUN_MSG;
00251       } else {
00252         TESEO_APP_LOG_INFO("start odo subystem.\r\n");
00253         gnss.startOdo(1);
00254       }
00255       break;
00256     case APP_CMD_STOPODO:
00257       sAppCmd = APP_CMD_IDLE;
00258       if(!gnssRunning) {
00259         WARNING_NOT_RUN_MSG;
00260       } else {
00261         TESEO_APP_LOG_INFO("stop odo subystem.\r\n");
00262         gnss.stopOdo();
00263       }
00264       break;
00265     case APP_CMD_ENDATALOG:
00266       sAppCmd = APP_CMD_IDLE;
00267       if(!gnssRunning) {
00268         WARNING_NOT_RUN_MSG;
00269       } else {
00270         TESEO_APP_LOG_INFO("enable datalog.\r\n");
00271         _AppEnDatalogging(gnss.isDataloggingSupported());
00272       }
00273       break;
00274     case APP_CMD_CONFDATALOG:
00275       sAppCmd = APP_CMD_IDLE;
00276       if(!gnssRunning) {
00277         WARNING_NOT_RUN_MSG;
00278       } else {
00279         TESEO_APP_LOG_INFO("config datalog.\r\n");
00280         _AppDatalogCfg();
00281       }
00282       break;
00283     case APP_CMD_STARTDATALOG:
00284       sAppCmd = APP_CMD_IDLE;
00285       if(!gnssRunning) {
00286         WARNING_NOT_RUN_MSG;
00287       } else {
00288         TESEO_APP_LOG_INFO("start datalog.\r\n");
00289         gnss.startDatalog();
00290       }
00291       break;
00292     case APP_CMD_STOPDATALOG:
00293       sAppCmd = APP_CMD_IDLE;
00294       if(!gnssRunning) {
00295         WARNING_NOT_RUN_MSG;
00296       } else {
00297         TESEO_APP_LOG_INFO("stop datalog.\r\n");
00298         gnss.stopDatalog();
00299       }
00300       break;
00301     case APP_CMD_ERASEDATALOG:
00302       sAppCmd = APP_CMD_IDLE;
00303       if(!gnssRunning) {
00304         WARNING_NOT_RUN_MSG;
00305       } else {
00306         TESEO_APP_LOG_INFO("erase datalog.\r\n");
00307         gnss.eraseDatalog();
00308       }
00309       break;
00310     case APP_CMD_VERBOSE:
00311       sAppCmd = APP_CMD_IDLE;
00312       if(!gnssRunning) {
00313         WARNING_NOT_RUN_MSG;
00314       } else {
00315         TESEO_APP_LOG_INFO("set verbose mode.\r\n");
00316         gnss.setVerboseMode(level);
00317       }
00318       break;
00319     case APP_CMD_GET_DEVICE_INFO:
00320       sAppCmd = APP_CMD_IDLE;
00321       if(!gnssRunning) {
00322         WARNING_NOT_RUN_MSG;
00323       } else {
00324         TESEO_APP_LOG_INFO("get device info.\r\n");
00325         if(gnss.haveDeviceInfo()) {
00326           TESEO_APP_LOG_INFO("%s", gnss.getDeviceInfo());
00327         }
00328         TESEO_APP_LOG_INFO("\r\n");
00329       }
00330       break;
00331     }
00332     ThisThread::yield(); // Allow other threads to run
00333   }
00334 }
00335 
00336 int main() {
00337   Thread consoleThread;
00338   Thread cmdThread;
00339 
00340   TESEO_APP_LOG_INFO("Starting GNSS...\r\n");
00341 
00342   consoleThread.start(_ConsoleRxHandler);
00343   
00344   gnss.reset();
00345   gnss.onLocationUpdate(locationHandler);
00346   TESEO_APP_LOG_INFO("Success to new GNSS.\r\n");
00347 
00348   _AppShowCmd();
00349   cmdThread.start(_ExecAppCmd);
00350   
00351   while(1) {
00352     ThisThread::yield();
00353   }
00354   
00355 }
00356 
00357 static void
00358 _AppShowLastPosition(const GPSProvider::LocationUpdateParams_t *lastLoc)
00359 {
00360   char msg[256];
00361   GPSProvider::LocationUpdateParams_t lastLocation = *lastLoc;
00362 
00363   if(lastLocation.valid == true) {
00364     sprintf(msg,"Latitude:\t\t[ %.0f' %d'' ]\n\r",
00365             (lastLocation.lat - ((int)lastLocation.lat % 100)) / 100, 
00366             ((int)lastLocation.lat % 100));          
00367     TESEO_APP_LOG_INFO("%s", msg);
00368     
00369     sprintf(msg,"Longitude:\t\t[ %.0f' %d'' ]\n\r",
00370             (lastLocation.lon - ((int)lastLocation.lon % 100)) / 100, 
00371             ((int)lastLocation.lon % 100));          
00372     TESEO_APP_LOG_INFO("%s", msg);
00373     
00374     sprintf(msg,"Altitude:\t\t[ %.2f ]\n\r",
00375             lastLocation.altitude);
00376     TESEO_APP_LOG_INFO("%s", msg);
00377     
00378     sprintf(msg,"Satellites locked:\t[ %d ]\n\r",
00379             lastLocation.numGPSSVs);
00380     TESEO_APP_LOG_INFO("%s", msg);
00381     
00382     sprintf(msg, "UTC:\t\t\t[ %d ]\n\r",
00383             (int)lastLocation.utcTime);
00384     TESEO_APP_LOG_INFO("%s", msg);
00385     
00386   } else {
00387     sprintf(msg, "Last position wasn't valid.\n\n\r");
00388     TESEO_APP_LOG_INFO("%s", msg);
00389   }
00390 }
00391 
00392 static void
00393 _AppEnGeofence(const bool isGeofenceSupported)
00394 {
00395   if(isGeofenceSupported) {
00396     gps_provider_error_t ret = gnss.enableGeofence();
00397     if(ret == GPS_ERROR_NONE) {
00398       TESEO_APP_LOG_INFO("Enabling Geofencing subsystem...\n\r");
00399     }
00400   } else {
00401     TESEO_APP_LOG_INFO("Geofencing is not supported!\n\r");
00402   }
00403 
00404 }
00405 
00406 static void
00407 _AppGeofenceCfg(void)
00408 {
00409   GPSGeofence gf;
00410 
00411   switch (geofenceId) {
00412   case LecceId:
00413     gf.setGeofenceCircle(STLecce);
00414     break;
00415   case CataniaId:
00416     gf.setGeofenceCircle(Catania);
00417     break;
00418   }
00419   /*
00420   GPSGeofence::GeofenceCircle_t c = gf.getGeofenceCircle();
00421   printf("_AppGeofenceCfg id=%d\r\n", c.id);
00422   printf("_AppGeofenceCfg en=%d\r\n", c.enabled);
00423   printf("_AppGeofenceCfg tol=%d\r\n", c.tolerance);
00424   printf("_AppGeofenceCfg lat=%.2f\r\n", c.lat);
00425   printf("_AppGeofenceCfg lon=%.2f\r\n", c.lon);
00426   printf("_AppGeofenceCfg radius=%.2f\r\n", c.radius);
00427   */
00428   
00429   GPSGeofence *geofenceTable[] = {&gf};
00430 
00431   gnss.onGeofenceCfgMessage(geofenceCfg);
00432   gnss.onGeofenceStatusMessage(geofenceStatus);
00433   gps_provider_error_t ret = gnss.configGeofences(geofenceTable, sizeof(geofenceTable)/sizeof(GPSGeofence *));
00434   if(ret == GPS_ERROR_NONE) {
00435     TESEO_APP_LOG_INFO("Configuring Geofence circles...\n\r");
00436   }
00437 
00438 }
00439 
00440 static void
00441 _AppEnOdometer(const bool isOdometerSupported)
00442 {
00443   if(isOdometerSupported) {
00444     gps_provider_error_t ret = gnss.enableOdo();
00445     if(ret == GPS_ERROR_NONE) {
00446       TESEO_APP_LOG_INFO("Enabling Odometer subsystem...\n\r");
00447     }
00448   } else {
00449     TESEO_APP_LOG_INFO("Odometer is not supported!\n\r");
00450   }
00451 
00452 }
00453 
00454 static void
00455 _AppEnDatalogging(const bool isDataloggingSupported)
00456 {
00457   if(isDataloggingSupported) {
00458     gps_provider_error_t ret = gnss.enableDatalog();
00459     if(ret == GPS_ERROR_NONE) {
00460       TESEO_APP_LOG_INFO("Enabling Datalog subsystem...\n\r");
00461     }
00462   } else {
00463     TESEO_APP_LOG_INFO("Datalog is not supported!\n\r");
00464   }
00465 
00466 }
00467 
00468 static void
00469 _AppDatalogCfg(void)
00470 {
00471   bool          enableBufferFullAlarm = false;
00472   bool          enableCircularBuffer = true;
00473   unsigned      minRate = 5;
00474   unsigned      minSpeed = 0;
00475   unsigned      minPosition = 0;
00476   int           logMask = 1;
00477 
00478   GPSDatalog dl(enableBufferFullAlarm,
00479                 enableCircularBuffer,
00480                 minRate,
00481                 minSpeed,
00482                 minPosition,
00483                 logMask);
00484 
00485   gps_provider_error_t ret = gnss.configDatalog(&dl);
00486   if(ret == GPS_ERROR_NONE) {
00487     TESEO_APP_LOG_INFO("Configuring Datalog...\n\r");
00488   }
00489 }
00490 
00491 static void
00492 _AppShowCmd(void)
00493 {
00494     TESEO_APP_LOG_INFO("Location commands:\r\n");
00495     TESEO_APP_LOG_INFO("    help         - help to show supported commands\r\n");
00496     TESEO_APP_LOG_INFO("    start        - begin location app\r\n");
00497     TESEO_APP_LOG_INFO("    stop         - end location app\r\n");
00498     TESEO_APP_LOG_INFO("    getlastloc   - get last location\r\n");
00499     TESEO_APP_LOG_INFO("    en-geo       - enable Geofence\r\n");
00500     TESEO_APP_LOG_INFO("    geo-c        - config Geofence [c=l Lecce, c=t Catania]\r\n");
00501     TESEO_APP_LOG_INFO("    req-geo      - request Geofence status\r\n");
00502     TESEO_APP_LOG_INFO("    en-odo       - enable Odoemter\r\n");
00503     TESEO_APP_LOG_INFO("    start-odo    - start Ododmeter [demo distance 1m]\r\n");
00504     TESEO_APP_LOG_INFO("    stop-odo     - stop Ododmeter\r\n");
00505     TESEO_APP_LOG_INFO("    en-datalog   - enable Datalog\r\n");
00506     TESEO_APP_LOG_INFO("    cfg-dl       - config Datalog\r\n");
00507     TESEO_APP_LOG_INFO("    start-dl     - start Datalog\r\n");
00508     TESEO_APP_LOG_INFO("    stop-dl      - stop Datalog\r\n");
00509     TESEO_APP_LOG_INFO("    erase-dl     - erase Datalog\r\n");
00510     TESEO_APP_LOG_INFO("    verbose-l    - nmea msg verbose mode [l=1 normal, l=2 debug]\r\n");
00511     TESEO_APP_LOG_INFO("    reset        - reset GNSS\r\n");
00512     TESEO_APP_LOG_INFO("    getdevinfo   - get device info\r\n");
00513 }
00514 
00515 static void
00516 _AppCmdProcess(char *pCmd)
00517 {
00518     if (strcmp(pCmd, "help") == 0) {
00519         sAppCmd = APP_CMD_HELP;
00520     } else if (strcmp(pCmd, "start") == 0) {
00521         sAppCmd = APP_CMD_START;
00522     } else if (strcmp(pCmd, "stop") == 0) {
00523         sAppCmd = APP_CMD_STOP;
00524     } else if (strcmp(pCmd, "getlastloc") == 0) {
00525         sAppCmd = APP_CMD_GETLASTLOC;
00526     } else if (strcmp(pCmd, "en-geo") == 0) {
00527         sAppCmd = APP_CMD_ENGEOFENCE;
00528     } else if (strcmp(pCmd, "geo-l") == 0) {
00529         geofenceId = LecceId;
00530         sAppCmd = APP_CMD_CONFGEOFENCE;
00531     } else if (strcmp(pCmd, "geo-t") == 0) {
00532         geofenceId = CataniaId;
00533         sAppCmd = APP_CMD_CONFGEOFENCE;
00534     } else if (strcmp(pCmd, "req-geo") == 0) {
00535         sAppCmd = APP_CMD_GEOFENCEREQ;
00536     } else if (strcmp(pCmd, "en-odo") == 0) {
00537         sAppCmd = APP_CMD_ENODO;
00538     } else if (strcmp(pCmd, "start-odo") == 0) {
00539         sAppCmd = APP_CMD_STARTODO;
00540     } else if (strcmp(pCmd, "stop-odo") == 0) {
00541         sAppCmd = APP_CMD_STOPODO;
00542     } else if (strcmp(pCmd, "en-datalog") == 0) {
00543         sAppCmd = APP_CMD_ENDATALOG;
00544     } else if (strcmp(pCmd, "cfg-dl") == 0) {
00545         sAppCmd = APP_CMD_CONFDATALOG;
00546     } else if (strcmp(pCmd, "start-dl") == 0) {
00547         sAppCmd = APP_CMD_STARTDATALOG;
00548     } else if (strcmp(pCmd, "stop-dl") == 0) {
00549         sAppCmd = APP_CMD_STOPDATALOG;
00550     } else if (strcmp(pCmd, "erase-dl") == 0) {
00551         sAppCmd = APP_CMD_ERASEDATALOG;
00552     } else if (strcmp(pCmd, "verbose-1") == 0) {
00553         level = 1;
00554         sAppCmd = APP_CMD_VERBOSE;
00555     } else if (strcmp(pCmd, "verbose-2") == 0) {
00556         level = 2;
00557         sAppCmd = APP_CMD_VERBOSE;
00558     } else if (strcmp(pCmd, "reset") == 0) {
00559         sAppCmd = APP_CMD_RESET;
00560     } else if (strcmp(pCmd, "getdevinfo") == 0) {
00561         sAppCmd = APP_CMD_GET_DEVICE_INFO;
00562     } else {
00563         TESEO_APP_LOG_INFO("\r\nUnknown command %s\r\n", pCmd);
00564     }
00565 
00566     TESEO_APP_LOG_INFO("\r\n");
00567 }