Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
io/GPSTracker.h@98:e369fc75c000, 2015-05-07 (annotated)
- Committer:
- xinlei
- Date:
- Thu May 07 09:57:55 2015 +0000
- Revision:
- 98:e369fc75c000
- Parent:
- 65:a62dbef2f924
prepare for v2.1rc3.
Who changed what in which revision?
User | Revision | Line number | New 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 | 98: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 |