portable version of the cumulocity demo

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

Revision:
47:89ae46d5c466
diff -r f6976fd64387 -r 89ae46d5c466 GPSTracker.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GPSTracker.h	Thu Jul 24 23:32:53 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