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:
- 86:2f9b9e0c7639
- Parent:
- 85:9fdd9198001c
- Child:
- 94:0159f907859b
--- a/MBEDEndpoint.cpp Thu Mar 06 17:09:38 2014 +0000
+++ b/MBEDEndpoint.cpp Sun Mar 09 16:35:27 2014 +0000
@@ -290,23 +290,26 @@
char *name = this->getMap()->endpointNameToIOCName(resource->getName());
char *value = resource->getValue();
- // Handle LOCATION a special way
- if (strcmp(name,"LOCATION") != 0) {
- // standard name,value for IOC
- sprintf(tmp, "\"%s\":\"%s\",",name,value);
- }
- else {
- // IOC expects "Point(X,Y)" for LOCATION
- sprintf(tmp, "\"%s\":\"Point(%s)\",",name,value);
- }
- strcat(data,tmp);
-
- // Handle /dev/addldata
- char *dev_addldata = this->getMap()->endpointNameToIOCName("/dev/addldata");
- if (dev_addldata != NULL && strcmp(name,dev_addldata) == 0 && light != NULL && light->getIOCID() > 0) {
- char buf[IOC_IOC_ID_LEN+1]; memset(buf,0,IOC_IOC_ID_LEN+1); sprintf(buf,"%d",light->getIOCID());
- sprintf(tmp,"\"%s\":\"id:%s\",",name,buf);
+ // make sure that we have a positive IOC resource match for the NSP resource
+ if (name != NULL && strlen(name) > 0) {
+ // Handle LOCATION a special way
+ if (strcmp(name,"LOCATION") != 0) {
+ // standard name,value for IOC
+ sprintf(tmp, "\"%s\":\"%s\",",name,value);
+ }
+ else {
+ // IOC expects "Point(X,Y)" for LOCATION
+ sprintf(tmp, "\"%s\":\"Point(%s)\",",name,value);
+ }
strcat(data,tmp);
+
+ // Handle /dev/addldata
+ char *dev_addldata = this->getMap()->endpointNameToIOCName("/dev/addldata");
+ if (dev_addldata != NULL && strcmp(name,dev_addldata) == 0 && light != NULL && light->getIOCID() > 0) {
+ char buf[IOC_IOC_ID_LEN+1]; memset(buf,0,IOC_IOC_ID_LEN+1); sprintf(buf,"%d",light->getIOCID());
+ sprintf(tmp,"\"%s\":\"id:%s\",",name,buf);
+ strcat(data,tmp);
+ }
}
}
}