All Products
Search
Document Center

IoT Platform:Device connection by using Link SDK

Last Updated:Sep 19, 2023

Link SDK is a device-side software development kit provided by IoT Platform. The SDK simplifies the development process and enables devices to connect to IoT Platform. After device manufacturers obtain the SDK, they can port the code based on business requirements. This way, the device manufacturers can integrate Link SDK into devices and connect the devices to IoT Platform.

Prerequisites

Before you develop the SDK, you must perform the required operations in the IoT Platform console to obtain the required information about devices and topics. For more information, see Overview of device connection.

Background information

A large number of heterogeneous devices can connect to IoT Platform. IoT Platform provides Link SDK for device-side development and the standard Alink protocol.

  • For more information about how to use the Alink protocol, see Configure devices based on the Alink protocol.

  • We recommend that you use Link SDK to quickly develop and connect devices to IoT Platform. The following figure describes the process of using Link SDK to develop a device.

For more information about related terms, see Terms.

image

Integrate Link SDK

The method to integrate Link SDK varies based on the device type:

  • IP devices: devices that support the TCP/IP protocol, such as Wi-Fi devices. Devices of this type can be directly integrated with Link SDK.WiFi Device

  • Non-IP devices: indicates the devices that do not support the TCP/IP protocol, such as ZigBee, BT, KNX, and ModBus devices. Devices of this type can connect to IoT Platform only by using a gateway that is integrated with Link SDK. You can configure a custom communication method between a gateway and its sub-devices. For more information about how to configure Link SDK for C to connect a sub-device with IoT Platform, see Overview of gateways and sub-devices. GW Device

Select a type of Link SDK

Link SDKs support multiple programming languages such as C, Java, Python, Node.js, Android, and iOS. You can select an SDK in the appropriate language based on your product.

SDK

Scenario

Configuration references

Example

Link SDK for C

Resource-constrained embedded devices programmed in C

Obtain Link SDK for C

Connection over MQTT

Link SDK for Android

Android devices

Environment requirements and configuration

Verify and connect a device

Link SDK for Python

The SDK is suitable for devices programmed in Python but not applicable to light application development in Python.

Environment requirements and configuration

Verify and connect a device

Link SDK for Java

Devices programmed in Java

Environment requirements and configuration

Verify and connect a device

Link SDK for iOS

iOS devices

Environment requirements and configuration

Verify and connect a device

Note

Port Link SDK

Important
  • You must port Link SDK for C to embedded devices. Other types of Link SDKs can be directly integrated to devices.

  • You can configure custom Link SDK for C based on the requirements of devices that you want to connect to IoT Platform. For more information about how to configure Link SDK for C in the IoT Platform console, see Obtain the SDK.

  • Link SDK for C is compiled in C99. The implementation of system interfaces in the SDK varies based on the hardware environment. You may need to port the SDK to the environment. For more information about how to port the SDK, see Example on how to port Link SDK for C.

  • By default, Link SDK for C uses the Linux-based Portable Operating System Interface (POSIX). You can directly integrate the SDK to Linux devices without the need to port the SDK.

Hardware environment

Operating system

Description

References

PC or system on a chip (SoC)

Linux

Cross compilation is required for embedded devices.

Integrate Link SDK for C into a Linux development environment

Windows

No sample implementation is available. You must port the SDK.

Example on how to port Link SDK for C

OpenCPU module

Real-time operating system (RTOS)

You can integrate Link SDK based on the Espressif IoT Development Framework (ESP-IDF).

Port the SDK to an ESP32 development board

Configure connection and messaging features in device development

IoT Platform supports multiple protocols and device verification methods that various devices can use for connection. The following table describes the device connection solutions.

Feature

Description

References

Multi-protocol connection

IoT Platform supports device connection over protocols such as Message Queuing Telemetry Transport (MQTT), Constrained Application Protocol (CoAP), and HTTP. Most devices use the MQTT protocol.

Connect a device to IoT Platform by using a protocol

Unique-certificate-per-device verification

Each device is verified by using separate credentials.

Unique-certificate-per-device verification

Unique-certificate-per-product verification

The same credentials are used to verify devices that belong to the same product. This simplifies the operations of burning credentials to devices.

Note

Unique-certificate-per-device verification and unique-certificate-per-product verification can be used together. Unique-certificate-per-product verification can be used to obtain the device-specific credentials the first time a device connects to IoT Platform, and then unique-certificate-per-device verification can be used.

Unique-certificate-per-product verification

X.509 certificate-based verification

Each device has a separate certificate, and the device can be verified when the Transport Layer Security (TLS) protocol is used. This improves security.

Use X.509 certificates to verify devices

Gateways and sub-devices

A gateway serves as the proxy for its sub-devices to connect to IoT Platform. After a sub-device connects to IoT Platform, the sub-device can use its own topics to communicate with IoT Platform.

Gateways and sub-devices

Configure business features in device development

After a device connects to IoT Platform, the device can send and receive messages by using IoT Platform. The device can use one of the following methods to submit business data to IoT Platform:

  • Custom topics: You can define custom topics and the message payload. For more information, see Use custom topics.

  • Thing Specification Language (TSL) models: You can define, submit, and deliver the device properties, events, and services based on the TSL models. For more information, see What is a TSL model? and Use TSL models for communication. The TSL model is the key capability of IoT Platform and provides the following advantages:

    • Structured data storage: simplifies the subsequent data development process.

    • Cached device status and data (device shadow): The device or server can query device status and data at any time.

    • Data visualization: You can view device data in the IoT Platform console.

    • Online debugging: You can debug devices online.

Configure O&M features in device development

If you plan to mass produce devices after you configure the business features of devices, we recommend that you configure operations and maintenance (O&M) features for subsequent device iteration, configuration, and troubleshooting. The following table describes the O&M features that are provided by IoT Platform.

Feature

Description

References

Over-the-air (OTA) update

Supports the remote upgrade of device firmware.

OTA update overview

Log reporting

Allows devices to submit logs to IoT Platform. You can troubleshoot devices based on the logs.

Device log reporting

Remote configuration

Supports remote device configuration.

Remote configuration

Network Time Protocol (NTP) service

Synchronizes the server time to devices.

NTP service