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: C027 C12832 EthernetInterface StatusReporter LM75B MQTT-ansond endpoint_core endpoint_mqtt mbed-rtos mbed
Diff: EmulatedResourceFactory.cpp
- Revision:
- 8:45f9a920e82c
- Parent:
- 2:90a84a216c58
- Child:
- 9:ff877db53cfd
--- a/EmulatedResourceFactory.cpp Wed Feb 26 18:59:08 2014 +0000
+++ b/EmulatedResourceFactory.cpp Wed Feb 26 21:29:27 2014 +0000
@@ -56,4 +56,20 @@
this->createResource("/sens/temp","23.2");
this->createResource("/sens/V","3.2");
this->createResource("/gps/loc","65.017210,25.492411");
- }
\ No newline at end of file
+ }
+
+ // set a resource value (AND trigger the Emulated actions if registered)
+ bool EmulatedResourceFactory::setResourceValue(char *name, char *value) {
+ // set the resource value
+ bool success = ((ResourceFactory *)this)->setResourceValue(name,value);
+ if (success) {
+ // invoke an action if registered
+ EmulatedCallbackPointer cb = (EmulatedCallbackPointer)this->getCallbackPointer(name);
+ if (cb != NULL) {
+ // invoke the callback
+ this->logger()->log("Invoking Action...");
+ cb();
+ }
+ }
+ return success;
+ }
\ No newline at end of file