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/SmartRestSocket.h

Committer:
xinlei
Date:
2015-05-18
Revision:
116:4eb3c7e945cf
Parent:
106:c61f0d62b625
Child:
122:68217ccb8cd1

File content as of revision 116:4eb3c7e945cf:

#ifndef SMARTRESTSOCKET_H
#define SMARTRESTSOCKET_H
#include "TCPSocketConnection.h"

class SmartRestSocket : private TCPSocketConnection
{
public:
        SmartRestSocket(): TCPSocketConnection(), timeout(-1) {
                memset(cachedIP, 0, sizeof(cachedIP));
        }
        virtual ~SmartRestSocket() {}
        int sendOnly(char *buf, int size);
        int sendAndReceive(char *buf, int size, int maxSize);
        /* Set the timeout for the socket.
           \param _timeout in milliseconds, -1 for no timeout.
         */
        void setBlocking(int _timeout = -1) {
                timeout = _timeout;
        }
private:
        int connect();
        char cachedIP[16];
        int timeout;
};

#endif /* SMARTRESTSOCKET_H */