0% found this document useful (0 votes)
167 views30 pages

Intelligent Terminal MQTT Protocol Docking Manual v1.4

This document provides a summary of the Intelligent Terminal MQTT Protocol Docking Manual v1.4. It describes how a smart terminal device connects to a docking platform using the MQTT protocol. The document outlines how the platform can obtain the device's system parameters and configure the device's parameters. It also describes how the device uploads temperature data to the platform. Key points covered include the topics for device subscription and publishing, and how to perform binding between the device and platform.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views30 pages

Intelligent Terminal MQTT Protocol Docking Manual v1.4

This document provides a summary of the Intelligent Terminal MQTT Protocol Docking Manual v1.4. It describes how a smart terminal device connects to a docking platform using the MQTT protocol. The document outlines how the platform can obtain the device's system parameters and configure the device's parameters. It also describes how the device uploads temperature data to the platform. Key points covered include the topics for device subscription and publishing, and how to perform binding between the device and platform.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Intelligent Terminal MQTT Protocol Docking Manual v1.

v1.4 channge log:(compare to v1.3)

1. Add Wiegand configuration

Chapter 1: Notes

1. The device described in the document refers to a smart terminal device.


2. The built-in MQTT client of the device is hereinafter referred to as the device.
3. MQTT client end of the docking platform is hereinafter referred to as the platform.
4. This document is for readers who have some knowledge of MQTT.
5. This agreement is divided into three parts.
5.1. The platform obtains the device system parameters.
5.2. The platform configuration device system parameters.
5.3. The equipment uploads the temperature data to the platform.
6. Josn parameters are used later in this protocol, such as device_id/device_token.
In order to give an example of data, the actual device_id/device_token of
the device should be used in the actual docking

Chapter 2: Several key points of this agreement

1. The platform obtains the device system parameters


{
"mqtt_cmd":2,
"device_id":"7101389947744",
"tag":"platfrom define",
"device_token":"1057628122"
}

Parameter Description
mqtt_cmd: Only 1 and 2 can be filled in.
1: The platform obtains the device system parameters.
2: The platform configuration device system parameters.
device_id: Device serial number. gets parameters from the specified device.
This field parameter is an optional entry. If there is no field,
all devices under the same topic will respond
tag: Message tag, platform custom, device will return the same tag,
the platform can use the tag to distinguish between the type of
operation and the type of data returned by the device
device_token: Protocol communication token. The platform binds the device
and the communication token returned by the device to the
platform For binding please read the binding instructions

2. The platform configuration device system parameters


{
"mqtt_cmd":1,
"device_id":"7101016972903", "tag":"platfrom
define", "device_token":"657724442",
"mqtt_operate_id":1,
"module_name":{"param_name":"param_value"}

Parameter Description
mqtt_cmd: Only 1 and 2 can be filled in.
1: The platform obtains the device system parameters.
2: The platform configuration device system parameters.

device_id: Device serial number. gets parameters from the specified device.
This field parameter is an optional entry. If there is no field, all
devices under the same topic will respond

tag: Message tag, platform custom, device will return the same tag, the platform
can use the tag to distinguish between the type of operation and the type of
data returned by the device
device_token: Protocol communication token. The platform binds the device
and the communication token returned by the device to the
platform For binding please read the binding instructions

mqtt_operate_id: mqtt_operate_id: The corresponding function / module


representative is currently only 1,2,3,4,6,7,8,9,10 can be filled,
please refer to the ID corresponding module as below

module_name:
Please refer to chapter 4 for the parameter configuration of each module

ID corresponding module description (ID 5 For version information only get)

ID 1: Basic parameter configuration


ID 2: Network configuration
ID 3: Face recognition configuration
ID 4: Remote parameter configuration
ID 6: Temperature function configuration
ID 7: Personnel data management
ID 8: MQTT Protocol configuration
ID 9: system maintenance
D 10: Binding control

3. The description of device Return parameter to platform Head parameter


(all return, operation error return, operation return successfully,
personnel upload data, query of personnel information)

{
"code":0,
"msg":"return success",
"device_id":"7101389947744",
"dev_cur_pts":1583985927,
"tag":"platfrom define",
"datas":""
}

Parameter Description

code: 0: configuration succeeded -1: configuration failed.


The device returned to the code of platform when Platform
configurated device parameters

msg: A short string description such as the success / failure of


configuring a module, the prompt when the json data
parameter of the platform configuration device is incorrect
device_id: unique ID / serial number of each device
dev_cur_pts: the current system time of the device, Timestamp

tag: Message tag, platform custom, device will return the same tag,
the platform can use the tag to distinguish between the type
of operation and the type of data returned by the device

datas: The platform requests the device's data. The data returned by
the device will be stored in this field.
There are common objects and array objects. For specific data,
please check the data return status of each function

When the device returns any data to the platform, the first 6 fields are certainly returned.
Only the datas: objects will change.

4. About binding operation instructions

The device currently supports three kinds of binding operation


The First type: PHP platform software
The second tupe: JAVA platform software
The third type: MQTT protocol platform software (that is, the docking
protocol operation interface described in this document)

The device and platform software are controlled by one-to-one binding.


One-to-three is not supported.

When any kind of platform software needs to control the device, you must create
a binding relationship before you can configure and obtain the device.

When the device is unbound from any kind of platform software,


the personnel data information in the device will be cleared and the personnel
data needs to be re-imported after binding.
Refer to item 10 of chapter 5 for the bind operation.

Chapter 3: mqtt configuration

1. Equipment configuration mqtt


publish subject: PublishTest
Subscription subject: SubscribeTest
qos: 0
Retain: false
mqtt server: No/Empty
mqtt_port: 1883
mqtt User name: No/Empty
mqtt Password: No/Empty

2.The configuration steps


The above parameters are the default mqtt configuration of the device.
You can also use a custom mqtt proxy server to ensure that the device
can normally connect to the Internet and log in to the web page of the
device through the LAN IE browser
Find the mqtt protocol configuration and selete the check box to finish
configure and the default IP and port of the device is http://192.168.1.88:7080
Please log in according to the actual IP address of the device, and
the HTTP port is fixed to 7080

3. Platform to device / device to platform subscription / publishing topic description

The device subscription subject is: SubscribeTest,


so the platform publishing subject needs to be configured as: SubscribeTest

The device publishing subject is: PublishTest,


so the platform subscription subject needs to be configured as: PublishTest

The configuration and acquisition described in subsequent documents are based


on the above rules. There will be no further explanation of the subject

Chapter 4: Platform Get Device System Parameters

1. The platform released the following message


{
"mqtt_cmd":2,
"device_id":"7101389947744",
"tag":"platfrom define",
"device_token":"1057628122"
}

This device_token is for debugging device, please use the actual device_token after binding
2. The device will return the following information (returns all parameters of the device)
{
"code":0,
"msg":"get param success",
"device_id":"7101389947744",
"dev_cur_pts":1585151687,
"tag":"platfrom define",
"datas":
{
"basic_parameters":{ //Basic data
"dev_pwd":"YWRtaW4=", //Devide password base64 encode string
"dev_name":"FRD" //Device name
},
"network_cofnig":{ //network Configuration
"ip_addr":"172.18.195.66", //IP address
"net_mask":"255.255.248.0",//subnet mask
"gateway":"172.18.192.1", //default gateway
"DDNS1":"211.136.192.6", //dns1
"DDNS2":"8.8.8.8", //dns2
"DHCP":false //dhcp
},
"face_recognition_cfg":{
"dec_face_num_cur":1, //Current number of captured faces
"dec_interval_cur":1, //the current same person identifies
the time interval again
"dec_face_num_min":1, //minimum number of faces to capture
"dec_face_num_max":4, //Maximum number of faces to capture
"dec_interval_min":1, //At least the same person recognizes
the time interval again
"dec_interval_max":5 //the maximum time interval can be
recognized by the same person again
},
"remote_config":{
"light_supplementary":false, //Fill light setting
"volume_cur":12, //the current volume

"screen_brightness_cur":60, //current screen brightness


"display_department":false //department display
"volume_min":0, //The minimum volume
"volume_max":24, //The largest volume
"screen_brightness_min":45, //Minimum screen brightness
"screen_brightness_max":100 //Maximum screen brightness
"wiegand_dir":0, //0=Wiegand intput 1=Wiegand output
"wiegand_write_bit":26 //Wiegand output bit 26 or 34
},
"version_info":{
"dev_model":"FK02GYW", //Device model
"firmware_ver":"FK02GYW_P4_V20.1.11.5",//Device software version
"firmware_date":"Mar 13 2020 20:34:00" //Firmware production time
},
"fun_param":{
"temp_dec_en":false, //Temperature detection true: turn on false: turn off
"stranger_pass_en":false, //Stranger detection true: turn on false: turn off
"make_check_en":false, //mask detection true: turn on false: turn off
"alarm_temp":37.30, //Fever Warning
"temp_comp":0.60, //Temperature compensation
"record_save_time":24, //How long the snapshot record is kept

"save_record":true, //Recording switch true: turn on false: turn off


"save_jpeg":true //Snap picture switch true: turn on false: turnoff
},
"mqtt_protocol_set":{
"enable":true, //MQTT Switch true: turn on false: turn off
"retain":true, //Publisher Retain configuration true: turn on false: turn off
"pqos":2, //publisher QOS
"sqos":0, //Subscriber QOS
"port":1883, //MQTT server port
"server":"", //MQTT server address
"username":"", //MQTT server user name
"passwd":"YWRtaW4", //MQTT server password, base64 encode string
"topic2pulish":"PublishTest", //Publisher topic
"topic2subscribe":"SubscribeTest",//Subscriber topic
"heartbeat":0 //Device and platform heartbeat parameters
}

}
}
Chapter 5: Platform Configuration and system parameters

1.Device basic Configuration


Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":1,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"basic_config":
{
"dev_name":"12315456445864",
"dev_pwd":"YWRtaW4=",
"sync_server_pts_en":true,
"server_cur_pts":"2020/05/18 11:07"
}
}

Device Back

Success
{
"code":0,
"msg":"basic param set success",
"device_id":"7101389947744",
"dev_cur_pts":1583985600,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"mqtt param erro!",
"device_id":"7101389947744",
"dev_cur_pts":1583986146,
"tag":"platfrom define",
"datas":"no data"
}
Parameter Description

dev_name: Device name


dev_pwd: Device login password, base64 encode string.
(web login password for management control will be provided
later) Max. 32 characters

sync_server_pts_en: Synchronization server time switch


true: turn on false: turn off
server_cur_pts: Incoming server current system time,
time format:yyyy/mm/dd,
need to cooperate with sync_server_pts_en
2. Device network parameter Configuration

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":2,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"network_cofnig":
{
"ip_addr":"172.18.195.67",
"net_mask":"255.255.248.0",
"gateway":"172.18.192.1",
"DDNS1":"211.136.192.6",
"DDNS2":"8.8.8.8",
"DHCP":false
}
}

Device Back

Success
{
"code":0,
"msg":"network param set success",
"device_id":"7101389947744",
"dev_cur_pts":1583985600,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"mqtt param erro!",
"device_id":"7101389947744",
"dev_cur_pts":1583986146,
"tag":"platfrom define",
"datas":"no data"
}

Parameter Description
ip_addr:
net_mask: Device ip address
gateway: Subnet mask
DDNS1: Default gateway
DDNS2: dns
DHCP: dns
DHCP true: turn on false: turn off
Note that modifying the network parameters to configure the MQTT service will restart

3. Device face recognition parameter Configuration


This interface has changed and the configuration has returned but no data
changes have been made

Platform send
{

"mqtt_cmd":1,
"mqtt_operate_id":3,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"face_config":
{
"dec_face_num":3,
"dec_interval":3
}
}

Device Back
{
"code":0,
"msg":"The interface has changed and is no longer supported",
"device_id":"7101016972903",
"dev_cur_pts":1589996147,
"tag":"platfrom define",
"datas":"no data"
}

4. Device remote parameter Configuration

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":4,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"remote_config":
{
"volume":12,
"screen_brightness":80,
"light_supplementary":true
"wiegand_dir":0,
"wiegand_write_bit":26

}
}

Device Back

Success
{
"code":0,
"msg":"remote config set success",
"device_id":"7101389947744",
"dev_cur_pts":1583987250,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"mqtt param erro!",
"device_id":"7101389947744",
"dev_cur_pts":1583987940,
"tag":"platfrom define",
"datas":"no data"
}

Parameter Description

volume:
volume range 0-24 Please refer to the minimum and
screen_brightness: maximum values of device back brightness range 45-
100 Please refer to the minimum and maximum
light_supplementary: values of device back fill light true: turn on false:
turn off

wiegand_dir: 0=Wiegand intput 1=Wiegand output

wiegand_write_bit:
Wiegand output bit 26 or 34
4. ID 5 is version information. can get but can not config

5. Device temperature control parameter configuration

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":6,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"temperature_fun":
{
"temp_dec_en":false,
"stranger_pass_en":false,
"make_check_en":false,
"alarm_temp":37.4,
"temp_comp":1.1,
"record_save_time":24,
"save_record":true,
"save_jpeg":true
}
}

Device Back

Success
{
"code":0,
"msg":"funtable param set success",
"device_id":"7101389947744",
"dev_cur_pts":1583987966,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"mqtt param erro!",
"device_id":"7101389947744",
"dev_cur_pts":1583987981,
"tag":"platfrom define",
"datas":"no data"
}

Parameter Description

temp_dec_en: temperature check true: turn on false: turn off


stranger_pass_en: strangers pass by true: turn on false: turn off
make_check_en: Mask detection true: turn on false: turn off
alarm_temp: Alarm temperature Floating-point data
temp_comp: Temperature compensation Floating-point data

record_save_time: How long the snapshot record is kept


Value : -1: unlimited 0: do not save 1+N: corresponding time
save_record: Recording switch true: turn on false: turn off
save_jpeg: Snap picture switch true: turn on false: turn off

7. Personnel information management

7.1 This agreement provides the function of adding, deleting,

changing and checking personnel information,


if want to call different functions piclib_manage just put in a different id,
The specific definition is as follows

ID 0: //Add single or multiple user photo database information


ID 1: //Delete all staff library information
ID 2: //Delete the photo database information of the corresponding batch
ID 3: //Delete single or multiple user photo database information
ID 4: //Query all personnel database information
ID 5: //Query the photo database information of the corresponding batch
ID 6: //Query single or multiple user photo database information

7.2 Add single or multiple user photo database information

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":7,
"device_token":"1514348271",
"device_id":"7101389947744",
"tag":"platfrom define",
"piclib_manage":0,
"param":
{
"lib_name":"Smart Park",
"lib_id":"8",
"server_ip":"172.18.195.61",
"server_port":80,
"pictures":
[{
"active_time":"2020/01/1 00:00:01",
"user_id":"11",
"user_name":"Zhang San",
"end_time":"2020/12/30 23:59:59",
"p_id":"null",
"picture":"/192952.JPG"
},
{
"active_time":"2020/01/1 00:00:01",
"user_id":"22",
"user_name":"LI SI",
"end_time":"2020/12/30 23:59:59",
"p_id":"null",
"picture":"/linxiaofei.jpg"
}]
}
}

Device Back
{
"code":0,
"msg":"download PicLib status",
"device_id":"7101389947744",
"dev_cur_pts":1583986208,
"tag":"platfrom define",
"datas":
[{
"pic_url":"/192952.JPG",
"picture_statues":10, //Download picture status
10: download succeed 20: download failed
"user_id":"11"
},
{
"pic_url":"/linxiaofei.jpg",
"picture_statues":10,
"user_id":"22"
}]
}

Parameter Description

lib_name: Name of the image batch, Max. 32 characters


lib_id: Send the batch ID of the picture, Max. 32 characters
server_ip: Http server address where the picture is stored,
Support IP address or domain name
server_port: Http server to store pictures
active_time: Start time when people are allowed to pass,
time format:yyyy/mm/dd.
user_id: unique User ID, Max. 32 characters
user_name: User name
end_time: Ending time when people are allowed to pass,
time format:yyyy/mm/dd.
p_id: No definition
picture: The absolute path where the picture is stored
on the http server

Take the http image server address listed in the document as an example:
http://72.18.195.61/192952.JPG
Enter the above address in the browser to preview the
picture.Based on above format, can download the picture

Among pictures, Data can be a set of data, or it can be multiple sets of data,
A single measurement of 2000 groups is also available

Modification / editing of personnel data The platform sends the data to


the device according to the data format of the newly added personnel.
Just to keep user_id same

7.3 Delete all photo library information

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":7,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"piclib_manage":1
}

Device Back

Success
{
"code":0,
"msg":"delete all piclib success!",
"device_id":"7101389947744",
"dev_cur_pts":1583986800,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"mqtt param erro!",
"device_id":"7101389947744",
"dev_cur_pts":1583987981,
"tag":"platfrom define",
"datas":"no data"
}
Parameter Description: no

7.4 Delete the photo database information of the corresponding batch

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":7,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"piclib_manage":2,
"param":{
"lib":[
{
"lib_id":"8"
},
{
"lib_id":"9"
}
]
}
}

Device Back

Success
{
"code":0,
"msg":"delete lib piclib success",
"device_id":"7101389947744",
"dev_cur_pts":1583985794,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"mqtt param erro!",
"device_id":"7101389947744",
"dev_cur_pts":1583987981,
"tag":"platfrom define",
"datas":"no data"
}

Parameter Description

lib_id: upload the related batch id

7.5 delete individual or multiple user face database information

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":7,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"piclib_manage":3,
"param":{
"users":[
{
"user_id":"11"
},
{
"user_id":"22"
}
]
}
}

Device Back
{
"code":0,
"msg":"delete users piclib success",
"device_id":"7101389947744",
"dev_cur_pts":1584092989,
"tag":"platfrom define",
"datas":[
{
"user_id":"11",
"status":0
},
{
"user_id":"22",
"status":0
}
]
}

Parameter Description

user_id: input corresponding use's id


status: Delete status 0: delete success 1: delete failure

7.6 query all face database information

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":7,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"piclib_manage":4,
"page":0
}

Parameters issued by the platform:


page: query the total number of entries for staff information for -
1 Query the corresponding page when the value is 0 or
above (including 0), and there are 1000 pieces of data in one
page For example, to query the 5001-6000 data page to fill 5, the
first page will fill 0

page ":-1 queries the total number of face databases and returns as
follows {
"code":0,
"msg":"mqtt query success!",
"device_id":"7101016972903",
"dev_cur_pts":1590480998,
"tag":"platfrom define",
"datas":{
"total_num":30102
}
}
"page":n the data corresponding to n pages of n query is returned as follows {

"code":0,
"msg":"mqtt query success!",
"device_id":"7101389947744",
"dev_cur_pts":1583987504,
"tag":"platfrom define",
"datas":[
{
"lib_id":"8",
"lib_name":"Smart Park",
"user_id":"1",
"user_name":"Zhang San",
"active_time":"2020/01/1 00:00:01",
"end_time":"2020/12/30 23:59:59",
},
{
"lib_id":"9",
"lib_name":"Smart Park",
"user_id":"2",
"user_name":"Li Si",
"active_time":"2020/01/1 00:00:01",
"end_time":"2020/12/30 23:59:59",
}
]
}

Parameter Description: no

7.7 query the corresponding batch of face database information

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":7,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"piclib_manage":5,
"param":{
"lib":[
{
"lib_id":"8"
},
{
"lib_id":"9"
}
]
}
}

Device Back
{
"code":0,
"msg":"mqtt query success!",
"device_id":"7101389947744",
"dev_cur_pts":1583987504,
"tag":"platfrom define",
"datas":[
{
"lib_id":"8",
"lib_name":"Smart Park",
"user_id":"1",
"user_name":"Zhang San",
"active_time":"2020/01/1 00:00:01",
"end_time":"2020/12/30 23:59:59",
},
{
"lib_id":"9",
"lib_name":"Smart Park",
"user_id":"2",
"user_name":"Li Si",
"active_time":"2020/01/1 00:00:01",
"end_time":"2020/12/30 23:59:59",
}
]
}

Parameter Description: no

7.8 query individual or multiple user face database information

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":7,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"piclib_manage":6,
"param":{
"users":[
{
"user_id":"1"
},
{
"user_id":"2"
}
]
}
}

Device Back
{
"code":0,
"msg":"mqtt query success!",
"device_id":"7101389947744",
"dev_cur_pts":1583987504,
"tag":"platfrom define",
"datas":[
{
"lib_id":"8",
"lib_name":"intelligent park",
"user_id":"1",
"user_name":"Zhang San",
"active_time":"2020/01/1 00:00:01",
"end_time":"2020/12/30 23:59:59",
},
{
"lib_id":"9",
"lib_name":"intelligent park",
"user_id":"2",
"user_name":"Li Si",
"active_time":"2020/01/1 00:00:01",
"end_time":"2020/12/30 23:59:59",
}
]
}

Parameter Description: no
8. mqtt protocol parameter configuration

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":8,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"mqtt_protocol_set":
{
"enable":1,
"retain":0,
"pqos":0,
"sqos":0,
"port":1883,
"server":"",
"username":"",
"passwd":"YWRtaW4",
"topic2pulish":"PublishTest123",
"topic2subscribe":"SubscribeTest123",
"heartbeat":0 //Device and platform heartbeat parameters
}
}

Device Back

Success
{
"code":0,
"msg":"mqtt protocol set success",
"device_id":"7101389947744",
"dev_cur_pts":1583985840,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"mqtt param erro!",
"device_id":"7101389947744",
"dev_cur_pts":1583987981,
"tag":"platfrom define",
"datas":"no data"
}

Parameter Description

enable: mqtt on-off true: turn on false: turn off


retain: retain the published topic on the switch on the server
pqos: publish qos
sqos: subscribe qos
port: server port
server: server address, Support IP address or domain name
username: username, Max. 32 characters
passwd: password, Max. 32 characters base64 encode string
topic2publish: publish topic, Max. 32 characters
topic2subscribe: subscribe topic, Max. 32 characters
heartbeat: Device and platform heartbeat parameters

Heartbeat opening steps

1. Please refer to the first part of chapter 2 for equipment parameters


2. Resolve all parameter configurations of MQTT
3. Fill the resolved MQTT parameters intact to prepare to send
the MQTT parameters to the device (except heartbeat)
4. Heartbeat parameter padding 0: turn off the heartbeat and the
remaining values are the time between sending the heartbeat (shaping data)
5. All MQTT parameter configurations can be sent back to the equipment.
Please refer to article 8 of chapter 5 (this chapter).

The MQTT parameters are reconfigured and the device MQTT client is restarted

9. System maintenance parameter configuration

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":9,
"device_token":"1057628122",
"device_id":"7101389947744",
"tag":"platfrom define",
"sys_maintain":
{
"reboot":1,
"reset":0
}
}

Device Back

Success
{
"code":0,
"msg":"systime maintain set success",
"device_id":"7101389947744",
"dev_cur_pts":1583985840,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"mqtt param erro!",
"device_id":"7101389947744",
"dev_cur_pts":1583987981,
"tag":"platfrom define",
"datas":"no data"
}

Parameter Description

reboot: 1 reboot the device


reset: 1 reset to factory setting

Note: when both of them are 1,then reset to factory setting

10. MQTT bind device operation

10.1 platform bind device

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":10,
"device_id":"7101389947741",
"tag":"platfrom define",
"bind_ctrl":1
}

Device Back

Success
{
"code":0,
"msg":"mqtt bind ctrl success",
"device_id":"7101389947744",
"dev_cur_pts":1584053128,
"tag":"platfrom define",
"datas":{
"device_token":"1057628122"
}
}

Failure //It will fail only if it is bound by another platform {

"code":-1,
"msg":"The device has been bound! ip:192.168.1.88 platfrom:2",
"device_id":"7101389947744",
"dev_cur_pts":1583988351,
"tag":"platfrom define",
"datas":"nodata"
}

10.2 platform unbind device

Platform send
{
"mqtt_cmd":1,
"mqtt_operate_id":10,
"device_token":"1514348271",
"device_id":"7101389947744",
"tag":"platfrom define",
"bind_ctrl":0
}

Device Back
Success
{
"code":0,
"msg":"mqtt unbind ctrl success",
"device_id":"7101389947744",
"dev_cur_pts":1583986540,
"tag":"platfrom define",
"datas":"no data"
}

Failure
{
"code":-1,
"msg":"device_token erro!",
"device_id":"7101389947744",
"dev_cur_pts":1584053102,
"tag":"platfrom define",
"datas":"no data"
}

10.3 Parameter Description

bind_ctrl: 0: mqtt unbind device


1: mqtt bind device(no need input"device_token")

Chapter 6: Authentication and identification of people / stranger information device uploaded


to the platform

Device Back
{
"code":0,
"msg":"Upload Person Info!",
"device_id":"7101389947744",
"dev_cur_pts":1583996959,
"tag":"UploadPersonInfo",
"datas":
{
"msgType":"1", //Message type, Not yet defined, you can let the
device returns the specified value

"similar":"98", //Similarity score


"user_id":"77", //User id, This key-value pair is empty when it is stranger
"name":"xiaoming", //Name, This key-value pair is empty when it is
stranger "time":"2020/05/20 20:00:00", //Event time/ People passing,
time format:yyyy/mm/dd
"temperature":"36.60", //People passing temperature
"matched":"1", // 1: Certified person, 0: Stranger
"imageFile":"data:image/jpg;base64,/9j/4........." //Personnel picture data,
base64 encode, When item 6 of chapter 5 save_jpeg is false,
the uploaded data does not have this field
}
}

You might also like