MBED_DEMOS / Mbed 2 deprecated mbed_mqtt_endpoint_ublox_cellular

Dependencies:   C027_Support C12832 StatusReporter LM75B MQTT-ansond c027_radios endpoint_core endpoint_mqtt mbed-rtos mbed

Revision:
163:392f89530162
Parent:
162:c9e9926cdc79
diff -r c9e9926cdc79 -r 392f89530162 MQTTTransport.cpp
--- a/MQTTTransport.cpp	Fri Mar 21 05:44:05 2014 +0000
+++ b/MQTTTransport.cpp	Fri Mar 21 05:55:23 2014 +0000
@@ -283,9 +283,12 @@
  char *MQTTTransport::mapIOCResourceToEndpointResource(char *ioc_name) { return this->getMap()->iocNameToEndpointName(ioc_name); }
  
  char *MQTTTransport::makeID(char *id_template,char *buffer) {
+     MBEDEndpoint *endpoint = (MBEDEndpoint *)this->getEndpoint();
+     int instance_id = rand()%100;
+     if (endpoint != NULL) instance_id = endpoint->getInstanceID();
      srand(time(0));
      srand(rand());
-     sprintf(buffer,id_template,rand()%MQTT_MAXID_VALUE);
+     sprintf(buffer,id_template,rand()%MQTT_MAXID_VALUE,instance_id);
      return buffer;
  }