Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Diff: ResourceFactory.cpp
- Revision:
- 21:cfdaee0a2b50
- Parent:
- 14:d4f8ab1e199a
- Child:
- 25:2a001b4f7024
diff -r f2dbbd852e08 -r cfdaee0a2b50 ResourceFactory.cpp --- a/ResourceFactory.cpp Wed Feb 26 18:59:01 2014 +0000 +++ b/ResourceFactory.cpp Wed Feb 26 21:29:18 2014 +0000 @@ -60,8 +60,9 @@ } // set a resource value - void ResourceFactory::setResourceValue(char *name, char *value) { + bool ResourceFactory::setResourceValue(char *name, char *value) { bool found = false; + bool set = false; // loop through the resource list for(int i=0;i<this->m_list.size() && !found;++i) { @@ -69,7 +70,26 @@ found = true; this->logger()->log("Setting Resource: %s Value: %s",name,value); this->m_list[i].setValue(value); + set = true; } } + + return set; } +// get the callback pointer +void *ResourceFactory::getCallbackPointer(char *name) { + void *cb = NULL; + bool found = false; + + // loop through the resource list + for(int i=0;i<this->m_list.size() && !found;++i) { + if (strcmp(this->m_list[i].getName(),name) == 0) { + found = true; + cb = this->m_list[i].getCallbackPointer(); + } + } + + return cb; +} +