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:
2016-08-08
Revision:
139:f8ab852e83e7
Parent:
130:dc9e37d4bc05

File content as of revision 139:f8ab852e83e7:

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

class SmartRestSocket : public TCPSocketConnection
{
public:
        SmartRestSocket(): TCPSocketConnection() {
                memset(cachedIP, 0, sizeof(cachedIP));
        }
        virtual ~SmartRestSocket() {}
        int connect();
        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) {
                if (timeout == -1)
                        Socket::set_blocking(true);
                else
                        Socket::set_blocking(false, timeout);
        }
private:
        char cachedIP[16];
};

#endif /* SMARTRESTSOCKET_H */