Import of CSR's demo for SirfV. Has minor cleanup.

Dependencies:   CsrLocation mbed GPSProvider

Fork of CsrLocationDemo by jie zhao

Revision:
18:c75558f5959f
Parent:
17:ebf95368b2d8
Child:
19:b8703d1c1b38
--- a/CsrLocationDemo.cpp	Fri Oct 31 13:36:57 2014 +0000
+++ b/CsrLocationDemo.cpp	Mon Nov 03 07:39:31 2014 +0000
@@ -30,19 +30,7 @@
     APP_CMD_PM_FULL,        // Set full power mode
     APP_CMD_PM_PTF,         // Set low power PTF mode
     APP_CMD_PTF_GETPOS,     // Get location immediately in low power PTF mode
-    APP_CMD_NMEA,           // proto mode is NMEA
-    APP_CMD_OSP,            // proto mode is OSP
-    APP_CMD_SWITCH_NMEA,    // Debug command, switch chip to NMEA protocol at 4800bps
-    APP_CMD_SWITCH_OSP,     // Debug command, switch chip to NMEA protocol at 4800bps
-    APP_CMD_START_FAILED,   // Process start failed case
-    APP_CMD_STOP_FAILED,    // Process stop failed case
-    APP_CMD_ONOFF_ON,       // Debug command, pull onoff pin high level
-    APP_CMD_ONOFF_OFF,      // Debug command, pull onoff pin low level
     APP_CMD_RESET,          // Debug command, pull reset pin high level
-    APP_CMD_WAKEUP_STATUS,  // Debug command, check wakeup pin status
-    APP_CMD_PINTEST_ON,     // Debug command, pull test pin high level
-    APP_CMD_PINTEST_OFF,    // Debug command, pull test pin low level
-    APP_CMD_PINTEST_OFF_ON  // Debug command, pull test pin low firstly, then pull high level
 } eAppCmd;
 
 static void _AppShowCmd(void);
@@ -57,7 +45,7 @@
 static InterruptIn sBtn(PINMAP_GPIO_BTN);
 static DigitalOut  sPinTest(PINMAP_GPIO_TEST);
 
-DBG_SERIAL_TYPE    sSerialDebug(USBTX, USBRX);
+Serial             sSerialDebug(USBTX, USBRX);
 
 void
 locationHandler(const GPSProvider::LocationUpdateParams_t *params)
@@ -106,57 +94,16 @@
                 gps.stop();
                 sLedLocOn = 0;
                 break;
-            // case APP_CMD_START_FAILED:
-            //     sAppCmd = APP_CMD_IDLE;
-            //     CSR_APP_LOG_INFO("reset as start failed.\r\n");
-            //     sLedLocOn = 0;
-            //     pCsrLoc->CsrLocStop();
-            //     pCsrLoc->reset();
-            //     break;
-            // case APP_CMD_STOP_FAILED:
-            //     sAppCmd = APP_CMD_IDLE;
-            //     CSR_APP_LOG_INFO("reset as stop failed.\r\n");
-            //     sLedLocOn = 0;
-            //     pCsrLoc->CsrLocStop();
-            //     pCsrLoc->reset();
-            //     break;
             case APP_CMD_RESET:
                 sAppCmd   = APP_CMD_IDLE;
                 gps.reset();
-                // sPinReset = 1;
                 CSR_APP_LOG_INFO("reset on.\r\n");
                 break;
-            // case APP_CMD_RESET_OFF:
-            //     CSR_APP_LOG_INFO("reset off.\r\n");
-            //     sAppCmd   = APP_CMD_IDLE;
-            //     sPinReset = 0;
-            //     break;
-            // case APP_CMD_PINTEST_ON:
-            //     CSR_APP_LOG_INFO("test pin on.\r\n");
-            //     sAppCmd  = APP_CMD_IDLE;
-            //     sPinTest = 1;
-            //     break;
-            // case APP_CMD_PINTEST_OFF:
-            //     CSR_APP_LOG_INFO("test pin off.\r\n");
-            //     sAppCmd  = APP_CMD_IDLE;
-            //     sPinTest = 0;
-            //     break;
-            // case APP_CMD_PINTEST_OFF_ON:
-            //     CSR_APP_LOG_INFO("test pin off and high.\r\n");
-            //     sAppCmd  = APP_CMD_IDLE;
-            //     sPinTest = 0;
-            //     wait_ms(100);
-            //     sPinTest = 1;
-            //     break;
-            // case APP_CMD_WAKEUP_STATUS:
-            //     CSR_APP_LOG_INFO("wakeup status : %d.\r\n", sWakeup.read());
-            //     sAppCmd = APP_CMD_IDLE;
-            //     break;
-            // case APP_CMD_PTF_GETPOS:
-            //     CSR_APP_LOG_INFO("lpm get pos.\r\n");
-            //     sAppCmd = APP_CMD_IDLE;
-            //     pCsrLoc->CsrLocLpmGetPos();
-            //     break;
+            case APP_CMD_PTF_GETPOS:
+                CSR_APP_LOG_INFO("lpm get pos.\r\n");
+                sAppCmd = APP_CMD_IDLE;
+                gps.lpmGetImmediateLocation();
+                break;
             case APP_CMD_PM_FULL:
                 sAppCmd  = APP_CMD_IDLE;
                 gps.setPowerMode(GPSProvider::POWER_FULL);
@@ -220,20 +167,8 @@
         sAppCmd = APP_CMD_PM_PTF;
     } else if (strcmp(pCmd, "getpos") == 0) {
         sAppCmd = APP_CMD_PTF_GETPOS;
-    // } else if (strcmp(pCmd, "onoffon") == 0) {
-    //     sAppCmd = APP_CMD_ONOFF_ON;
-    // } else if (strcmp(pCmd, "onoffoff") == 0) {
-    //     sAppCmd = APP_CMD_ONOFF_OFF;
     } else if (strcmp(pCmd, "reset") == 0) {
         sAppCmd = APP_CMD_RESET;
-    // } else if (strcmp(pCmd, "pinteston") == 0) {
-    //     sAppCmd = APP_CMD_PINTEST_ON;
-    // } else if (strcmp(pCmd, "pintestoff") == 0) {
-    //     sAppCmd = APP_CMD_PINTEST_OFF;
-    // } else if (strcmp(pCmd, "pintestoffon") == 0) {
-    //     sAppCmd = APP_CMD_PINTEST_OFF_ON;
-    // } else if (strcmp(pCmd, "iswakeup") == 0) {
-    //     sAppCmd = APP_CMD_WAKEUP_STATUS;
     } else {
         CSR_APP_LOG_INFO("\r\nUnknown command %s\r\n", pCmd);
     }