Help Center> IoT Device Access> Best Practices> Device Access> Developing a Protocol Conversion Gateway for Access of Generic-Protocol Devices
Updated on 2023-02-02 GMT+08:00

Developing a Protocol Conversion Gateway for Access of Generic-Protocol Devices

Scenarios

Currently, the IoT platform supports only standard protocols such as MQTT, HTTP, and LwM2M. If a device uses other protocols (referred to as third-party protocols), it cannot access the platform directly.

To address this issue, protocol conversion must be performed outside the platform. It is recommended that a gateway be used to convert third-party protocols into MQTT. This gateway is called the protocol conversion gateway.

Implementation Principle

The figure below shows the overall architecture of the solution.

The protocol conversion gateway can be deployed in the cloud or locally. A third-party protocol device is connected to the platform as a child device of the protocol conversion gateway.

The protocol conversion gateway consists of the following components:

  1. Third-party protocol access component: This component parses and authenticates third-party protocols.
  2. Protocol conversion component: This component converts between third-party protocol data and platform data.
    • In the upstream direction, the component converts third-party protocol data into platform-supported data and invokes the device SDK APIs to report the data.
    • In the downstream direction, the component, after receiving data from the platform, converts the data into third-party protocol data and forwards the data to third-party protocol devices.
  3. Device SDK component: The component is the device access SDK provided by the platform and provides common gateway functions. You can implement your own gateways based on the SDK.

Service Flow

  1. Register a gateway with the platform. For details, see Device Authentication.
  2. Power on the gateway and connect it to the platform. Obtain the authentication parameters required for connection during gateway registration.
  3. Register a child device on the IoTDA console. The platform delivers a child device addition event to the gateway. The gateway saves the child device information and makes the information persistent. (The SDK provides the default persistent implementation. You can customize the implementation.)
  4. The child device connects to the gateway, and the gateway authenticates the child device.
  5. The child device reports data to the gateway. The gateway converts the data to the format supported by the platform and then calls an SDK API for reporting child device properties or messages to the platform.
  6. The platform delivers a command to the child device. The gateway converts the command into a command compliant with the third-party protocol and forwards it to the child device. The child device processes the command.

Implementation of Protocol Conversion Gateway

For details on the implementation and usage of the gateway, see IoT Device SDK (Java) and IoT Device SDK (C).