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:
132:563a1ee99efc
Parent:
131:27f29e230bbb
Child:
133:e69d03f4eb5c
--- a/MQTTTransport.cpp	Sun Mar 16 22:38:55 2014 +0000
+++ b/MQTTTransport.cpp	Mon Mar 17 02:40:14 2014 +0000
@@ -297,7 +297,7 @@
          sscanf(payload,"%s%d",verb,&counter);
          
          // check the contents to make sure its for us...
-         this->logger()->log("isPongMessage: verb: %s counter %d ping_counter: %d",verb,counter,this->m_ping_counter);
+         //this->logger()->log("isPongMessage: verb: %s counter %d ping_counter: %d",verb,counter,this->m_ping_counter);
          if (strcmp(verb,"pong") == 0 && counter == this->m_ping_counter) {     
              // its a PONG message to our PING... 
              isPong = true;
@@ -330,14 +330,14 @@
      memset(message,0,MAX_MQTT_MESSAGE_LENGTH+1);
      
      // build message
-     sprintf(message,"ping:%d:",this->m_ping_counter);
+     sprintf(message,"ping:%s:%d:",this->m_endpoint_name,this->m_ping_counter);
      
      // send the message over the ping/pong topic
-     this->logger()->log("Sending PING on %s Message: %s",this->getTopic(),message);
-     sent = this->m_mqtt->publish(this->getTopic(),message,strlen(message));
+     this->logger()->log("Sending PING: counter=%d",this->m_ping_counter);
+     sent = this->m_mqtt->publish(MQTT_PING_SEND_TOPIC,message,strlen(message));
      if (sent) {
          // send succeeded
-         this->logger()->log("PING %d sent successfully",this->m_ping_counter);
+         //this->logger()->log("PING %d sent successfully",this->m_ping_counter);
          this->logger()->blinkTransportTxLED();
          
          // wait for 1 second
@@ -427,10 +427,10 @@
      }
      
      // send a PING if time for it
-     //--this->m_ping_countdown;
-     //if (this->m_ping_countdown <= 0) {
-     //    this->logger()->log("MQTT: Sending PING...");
-     //    this->m_ping_countdown = MQTT_PING_COUNTDOWN;
-     //    this->sendPingMessage();
-     //}
+     --this->m_ping_countdown;
+     if (this->m_ping_countdown <= 0) {
+         this->logger()->log("MQTT: Sending PING...");
+         this->m_ping_countdown = MQTT_PING_COUNTDOWN;
+         this->sendPingMessage();
+     }
  }
\ No newline at end of file