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:
31:e5950e0677be
Parent:
29:ac6390032cec
Child:
32:9a024a6af2fb
diff -r 00ff5fe192f0 -r e5950e0677be MQTTTransport.cpp
--- a/MQTTTransport.cpp	Mon Apr 07 03:37:12 2014 +0000
+++ b/MQTTTransport.cpp	Tue Apr 08 16:41:41 2014 +0000
@@ -217,6 +217,13 @@
                                  this->sendResult(message_name,message_verb,message_value,success);
                              }
                          }
+                         
+                         // for Dimming, we also want to refresh our record (in whole) at the IOC
+                         if (this->isDimmingResource(message_verb)) {
+                             // send a fresh update to the IOC - just us...
+                             int index = endpoint->indexOfPersonality((char *)message_name);
+                             if (index >= 0) endpoint->updatePersonality(index);
+                         }
                      }
                  }
              }
@@ -254,6 +261,15 @@
      }     
  }
  
+ // is this the dimming resource?
+ bool MQTTTransport::isDimmingResource(char *resource) {
+     bool isDimming = false;
+  
+     if (resource != NULL && strcmp(resource,"Dimming") == 0) isDimming = true;
+        
+     return isDimming;
+ }
+ 
  // send result back to MQTT
  void MQTTTransport::sendResult(char *endpoint_name,char *resource_name,char *value,bool success) {
      if (this->m_connected == true) {