IoT Hub device SDK for C relies on a secure and powerful data channel to enable IoT developers to quickly connect devices to the cloud for two-way communication.
After v3.1.0, the SDK refactored and optimized the compilation environment, code, and directory structure, increasing the availability and portability.
Featuring a modular design, the SDK for C separates the core protocol service from the hardware abstraction layer and provides flexible configuration options and multiple compilation methods, making it suitable for development platforms and use environments of different devices.
glibcor similar libraries which can provide system calls, including socket communication, SELECT sync IO, dynamic memory allocation, functions for getting time/sleeping/generating random number/printing, as well as critical data protection such as the mutex mechanism (only when multiple threads are required), only simple adaptation (e.g., changing the cross compiler settings in
make.settings) is required before the SDK can be compiled and run.
Newliband embedded TCP/IP protocol stacks like lwIP, adaptation for porting can be done easily.
The directory structure and top-level documents are described as follows:
|CMakeLists.txt||CMake compilation and description file|
|CMakeSettings.json||CMake configuration file on Visual Studio|
|cmake_build.sh||Compilation script with CMake on Linux|
|make.settings||Configuration file compiled directly by Makefile on Linux|
|Makefile||Direct compilation with Makefile on Linux|
|device_info.json||Device information file. If
|docs||Documentation directory, i.e., the use instructions of the SDKs for different platforms|
|external_libs||Third-party package components, such as Mbed TLS|
|include||External header files provided to users|
|platform||Platform source code files. Currently, implementations are provided for different OS (Linux/Windows/FreeRTOS/nonOS), TLS (Mbed TLS), and AT module|
|sdk_src||Core communication protocols and service code of the SDK|
|tools||Compilation and code generation script tools supporting the SDK|
The SDK for C supports three compilation methods:
samples directory of the SDK for C contains demos showing how to use the features. For more information on how to run the demos, please see the corresponding documents in the SDK documentation directory.
For more information on device connection to and message sending/receiving in IoT Hub over MQTT, please see Getting Started with MQTT.
Starting from SDK v3.0.3, OTA update supports checkpoint restart. When the firmware download process is interrupted due to network exceptions or other issues, the downloaded part of the firmware can be saved, so that the download can start from where interrupted instead of from the beginning when it is resumed.
After this new feature was supported, the methods of using relevant OTA APIs changed. If you have upgraded from v3.0.2 or below, you should modify your logic code; otherwise, firmware download will fail. For more information on how to modify it, please see
To improve the code readability and comply with the naming conventions, SDK v3.1.0 incorporated changes to certain variables, functions, and macro names. If you have upgraded from v3.0.3 or below, you can run the
tools/update_from_old_SDK.sh script on Linux to replace the names in your own code, and then you can use the new version of the SDK directly.
|Old Name||New Name|