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)

BG96_GNSS.h

Committer:
Pawel Zarembski
Date:
2020-02-19
Revision:
1:c3a5d3a0b437
Parent:
0:6a2a480672be
Child:
2:8b0663001935

File content as of revision 1:c3a5d3a0b437:

#ifndef BG96_GNSS_H
#define BG96_GNSS_H

#include "mbed.h"

#define SUCCESS 0
#define FAILURE 1

#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:
    BG96_GNSS();

    /* init methods */
    int check_if_ready(void);
    int set_gps_power(bool state);

    /* data acquisition methods */
    int get_gps_data(gps_data *data);
};

#endif /* BG96_GNSS_H */