question

XIANGZHIYINGAgilentCHN-9387 avatar image
0 Votes"
XIANGZHIYINGAgilentCHN-9387 asked XIANGZHIYINGAgilentCHN-9387 commented

What is the difference between "azure sdk for cpp" and "azure sdk for c" ?

Hi everyone,

I wish to find a single SDK from Azure to support my below needs:
1. Enable uploading binary data from my Linux device to Azure storage
2. Enable pushing status infor from my Linux device to Azure IoT hub

I might be wrong, but I realize that I need to use "azure sdk for cpp" to support feature 1, and use "azure sdk for c" to support feature 2.

This is weird to me, why can't Microsoft combine these two SDKs ?

Can anyone help me to further understand their difference ? And a further question, is there really a single SDK that can support my needs ?

Thanks alot in advance for any help.

  • Randy



azure-iotazure-iot-sdk
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

For your needs, such as sending a telemetry data to the Azure IoT Hub and uploading a binary data to the Azure Storage can be used the REST APIs, in other words, you don't need the Azure SDKs.

Thanks
Roman

0 Votes 0 ·

Hi Roman,

Thanks a lot! Is there any example you could share of using such REST APIs ? Really appreciate !

0 Votes 0 ·
rkiss avatar image rkiss XIANGZHIYINGAgilentCHN-9387 ·

Hi,

have a look at the following documents:
Device - Send Device Event
Device - Create File Upload Sas Uri
Device - Update File Upload Status

Also have a look at my answer here where is described an usage of the above REST APIs using the C#.

Thanks
Roman

1 Vote 1 ·
Show more comments
SandervandeVelde42 avatar image
1 Vote"
SandervandeVelde42 answered

Hello @XIANGZHIYINGAgilentCHN-9387 ,

yes, there are two different SDKs both with its own purpose:
- Azure SDK for C++ (DOCS) A library to connect to eg. Azure Blob storage
- Azure SDK for Embedded C. The Azure SDK for Embedded C is designed to allow small embedded (IoT) devices to communicate with Azure services

These are to different use cases, combining them by default could be useful in your case but this is not the case for the majority.

I'm not sure what your usecase is but most of the projects I have seen, do not connect directly to Azure storage, although this service is part of the solution.

Two possible solutions:
1. the device sends telemetry to the Azure IoT Hub. Incoming messages are routed towards blob storage
2. the device makes use of the ability of the IoT Hub to offer the upload of complete files and stored them in a related storage

Especially the second solution lowers the amount of consumed Device-to-Cloud messages drastically.

If you still want to make use of the blob storage endpoint and SDK, the secrets of that endpoint must be stored on each device you deploy in the world. As an alternative, you could distribute the keys just-in-time using the Azure IoT Cloud-to-Device communication abilities (like the desired properties).

Although I recommend to use the Embedded C SDK, you can skip that SDK and try the REST interface of the IoT Hub. I tried something similar with C# in the past.

There is also MQTT support, an alternative to connect to the IoT Hub without SDK. The MQTT 5 version is in preview.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered XIANGZHIYINGAgilentCHN-9387 commented

C and Cpp = C++ are two very similar programming languages, but only similar: C++ supports OOP, C not; that's the reason for 2 SDK's.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the explanation. But I do understand the difference between these two languages, I'm just not sure why the two SDK provides very different feature set.

I also did some research yesterday, seems the C SDK is also planning to support the storage blob, but not officially released yet. C++ SDK on the other hand, still does not support IoT related stuff.

0 Votes 0 ·