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/CloudFileReceiver.cpp
- Revision:
- 31:4b1587034318
- Parent:
- 27:38205cebc3da
- Child:
- 45:3b9e1923cb15
--- a/src/CloudDataHandler/CloudFileReceiver.cpp Thu Sep 08 18:39:29 2016 +0000
+++ b/src/CloudDataHandler/CloudFileReceiver.cpp Thu Sep 08 21:15:11 2016 +0000
@@ -1,17 +1,18 @@
#include "CloudFileReceiver.h"
#include "MTSLog.h"
#include "MbedJSONValue.h"
+#include "global.h"
bool CloudFileReceiver( std::string *recv_string, mDot *dot )
{
MbedJSONValue from_json;
bool status;
-
+
parse( from_json, recv_string->c_str() );
int sequence = from_json["seq"].get<int>();
logInfo("Received command: %s", recv_string->c_str());
-// logInfo("ID=%s",from_json["pay"]["spcontrol"]["id"].get<std::string>().c_str());
+ // sequence of -1 means string sent in 1 chunk.
if( sequence == -1 ) {
FILENAME_STRING filename;
@@ -23,15 +24,32 @@
switch( mType ) {
case SETPOINT_CONTROL_MTYPE:
+ {
logInfo("PROCESSING SETPONT CONTROL FILE");
- snprintf( filename, sizeof(TASKNAME_STRING), "%s_%s%s",
+ snprintf( filename, sizeof(FILENAME_STRING), "%s_%s%s",
from_json["pay"]["spcontrol"]["id"].get<std::string>().c_str(),
from_json["pay"]["spcontrol"]["input"].get<std::string>().c_str(),
".json" );
logInfo("SETPONT CONTROL FILENAME=%s", filename);
break;
+ }
case TIMER_CONTROL_MTYPE:
break;
+ case INPUT_CONFIG_MTYPE:
+ {
+ logInfo("PROCESSING INPUT CONFIG FILE");
+ snprintf( filename, sizeof(FILENAME_STRING), "input_%s%s",
+ from_json["pay"]["input"]["id"].get<std::string>().c_str(),
+ ".json" );
+ logInfo("INPUT CONFIG FILENAME=%s", filename);
+
+ logInfo("Sending Mail To ModbusMasterMailBox, filename=%s");
+ Message_t *mail = ModbusMasterMailBox.alloc();
+ mail->action = ACTION_READ_FILE;
+ strncpy( mail->controlFile, filename, (sizeof(mail->controlFile)-1));
+ ModbusMasterMailBox.put(mail);
+ break;
+ }
default:
logInfo("DEFAULT");
break;
