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:
- 34:4eea18741566
- Parent:
- 30:7bb030702a93
- Child:
- 38:6661a95af557
diff -r 2a25d289aa6d -r 4eea18741566 simplesample_mqtt.c --- a/simplesample_mqtt.c Fri Mar 10 11:50:59 2017 -0800 +++ b/simplesample_mqtt.c Fri Mar 24 16:38:31 2017 -0700 @@ -94,7 +94,6 @@ } IoTHubMessage_Destroy(messageHandle); } - free((void*)buffer); messageTrackingId++; } @@ -190,24 +189,7 @@ } else { - IOTHUB_MESSAGE_HANDLE messageHandle = IoTHubMessage_CreateFromByteArray(destination, destinationSize); - if (messageHandle == NULL) - { - printf("unable to create a new IoTHubMessage\r\n"); - } - else - { - if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messageHandle, sendCallback, (void*)1) != IOTHUB_CLIENT_OK) - { - printf("failed to hand over the message to IoTHubClient"); - } - else - { - printf("IoTHubClient accepted the message for delivery\r\n"); - } - - IoTHubMessage_Destroy(messageHandle); - } + sendMessage(iotHubClientHandle, destination, destinationSize); free(destination); } }