GPS GMS-6 Module

Dependents:   RwSDCard_Xml_GPS

Revision:
0:7ef27b349b37
Child:
1:dceb4eaf697e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GPSGms6.h	Tue May 10 06:33:57 2016 +0000
@@ -0,0 +1,111 @@
+
+
+#define HEADER_SIZE                 5
+#define GPRMC_TIME_SIZE             10
+#define GPRMC_STATUS_SIZE           1
+#define GPRMC_LATITUDE_SIZE         9
+#define GPRMC_LATITUDE_HEMI_SIZE    1
+#define GPRMC_LONGITUDE_SIZE        10
+#define GPRMC_LONGITUDE_HEMI_SIZE   1
+#define GPRMC_SPEED_SIZE            5
+#define GPRMC_COURSE_SIZE           5
+#define GPRMC_DATE_SIZE             6
+#define GPRMC_MAGNETIC_SIZE         5
+#define GPRMC_MAGNETIC_DIR_SIZE     1
+#define GPRMC_INDICATOR_SIZE        1
+
+#define INVALID_VALUE               0xFFFF
+#define RX_BUF_SIZE                 100
+
+typedef struct {
+    char header[HEADER_SIZE+1];
+    char time[GPRMC_TIME_SIZE+1];
+    char status[GPRMC_TIME_SIZE+1];
+    char latitude[GPRMC_LATITUDE_SIZE+1];
+    char latitude_hemi[GPRMC_LATITUDE_HEMI_SIZE+1];
+    char longitude[GPRMC_LONGITUDE_SIZE+1];
+    char longitude_hemi[GPRMC_LATITUDE_HEMI_SIZE+1];
+    char speed[GPRMC_SPEED_SIZE+1];
+    char course[GPRMC_COURSE_SIZE+1];
+    char date[GPRMC_DATE_SIZE+1];
+    char magnetic[GPRMC_MAGNETIC_SIZE+1];
+    char magnetic_dir[GPRMC_MAGNETIC_DIR_SIZE+1];
+    char indicator[GPRMC_INDICATOR_SIZE+1];
+} GPRMC_Data_TypeDef;
+
+typedef enum GPS_ProcessState {
+    GPS_Process_Start = 0,
+    GPS_Process_Header,
+    GPS_Process_Time,
+    GPS_Process_Status,
+    GPS_Process_Latitude,
+    GPS_Process_Latitude_hemis,
+    GPS_Process_Longitude,
+    GPS_Process_Longitude_hemis,
+    GPS_Process_Speed,
+    GPS_Process_Course,
+    GPS_Process_Date,
+    GPS_Process_Magnetic,
+    GPS_Process_Magnetic_Dir,
+    GPS_Process_Indicator,
+    GPS_Process_Complete ,
+    GPS_Process_SIZE
+} GPS_ProcessState;
+
+typedef enum GPS_ProcessStatus {
+    GPS_Status_Valid,
+    GPS_Status_Empty,
+    GPS_Status_NotEnough,
+} GPS_ProcessStatus;
+
+typedef struct {
+    GPS_ProcessState state;
+    int              size;
+    char *           p_val;
+} GPRMC_Tbl_TypeDef;
+
+
+
+class GPSGms6
+{
+public:
+
+    GPSGms6();
+
+    void start_GPS();
+    tm UTCTime();
+    /** Get Latest GPRMC Data
+     *
+     * @returns
+     *   Latest GPRMC Data
+     */
+    GPRMC_Data_TypeDef latestGPRMC();
+
+    /**  Get Valid Data Interval
+     *
+     * @returns
+     * Valid Data Interval
+     */
+    GPRMC_Data_TypeDef validGPRMC();
+
+    /**  Get availability of gprmc
+     *
+     * @returns
+     * 'true' - if data is available
+     */
+    bool available();
+
+
+private:
+    // States
+
+
+
+    //Member variables
+
+
+
+    //void GPS_ProcessGpsData(char * buf, unsigned int size, char * t, char * d);
+    //GPS_ProcessStatus GPS_ProcessGprmcSection(GPS_ProcessState state,char * buf , unsigned int buf_index,unsigned int buf_size, unsigned int section_size, char * ret_value);
+
+};
\ No newline at end of file