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: C12832_lcd EthernetInterface StatusReporter LM75B MQTT-ansond endpoint_core endpoint_mqtt mbed-rtos mbed
Diff: MBEDEndpoint.cpp
- Revision:
- 17:84ab108ed670
- Parent:
- 15:e44d75d95b38
- Child:
- 18:214698dbcdfa
diff -r 618a6bc27fb3 -r 84ab108ed670 MBEDEndpoint.cpp
--- a/MBEDEndpoint.cpp Thu Feb 27 06:06:10 2014 +0000
+++ b/MBEDEndpoint.cpp Thu Feb 27 06:28:42 2014 +0000
@@ -185,13 +185,11 @@
char payload[IOC_PAYLOAD_LEN+1];
// initialize
- //memset(result,0,IOC_RESULT_LEN+1);
- //memset(payload,0,IOC_PAYLOAD_LEN+1);
+ memset(result,0,IOC_RESULT_LEN+1);
+ memset(payload,0,IOC_PAYLOAD_LEN+1);
// DEBUG
this->logger()->log("Loading Light: %s...",light->getName());
-
-return true;
// build the payload
char *data = this->buildIOCPayload(payload,IOC_PAYLOAD_LEN,light);
@@ -237,8 +235,8 @@
char payload[IOC_PAYLOAD_LEN+1];
// initialize
- //memset(result,0,IOC_RESULT_LEN+1);
- //memset(payload,0,IOC_PAYLOAD_LEN+1);
+ memset(result,0,IOC_RESULT_LEN+1);
+ memset(payload,0,IOC_PAYLOAD_LEN+1);
// build the payload
char *data = this->buildIOCPayload(payload,IOC_PAYLOAD_LEN,light);
@@ -264,17 +262,27 @@
Resource *resource = factory->getResource(i);
// add to the JSON payload
- json[this->getMap()->endpointNameToIOCName(resource->getName())] = resource->getValue();
+ char *name = this->getMap()->endpointNameToIOCName(resource->getName());
+
+ this->logger()->log("Name: %s Value: %s",name,resource->getValue());
+
+ json[name] = resource->getValue();
}
+ // Special Case: STARTDATETIME
+
+ // Special Case: ENDDATETIME
+
+ // Speical Case: LOCATION
+
// now convert to JSON
- std::string str_json = json.serialize();
+ //std::string str_json = json.serialize();
// copy over to the buffer
//strncpy(data,str_json.c_str(),this->min(str_json.length(),data_length));
// DEBUG
- this->logger()->log("Loading Payload: %s",data);
+ //this->logger()->log("Loading Payload: %s",data);
// return the payload
return data;