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
util/SmartRestSocket.h@99:e369fc75c000, 2015-05-07 (annotated)
- Committer:
- xinlei
- Date:
- Thu May 07 09:57:55 2015 +0000
- Revision:
- 99:e369fc75c000
- Parent:
- 97:ea056f6be2e8
- Child:
- 106:c61f0d62b625
prepare for v2.1rc3.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xinlei | 94:61d44636f020 | 1 | #ifndef SMARTRESTSOCKET_H |
xinlei | 94:61d44636f020 | 2 | #define SMARTRESTSOCKET_H |
xinlei | 94:61d44636f020 | 3 | #include "TCPSocketConnection.h" |
xinlei | 94:61d44636f020 | 4 | #include "rtos.h" |
xinlei | 94:61d44636f020 | 5 | |
xinlei | 99:e369fc75c000 | 6 | class SmartRestSocket : private TCPSocketConnection |
xinlei | 94:61d44636f020 | 7 | { |
xinlei | 94:61d44636f020 | 8 | public: |
xinlei | 97:ea056f6be2e8 | 9 | SmartRestSocket(): TCPSocketConnection() {} |
xinlei | 94:61d44636f020 | 10 | virtual ~SmartRestSocket() {} |
xinlei | 94:61d44636f020 | 11 | int sendOnly(char *buf, int size); |
xinlei | 94:61d44636f020 | 12 | int sendAndReceive(char *buf, int size, int maxSize); |
xinlei | 99:e369fc75c000 | 13 | void set_blocking(bool blocking, unsigned int timeout = 3000) { // timeout in milliseconds |
xinlei | 99:e369fc75c000 | 14 | Socket::set_blocking(blocking, timeout); |
xinlei | 99:e369fc75c000 | 15 | } |
xinlei | 94:61d44636f020 | 16 | private: |
xinlei | 99:e369fc75c000 | 17 | int connect(); |
xinlei | 94:61d44636f020 | 18 | static char cachedIP[16]; |
xinlei | 94:61d44636f020 | 19 | Mutex ipLock; |
xinlei | 94:61d44636f020 | 20 | }; |
xinlei | 94:61d44636f020 | 21 | |
xinlei | 94:61d44636f020 | 22 | #endif /* SMARTRESTSOCKET_H */ |