Overview of the SL 651 protocol

Updated at:

SL 651 is a protocol for hydrological data communication that was developed by the National Hydrology Bureau of China. It defines the technical parameters for collecting and transmitting hydrological monitoring data, such as data format, content, and transmission methods. Devices can connect using the Transmission Control Protocol (TCP) or Transport Layer Security (TLS). TCP is not recommended because it is less secure.

Limits

You can connect devices to IoT Platform using an SL 651 protocol cloud gateway only on Premium Enterprise Instances in the China (Shanghai), China (Beijing), and China (Shenzhen) regions.

Features

Cloud gateway features

Feature

Description

Custom port number

The default port number for an SL 651 protocol cloud gateway URL is 8898. Specify a custom port number from 1024 to 65535.

First-party authentication

Alibaba Cloud IoT Platform provides device registration, authentication, and unregistration services.

First, create a first-party authentication cloud gateway product. Then, batch import devices into the product. After the devices register and authenticate with IoT Platform using the standard SL 651 protocol, they can connect to IoT Platform.

Third-party authentication

The developer manages device registration, authentication, and unregistration services. The developer grants Alibaba Cloud IoT permission to call services provided through Function Compute (FC) functions. When creating the cloud gateway, the developer must select the FC functions that provide these services.

First, create the FC service and corresponding functions for device registration, authentication, and unregistration. Then, create a third-party authentication cloud gateway product and grant IoT Platform permission to call the FC service and functions. Finally, devices are automatically created and connected in the IoT Platform console through the registration and authentication services provided by the FC functions.

Transport protocol

Supports TCP and TLS.

When connecting directly over TCP, do not use the public network. Use a highly secure leased line instead.

Device X.509 authentication

The cloud gateway provides server-side one-way authentication and mutual authentication between the device and the server for device identity authentication.

SM certificate

When the device side uses TLS protocol version 1.3, SM certificates are supported. This includes support for SM2, SM3, and SM4 Chinese cryptographic algorithms and the SM SSL security protocol.

Note

Only single SM certificates and the TLS_SM4_GCM_SM3 and TLS_SM4_CCM_SM3 cipher suites are supported. Dual SM certificates (TLCP protocol) are not supported.

OCSP

The cloud gateway provides Online Certificate Status Protocol (OCSP) capabilities for both device-side and server-side certificates.

SL 651 protocol connection and communication

Devices connect to and communicate with IoT Platform using the SL 651 protocol. Device communication messages use the standard SL 651 protocol data format.

When a device connects to IoT Platform, the default timeout period is 180 seconds. If the device does not report data or send a heartbeat within 180 seconds, IoT Platform disconnects from the device.

IoT Platform supports the 2014 version of the SL 651 protocol. The following features are supported:

  • Only link transmission modes M1 and M2 are supported.

  • Only Binary-Coded Decimal (BCD) or hexadecimal (HEX) encoding is supported. The response contains only the escape (ESC) character.

  • Message types

    Message

    Message type

    Telemetry station timed report

    0x32

    Link maintenance packet (heartbeat)

    0x2F

    Telemetry station hourly report

    0x34

    Hydrological information report for uniform time periods

    0x31

    Telemetry station supplementary report message

    0x33

    Test message

    0x30

  • For more information about the SL 651 protocol, see SL651-2014.

Preparations for device connection and communication

First-party authentication

  1. Create a cloud gateway product (SL 651): When you create the cloud gateway product, set Authentication Type to First-party Authentication. You can configure other parameters as needed.

  2. Create a cloud gateway device (SL 651): You can batch import device information, including telemetryaddress (telemetry station address) and password (password), into the cloud gateway product. IoT Platform uses the uploaded telemetryaddress value as the device name to create the corresponding device.

  3. Configure the cloud gateway access domain name on the device to connect to IoT Platform using the standard SL 651 protocol:

    • If the device already has an access domain name configured, you can configure a Canonical Name (CNAME) record to resolve to the cloud gateway connection domain name (cloud gateway URL). For more information about domain name resolution, see Authoritative DNS resolution over the internet.

    • If the device does not have an access domain name configured, you can configure the cloud gateway URL on the device.

  4. (Optional) You can configure message forwarding to subscribe to or forward messages related to device logon, log off, and data reporting to your server.

Third-party authentication

  1. Manage services and Manage functions: Create a Function Compute (FC) service and corresponding functions for third-party device authentication.

    The request and response parameters for the FC authentication function must meet the specified requirements. You can customize the authentication function name. For more information about the request and response parameters in the authentication function, see Create a cloud gateway product (SL 651).

  2. Create a cloud gateway product (SL 651): When you create the cloud gateway product, set Authentication Type to Third-party Authentication. For Device Authentication FC Service and Device Authentication FC Function, select the FC service and function that you created. You can configure other parameters as needed.

  3. After the cloud gateway product is created, when a device connects for the first time, IoT Platform uses the value of the telemetryaddress request parameter from the FC authentication function as the device name and automatically creates the corresponding device for authentication and connection.

  4. (Optional) You can configure message forwarding to subscribe to or forward messages related to device logon, log off, and data reporting to your server.

Device connection and communication flow

Note

The SL 651 protocol does not have a dedicated authentication message. Authentication is performed each time data is reported.

First-party authentication

image

Third-party authentication

image

Message communication

IoT Platform and cloud gateway devices communicate using the 2014 version of the standard SL 651 protocol. For more information, see SL 651 protocol connection and communication above.

Uplink communication: device to server

You can use the data forwarding feature of the IoT Platform rules engine to forward messages related to device logon, log off, and data reporting to your server. You can also use the Advanced Message Queuing Protocol (AMQP) subscription feature of the rules engine to push messages that contain reported data to your server.

For more information, see Message forwarding.

Downlink communication: server to device

The server can call the RRpc Application Programming Interface (API) to send a communication message to a specific device and receive a synchronous response.