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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SmartRestSocket.h Source File

SmartRestSocket.h

00001 #ifndef SMARTRESTSOCKET_H
00002 #define SMARTRESTSOCKET_H
00003 #include "TCPSocketConnection.h"
00004 
00005 class SmartRestSocket : public TCPSocketConnection
00006 {
00007 public:
00008         SmartRestSocket(): TCPSocketConnection() {
00009                 memset(cachedIP, 0, sizeof(cachedIP));
00010         }
00011         virtual ~SmartRestSocket() {}
00012         int connect();
00013         int sendOnly(char *buf, int size);
00014         int sendAndReceive(char *buf, int size, int maxSize);
00015         /* Set the timeout for the socket.
00016            \param _timeout in milliseconds, -1 for no timeout.
00017          */
00018         void setBlocking(int timeout = -1) {
00019                 if (timeout == -1)
00020                         Socket::set_blocking(true);
00021                 else
00022                         Socket::set_blocking(false, timeout);
00023         }
00024 private:
00025         char cachedIP[16];
00026 };
00027 
00028 #endif /* SMARTRESTSOCKET_H */