Erick / Mbed 2 deprecated ICE-F412

Dependencies:   mbed-rtos mbed

Revision:
0:61364762ee0e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ICE-Application/src/CloudDataHandler/CloudDataHandler.cpp	Tue Jan 24 19:05:33 2017 +0000
@@ -0,0 +1,59 @@
+/******************************************************************************
+ *
+ * File:            CloudDataHandler.cpp
+ * Description: 
+ *
+ *****************************************************************************/
+#include "CloudDataHandler.h"
+#include "CloudFileReceiver.h"
+#include "LogHandler.h"
+#include <stdio.h>
+#include <vector>
+#include "rtos.h"
+#include "global.h"
+
+// 
+// The Cloud Data Handler task
+//
+void CloudDataHandler(void const *args)
+{
+#if 0
+    int32_t ret;
+    bool joined;
+    bool sent;
+#endif
+
+    printf("\r%s has started...\n", __func__);
+
+    while ( true ) {
+
+        std::string tmp_buffer;
+#if 0
+        if (!GLOBAL_mdot->getNetworkJoinStatus()) {
+            logInfo("network not joined, joining network");
+            if ((ret = GLOBAL_mdot->joinNetwork()) != mDot::MDOT_OK) {
+                printf("failed to join network %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
+                joined = false;
+            }
+        } else {
+            joined = true;
+        }
+
+        sent = LogHandler( joined );
+        if( sent == true ) {
+            // sent a packet, try to receive back.
+            printf("Sent to gateway: %s", tmp_buffer.c_str());
+            std::vector<uint8_t> rcvData(256);
+            rcvData.clear();
+            if ((ret = GLOBAL_mdot->recv(rcvData)) == mDot::MDOT_OK) {
+                if (!rcvData.empty()) {
+                    std::string rcv_string(rcvData.begin(), rcvData.end());
+                    printf("Received Data: %s", rcv_string.c_str());
+                    CloudFileReceiver( &rcv_string, GLOBAL_mdot );
+                }
+            }
+        }
+#endif
+        Thread::wait(1000);
+    }
+}
\ No newline at end of file