demo project

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

Revision:
15:4bd10f531cdc
Parent:
14:570c8071f577
Child:
18:224289104fc0
--- a/IothubRobotArm.cpp	Fri Jan 15 23:10:30 2016 +0000
+++ b/IothubRobotArm.cpp	Tue Jan 19 19:50:07 2016 +0000
@@ -27,6 +27,7 @@
 
 extern void ShowLedColor(int col);
 
+// method to initialize platform - Time of day
 int setupRealTime(void)
 {
     int result;
@@ -59,6 +60,7 @@
     return result;
 }
 
+// method to initialize platform - Ethernet
 int InitEthernet()
 {
     (void)printf("Initializing ethernet..\r\n");
@@ -88,7 +90,7 @@
     return 0;
 }
 
-
+// IoTHub SDK stuff
 DEFINE_ENUM_STRINGS(IOTHUB_CLIENT_CONFIRMATION_RESULT, IOTHUB_CLIENT_CONFIRMATION_RESULT_VALUES);
 
 typedef struct EVENT_INSTANCE_TAG
@@ -102,10 +104,12 @@
 #define MESSAGE_LEN         1024
 static char msgText[MESSAGE_LEN];
 
+// a larger MESSAGE_COUNT results in being able to send as data is available
+// but requires more heap space to hold buffers
 #define MESSAGE_COUNT       2
 EVENT_INSTANCE messages[MESSAGE_COUNT];
 
-// send thread poll ms
+// sending thread timeout
 #define SEND_POLL_MS        500
 
 
@@ -114,7 +118,6 @@
 static int callbackCounter;
 static int msgNumber;
 
-
 static  IOTHUB_CLIENT_HANDLE iotHubClientHandle;
 
 // used to detect send confirmation timeout
@@ -122,9 +125,10 @@
 RtosTimer* confirmTimer;
 
 
-
+// pass received commands to device
 extern void ControlArmCommands(const char* cmd);
 
+// callback for incoming messages
 static IOTHUBMESSAGE_DISPOSITION_RESULT ReceiveMessageCallback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback)
 {
     int* counter = (int*)userContextCallback;
@@ -149,6 +153,7 @@
     return IOTHUBMESSAGE_ACCEPTED;
 }
 
+// callback for completion of sent messages
 static void SendConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback)
 {
     EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback;
@@ -219,10 +224,6 @@
     return true;
 }
 
-bool SendIothubData()
-{
-    return true;
-}
 
 void EndIothubThread()
 {