Link SDK for C that is provided by IoT Platform supports the dynamic registration or unique-certificate-per-product authentication feature. This eliminates the need to burn different DeviceSecrets to devices and reduces the burning costs. You can use MQTT-based dynamic registration to obtain device authentication information and then connect devices with IoT Platform.
- A development environment is prepared.
- Obtain the SDK.
When you customize an SDK, set Device authentication scheme to Dynamic registration on the SDK customization page.
- A product is created, the ProductName and ProductSecret are obtained, and dynamic registration is enabled.
- One or more devices are added to the product and the DeviceNames are obtained if you use pre-registration unique-certificate-per-product authentication.
For more information about the features and limits of pre-registration unique-certificate-per-product authentication and preregistration-free unique-certificate-per-product authentication, see Unique-certificate-per-product authentication.
The application program calls the API operations of Link SDK for C to to implement MQTT-based dynamic registration and obtain the authentication information that are required to connect the devices with IoT Platform.
The following figure shows the process. In this example, the ./demos/dynregmq_basic_demo.c application program is used.
For more information about API operations that are related to MQTT-based dynamic registration, see aiot_dynregmq_api.h.
The following table describes the request parameters and response parameters when you initiate a request of MQTT-based dynamic registration. You can use pre-registration unique-certificate-per-product authentication or preregistration-free unique-certificate-per-product authentication based on your business requirements.
|Method||Request parameter||Response parameter|
|Pre-registration unique-certificate-per-product authentication|
|Preregistration-free unique-certificate-per-product authentication|
What to do next
- If the device is not activated, you can perform dynamic registration multiple times. However, only the latest DeviceSecret is valid. Make sure that the latest DeviceSecret is burned on the device.
- If the device is activated, you must call the ResetThing operation to reset the registration status of the device to unregistered in the IoT Platform console. Then, you can dynamically register the device.