Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: io/GPSTracker.h
- Revision:
- 65:a62dbef2f924
- Parent:
- 47:89ae46d5c466
- Child:
- 98:e369fc75c000
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/io/GPSTracker.h Thu Oct 30 13:38:20 2014 +0000 @@ -0,0 +1,45 @@ +#ifndef GPSTRACKER_H +#define GPSTRACKER_H + +#include <stddef.h> +#include "GPS.h" +#include "rtos.h" + +/** + * A GPS tracker class providing access to the current position. + */ +class GPSTracker +{ +public: + /** + * Initialize a new GPSTracker object. + * @param gps a previously initialized instance of the GPSI2C class + */ + GPSTracker(GPSI2C&); + + typedef struct { + double altitude; // altitude meters + double latitude; // latitude degrees + double longitude; // longitude degrees + } Position; + + /** + * Retrieves and invalidates the current position. + * @param position a pointer of type Position where the current position is written to + * @return true on success, false otherwise + */ + bool position(Position*); + +protected: + void thread(); + static void thread_func(void const*); + +private: + GPSI2C _gps; + Thread _thread; + Mutex _mutex; + Position _position; + bool _positionSet; +}; + +#endif \ No newline at end of file