Simple driver for GNSS functions on BG96 module.
Dependents: mbed-os-example-cellular-gps-bg96
Note: this is early version
BG96 module needs to be already running to use this. Configuration only inside of this class. (hardcoded values)
Diff: BG96_GNSS.h
- Revision:
- 1:c3a5d3a0b437
- Parent:
- 0:6a2a480672be
- Child:
- 2:8b0663001935
--- a/BG96_GNSS.h Wed Feb 19 11:02:17 2020 +0100 +++ b/BG96_GNSS.h Wed Feb 19 16:34:28 2020 +0100 @@ -6,39 +6,38 @@ #define SUCCESS 0 #define FAILURE 1 -#define BG96_AT_TIMEOUT 1000 +#define BG96_AT_TIMEOUT 1000 +#define BG96_GPS_FIX_TIMEOUT 15000 + +typedef struct gps_data_t { + float utc; // hhmmss.sss + float lat; // latitude. (-)dd.ddddd + float lon; // longitude. (-)dd.ddddd + float hdop; // Horizontal precision: 0.5-99.9 + float altitude; // altitude of antenna from sea level (meters) + int fix; // GNSS position mode 2=2D, 3=3D + float cog; // Course Over Ground ddd.mm + float spkm; // Speed over ground (Km/h) xxxx.x + float spkn; // Speed over ground (knots) xxxx.x + char date[7]; // data: ddmmyy + int nsat; // number of satellites 0-12 +} gps_data; class BG96_GNSS { +private: + ATCmdParser *_parser; + UARTSerial *_serial; + public: - typedef struct gps_data_t { - float utc; // hhmmss.sss - float lat; // latitude. (-)dd.ddddd - float lon; // longitude. (-)dd.ddddd - float hdop; // Horizontal precision: 0.5-99.9 - float altitude; // altitude of antenna from sea level (meters) - int fix; // GNSS position mode 2=2D, 3=3D - float cog; // Course Over Ground ddd.mm - float spkm; // Speed over ground (Km/h) xxxx.x - float spkn; // Speed over ground (knots) xxxx.x - char date[7]; // data: ddmmyy - int nsat; // number of satellites 0-12 - } gps_data; - // todo: include gps data type in name - - BG96_GNSS(bool debug = false); + BG96_GNSS(); /* init methods */ - void serial_at_parser_init(const char *delimiter, bool debug_en); - void check_if_ready(void); + int check_if_ready(void); int set_gps_power(bool state); - /* module check state methods */ - /* data acquisition methods */ int get_gps_data(gps_data *data); +}; -private: - UARTSerial *_serial; - ATCmdParser *_parser; -} \ No newline at end of file +#endif /* BG96_GNSS_H */