Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

az_http_client_send_request #135

Closed
jameszah opened this issue Oct 12, 2021 · 1 comment
Closed

az_http_client_send_request #135

jameszah opened this issue Oct 12, 2021 · 1 comment

Comments

@jameszah
Copy link

Hi, wondering if I could get a word of advice on implementing az_http_client_send_request

I'm trying to upload some blobs to azure from a esp32.

I see this example https://github.com/Azure/azure-iot-arduino/blob/master/examples/esp32/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.ino, which I got working and then modified if to implement an upload to blob function, going through the IOTHub system -- but it is quite slow, and I think not the ideal method.

And I see this new library
https://github.com/antkmsft/azure-sdk-for-c/tree/blob-upload using the azure-sdk-for-c which goes directly to the azure container, but requires me to implement az_http_client_send_request

https://github.com/Azure/azure-sdk-for-c#using-your-own-http-stack-implementation

I went through this procedure https://github.com/Azure/azure-sdk-for-c/blob/main/sdk/samples/iot/aziot_esp32/readme.md
which works fine (modified for the new upload to blob support), and builds the new library that has the additional upload to blob functionality - and that example works for fine for mqtt data.

But when I try to build the actual upload to blob code, I get this error.

undefined reference to az_http_client_send_request'`

I have all the arduino libraries, such as this one https://github.com/Azure/azure-iot-arduino, https://github.com/Azure/azure-iot-arduino-protocol-http, https://github.com/Azure/azure-iot-pal-arduino, ...

But I cannot find that compiler or linker command to link az_http_client_send_request to the http wifi stack that I think is implemented here in iot-arduino and AzureIoTSocket_WiFi, etc.

This program implements az_http_client_send_request with its own code RoSchmi/AzureDataSender_Esp32#1 (comment)

So, any ideas would be appreciated.

https://github.com/ericwol-msft/AzureIotEmbedSdk-Samples/tree/cdd88b1fb75750dba27edb687cad3bf523cc4b59/HubBlobUpload

@RoSchmi
Copy link

RoSchmi commented Oct 18, 2021

Hi @jameszah
within the files of the 'azure-sdk-for-c' the method 'az_http_client_send_request' can be found in the files /platform/az_curl.c and /platform/no_hhtp.c.
I think that to use the method 'az_http_client_send_request' in an own implementation it is needed to exclude 'az_curl.c' and 'no_http.c' from the compilation for example by changing the names to 'az_curl.c__', 'no_http.c__' and then make an own implementation as I did it
in my project: https://github.com/RoSchmi/AzureDataSender_Esp32 in the file 'az_esp32_roschmi.cpp' where I dissecet the request to send it over the used http-client. After having received the response from the http-client, I wrote the response in a proper way to the 'az_http_response* ref_response' parameter of the 'az_http_client_send_request' method.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants