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: C12832_lcd EthernetInterface StatusReporter LM75B MQTT-ansond endpoint_core endpoint_mqtt mbed-rtos mbed
Diff: MQTTTransport.cpp
- 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;
}