portable version of the cumulocity demo

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

GPSTracker.h

Committer:
ublox
Date:
2014-10-03
Revision:
56:2da813cc2f47
Parent:
47:89ae46d5c466

File content as of revision 56:2da813cc2f47:

#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