GPS GMS-6 Module

Dependents:   RwSDCard_Xml_GPS

Committer:
Lucyjungz
Date:
Sun May 15 09:56:11 2016 +0000
Revision:
1:dceb4eaf697e
Parent:
0:7ef27b349b37
Child:
4:fb1cd9893eb8
Update Comment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Lucyjungz 1:dceb4eaf697e 1 /* ############### Constant Defination ################## */
nsrwsurasak 0:7ef27b349b37 2
nsrwsurasak 0:7ef27b349b37 3 #define HEADER_SIZE 5
nsrwsurasak 0:7ef27b349b37 4 #define GPRMC_TIME_SIZE 10
nsrwsurasak 0:7ef27b349b37 5 #define GPRMC_STATUS_SIZE 1
nsrwsurasak 0:7ef27b349b37 6 #define GPRMC_LATITUDE_SIZE 9
nsrwsurasak 0:7ef27b349b37 7 #define GPRMC_LATITUDE_HEMI_SIZE 1
nsrwsurasak 0:7ef27b349b37 8 #define GPRMC_LONGITUDE_SIZE 10
nsrwsurasak 0:7ef27b349b37 9 #define GPRMC_LONGITUDE_HEMI_SIZE 1
nsrwsurasak 0:7ef27b349b37 10 #define GPRMC_SPEED_SIZE 5
nsrwsurasak 0:7ef27b349b37 11 #define GPRMC_COURSE_SIZE 5
nsrwsurasak 0:7ef27b349b37 12 #define GPRMC_DATE_SIZE 6
nsrwsurasak 0:7ef27b349b37 13 #define GPRMC_MAGNETIC_SIZE 5
nsrwsurasak 0:7ef27b349b37 14 #define GPRMC_MAGNETIC_DIR_SIZE 1
nsrwsurasak 0:7ef27b349b37 15 #define GPRMC_INDICATOR_SIZE 1
nsrwsurasak 0:7ef27b349b37 16
nsrwsurasak 0:7ef27b349b37 17 #define INVALID_VALUE 0xFFFF
nsrwsurasak 0:7ef27b349b37 18 #define RX_BUF_SIZE 100
nsrwsurasak 0:7ef27b349b37 19
nsrwsurasak 0:7ef27b349b37 20
Lucyjungz 1:dceb4eaf697e 21 /* ############### Enum ################## */
nsrwsurasak 0:7ef27b349b37 22 typedef enum GPS_ProcessState {
nsrwsurasak 0:7ef27b349b37 23 GPS_Process_Start = 0,
nsrwsurasak 0:7ef27b349b37 24 GPS_Process_Header,
nsrwsurasak 0:7ef27b349b37 25 GPS_Process_Time,
nsrwsurasak 0:7ef27b349b37 26 GPS_Process_Status,
nsrwsurasak 0:7ef27b349b37 27 GPS_Process_Latitude,
nsrwsurasak 0:7ef27b349b37 28 GPS_Process_Latitude_hemis,
nsrwsurasak 0:7ef27b349b37 29 GPS_Process_Longitude,
nsrwsurasak 0:7ef27b349b37 30 GPS_Process_Longitude_hemis,
nsrwsurasak 0:7ef27b349b37 31 GPS_Process_Speed,
nsrwsurasak 0:7ef27b349b37 32 GPS_Process_Course,
nsrwsurasak 0:7ef27b349b37 33 GPS_Process_Date,
nsrwsurasak 0:7ef27b349b37 34 GPS_Process_Magnetic,
nsrwsurasak 0:7ef27b349b37 35 GPS_Process_Magnetic_Dir,
nsrwsurasak 0:7ef27b349b37 36 GPS_Process_Indicator,
nsrwsurasak 0:7ef27b349b37 37 GPS_Process_Complete ,
nsrwsurasak 0:7ef27b349b37 38 GPS_Process_SIZE
nsrwsurasak 0:7ef27b349b37 39 } GPS_ProcessState;
nsrwsurasak 0:7ef27b349b37 40
nsrwsurasak 0:7ef27b349b37 41 typedef enum GPS_ProcessStatus {
nsrwsurasak 0:7ef27b349b37 42 GPS_Status_Valid,
nsrwsurasak 0:7ef27b349b37 43 GPS_Status_Empty,
nsrwsurasak 0:7ef27b349b37 44 GPS_Status_NotEnough,
nsrwsurasak 0:7ef27b349b37 45 } GPS_ProcessStatus;
nsrwsurasak 0:7ef27b349b37 46
Lucyjungz 1:dceb4eaf697e 47
Lucyjungz 1:dceb4eaf697e 48 /* ############### Structure ################## */
Lucyjungz 1:dceb4eaf697e 49 typedef struct {
Lucyjungz 1:dceb4eaf697e 50 char header[HEADER_SIZE+1];
Lucyjungz 1:dceb4eaf697e 51 char time[GPRMC_TIME_SIZE+1];
Lucyjungz 1:dceb4eaf697e 52 char status[GPRMC_TIME_SIZE+1];
Lucyjungz 1:dceb4eaf697e 53 char latitude[GPRMC_LATITUDE_SIZE+1];
Lucyjungz 1:dceb4eaf697e 54 char latitude_hemi[GPRMC_LATITUDE_HEMI_SIZE+1];
Lucyjungz 1:dceb4eaf697e 55 char longitude[GPRMC_LONGITUDE_SIZE+1];
Lucyjungz 1:dceb4eaf697e 56 char longitude_hemi[GPRMC_LATITUDE_HEMI_SIZE+1];
Lucyjungz 1:dceb4eaf697e 57 char speed[GPRMC_SPEED_SIZE+1];
Lucyjungz 1:dceb4eaf697e 58 char course[GPRMC_COURSE_SIZE+1];
Lucyjungz 1:dceb4eaf697e 59 char date[GPRMC_DATE_SIZE+1];
Lucyjungz 1:dceb4eaf697e 60 char magnetic[GPRMC_MAGNETIC_SIZE+1];
Lucyjungz 1:dceb4eaf697e 61 char magnetic_dir[GPRMC_MAGNETIC_DIR_SIZE+1];
Lucyjungz 1:dceb4eaf697e 62 char indicator[GPRMC_INDICATOR_SIZE+1];
Lucyjungz 1:dceb4eaf697e 63 } GPRMC_Data_TypeDef;
Lucyjungz 1:dceb4eaf697e 64
Lucyjungz 1:dceb4eaf697e 65
nsrwsurasak 0:7ef27b349b37 66 typedef struct {
nsrwsurasak 0:7ef27b349b37 67 GPS_ProcessState state;
nsrwsurasak 0:7ef27b349b37 68 int size;
nsrwsurasak 0:7ef27b349b37 69 char * p_val;
nsrwsurasak 0:7ef27b349b37 70 } GPRMC_Tbl_TypeDef;
nsrwsurasak 0:7ef27b349b37 71
nsrwsurasak 0:7ef27b349b37 72
Lucyjungz 1:dceb4eaf697e 73 /* ############### Class ################## */
nsrwsurasak 0:7ef27b349b37 74 class GPSGms6
nsrwsurasak 0:7ef27b349b37 75 {
nsrwsurasak 0:7ef27b349b37 76 public:
nsrwsurasak 0:7ef27b349b37 77
Lucyjungz 1:dceb4eaf697e 78 /**
Lucyjungz 1:dceb4eaf697e 79 * Constructor
Lucyjungz 1:dceb4eaf697e 80 */
nsrwsurasak 0:7ef27b349b37 81 GPSGms6();
nsrwsurasak 0:7ef27b349b37 82
Lucyjungz 1:dceb4eaf697e 83 /**
Lucyjungz 1:dceb4eaf697e 84 * Start GPS
Lucyjungz 1:dceb4eaf697e 85 */
nsrwsurasak 0:7ef27b349b37 86 void start_GPS();
Lucyjungz 1:dceb4eaf697e 87
Lucyjungz 1:dceb4eaf697e 88 /**
Lucyjungz 1:dceb4eaf697e 89 * Get UTC Time
Lucyjungz 1:dceb4eaf697e 90 * @returns
Lucyjungz 1:dceb4eaf697e 91 * UTC Time
Lucyjungz 1:dceb4eaf697e 92 */
nsrwsurasak 0:7ef27b349b37 93 tm UTCTime();
nsrwsurasak 0:7ef27b349b37 94 /** Get Latest GPRMC Data
nsrwsurasak 0:7ef27b349b37 95 *
nsrwsurasak 0:7ef27b349b37 96 * @returns
nsrwsurasak 0:7ef27b349b37 97 * Latest GPRMC Data
nsrwsurasak 0:7ef27b349b37 98 */
nsrwsurasak 0:7ef27b349b37 99 GPRMC_Data_TypeDef latestGPRMC();
nsrwsurasak 0:7ef27b349b37 100
nsrwsurasak 0:7ef27b349b37 101 /** Get Valid Data Interval
nsrwsurasak 0:7ef27b349b37 102 *
nsrwsurasak 0:7ef27b349b37 103 * @returns
nsrwsurasak 0:7ef27b349b37 104 * Valid Data Interval
nsrwsurasak 0:7ef27b349b37 105 */
nsrwsurasak 0:7ef27b349b37 106 GPRMC_Data_TypeDef validGPRMC();
nsrwsurasak 0:7ef27b349b37 107
nsrwsurasak 0:7ef27b349b37 108 /** Get availability of gprmc
nsrwsurasak 0:7ef27b349b37 109 *
nsrwsurasak 0:7ef27b349b37 110 * @returns
nsrwsurasak 0:7ef27b349b37 111 * 'true' - if data is available
nsrwsurasak 0:7ef27b349b37 112 */
nsrwsurasak 0:7ef27b349b37 113 bool available();
nsrwsurasak 0:7ef27b349b37 114
nsrwsurasak 0:7ef27b349b37 115
nsrwsurasak 0:7ef27b349b37 116 private:
nsrwsurasak 0:7ef27b349b37 117
nsrwsurasak 0:7ef27b349b37 118 };