I'm trying the iothub_client/samples/iothub_client_sample_upload_to_blob from the Azure IoT hub C sdk. It compiles and works fine if I use the low-level API. But as soon as I switch to the convenience layer (as the documentation in the app's file suggests), I get an error:
/home/user/workspaceMisc/azure-iot-sdk-c/iothub_client/samples/iothub_client_sample_upload_to_blob/iothub_client_sample_upload_to_blob.c: In function ‘iothub_client_sample_upload_to_blob_run’:
/home/user/workspaceMisc/azure-iot-sdk-c/iothub_client/samples/iothub_client_sample_upload_to_blob/iothub_client_sample_upload_to_blob.c:77:25: error: implicit declaration of function ‘IoTHubClient_UploadToBlob’ [-Werror=implicit-function-declaration]
if (IoTHubClient_UploadToBlob(iotHubClientHandle, "subdir/hello_world.txt", (const unsigned char*)HELLO_WORLD, sizeof(HELLO_WORLD) - 1) != IOTHUB_CLIENT_OK)
^
cc1: all warnings being treated as errors
iothub_client/samples/iothub_client_sample_upload_to_blob/CMakeFiles/iothub_client_sample_upload_to_blob.dir/build.make:62: recipe for target 'iothub_client/samples/iothub_client_sample_upload_to_blob/CMakeFiles/iothub_client_sample_upload_to_blob.dir/iothub_client_sample_upload_to_blob.c.o' failed
How can I upload a file with the convenience layer instead of the low level layer? Is it possible at all?
I'm using Ubuntu 16.04, gcc 5.4.0 and the latest clone of the SDK.
Actually the function name is
IoTHubClient_UploadToBlobAsync
, you need add Async postfix. And there is needed additional two parameters:iotHubClientFileUploadCallback
andcontext
. This document is somewhat misleading.So you can call this function like this: