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

util/RtosSmartRest.h

Committer:
vwochnik
Date:
2014-11-30
Revision:
67:c360a2b2c948
Parent:
55:a0f7295ed6b6
Child:
77:f6717e4eccc4

File content as of revision 67:c360a2b2c948:

#ifndef RTOSSMARTREST_H
#define RTOSSMARTREST_H

#include "AbstractSmartRest.h"
#include "MbedSmartRest.h"
#include "rtos.h"

#define RTOS_SMARTREST_SLOTS 8

class RtosSmartRest : public AbstractSmartRest
{
public:
    RtosSmartRest(const char*, uint16_t, const char*, uint8_t = MBEDSMARTREST_TRIES);
    ~RtosSmartRest();
    
    struct Slot {
        osThreadId tid;
        MbedSmartRest *inst;
    };

    uint8_t setAuthorization(const char*, const char*);
    uint8_t bootstrap(const DataGenerator&);
    uint8_t send(const DataGenerator&, const char* = NULL);
    uint8_t stream(const char*, const Record&, const char* = NULL);
    uint8_t receive(ParsedRecord&);
    void stop();
    const char * getIdentifier();
    
protected:
    MbedSmartRest * instance();

private:
    const char *_host, *_identifier;
    uint8_t _port, _tries;
    const char *_username, *_password;
    
    Slot _slots[RTOS_SMARTREST_SLOTS];
    size_t _count;
};

#endif