A simple IoTHub sample using MQTT as transport
Dependencies: EthernetInterface NTPClient mbed-rtos mbed wolfSSL azure_c_shared_utility iothub_client azure_umqtt_c iothub_mqtt_transport serializer
Diff: simplesample_mqtt.c
- Revision:
- 4:79b01589ddcb
- Parent:
- 2:eef448cf9eb7
- Child:
- 5:09ddfa234c6e
diff -r a45a9389e595 -r 79b01589ddcb simplesample_mqtt.c --- a/simplesample_mqtt.c Sat Mar 26 00:09:46 2016 +0000 +++ b/simplesample_mqtt.c Sat Mar 26 00:35:37 2016 +0000 @@ -16,6 +16,10 @@ #include "iothubtransportmqtt.h" #include "threadapi.h" #include "platform.h" +#ifdef MBED_BUILD_TIMESTAMP +#include "certs.h" +#endif // MBED_BUILD_TIMESTAMP + /*String containing Hostname, Device Id & Device Key in the format: */ /* "HostName=<host_name>;DeviceId=<device_id>;SharedAccessKey=<device_key>" */ @@ -149,6 +153,14 @@ } else { +#ifdef MBED_BUILD_TIMESTAMP + // For mbed add the certificate information + if (IoTHubClient_LL_SetOption(iotHubClientHandle, "TrustedCerts", certificates) != IOTHUB_CLIENT_OK) + { + (void)printf("failure to set option \"TrustedCerts\"\r\n"); + } +#endif // MBED_BUILD_TIMESTAMP + ContosoAnemometer* myWeather = CREATE_MODEL_INSTANCE(WeatherStation, ContosoAnemometer); if (myWeather == NULL)