Alibaba Cloud IoT C-SDK
repository·v3.0.1·Indexed 19 days ago
https://github.com/aliyun/iotkit-embeddedA C-SDK for embedded devices to securely connect to the Alibaba Cloud IoT platform. It supports TCP/IP or serial communication and requires a C99 standard C library. The SDK is OS and hardware independent, utilizing a Hardware Abstraction Layer (HAL) for porting to platforms such as Linux and Windows. It includes modules for CoAP Cloud, CoAP Local Server, ALCS, and HTTP communication channels.
What's inside iotkit-embedded
- The CoAP Cloud module provides an implementation of the Constrained Application Protocol (CoAP) with specific customizations designed for connecting to the AliCloud IoT platform. It handles serialization, deserialization, networking, and platform abstraction required for IoT communication via CoAP.
Overview of the CoAP Local Server implementation
v3.0.1The
coap localcomponent provides an implementation of the CoAP (Constrained Application Protocol) specifically customized foralcsandawss. It is designed for embedded environments and relies on abstraction layers to remain portable across different hardware and operating systems.Key Dependencies:
- hal: Uses OSAL (Operating System Abstraction Layer) and HAL (Hardware Abstraction Layer) to shield the implementation from specific OS and hardware differences.
- infra: Utilizes the project's infrastructure toolset for authentication, networking, and other core services.
Overview of the ALCS implementation
v3.0.1ALCS is an implementation of the ICA (IoT Communication Service) local communication service. It provides the necessary infrastructure for local device communication and integrates with cloud services to facilitate connectivity.
Key features include:
- Local communication via coap local.
- Token acquisition from the cloud using mqtt.
- Hardware and OS abstraction using hal (Hardware Abstraction Layer) and osal (Operating System Abstraction Layer).
- Core utility support via the infra toolset (Authentication, Networking, etc.).
Overview of the HTTP communication channel
v3.0.1The
httpmodule provides a communication channel implemented via the HTTP protocol. It is designed to work within theiotkit-embeddedecosystem, leveraging abstraction layers to support various hardware and operating systems.Key Dependencies:
- hal: Provides Hardware Abstraction Layer (HAL) and OS Abstraction Layer (OSAL) to shield the HTTP implementation from specific OS and hardware differences.
- infra: Provides essential infrastructure tools including authentication and networking capabilities.
Overview of the IoT C-SDK
v3.0.1The
C-SDKallows device manufacturers to securely connect devices to the Alibaba Cloud IoT platform for management.Requirements for integration:
- Support for TCP/IP protocol stack or Serial communication.
- A C99 standard C library.
Note for non-IP devices: Devices using non-IP protocols (such as Zigbee, 433, or KNX) cannot connect directly. They must connect via a Gateway device, and that gateway device must integrate the
C-SDK.CoAP Cloud dependencies
v3.0.1To use the CoAP Cloud module, the following dependencies must be present in your environment:
- hal: Hardware Abstraction Layer (HAL) and OS Abstraction Layer (OSAL) to shield the implementation from different operating systems and hardware architectures.
- infra: Infrastructure toolsets providing essential services such as Authentication and Networking.
Porting the C-SDK to hardware or OS
v3.0.1The
C-SDKis designed to be OS and hardware platform independent. It is written entirely in C and utilizes a HAL (Hardware Abstraction Layer) to interface with hardware-specific functions.To port the SDK, you must implement the required HAL functions for your specific platform.
Reference implementations for the HAL are available for:
- Linux
- Windows
- Common Operating Systems and Modules
For detailed instructions on compiling and integrating the SDK on specific platforms, refer to the official porting documentation.
https://help.aliyun.com/document_detail/97556.htmlGet started with the C-SDK
v3.0.1To experience how to connect a device to the Alibaba Cloud IoT platform, send data to the platform, and receive data from the platform, follow the official quickstart guide.
https://help.aliyun.com/document_detail/96624.htmlOverview of kconfig-frontends for Windows
v3.0.1This package provides thekconfig-frontendsand its parser, ported specifically for Windows environments. Kconfig is the configuration language used by the Linux kernel. This version includes necessary modifications to allow it to function outside of the standard Linux kernel build infrastructure and includes a modified version ofPDCursesto support terminal interfaces on Windows. It also includes required.dllfiles fromuvc.deto ensure proper operation.View CoAP Cloud connection examples
v3.0.1For practical implementation patterns and code examples demonstrating how to establish a CoAP connection to the cloud, refer to the CoAP Connect reference guide.Access CoAP Cloud API details
v3.0.1Detailed technical documentation for the CoAP API, including function signatures and parameter descriptions, is hosted on the AliCloud public documentation wiki. For specific initialization and usage details, refer to the official CoAP API guide.Use Make commands to manage the build process
v3.0.1The build system uses
maketo handle compilation, platform configuration, and environment inspection. Use the following commands to manage your build lifecycle:- Compilation: Use
maketo start building with the current or selected platform configuration. - Platform Configuration: Use
make reconfigto open a multi-platform selection menu where you can choose your hardware platform by number. Usemake configto view the currently selected platform configuration file. - Settings Customization: Use
make menuconfigto open a graphical interface for editing themake.settingsfile. - Cleanup: Use
make distcleanto remove all intermediate files generated during the build process, returning the directory to its original state (as if just cloned). - Inspection: Use
make envto print the current compilation options and their assigned values. Usemake helpto print the help text.
# Example workflow make reconfig # Select your hardware platform make # Compile the project make env # Verify build options make distclean # Clean everything- Compilation: Use