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@106:c61f0d62b625, 2015-05-11 (annotated)
- Committer:
- xinlei
- Date:
- Mon May 11 18:10:44 2015 +0000
- Revision:
- 106:c61f0d62b625
- Parent:
- 99:e369fc75c000
- Child:
- 116:4eb3c7e945cf
SmartRestSSLSocket and various bug-fixes for rc3
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 | 106:c61f0d62b625 | 9 | SmartRestSocket(): TCPSocketConnection(), timeout(-1) {} |
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 | 106:c61f0d62b625 | 13 | void setBlocking(int _timeout = -1) { // timeout in milliseconds |
xinlei | 106:c61f0d62b625 | 14 | timeout = _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 | 106:c61f0d62b625 | 19 | int timeout; |
xinlei | 94:61d44636f020 | 20 | Mutex ipLock; |
xinlei | 94:61d44636f020 | 21 | }; |
xinlei | 94:61d44636f020 | 22 | |
xinlei | 94:61d44636f020 | 23 | #endif /* SMARTRESTSOCKET_H */ |