Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/CloudDataHandler/CloudDataHandler.cpp
- Revision:
- 116:7337ed514891
- Parent:
- 99:55317f374a94
- Child:
- 123:ce602c91a9c3
--- a/src/CloudDataHandler/CloudDataHandler.cpp Thu Sep 22 16:10:01 2016 +0000 +++ b/src/CloudDataHandler/CloudDataHandler.cpp Thu Sep 22 21:09:49 2016 +0000 @@ -1,6 +1,6 @@ #include "CloudDataHandler.h" #include "CloudFileReceiver.h" -#include "CloudFileSender.h" +#include "LogHandler.h" #include "MTSLog.h" #include <stdio.h> #include "mDot.h" @@ -8,11 +8,11 @@ #include "rtos.h" #include "global.h" -bool CloudDataHandlerConnected = false; - void CloudDataHandler(void const *args) { int32_t ret; + bool connected; + bool sent; printf("\r%s has started...\n", __func__); @@ -20,20 +20,17 @@ std::string tmp_buffer; - CloudDataHandlerConnected = false; - if (!GLOBAL_mdot->getNetworkJoinStatus()) { logInfo("network not joined, joining network"); if ((ret = GLOBAL_mdot->joinNetwork()) != mDot::MDOT_OK) { logError("failed to join network %d:%s", ret, mDot::getReturnCodeString(ret).c_str()); - Thread::wait(30000); - continue; + connected = false; } + } else { + connected = true; } - CloudDataHandlerConnected = true; - - bool sent = CloudFileSender( tmp_buffer ); + sent = LogHandler( connected ); if( sent == true ) { // sent a packet, try to receive back. logInfo("Sent to gateway: %s", tmp_buffer.c_str());