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)

Revision:
0:6a2a480672be
Child:
1:c3a5d3a0b437
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BG96_GNSS.h	Wed Feb 19 11:02:17 2020 +0100
@@ -0,0 +1,44 @@
+#ifndef BG96_GNSS_H
+#define BG96_GNSS_H
+
+#include "mbed.h"
+
+#define SUCCESS 0
+#define FAILURE 1
+
+#define BG96_AT_TIMEOUT 1000
+
+class BG96_GNSS 
+{
+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);
+
+    /* init methods */
+    void serial_at_parser_init(const char *delimiter, bool debug_en);
+    void 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