demo project

Dependencies:   AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL

Revision:
11:3a2e6eb9fbb8
Parent:
10:9b21566a5ddb
Child:
13:ffeff9b5e513
--- a/IothubRobotArm.cpp	Wed Jan 06 00:58:41 2016 +0000
+++ b/IothubRobotArm.cpp	Wed Jan 06 22:25:51 2016 +0000
@@ -145,8 +145,13 @@
 static void SendConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback)
 {
     EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback;
-    (void)printf("Confirmation[%d] received for message  handle %x tracking id = %d with result = %d\r\n", 
-                eventInstance->messageHandle, callbackCounter, eventInstance->messageTrackingId, result);
+    if (eventInstance == NULL)
+    {
+        printf("SendConfirmation with NULL context\r\n");
+        return;
+    }
+    (void)printf("Confirmation[%d] received for tracking id = %d with result = %d\r\n", 
+                eventInstance->messageHandle, eventInstance->messageTrackingId, result);
 
     confirmTimer->stop();
     callbackCounter++;
@@ -197,14 +202,7 @@
         }
         else
         {
-            if ((ev.value.signals & IS_SendStatus) == IS_SendStatus)
-            {
-                iotRobot.SendMeasurements();
-            }
-            else
-            {
-                (void)printf("Iothub thread unknown signal\r\n");
-            }
+            iotRobot.SendMeasurements();
         }
     }
 }
@@ -257,7 +255,7 @@
         // For mbed add the certificate information
         if (IoTHubClient_SetOption(iotHubClientHandle, "TrustedCerts", certificates) != IOTHUB_CLIENT_OK)
         {
-            //printf("failure to set option \"TrustedCerts\"\r\n");
+            printf("failure to set option \"TrustedCerts\"\r\n");
             return false;
         }
 #endif // MBED_BUILD_TIMESTAMP
@@ -316,12 +314,6 @@
             {
                 messages[i].messageTrackingId = msgNumber;
                 
-                //MAP_HANDLE propMap = IoTHubMessage_Properties(messages[i].messageHandle);
-                //sprintf_s(propText, sizeof(propText), "PropMsg_%d", msgNumber);
-                //if (Map_AddOrUpdate(propMap, "PropName", propText) != MAP_OK)
-                //{
-                //    (void)printf("ERROR: Map_AddOrUpdate Failed!\r\n");
-                //}
                 confirmTimer->stop();
                 
                 if (IoTHubClient_SendEventAsync(iotHubClientHandle, messages[i].messageHandle, SendConfirmationCallback, &messages[i]) != IOTHUB_CLIENT_OK)