MBED MQTT Lighting Endpoint for NXP LPC1768+AppBoard
Dependencies: C12832_lcd EthernetInterface StatusReporter LM75B MQTT-ansond endpoint_core endpoint_mqtt mbed-rtos mbed
Revision 161:eea2bbfbb387, committed 2014-03-21
- Comitter:
- ansond
- Date:
- Fri Mar 21 05:33:18 2014 +0000
- Parent:
- 160:3f373ec7ab3c
- Child:
- 162:c9e9926cdc79
- Commit message:
- updates
Changed in this revision
Definitions.h | Show annotated file Show diff for this revision Revisions of this file |
MQTTTransport.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Definitions.h Fri Mar 21 05:23:52 2014 +0000 +++ b/Definitions.h Fri Mar 21 05:33:18 2014 +0000 @@ -116,6 +116,7 @@ #define MQTT_MAXID_VALUE 99 // IOC MQTT Endpoint ID maximum integer value #define MQTT_ENDPOINT_IDLEN 64 // IOC MQTT Endpoint ID length (max) #define MQTT_IOC_TOPIC "ARM/sensinode/control/%s" // IOC MQTT Topic +#define MQTT_IOC_ALL_TOPIC "ARM/sensinode/control/all" // IOC MQTT Topic (broadcast) #define MQTT_PING_SEND_TOPIC "ARM/sensinode/ping" // IOC MQTT Ping Send Topic #define MQTT_IOC_ALL_ENDPOINT "all" // must be the same as the last element of MATT_IOC_ANNOUNCE_TOPIC #define MQTT_IOC_TOPIC_LEN 64 // max length for the topic string
--- a/MQTTTransport.cpp Fri Mar 21 05:23:52 2014 +0000 +++ b/MQTTTransport.cpp Fri Mar 21 05:33:18 2014 +0000 @@ -384,8 +384,15 @@ if (this->m_mqtt->connect(id)) { this->logger()->log("MQTT Subscribe: Topic: %s...",this->getTopic()); if (this->m_mqtt->subscribe(this->getTopic())) { - this->logger()->log("MQTT CONNECTED."); - this->m_connected = true; + if (this->m_mqtt->subscribe(MQTT_IOC_ALL_TOPIC)) { + this->logger()->log("MQTT CONNECTED."); + this->m_connected = true; + } + else { + this->logger()->log("MQTT Subscribe: Topic: %s FAILED",MQTT_IOC_ALL_TOPIC); + this->logger()->turnLEDRed(); + this->m_connected = false; + } } else { this->logger()->log("MQTT Subscribe: Topic: %s FAILED",this->getTopic());