Csr location class shows location and satellite information, which supports H13467 + ST F103RB/NXP LCP1549 boards now.

Dependents:   CsrLocationDemo CsrLocationDemo

Fork of CsrLocation by jie zhao

Files at this revision

API Documentation at this revision

Comitter:
zhjcpi
Date:
Tue May 27 10:54:06 2014 +0000
Parent:
3:71690f7bb480
Child:
5:219dfc2905dc
Commit message:
add more protection code to control state transfering and commands.

Changed in this revision

CsrLocation.cpp Show annotated file Show diff for this revision Revisions of this file
CsrLocation.h Show annotated file Show diff for this revision Revisions of this file
--- a/CsrLocation.cpp	Wed May 21 08:55:55 2014 +0000
+++ b/CsrLocation.cpp	Tue May 27 10:54:06 2014 +0000
@@ -58,6 +58,11 @@
 	_CsrLocHwReset();
 }
 
+eCsrLocState CsrLocation::CsrLocGetState(void)
+{
+	return csrLocInst.locState;
+}
+
 void CsrLocation::CsrLocStart(ePowerMode pwrMode, eProto proto)
 {
     csrLocInst.pwrMode = pwrMode;
@@ -86,6 +91,10 @@
 
         /* trigger on_off */
         _CsrLocHwOnoff();
+		if(csrLocInst.pwrMode == PWR_PTF)
+		{
+			_CsrLocSendData(SEND_DATA_TYPE_OSP_LPM_REQ);
+		}
 
         csrLocInst.locState = CSR_LOC_STATE_RUN;
     	csrLocInst.bPwrModeRsp = false;
@@ -124,6 +133,12 @@
     }
     else
     {
+   		if(csrLocInst.pwrMode == PWR_PTF)
+		{
+    		CSR_LOG_INFO("Stop with fpm.\r\n");
+			_CsrLocSendData(SEND_DATA_TYPE_OSP_FPM_REQ);
+		}
+
         _CsrLocSendData(SEND_DATA_TYPE_OSP_STOP_REQ);
     }
     wait_ms(10);
@@ -538,6 +553,20 @@
             {
                 if(pLocInst->protoState == PROTO_STATE_DET_OSP || pLocInst->protoState == PROTO_STATE_DET_OSP_FROM_NMEA)
                 {
+                    if(pLocInst->protoState == PROTO_STATE_DET_OSP_FROM_NMEA)
+                    {
+                        if(!csrLocInst.bPwrModeRsp)
+				        {
+				            if(csrLocInst.pwrMode == PWR_PTF)
+				            {
+				                _CsrLocSendData(SEND_DATA_TYPE_OSP_LPM_REQ);
+				            }
+				            else
+				            {
+				                _CsrLocSendData(SEND_DATA_TYPE_OSP_FPM_REQ);
+				            }
+				        }
+                	}
                     CSR_LOG_INFO("Checking OSP protocol OK.\r\n");
                     pLocInst->protoState = PROTO_STATE_DET_OK;
                     pLocInst->appEventCb(CSR_LOC_EVENT_START_RESULT, 0);
--- a/CsrLocation.h	Wed May 21 08:55:55 2014 +0000
+++ b/CsrLocation.h	Tue May 27 10:54:06 2014 +0000
@@ -385,6 +385,9 @@
 
     /** hw reset to get location chip into hibernation mode */
     void CsrLocReset(void);
+    
+    /** get location state */
+    eCsrLocState CsrLocGetState(void);
 
     /** Start location request, activate location chip */
     void CsrLocStart(ePowerMode pwrMode, eProto proto);