mqtt specific components for the impact mbed endpoint library

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_mqtt_endpoint_nxp

Revision:
14:717372430717
Parent:
11:9ae0fe4517c1
Child:
17:36a4ab911aaa
diff -r 66f6cf705184 -r 717372430717 EmulatedLightResourceFactory.cpp
--- a/EmulatedLightResourceFactory.cpp	Mon Mar 31 18:14:23 2014 +0000
+++ b/EmulatedLightResourceFactory.cpp	Mon Mar 31 18:47:19 2014 +0000
@@ -58,9 +58,11 @@
  // NSP supports Light Switch 
  extern void emulated_light_switch_cb();
  
- // Ethernet
- #include "EthernetInterface.h"
- extern EthernetInterface ethernet;
+ // get the IP address if we are using Ethernet
+ #ifndef CELLULAR_NETWORK
+    #include "EthernetInterface.h"
+    extern EthernetInterface ethernet;
+ #endif
  
  // default constructor
  EmulatedLightResourceFactory::EmulatedLightResourceFactory(ErrorHandler *error_handler,void *endpoint) : EmulatedResourceFactory(error_handler,endpoint) { 
@@ -90,7 +92,11 @@
     this->createResource("/dev/bat","5.0V",(void *)&init_battery,NULL);
     this->createResource("/sen/I","0.1A",(void *)&init_current,NULL);
     this->createResource("/dev/I","0.1A",(void *)&init_current,NULL);
+#ifndef CELLULAR_NETWORK
     this->createResource("/nw/ipaddr",ethernet.getIPAddress());
+#else
+    this->createResource("/nw/ipaddr","0.0.0.0");
+#endif
     this->createResource(endpoint_name,"/lt/0/dim","25",(void *)&emulated_light_dimming_cb);          // Action: dim/brighten light
     this->createResource("/nw/eripaddr","N/A");
     this->createResource(endpoint_name,"/lt/0/on","1",(void *)&emulated_light_switch_cb);             // Action: light on/off