Official reference client implementation for Cumulocity SmartREST on u-blox C027.

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Committer:
xinlei
Date:
Mon Aug 08 11:05:57 2016 +0000
Revision:
139:f8ab852e83e7
Parent:
99:e369fc75c000
Etisalat and Teleena APN.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Cumulocity 47:89ae46d5c466 1 #ifndef GPSTRACKER_H
Cumulocity 47:89ae46d5c466 2 #define GPSTRACKER_H
Cumulocity 47:89ae46d5c466 3
Cumulocity 47:89ae46d5c466 4 #include <stddef.h>
Cumulocity 47:89ae46d5c466 5 #include "GPS.h"
Cumulocity 47:89ae46d5c466 6 #include "rtos.h"
Cumulocity 47:89ae46d5c466 7
Cumulocity 47:89ae46d5c466 8 /**
Cumulocity 47:89ae46d5c466 9 * A GPS tracker class providing access to the current position.
Cumulocity 47:89ae46d5c466 10 */
Cumulocity 47:89ae46d5c466 11 class GPSTracker
Cumulocity 47:89ae46d5c466 12 {
Cumulocity 47:89ae46d5c466 13 public:
Cumulocity 47:89ae46d5c466 14 /**
Cumulocity 47:89ae46d5c466 15 * Initialize a new GPSTracker object.
Cumulocity 47:89ae46d5c466 16 * @param gps a previously initialized instance of the GPSI2C class
Cumulocity 47:89ae46d5c466 17 */
xinlei 99:e369fc75c000 18 GPSTracker();
Cumulocity 47:89ae46d5c466 19
Cumulocity 47:89ae46d5c466 20 typedef struct {
Cumulocity 47:89ae46d5c466 21 double altitude; // altitude meters
Cumulocity 47:89ae46d5c466 22 double latitude; // latitude degrees
Cumulocity 47:89ae46d5c466 23 double longitude; // longitude degrees
Cumulocity 47:89ae46d5c466 24 } Position;
Cumulocity 47:89ae46d5c466 25
Cumulocity 47:89ae46d5c466 26 /**
Cumulocity 47:89ae46d5c466 27 * Retrieves and invalidates the current position.
Cumulocity 47:89ae46d5c466 28 * @param position a pointer of type Position where the current position is written to
Cumulocity 47:89ae46d5c466 29 * @return true on success, false otherwise
Cumulocity 47:89ae46d5c466 30 */
Cumulocity 47:89ae46d5c466 31 bool position(Position*);
Cumulocity 47:89ae46d5c466 32
Cumulocity 47:89ae46d5c466 33 protected:
Cumulocity 47:89ae46d5c466 34 void thread();
Cumulocity 47:89ae46d5c466 35 static void thread_func(void const*);
Cumulocity 47:89ae46d5c466 36
Cumulocity 47:89ae46d5c466 37 private:
Cumulocity 47:89ae46d5c466 38 GPSI2C _gps;
Cumulocity 47:89ae46d5c466 39 Thread _thread;
Cumulocity 47:89ae46d5c466 40 Mutex _mutex;
Cumulocity 47:89ae46d5c466 41 Position _position;
Cumulocity 47:89ae46d5c466 42 bool _positionSet;
Cumulocity 47:89ae46d5c466 43 };
Cumulocity 47:89ae46d5c466 44
Cumulocity 47:89ae46d5c466 45 #endif