demo project
Dependencies: AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL
Diff: IothubRobotArm.cpp
- Revision:
- 24:f6aa0e64c5e1
- Parent:
- 23:381b6c77a6a0
- Child:
- 25:acc34bcf563e
--- a/IothubRobotArm.cpp Tue Jan 26 20:26:24 2016 +0000 +++ b/IothubRobotArm.cpp Wed Jan 27 19:59:21 2016 +0000 @@ -23,8 +23,9 @@ #include "certs.h" #endif // MBED_BUILD_TIMESTAMP -// TODO: move to config file -static const char* connectionString = "[Insert ITHub connection string here]"; +/*String containing Hostname, Device Id & Device Key in the format: */ +/* "HostName=<host_name>;DeviceId=<device_id>;SharedAccessKey=<device_key>" */ +static const char* connectionString = "[device connection string]"; extern void ShowLedColor(int col); @@ -218,7 +219,14 @@ callbackCounter = 0; msgNumber = 0; - (void)printf("Starting the IoTHub RobotArm sample AMQP...\r\n"); + (void)printf("Starting the IoTHub RobotArm connection\r\n"); + + if (connectionString[0] == '[') + { + // forgot to replace placeholder + (void)printf("ERROR: connectionString is not set to a device connection!\r\n"); + return false; + } if ((iotHubClientHandle = IoTHubClient_Mod_CreateFromConnectionString(connectionString, AMQP_Protocol)) == NULL) { @@ -228,7 +236,6 @@ else { #ifdef MBED_BUILD_TIMESTAMP - (void)printf("INFO: IoTHubClient_SetOption\r\n"); // For mbed add the certificate information if (IoTHubClient_Mod_SetOption(iotHubClientHandle, "TrustedCerts", certificates) != IOTHUB_CLIENT_OK) {