All Products
Search
Document Center

Development Procedure

Last Updated: Jan 26, 2019

Application scope

This document describes the development procedure for devices that will be integrated with the Link Kit SDK, if you are developing a product based on another Alibaba SDKs with Link Kit SDK( such as AliOS and LinkEdge), please refer to the development documents for the corresponding SDKs.

Product development procedure

The procedure to develop and connect a device to Alibaba Cloud IoT Platform consists of the following steps:

  1. Cloud-side product definition: Define the product functions (including device properties, services, and events) on Alibaba Cloud IoT Platform. This document does not describe how to define products on the cloud. For more information about product creation, visit the Alibaba Cloud IoT website.

  2. Device-side development: Integrate the Link Kit SDK into the device to start functional development and implement the product functions defined on the IoT platform.

  3. Uplink and downlink debugging: Apply for the trituple (representing the unique ID used by a device to connect to the cloud) of a test device from the IoT platform, and burn them to the device. Then, debug the uplink and downlink connections between the device and the cloud to ensure that the device can communicate with Alibaba cloud IoT platform properly. This section does not describe the debugging process, it will be explained in subsequent sections.

pdDevProc

After the devices are debugged, apply for the trituple for multiple devices at the same time on Alibaba Cloud IoT Platform for mass production of devices.

General Device-side development procedure

The following figure shows the general development procedure of Link Kit SDK integration on the device side.

devSideDev

  • Device authentication

A device needs to be authenticated when connecting to Alibaba Cloud IoT Platform. Currently, Alibaba Cloud IoT Platform provides two ways to authenticate devices:

  1. Unique-certificate-per-device authentication
    A unique identity needs to be burnt to each device for authentication. The device manufacturer needs to implement the relevant HAL functions so that the SDK can obtain the corresponding identity information.

  2. Unique-certificate-per-product authentication
    A same identity will be burnt to the devices of the same product for authentication. The device manufacturer needs to implement the relevant HAL functions so that the SDK can obtain the corresponding identity information.

Note: The device manufacturer determines how to burn the identity information to devices. To prevent a device from being compromised by hackers, the manufacturer should encrypt all relevant information and then write it to flash in a secure way.

  • Function definition on the cloud

Alibaba Cloud IoT Platform allows device manufacturers to define product functions through a TSL, which includes:

  1. Properties
    The readable and/or configurable parameter function supported by the device. For example, a light switch can be defined as a property, Users can see the on-off state of the light by reading the current value of this property, and turn the light on or off by changing the property.

  2. Service
    If a device has a function that can only be triggered but cannot be read, it can be defined as a service. For example, a reset service can be provided for a light that supports color modulation. When this service is triggered, the color of the light is restored to white.

  3. Event
    When something happens on the device and you want to report it to Alibaba Cloud IoT Platform, you can define it as an event. Taking a smart door lock that supports anti-forced unlocking as an example, if the smart door lock detects someone is prying the door open, it can send a forced unlocking event to the cloud, the cloud can then send this information to the owner of the house.

After defining the TSL on Alibaba Cloud IoT Platform, the device manufacturer needs to implement the defined TSL on the device. This allows the device to be remotely controlled from the cloud (configuring properties or calling services) and to correctly receive and process property change reports and event reports from the device.

Note: If the device manufacturer only uses Alibaba Cloud IoT Platform as a data channel; that is, uploading the device data to Alibaba Cloud IoT Platform and then transparently pushing it to the manufacturer’s services on the cloud, the device manufacturer does not need to implement TSL.

  • Other function implementations

Other function implementations include firmware OTA and sub-device access.

There are differences in the development processes for different types of products to integrate with the Link Kit SDK. The following describes the development processes for different types of products to integrate with the SDK:

Products that connect to the cloud over Wi-Fi

For devices connected to the network over Wi-Fi, the development process is as follows.

wifiDevDevProc

  • Wi-Fi Provisioning

    Wi-Fi Provisioning: A Wi-Fi device must be connected to a Wi-Fi AP by using a SSID and a password. The process for transmitting the SSID and password to a device is called Wi-Fi provisioning.

    For Wi-Fi devices with keyboards, touch screens, serial ports, or Web servers, the device manufacturer can design their own solution to transmit the AP’s SSID and password to the Wi-Fi devices. For Wi-Fi devices that don’t have such kinds of input hardware, Link Kit SDK provides a few methods to transmit the SSID and password to the devices through a cellphone or other devices.

Products that connect to the cloud over Ethernet

The general device development process also applies to products that connect to the cloud over Ethernet.

Products with both Wi-Fi and Ethernet interfaces

Because the devices have both Wi-Fi and Ethernet interfaces, Wi-Fi network provisioning must also be implemented. The device manufacturer can choose to design their own Wi-Fi network configuration or use the Wi-Fi provisioning solutions provided by Alibaba Cloud.

Products that connect to the cloud over a cellular network

A product can connect to the cloud over a cellular network by a cellular interface (such as, GPRS, 3G, or 4G), In this scenario, the development procedure is the same as the general development process for devices. The products that connect to the cloud over a cellular network include the following varieties, there are some differences in the development:

Module SoC solution

The Link Kit SDK & product logic are running on the SOC which has a cellular network module, In this scenario, the device manufacturer needs to implement all software functions on the SoC.

MCU + cellular network module

Depending on whether the Link Kit SDK is deployed in the MCU or cellular network module, the following scenarios are involved:

  • MCU + Module with Link Kit SDK

    In this scenario, the manufacturer for the cellular network module has completed integration of the Link Kit SDK, So the software development by the device manufacturer is mainly concentrated on the MCU, the logic on the MCU needs to provide device certificate to the cellular module and command the module to connect Alibaba Cloud IoT Platform.

  • MCU + Module without Link Kit SDK

    The manufacturer needs to port Link Kit SDK to the MCU.

Gateway products

A gateway functions as a proxy to connect sub-devices to Alibaba Cloud IoT Platform, these sub-devices are generally the devices that do not support TCP/IP, such as ZigBee, 433, and KNX devices.

The gateway products need to connect to Alibaba Cloud over Wi-Fi, Ethernet, or cellular network. Therefore, the device manufacturer first needs to do the product development based on the connection method of the network interface as described above, and then implement the access function for the sub-devices. The following figure shows the development process of gateway products.

Several functions need to be implemented for sub-devices on the gateway:

  • Sub-device discovery

    The gateway needs to discover and obtain the identity information of a sub-device, and maintain its online and offline status on the gateway.

  • Sub-device addition and deletion

    Because a sub-device can’t directly establish a connection to the cloud, the gateway needs to notify the IoT platform it has connected a new device or removed a device. When adding a sub device, the gateway needs to performs device authentication on behalf of the device.

  • Sub-device TSL management

    If a sub-device sends a property change notification or an event to the gateway, the gateway needs to send the property change or event report to the IoT platform for the sub-device. When the gateway receives a peroperty setting or service call request for the sub-device from the cloud, the gateway needs to convert the command into a data format that can be recognized by the sub-device and then send it to the sub-device.

Sub-device

A sub-device accesses Alibaba Cloud IoT Platform through the gateway. Though Link Kit SDK integration is not required for a sub-device, you need to define the product and apply for device identity information for the sub-device on Alibaba Cloud IoT Platform. The development process for sub-devices is as follows.

subDevProc

Note: No Alibaba Cloud IoT certificates are required to be burnt to sub-devices, and we suggest the manufacturers to use unique-certificate-per-product authentication method for sub-devices, so the manufacturer of a sub-device needs to upload the unique IDs of sub-devices to Alibaba Cloud IoT Platform to work as a white-list.

Product manufacturing

For products that integrate with the Link Kit SDK, the device manufacturer needs to apply for identity information for each device and burn it to the device on the production line. How to burn the certificate is designed & implemented by device manufacturers. There are several parameters in device certificate:

  • ProductKey

    Alibaba Cloud IoT Platform creates a unique product ID (model) for each product. The maximum length of this parameter is 11 bytes.

  • DeviceName

    Each product unit is called a device, and each device needs a unique device ID within this product. This ID can be automatically generated by Alibaba Cloud IoT Platform, or uploaded to Alibaba Cloud IoT Platform after being defined by the device manufacturer. The length of this parameter is 4–32 bytes.

  • DeviceSecret

    Alibaba Cloud IoT Platform creates a device key for each product. This key is used in device authentication and the secure communication between the device and the cloud platform. Therefore, the device manufacturer needs to avoid leaking the DeviceSecret of a product. The maximum length of this parameter is 32 bytes.

  • ProductSecret

    Alibaba Cloud IoT Platform creates a device key for each product. This key is used in device authentication and the secure communication between the device and the cloud platform. Therefore, the device manufacturer also needs to avoid leaking the ProductSecret of a product. The maximum length of this parameter is 32 bytes.

Note: For the sake of simplification, this document sometimes uses “device trituple” to represent ProductKey, DeviceName, and DeviceSecret, and uses “quadruple” to represent ProductKey, DeviceName, DeviceSecret, and ProductSecret.