Version history
The main change in V3.0.1 is that it removes the requirement to use the SDK's built-in compilation system. Instead, you can extract the C files for specific features and compile them using your preferred method.
V3.0.1
V3.0.1 was released in March 2019. It includes the following changes from V2.3.0, which was released in November 2018.
Added support for source code porting
Supports development on hosts that run
64-bit Ubuntu 16.04,Windows XP,Windows 7, orWindows 10.You can select features by running the
make menuconfigcommand on Ubuntu or by running theconfig.batscript on Windows.After you select the features, you can extract the required source files by running the
extract.shcommand on Ubuntu or by running theextract.batscript on Windows.You can then add these source files to your project and compile them on any host using your preferred method.
All Hardware Abstraction Layer (HAL) function interfaces that require implementation are automatically consolidated into a single file at output/eng/wrappers/wrapper.c. You must implement these functions.
This enhancement resolves the issue that prevented users from cross-compiling the SDK, which significantly improves the portability and usability of the SDK.
*Note: The original compilation system and usage methods are still available. For more information, see *GNU Make-based compilation system.
Directory structure
To improve usability, the V3.0.1 SDK uses a flat directory structure for its source code. For example, the
src/mqttfolder contains all header and source files for the MQTT cloud connection feature. Allsrc/xxxxdirectories are self-contained.The arrangement of all source files corresponds one-to-one with the SDK features. Except for the basic
src/infradirectory, eachsrc/xxxdirectory now corresponds to a specific SDK feature. The number ofsrc/xxxdirectories equals the number of features. For example:src/dynamic_register: Contains all source files related to one-type-one-secret dynamic registration.src/dev_sign: Contains all source files related to device signing.src/mqtt: Contains all source files related to MQTT cloud connection.src/ota: Contains all source files related to OTA firmware download.src/dev_model: Stores the source files for Thing Specification Language model management and sub-device management.
Presentation of API and HAL interfaces
Previously, the SDK had only two global header files: iot_import.h and iot_export.h. These files listed the underlying HAL_XXX() interfaces required by the SDK and the user-facing IOT_XXX() APIs provided by the SDK.
We received feedback from some users who felt overwhelmed. They mistakenly believed they had to implement all 100+ HAL interfaces listed in iot_import.h and learn all 200+ APIs listed in iot_export.h.
Therefore, we removed this design.
The SDK no longer has monolithic
iot_import.handiot_export.hfiles.The top-level
includedirectory has also been removed.Instead, source files are organized into directories by feature. This design ensures that you only see code relevant to your needs.
Now
When you use the V3.0.1 SDK, you first identify the available features, such as MQTT cloud connection and OTA download. Then, you can select and configure the required features using a graphical interface.
Next, you can use the extraction tool (
extract.shscript on Ubuntu orextract.baton Windows) to obtain the source files for these features in theoutputdirectory.You can then use the SDK. All external SDK interfaces follow the design principles described below.
output/eng/xxxcontains the files for thexxxfeature. These files are sourced fromsrc/xxx.output/eng/xxx/xxx_api.hcontains the user-facing APIs for thexxxfeature. These files are sourced fromsrc/xxx/xxx_api.h.output/eng/wrappers/wrapper.cis an automatically generated file that lists all the underlyingHAL_XXX()interfaces you must implement for your target embedded platform.
In other words:
You only need to check
src/xxx/xxx_api.horoutput/eng/xxx/xxx_api.hfor the features you need. This prevents you from seeing declarations for APIs you do not use.All functions that you must implement are listed in
output/eng/wrappers/wrapper.c. Functions that do not require implementation are not included. This prevents you from seeing definitions for HAL interfaces you do not need.
For example, in the simplest scenario, you may only need the SDK's ability to calculate signatures for MQTT cloud connections. This feature is provided by the src/dev_sign or output/eng/dev_sign directory.
You will see only one API, which is listed in
dev_sign_api.h.You will not see any HAL interfaces or even the
wrapper.cfile because this feature has no dependencies and can be used without implementing any C functions.
make.settings file
Developers who use hosts that run
Windows XP,Windows 7, orWindows 10can now use theconfig.battool to graphically configure features, which removes the need for a Linux host.The names of the
FEATURE_XXXoptions have been changed.
Previous name | New name | Description |
|
| Mobile hot spot provisioning mode for Wi-Fi provisioning. |
|
| Router provisioning mode for Wi-Fi provisioning. |
Added the following options:
FEATURE_AWSS_SUPPORT_SMARTCONFIG_WPS: Peer-to-peer mode for Wi-Fi provisioning.FEATURE_AWSS_SUPPORT_DEV_AP: Device hot spot mode for Wi-Fi provisioning.
MQTT function interfaces
The
IOT_SetupConnInfo()function is no longer required. To establish an MQTT connection, you only need to use theIOT_MQTT_Construct()function.You are no longer required to prepare input parameters. When you call
IOT_MQTT_Construct(), you can leave most connection parameters empty. The SDK automatically populates the default values instead of returning an error.
New features and interfaces
The device signing feature has been added. This is the simplest form of the SDK.
This feature has only one API:
IOT_Sign_MQTT().For more information, see Device Signing Developer Guide.
The one-type-one-secret feature has been added. This feature is for scenarios where you do not need to burn a unique device certificate (ProductKey, DeviceName, and DeviceSecret) for each device.
This feature has only one API:
IOT_Dynamic_Register().For more information, see One-Type-One-Secret Developer Guide.
The device reset feature has been added. This feature can be used in scenarios where a device notifies the cloud to unbind it, or to unbind a sub-device from a gateway.
This feature has only one API:
IOT_DevReset_Report().For more information, see Device Reset Developer Guide.
The HTTP/2 file upload feature has been added. This feature can be used to stream large file uploads to the cloud.
This feature has three APIs:
IOT_HTTP2_UploadFile_Connect(),IOT_HTTP2_UploadFile_Request(), andIOT_HTTP2_UploadFile_Disconnect().For more information, see HTTP/2 File Upload Developer Guide.
Removed features
Support for the
cmake-based compilation method has been removed because you can now use source file porting or GNU Make porting.
V2.3.0
V2.3.0 was released in November 2018. It includes the following changes from V2.2.1, which was released on August 31, 2018.
make.settings file
Developers who use a
64-bithost that runsUbuntu 16.04can use themake menuconfigcommand to graphically edit themake.settingsfile.The names of the
FEATURE_XXXoptions have been changed.
Previous name | New name | Description |
|
| Switch for the Thing Specification Language model management (Alink JSON protocol) feature. |
|
| Switch for the gateway feature in Thing Specification Language model management. |
|
| Switch for the Wi-Fi provisioning feature. |
Added the following options:
FEATURE_DEVICE_BIND_ENABLED: Enables or disables the device binding feature. This option is required only for customers who connect to the Feiyan platform. It is used to enable device control through the public app.FEATURE_ALCS_CLIENT_ENABLED: Enables or disables the client component of the local communication feature. This option is required only for devices that need to control other IoT devices, such as edge gateways.FEATURE_ALCS_SERVER_ENABLED: Enables or disables the server-side component of the local communication feature. This option must be enabled for devices that need to accept control from a mobile app or an edge gateway over a local area network.FEATURE_AWSS_SUPPORT_SMARTCONFIG: One-click mode for Wi-Fi provisioning.FEATURE_AWSS_SUPPORT_ZEROCONFIG: Zero-configuration mode for Wi-Fi provisioning.FEATURE_AWSS_SUPPORT_ROUTER: Router mode for Wi-Fi provisioning.FEATURE_AWSS_SUPPORT_PHONEASAP: Mobile hot spot mode for Wi-Fi provisioning.
Removed the following option:
FEATURE_COAP_DTLS_SUPPORT: Specifies whether to encrypt CoAP cloud connections using Datagram Transport Layer Security (DTLS). This option is removed because encryption is now always enabled and no longer requires user configuration.
Global function interfaces
IOT_OpenLog()andIOT_CloseLog()have been removed. You can now useIOT_SetLogLevel()to control the level of detail for SDK log printing or to disable it.The
IOT_LOG_EMERGlog level has been removed. It is replaced byIOT_LOG_NONE, which is used withIOT_SetLogLevel(IOT_LOG_NONE)to disable the logging feature.IOT_Linkkit_Ioctl()has been removed. Its functionality is merged intoIOT_Ioctl(). For all parameter options, see theiotx_ioctl_option_tenumeration definition.IOT_Ioctl()has been enhanced. The new optionsIOTX_IOCTL_SET_MQTT_DOMAINandIOTX_IOCTL_SET_HTTP_DOMAINallow you to pass custom MQTT or HTTP domain names for connections. This is used for new sites outside China.
MQTT function interfaces
In both the original Basic Edition interfaces and the new interfaces, you can pass
NULLas thehandleparameter. This indicates that you want to create a connection with default parameters or use the default connection. This applies to the following interfaces:IOT_MQTT_ConstructIOT_MQTT_DestroyIOT_MQTT_YieldIOT_MQTT_LogPostIOT_MQTT_CheckStateNormalIOT_MQTT_SubscribeIOT_MQTT_UnsubscribeIOT_MQTT_PublishIOT_MQTT_Subscribe_SyncIOT_MQTT_Publish_Simple
The
pwrite_bufandpread_bufmembers have been removed from theiotx_mqtt_param_tstruct.The
IOT_MQTT_Publish_Simple()interface has been added. You can use this interface to pass the topic and payload as string parameters.int IOT_MQTT_Publish_Simple(void *handle, const char *topic_name, int qos, void *data, int len);The
IOT_MQTT_Subscribe_Sync()interface has been added. You can use this interface to perform a blocking, synchronous subscription. The function does not return until the subscription is successful.int IOT_MQTT_Subscribe_Sync(void *handle, const char *topic_filter, iotx_mqtt_qos_t qos, iotx_mqtt_event_handle_func_fpt topic_handle_func, void *pcontext, int timeout_ms);The
IOT_MQTT_Subscribe()interface has been optimized. You can now perform an offline subscription before the MQTT connection is established. The C-SDK sends the subscription message immediately after the connection is successfully established.
OTA function interfaces
Because you can pass
NULLas thehandleparameter of MQTT function interfaces, you can also passNULLas the third parameter of the Basic Edition OTA function interfaceIOT_OTA_Init. This indicates that you want to use the default connection.void *IOT_OTA_Init(const char *product_key, const char *device_name, void *ch_signal);
Linkkit function interfaces
For more information, see API reference.
Removed interfaces
The legacy linkkit_xxx() and linkkit_gateway_xxx() interfaces are now optional at compile-time and are disabled by default.
Note: You can still enable the legacy Linkkit interfaces by adding the following statement to the make.settings file. When you do this, the new interfaces are hidden and the legacy interfaces are used instead.
FEATURE_DEPRECATED_LINKKIT=y
Note: To reduce memory consumption on the device, the SDK no longer checks the correctness of the data format when you call an SDK API to upload property or event notifications to the cloud. Therefore, you are no longer required to export the TSL JSON file from the cloud, convert it to a C string, and then include it in your C code.
HAL function interfaces
HAL_Sys_reboothas been removed because it was a duplicate of the existingHAL_Rebootinterface.