I want to connect to the Azure Iot Hub not using the Client SDK.
On
https://azure.microsoft.com/nb-no/blog/upload-files-from-devices-with-azure-iot-hub/
there are documentation on how to do this by
1) get the SAS URI for storage
2) to notify the IoT hub of a completed upload
But before this can be done you need to connect to the IoT Hub using the DeviceConnectionString. Does anyone have an example / hints of how this and uploading a file can be done?
Here's my ATWINC1500 Arduino AVR implementation of reading from IoT Hub (amend the endpoint and change to a POST):
I just used Device Explorer to generate a 2-year valid SAS key.
I'm pretty sure i can't calculate my own SAS without a real time clock, something the AVR doesn't have.. Oliver can confirm.
Here is an example of a client testing app with source code to interact with Azure Iot Hub without using the SDK. It covers among other things file uploads. It uses the M2MQTT library
If you want to go without the SDKs (which I am curious to know why), you can find all the REST API reference docs here. The specifics about the SAS URI for Storage are here. And for the file upload notifications, it's here. With the authentication + these you should be able to implement File Upload through IoT Hub.
You can follow "File uploads with IoT Hub" and do it through four steps:
And IoT Hub returns the following data:
The device uploads the file to storage using the Azure Storage SDKs. You can follow this tutorial. The code looks like this:
Once the upload is completed, the device sends a POST to the IoT hub like this:
Besides, you can download the blob to check the file uploaded. And check the file upload notification using the following code: