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

Revision:
106:c61f0d62b625
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/SmartRestSSLSocket.h	Mon May 11 18:10:44 2015 +0000
@@ -0,0 +1,40 @@
+#ifndef SMARTRESTSSLSOCKET_H
+#define SMARTRESTSSLSOCKET_H
+#include "mbed.h"
+#include "rtos.h"
+#include "MDM.h"
+#include "cyassl/ssl.h"
+
+extern MDMSerial *pMdm;
+extern CYASSL_CTX *pCtx;
+
+class SmartRestSSLSocket
+{
+public:
+        SmartRestSSLSocket(): timeout(3000), sockfd(-1), ssl(NULL) {
+//                sockfd = pMdm->socketSocket(MDMParser::IPPROTO_TCP);
+                ssl = CyaSSL_new(pCtx);
+        }
+        virtual ~SmartRestSSLSocket() {
+                close(); 
+//                pMdm->socketFree(sockfd);
+                CyaSSL_free(ssl);
+        }
+        int sendOnly(char *buf, int size);
+        int sendAndReceive(char *buf, int size, int maxSize);
+        void setBlocking(int _timeout = -1) {
+                // timeout in milliseconds
+                timeout = _timeout;
+        }
+protected:
+        int connect();
+        int close();
+private:
+        static char cachedIP[16];
+        int timeout;
+        int sockfd;
+        CYASSL *ssl;
+        Mutex ipLock;
+};
+
+#endif /* SMARTRESTSSLSOCKET_H */
\ No newline at end of file