Csr location class shows location and satellite information, which supports H13467 + ST F103RB/NXP LCP1549 boards now.
Dependents: CsrLocationDemo CsrLocationDemo
Fork of CsrLocation by
Diff: CsrLocation.h
- Revision:
- 12:5fb829ce6b82
- Parent:
- 11:10ba3c761444
- Child:
- 17:05033198f8f3
diff -r 10ba3c761444 -r 5fb829ce6b82 CsrLocation.h
--- a/CsrLocation.h Tue Oct 28 12:20:42 2014 +0000
+++ b/CsrLocation.h Tue Nov 04 08:41:25 2014 +0000
@@ -1,12 +1,11 @@
-
-/* CsrLocation class for mbed Microcontroller
+/* CSRLocation class for mbed Microcontroller
* Copyright 2014 CSR plc
*/
-
#ifndef CSRLOCATION_H
#define CSRLOCATION_H
+#include <GPSProviderImplBase.h>
#define CSR_LOC_SDK_VER "CSR-LOC-SDK-0.5"
@@ -14,35 +13,15 @@
#define CSR_RESULT_SUCCESS ((CsrResult) 0x0000)
#define CSR_RESULT_FAILURE ((CsrResult) 0xFFFF)
-#ifdef TARGET_LPC1768
-#define PINMAP_UART_DEBUG_TX USBTX
-#define PINMAP_UART_DEBUG_RX USBRX
-#define PINMAP_UART_LOC_TX D8
-#define PINMAP_UART_LOC_RX D9
-#define PINMAP_GPIO_LOC_ONOFF D11
-#define PINMAP_GPIO_LOC_RESET D12
-#define PINMAP_GPIO_LOC_WAKEUP D3
-#define PINMAP_GPIO_BTN D6
-#define PINMAP_GPIO_TEST D10
-#define LOC_LED1 LED1
-#define LOC_LED2 LED2
-#define DBG_SERIAL_TYPE RawSerial
-#define LOC_SERIAL_TYPE RawSerial
-#elif defined(TARGET_LPC1549) || defined(TARGET_NUCLEO_F103RB) || defined(TARGET_NUCLEO_F401RE)
-#define PINMAP_UART_DEBUG_TX D1
-#define PINMAP_UART_DEBUG_RX D0
-#define PINMAP_UART_LOC_TX D8
-#define PINMAP_UART_LOC_RX D2
-#define PINMAP_GPIO_LOC_ONOFF D9
-#define PINMAP_GPIO_LOC_RESET D4
-#define PINMAP_GPIO_LOC_WAKEUP D3
-#define PINMAP_GPIO_BTN D5
-#define PINMAP_GPIO_TEST D10
-#define LOC_LED1 D7
-#define LOC_LED2 D6
-#define DBG_SERIAL_TYPE Serial
-#define LOC_SERIAL_TYPE RawSerial
-#endif
+/* IOCTL commands */
+#define CSR_IOCTL_CMD_WAKEUP_STATUS (0x01)
+#define CSR_IOCTL_CMD_ONOFF_ON (0x02)
+#define CSR_IOCTL_CMD_ONOFF_OFF (0x03)
+#define CSR_IOCTL_CMD_ONOFF_PULSE (0x04)
+#define CSR_IOCTL_CMD_RESET_ON (0x05)
+#define CSR_IOCTL_CMD_RESET_OFF (0x06)
+#define CSR_IOCTL_CMD_PROTO_NMEA (0x07)
+#define CSR_IOCTL_CMD_PROTO_OSP (0x08)
/* OSP protocol related definitions */
@@ -61,22 +40,21 @@
/* NMEA message footer */
#define NMEA_MSG_TAIL0 ('*')
-#define CSR_SWAPIN16(bytestream) (((uint16_t)*((bytestream)+0) << 8) | ((uint16_t)*((bytestream)+1)))
+#define CSR_SWAPIN16(bytestream) (((uint16_t)*((bytestream) + 0) << 8) | ((uint16_t)*((bytestream) + 1)))
-#define CSR_SWAPIN32(bytestream)\
- ( ((uint32_t)*((bytestream)+0) << 24)\
- | ((uint32_t)*((bytestream)+1) << 16)\
- | ((uint32_t)*((bytestream)+2) << 8)\
- | ((uint32_t)*((bytestream)+3) ))
+#define CSR_SWAPIN32(bytestream) \
+ (((uint32_t)*((bytestream) + 0) << 24) \
+ | ((uint32_t)*((bytestream) + 1) << 16) \
+ | ((uint32_t)*((bytestream) + 2) << 8) \
+ | ((uint32_t)*((bytestream) + 3)))
/* import macros for little endian: */
/* NOTE: must use {} around these macros when calling in a loop */
-#define BINARY_IMPORT_UINT8(bytestream) ( *((bytestream)++))
-#define BINARY_IMPORT_UINT16(bytestream) ((uint16_t) CSR_SWAPIN16((bytestream))); bytestream+=2
-#define BINARY_IMPORT_UINT32(bytestream) ((uint32_t) CSR_SWAPIN32((bytestream))); bytestream+=4
-#define BINARY_IMPORT_SINT32(bytestream) ((int32_t) CSR_SWAPIN32((bytestream))); bytestream+=4
-
+#define BINARY_IMPORT_UINT8(bytestream) (*((bytestream)++))
+#define BINARY_IMPORT_UINT16(bytestream) ((uint16_t) CSR_SWAPIN16((bytestream))); bytestream += 2
+#define BINARY_IMPORT_UINT32(bytestream) ((uint32_t) CSR_SWAPIN32((bytestream))); bytestream += 4
+#define BINARY_IMPORT_SINT32(bytestream) ((int32_t) CSR_SWAPIN32((bytestream))); bytestream += 4
#define OSP_MAKE_MSG_ID(mid, sid) ((((mid) & 0xFF) << 8) | ((sid) & 0xFF))
@@ -91,7 +69,7 @@
#define OSP_MSG_PWR_MODE_FPM_RSP OSP_MAKE_MSG_ID(0x5A, 0x0)
#define OSP_MSG_PWR_MODE_LPM_RSP OSP_MAKE_MSG_ID(0x5A, 0x6)
-
+
#define GNSS_SAT_DATA_NUM_OF_SATS (15)
#define CODEC_GLO_MAX_CHANNELS (14)
/* The end of OSP protocol definitions */
@@ -101,7 +79,7 @@
#define LOC_GLO_FREQ_OFFSET (77)
#define LOC_GLO_FREQ_ID_START (70)
#define LOC_GLO_FREQ_ID_END (83)
-#define LOC_NUM_OF_GLO_FREQ_CHANNELS (1+LOC_GLO_FREQ_ID_END-LOC_GLO_FREQ_ID_START)
+#define LOC_NUM_OF_GLO_FREQ_CHANNELS (1 + LOC_GLO_FREQ_ID_END - LOC_GLO_FREQ_ID_START)
#define MAX_PORT_NUM_STRING_LENGTH (16)
#define MAX_SERIAL_BUF_LEN (2048)
@@ -116,49 +94,44 @@
#define LOC_OUTPUT_LOCATION (1)
/* Indicates the outputted sv status information */
#define LOC_OUTPUT_SV_STATUS (2)
+#define LOC_OUTPUT_NMEA (3)
#if 0
#define CSR_LOG_INFO printf
#else
-#define CSR_LOG_INFO(...) \
-{\
- if(csrLocInst.pSerialDebug != NULL)\
- {\
- (csrLocInst.pSerialDebug->printf(__VA_ARGS__));\
- }\
-}
-#endif
+#define CSR_LOG_INFO(...) { \
+ if (pSerialDebug != NULL) { \
+ (pSerialDebug->printf(__VA_ARGS__)); \
+ } \
+ }
+#endif // if 0
-/** Location enent definitions */
-typedef enum
-{
+/** Location event definitions */
+typedef enum {
/** Start result event */
CSR_LOC_EVENT_START_RESULT,
/** Stop result event */
CSR_LOC_EVENT_STOP_RESULT,
-}eCsrLocEventType;
+} eCsrLocEventType;
/** Power mode selection */
-typedef enum
-{
+typedef enum {
/** full power mode */
PWR_FULL,
/** Low power push to fix mode */
PWR_PTF,
-}ePowerMode;
+} ePowerMode;
/** Power mode selection */
-typedef enum
-{
+typedef enum {
/** NMEA protocol */
PROTO_NMEA,
/** OSP protocol */
PROTO_OSP,
-}eProto;
+} eProto;
/* Protocol detection state */
-typedef enum
-{
+typedef enum {
STATE_START1, /* Indicates the first byte of the OSP or NMEA message header*/
STATE_START2, /* Indicates the second byte of the OSP or NMEA message header */
STATE_SIZE1, /* Indicates the first byte of the OSP message length */
@@ -168,40 +141,36 @@
STATE_CHECKSUM2, /* Indicates the second byte of the OSP message checksum */
STATE_END1, /* Indicates the first byte of the OSP or NMEA message footer */
STATE_END2 /* Indicates the second byte of the OSP message footer */
-}eProtoDetState;
+} eProtoDetState;
-/* Csr Location state */
-typedef enum
-{
+/* CSR Location state */
+typedef enum {
CSR_LOC_STATE_IDLE,
CSR_LOC_STATE_RUN,
-}eCsrLocState;
+} eCsrLocState;
-/* Locatin chip protocol detection state */
-typedef enum
-{
- PROTO_STATE_DET_INVALID = 0,
- PROTO_STATE_DET_OSP,
- PROTO_STATE_DET_NMEA,
-// PROTO_STATE_SWI_OSP_FROM_NMEA,
- PROTO_STATE_DET_OSP_FROM_NMEA,
-// PROTO_STATE_SWI_NMEA_FROM_OSP,
- PROTO_STATE_DET_NMEA_FROM_OSP,
- PROTO_STATE_DET_OK,
-}eProtoState;
+/* Location chip protocol detection state */
+typedef enum {
+ PROTO_STATE_DET_INVALID = 0,
+ PROTO_STATE_DET_OSP,
+ PROTO_STATE_DET_NMEA,
+ // PROTO_STATE_SWI_OSP_FROM_NMEA,
+ PROTO_STATE_DET_OSP_FROM_NMEA,
+ // PROTO_STATE_SWI_NMEA_FROM_OSP,
+ PROTO_STATE_DET_NMEA_FROM_OSP,
+ PROTO_STATE_DET_OK,
+} eProtoState;
-/* Locaiton chip status */
-typedef enum
-{
+/* Location chip status */
+typedef enum {
/* Location chip is going to hibernation mode and cannot accept message any more */
ENGINE_STATUS_NOTOK2SEND,
- /* Locaitn come back from hibernation mode and can accept message now */
+ /* Location come back from hibernation mode and can accept message now */
ENGINE_STATUS_OK2SEND
-}eEngineStatus;
+} eEngineStatus;
/* OSP data type to be sent to location chip */
-typedef enum
-{
+typedef enum {
SEND_DATA_TYPE_OSP_STOP_REQ,
SEND_DATA_TYPE_OSP_VER_REQ,
SEND_DATA_TYPE_OSP_LPM_REQ,
@@ -209,219 +178,159 @@
SEND_DATA_TYPE_OSP_SWITCH2NMEA_REQ,
SEND_DATA_TYPE_NMEA_SWITCH2OSP_REQ,
SEND_DATA_TYPE_NMEA_STOP_REQ
-}eSendDataType;
+} eSendDataType;
-typedef struct GpsTime
-{
+typedef struct GpsTime {
/** Week part of GPS time */
- uint16_t gps_week;
+ uint16_t gps_week;
/** Time of second part of GPS time */
- uint32_t tow;
-}tGpsTime;
+ uint32_t tow;
+} tGpsTime;
/** Structure to hold Position Response Message Information. */
-typedef struct LocPosResp
-{
- union
- {
- tGpsTime gpsTime;
- float utcTime;
- }u;
+typedef struct LocPosResp {
+ union {
+ tGpsTime gpsTime;
+ float utcTime;
+ } u;
/** Latitude */
- double lat;
+ double lat;
/** Longitude */
- double lon;
+ double lon;
/** Altitude */
- double alt;
+ double alt;
} tLocPosResp;
/** Structure to hold Satellite Information. */
-typedef struct LocSvInfo
-{
+typedef struct LocSvInfo {
/** Prn or svId */
- uint8_t prn;
+ uint8_t prn;
/** The ratio of carrier and noise */
- float cno;
+ float cno;
/** elevation */
- float elevation;
+ float elevation;
/** azimuth */
- float azimuth;
+ float azimuth;
/** satellite state */
- uint16_t state;
+ uint16_t state;
} tLocSvInfo;
/** Structure to hold Satellite Information for GLONASS */
-typedef struct LocGloSvInfo
-{
+typedef struct LocGloSvInfo {
/** Prn or svId */
- uint8_t prn;
+ uint8_t prn;
/** Slot number */
- uint8_t sno;
+ uint8_t sno;
/** The ratio of carrier and noise */
- float cno;
+ float cno;
/** elevation */
- float elevation;
+ float elevation;
/** azimuth */
- float azimuth;
+ float azimuth;
/** satellite state */
- uint16_t state;
+ uint16_t state;
} tLocGloSvInfo;
/** Structure to hold Satellite Status Information. */
-typedef struct LocSvStatus
-{
+typedef struct LocSvStatus {
/** Week part of GPS time */
- uint16_t gps_week;
+ uint16_t gps_week;
/** Time of second part of GPS time */
- uint32_t tow;
+ uint32_t tow;
/** Time of millisecond part of GPS time */
- uint32_t tow_sub_ms;
-
+ uint32_t tow_sub_ms;
+
/**Number of GPS SVs currently visible **/
- uint8_t numOfSVs;
+ uint8_t numOfSVs;
/**Number of GLONASS SVs currently visible **/
- uint8_t numOfGloSVs;
+ uint8_t numOfGloSVs;
/** GPS SVs information */
- tLocSvInfo svList[LOC_MAX_GNSS_SVS];
+ tLocSvInfo svList[LOC_MAX_GNSS_SVS];
/** GLONASS SVs information */
- tLocGloSvInfo gloSvList[LOC_NUM_OF_GLO_FREQ_CHANNELS];
+ tLocGloSvInfo gloSvList[LOC_NUM_OF_GLO_FREQ_CHANNELS];
/** Bit mask indicating which SVs have ephemeris data **/
- uint32_t ephemerisMask;
+ uint32_t ephemerisMask;
/** Bit mask indicating which GLONASS SVs have ephemeris data **/
- uint32_t gloEphemerisMask;
+ uint32_t gloEphemerisMask;
/** Bit mask indicating which SVs were used in latest sent fix **/
- uint32_t svUsedInFixMask;
+ uint32_t svUsedInFixMask;
/** Bit mask indicating which GLONASS SVs were used in latest sent fix **/
- uint32_t gloSvUsedInFixMask;
- /** Bit mask indicating which QZSS SVs were used in latest sent fix **/
- uint32_t qzssSvUsedInFixMask;
- /** Bit mask indicating which SBAS SVs were used in latest sent fix **/
- uint32_t sbasSvUsedInFixMask;
+ uint32_t gloSvUsedInFixMask;
+ /** Bit mask indicating which QZSS SVs were used in latest sent fix **/
+ uint32_t qzssSvUsedInFixMask;
+ /** Bit mask indicating which SBAS SVs were used in latest sent fix **/
+ uint32_t sbasSvUsedInFixMask;
} tLocSvStatus;
-/** Applicaiton register this out callback function and CsrLocaiton class will pass outputted information to application */
-typedef void (*csr_app_output_callback)(uint32_t msgId, void * const pMsgData, uint32_t msgLength);
+/** Application register this out callback function and CsrLocation class will pass outputted information to application */
+typedef void (*csr_app_output_callback)(uint32_t msgId, void *const pMsgData, uint32_t msgLength);
-/** Applicaiton register this event callback function and CsrLocaiton class will pass internal porcessing event to application */
+/** Application register this event callback function and CsrLocation class will pass internal processing event to application */
typedef void (*csr_app_event_callback)(eCsrLocEventType event, uint32_t data);
-/** tCsrLocConfig structure
- * Application needs to decides and pass the configuration into CsrLocation class.
- */
-typedef struct CsrLocConfig
-{
- /** Debug serial port to print debug information */
- DBG_SERIAL_TYPE *pSerialDebug;
- /** location serail port to communicate between mbed host side and location chip */
- LOC_SERIAL_TYPE *pSerialLoc;
- /** GPIO pin to control location chip on, a rising edge is uset to activate location chip. Please note, before activate chip, reset pin should be pull high */
- DigitalOut *pPinOnoff;
- /** GPIO pin to control location chip reset, low level will keep location chip in hibernation state and high level will permit location chip to be activated */
- DigitalOut *pPinReset;
- /** GPIO pin to detect if the chip is still wakeup */
- DigitalIn *pWakeup;
-}tCsrLocConfig;
-
-/* General OSP mesasge format */
-typedef struct OspMsg
-{
- uint32_t msgId;
- uint32_t length;
- uint8_t payload[4];
+/* General OSP message format */
+typedef struct OspMsg {
+ uint32_t msgId;
+ uint32_t length;
+ uint8_t payload[4];
} tOspMsg;
-/* keep the internal data of CsrLocation class */
-typedef struct CsrLocInst
-{
- bool bStopFlag;
- bool bPwrModeRsp;
- bool bVerRsp;
- eProto proto;
- eCsrLocState locState;
- eProtoState protoState;
- ePowerMode pwrMode;
- uint32_t baudRate;
- int32_t computedCheckSum;
- int32_t checksum;
- int32_t msgSize;
- int32_t decodeIndex;
- eProtoDetState protoDetState;
- Timeout *pTimeoutChk; /* timeout process */
- bool bTimeoutFlag;
- eEngineStatus engStatus;
-
- tLocSvStatus svStatus; /* 2 kind of messages contribute the svStaus */
-
- DBG_SERIAL_TYPE *pSerialDebug;
- LOC_SERIAL_TYPE *pSerialLoc;
- DigitalOut *pPinOnoff;
- DigitalOut *pPinReset;
- DigitalIn *pWakeup;
-
- uint8_t serialBuf[MAX_SERIAL_BUF_LEN]; /* buffer the serial data from uart callback function */
- uint8_t serialPkt[MAX_SERIAL_PKT_LEN]; /* decoded osp data */
- uint32_t in;
- uint32_t out;
-
- csr_app_output_callback appOutCb;
- csr_app_event_callback appEventCb;
-}tCsrLocInst;
-
-/** CsrLocation class.
+/** CSRLocation class.
* A location interface to control location chip and get position and satellite information.
*/
-class CsrLocation
+class CSRLocation : public GPSProviderImplBase
{
public:
- /** Constructor: CsrLocaiton
- * Create the CsrLocation, accept specified configuration
- * @param pLocConfig Configuration including debug serial port, location communication serail port, onoff pin, reset pin
+ /** Constructor: CsrLocation
+ * Create the CSRLocation, accept specified configuration
+ *
+ * @param [in] pSerialLoc
+ * serial communication channel between host and GPS controller.
+ * @param [in] pPinOnoff
+ * GPIO pin to control location chip on, a rising edge is used to activate
+ * location chip. Please note, before activate chip, reset pin should be
+ * pull high.
+ * @param [in] pPinReset
+ * GPIO pin to control location chip reset, low level will keep location
+ * chip in hibernation state and high level will permit location chip to be
+ * activated.
+ * @param [in] pWakeup
+ * GPIO pin to detect if the chip is still wakeup.
+ * @param [in] pLocConfig
+ * Configuration including debug serial port, location communication serial port, onoff pin, reset pin
+ * @param [in] debugP
+ * The debug port for diagnostic messages; can be NULL.
*/
- CsrLocation(tCsrLocConfig *pLocConfig);
-
- /** Destructor: CsrLocation
+ CSRLocation(RawSerial &serialLoc,
+ DigitalOut &pinOnoff,
+ DigitalOut &pinReset,
+ DigitalIn &wakeup,
+ Serial *debugP = NULL);
+
+ /** Destructor: CSRLocation
* Free allocated resource
*/
- ~CsrLocation();
-
- /** Register output callback and enent callback functions
- * @param app_output_cb CsrLocation class output the loaction and satellite information to application
- * @param app_event_cb CsrLocation class output the start and stop result to application
+ virtual ~CSRLocation();
+
+ /** Register output callback and event callback functions
+ * @param app_output_cb CSRLocation class output the location and satellite information to application
+ * @param app_event_cb CSRLocation class output the start and stop result to application
*/
void CsrLocRegOutput(csr_app_output_callback app_output_cb, csr_app_event_callback app_event_cb);
- /** hw reset to get location chip into hibernation mode */
- void CsrLocReset(void);
-
- /** Start location request, activate location chip */
- void CsrLocStart(ePowerMode pwrMode, eProto proto);
-
- /** Process location data from chip and update location and satellite information */
- void CsrLocUpdate(void);
-
- /** Stop location request, get location chip into hibernation mode */
- void CsrLocStop(void);
-
- /** Speical for low power PTF mode.
- * During low power PTF mode, after reporting position, chip will go to hibernation mode automatically.
- * After 30 seconds, chip will recover and report position again. Then chip will go to hibernation mode again.
- * During the hibernation, application can call CsrLocLpmGetPos to get position immediately and no need to wait for the whole interval.
- */
- void CsrLocLpmGetPos(void);
+ /** HW reset to get location chip into hibernation mode */
+ virtual void reset(void);
/* A debug interface to switch location chip protocol from OSP at 115200bps to NMEA at 4800bps */
void CsrLocDebugSwitch2Nmea(void);
-
+
private:
- /* Internal kept data */
- tCsrLocInst csrLocInst;
-
/* Initialize the serial port and open it */
void _CsrLocUartInit(void);
- /* Process the raw stream from location seraial port */
+ /* Process the raw stream from location serial port */
void _CsrLocProcessRawStream(void);
/* Detect the OSP protocol detection timeout */
@@ -430,23 +339,27 @@
/* Detect the NMEA protocol outputted from location serial port */
void _CsrLocDetProtoNmeaTimeout(void);
- /* Process the raw NMEA stream, remove the NMEA header, tail, and save the NMEA data into interal buffer */
+ /* Process the raw NMEA stream, remove the NMEA header, tail, and save the NMEA data into internal buffer */
void _CsrLocProcessRawNmeaStream(uint8_t data);
- /* Process the raw OSP stream, remove the OSP header, size, check sum, and save the OSP data into interal buffer */
+ /* Process the raw OSP stream, remove the OSP header, size, check sum, and save the OSP data into internal buffer */
void _CsrLocProcessRawOspStream(uint8_t data);
- /* Process the saved nmea data and decode them */
+ /* Process the saved NMEA data and decode them */
void _CsrLocProcessRawNmeaPkt(void);
/* Process the saved OSP data and decode them */
void _CsrLocProcessRawOspPkt(void);
- /* Calculate the OSP message size to allcate buffer to save the decoded OSP data */
+ /* Calculate the OSP message size to allocate buffer to save the decoded OSP data */
uint32_t _CsrLocCalcMsgSize(void);
- /* Decode OSP data into pakcet data structure */
- CsrResult _CsrLocDecodeOspPkt( uint8_t *payload, uint32_t payload_length, uint32_t *message_id, void *message_structure, uint32_t *message_length);
+ /* Decode OSP data into packet data structure */
+ CsrResult _CsrLocDecodeOspPkt(uint8_t *payload,
+ uint32_t payload_length,
+ uint32_t *message_id,
+ void *message_structure,
+ uint32_t *message_length);
/* Process the decode OSP packet and pass to application when needed */
void _CsrLocProcessOspPkt(tOspMsg *pOspMsg);
@@ -454,10 +367,10 @@
/* Timeout process, such as detect OSP and NMEA protocol */
void _CsrLocTimeout(void);
- /* Location serial port data recevier */
+ /* Location serial port data receiver */
void _CsrLocRxHandler(void);
- /* Send special OSP messges to location chip */
+ /* Send special OSP messages to location chip */
void _CsrLocSendData(eSendDataType type);
/* Trigger a pulse on the onoff pin */
@@ -469,8 +382,63 @@
/* Detect wakeup status on the wakeup pin */
bool _CsrLocIsWakeup(void);
+private:
+ void outputHandler(uint32_t msgId, void *const pMsgData, uint32_t msgLength);
+ void eventHandler(eCsrLocEventType event, uint32_t data);
+
+ /**
+ * APIs needed to extend GPSProviderImplBase
+ */
+private:
+ virtual bool setPowerMode(GPSProvider::PowerMode_t pwrMode);
+ virtual void start(void);
+ virtual void stop(void);
+ virtual void process(void);
+ virtual uint32_t ioctl(uint32_t command, void *arg);
+
+ /** Special for low power PTF mode.
+ * During low power PTF mode, after reporting position, chip will go to hibernation mode automatically.
+ * After 30 seconds, chip will recover and report position again. Then chip will go to hibernation mode again.
+ * During the hibernation, application can call lpmGetImmediateLocation to get position immediately and no need to wait for the whole interval.
+ */
+ virtual void lpmGetImmediateLocation(void);
+
+ /* Internal data */
+private:
+ RawSerial &serialLoc; /**< serial communication channel between host and GPS controller. */
+ DigitalOut &pinOnoff;
+ DigitalOut &pinReset;
+ DigitalIn &wakeup;
+
+ bool bPwrModeRsp;
+ bool bVerRsp;
+
+ eProto proto;
+ eCsrLocState locState;
+ eProtoState protoState;
+ ePowerMode pwrMode;
+
+ uint32_t baudRate;
+ int32_t computedCheckSum;
+ int32_t checksum;
+ int32_t msgSize;
+ int32_t decodeIndex;
+ eProtoDetState protoDetState;
+ Timeout *pTimeoutChk; /* timeout process */
+ bool bTimeoutFlag;
+ eEngineStatus engStatus;
+
+ tLocSvStatus svStatus; /* 2 kind of messages contribute the svStaus */
+
+ uint8_t serialBuf[MAX_SERIAL_BUF_LEN]; /* buffer the serial data from UART callback function */
+ uint8_t serialPkt[MAX_SERIAL_PKT_LEN]; /* decoded OSP data */
+ uint32_t in;
+ uint32_t out;
+
+ csr_app_output_callback appOutCb;
+ csr_app_event_callback appEventCb;
+
+ Serial *pSerialDebug;
};
-
-
#endif /* CSRLOCATION_H */

GPS mbed Shield