![USR IOT USR-DR404 Скачать руководство пользователя страница 32](http://html.mh-extra.com/html/usr-iot/usr-dr404/usr-dr404_user-manual_1064542032.webp)
USR-DR404 user manual
Jinan USR IOT Technology Limited
32
In applications where the server sends fixed query commands to the device, in order to reduce frequent
interactions, users can choose to send heartbeat packets (query commands) to the serial device instead of sending query
commands from the server.
Enable the custom heartbeat packet function. AT command settings are as follows:
(1) Enable heartbeat packet function
AT+HEARTEN=on
(2) Set the sending direction (NET or COM) of the heartbeat packet, for example, set the heartbeat packet to be
sent to the network.
AT+HEARTTP=NET
(3) Set the heartbeat packet data (maximum 40 bytes). For example, to set the data to the string www.usr.cn, you
need to first convert the string to hex 7777772E7573722E636E.
AT+HEARTDT=7777772E7573722E636E
(4) Set the interval for sending heartbeat packets. The setting range is 1-65535s, and the default is 30s. For example,
set the sending interval to 30 seconds.
AT+HEARTTM=30
Then need to set up network connections such as socket A and socket B, please refer to section 2.4. After
completing the settings, restart the serial server. After socket A or socket B is connected to the server, if there is no data
transmission within 30 seconds, the serial server will send the string www.usr.cn to the server.
AT commands:
Item
Description
1
HEARTEN
Query / Se whether to enable the heartbeat packet
function
2
HEARTTP
Query / Set heartbeat packet sending mode
3
HEARTDT
Query / Set heartbeat packet data
4
HEARTTM
Query/ Set heartbeat packet sending interval
Form 13 Heartbeat packet related commands
3.9. Socket Distribution
Users are allowed to send data to appointed socket connection and take the DR404 packaging the data from the net
according to the protocol send to serial device if enabling the socket distribution under the transparent transport.
Users’ MCU send data package according to the socket protocol and DR404 will parse the data package. If correspond
with the protocol, it will be sent to the appointed socket; if not, it will return related error code and does not send it.
1) Data format from serial device to module
MCU send data package according the below format, module parse and send “n”bytes data to the appointed socket
connection. When the data returned, no parse and output from the serial directly.
header
Length
Parameters Data
Parity
3
2
(n+2)
2
n
1
Format 14 Serial transmission format
Header: 0x55 0xFD 0xAA