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:
- 41:36c59c3cd6f2
- Parent:
- 39:bd5b2bcd2dcc
- Child:
- 42:46cc1641800b
--- a/EmulatedResourceFactory.cpp Sat Mar 01 07:18:49 2014 +0000
+++ b/EmulatedResourceFactory.cpp Sat Mar 01 07:43:17 2014 +0000
@@ -67,8 +67,8 @@
// create all of the resources we expect for this endpoint
this->createResource("/dev/addldata","AdditionalData");
this->createResource("/dev/location",ENDPOINT_LOCATION);
- this->createResource("/dev/bat","0.0",(resourceInitializer *)&init_battery);
- this->createResource("/sen/I","0.0",(resourceInitializer *)&init_current);
+ this->createResource("/dev/bat","0.0",(void *)&init_battery,NULL);
+ this->createResource("/sen/I","0.0",(void *)&init_current,NULL);
this->createResource("/nw/ipaddr",ethernet.getIPAddress());
this->createResource(endpoint_name,"/lt/0/dim","25",(void *)&emulated_light_dimming_cb); // Action: dim/brighten light
this->createResource("/nw/eripaddr","N/A");
@@ -78,17 +78,21 @@
this->createResource("/gps/fix","1");
this->createResource("/nw/pipaddr","N/A");
this->createResource("/nw/prssi","N/A");
- this->createResource("/sen/temp","0.0",(resourceInitializer *)&init_temperature);
- this->createResource("/sen/V","5.0",(resourceInitializer *)&init_voltage);
- this->createResource("/gps/loc",ENDPOINT_GPS_COORDS,(resourceInitializer *)&init_gps);
+ this->createResource("/sen/temp","0.0",(void *)&init_temperature,NULL);
+ this->createResource("/sen/V","5.0",(void *)&init_voltage,NULL);
+ this->createResource("/gps/loc",ENDPOINT_GPS_COORDS,(void *)&init_gps,NULL);
}
void EmulatedResourceFactory::createResource(char *name,char *value) { ResourceFactory::createResource(name,value); }
void EmulatedResourceFactory::createResource(char *endpoint_name,char *name,char *value,void *cb) { ResourceFactory::createResource(endpoint_name,name,value,cb); }
- void EmulatedResourceFactory::createResource(char *name,char *value,resourceInitializer *io) {
+ void EmulatedResourceFactory::createResource(char *name,char *value,void *io,void *notused) {
MBEDEndpoint *endpoint = (MBEDEndpoint *)this->m_endpoint;
- this->m_list[this->m_count] = new Resource(this->logger(),endpoint->getEndpointName(),name,value,NULL);
- if (io != NULL) (*io)(this->m_list[this->m_count]);
+ char *ep_name = NULL; if (endpoint != NULL) ep_name = endpoint->getEndpointName();
+ this->m_list[this->m_count] = new Resource(this->logger(),ep_name,name,value,NULL);
+ if (io != NULL) {
+ resourceInitializer initializer = (resourceInitializer)io;
+ (initializer)(this->m_list[this->m_count]);
+ }
++this->m_count;
}