Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SakuraIO_Evaluation_Board_Standard SakuraIO_Evalution_Board_Standard sakuraio_plus_rental_server
gps.h
00001 00002 #ifndef GPS_DECODER_H 00003 #define GPS_DECODER_H 00004 00005 #include "mbed.h" 00006 #include <string.h> 00007 #include <stdint.h> 00008 #include <stdlib.h> 00009 #include <math.h> 00010 00011 00012 #define NMEA_BUF_LEN 128 00013 #define MAXTOKEN 32 00014 00015 class GPSDecoder 00016 { 00017 public: 00018 GPSDecoder() { } 00019 GPSDecoder(char *nmea_msg) { 00020 set_nmea_message(nmea_msg); 00021 } 00022 00023 void set_nmea_message(char *nmea_msg); 00024 void decode(); 00025 uint8_t validate(); 00026 void dump_info(char *buf); 00027 00028 double get_latitude() { 00029 return latitude; 00030 } 00031 double get_longitude() { 00032 return longitude; 00033 } 00034 float get_speed() { 00035 return speed; 00036 } 00037 float get_move_direction() { 00038 return move_direction; 00039 } 00040 uint16_t get_year() { 00041 return year; 00042 } 00043 uint8_t get_month() { 00044 return month; 00045 } 00046 uint8_t get_day() { 00047 return day; 00048 } 00049 uint8_t get_hour() { 00050 return hour; 00051 } 00052 uint8_t get_min() { 00053 return min; 00054 } 00055 uint8_t get_sec() { 00056 return sec; 00057 } 00058 uint8_t get_msec() { 00059 return msec; 00060 } 00061 time_t get_unixtime(); 00062 00063 private: 00064 long str2int(char *src_ptr, uint8_t len); 00065 int split(char *str, const char delim, char *token[], int max_item); 00066 00067 char nmea_line[NMEA_BUF_LEN]; 00068 00069 double latitude; 00070 double longitude; 00071 float speed; 00072 float move_direction; 00073 uint16_t year; 00074 uint8_t month; 00075 uint8_t day; 00076 uint8_t hour; 00077 uint8_t min; 00078 uint8_t sec; 00079 uint16_t msec; 00080 }; 00081 00082 00083 #endif
Generated on Sat Jul 16 2022 23:13:41 by
1.7.2