# Face recognition access control development document--V3.8

Modification record

Time Version Content
2019-11-29 V1.0 In the initial version, there are some interfaces to be determined
2019-12-17 V1.1 Adjust several interfaces. In the past, the protocol was too simple and put signaling and data in one TCP, which caused some problems
2019-12-20 V1.2 Adjust several message fields
2019-12-23 V1.3 The IO port configuration has been modified, and the message template has been modified
2019-12-30 V1.4 The JSON in the HTTP response package is unified with the type of CMD and return code, and the data carried is put into the data field as a secondary JSON, so as to facilitate the implementation of the server; User group permissions have been modified
2020-1-9 V2.0 In order to facilitate docking, the underlying communication protocol is changed to WebSocket
2020-1-13 V2.1 Adjusted the type of access result
2020-2-14 V3.0 In WebSocket protocol, SSL encryption is added, and password is added when logging in. The server can verify it
2020-3-4 V3.1 Add QR code interface
2020-3-20 V3.2 Add activation protocol
2020-3-27 V3.3 Remote_Ctrl interface removes the Duration field
2020-5-11 V3.4 Add Change_Password interface and change Face_Feature field added by user to Face_jpg
2020-5-29 V3.5 Add screen auto off time configuration
2020-7-21 V3.6 Updated face parameters
2020-10-9 V3.7 Add language configuration
2020-10-10 V3.7.1 Adjust the language name in the language configuration to make it more concise
2020-10-30 V3.7.2 Add a debug interface
2020-12-19 V3.7.3 Add the interface to get the number of users (used / remaining)
2020-12-29 V3.7.4 Add the anti-counterfeiting authentication code of the reported message
2021-03-29 V3.7.5 Add the function of reporting body temperature
2021-05-27 V3.7.6 Add weigand support
2021-10-20 V3.8 Add temperature format, time format, face recognition interval and other configurations

Design principle

  1. this product is designed for small scenarios, and the protocol is concise, with only 23 interfaces, which is convenient for docking
  2. Support external network penetration. The server deployed in the public network can directly control the access control machine in the intranet, such as remote door opening and remote user adding
  3. The system consists of three parts: the face access control machine (hereinafter referred to as the device end) is the client, the signaling server used to manage and control the equipment, and the data server used to receive the traffic records (including the captured pictures). The two servers can be implemented together or separately
  4. Websocket + SSL (WSS) protocol is adopted between the device and the signaling server, and the server port is 443. Except for the first login command, all other commands are actively requested by the server
  5. The standard HTTP post protocol is used between the device and the data server to report the traffic record through multipart message
  6. The device can work offline, and can cache thousands of traffic records (the number depends on the size of the device memory) at the device end (without snapshot), and then send them out after reconnecting with the data server
  7. The device supports IC card, face recognition, IC card or face recognition, and IC card + face recognition dual authentication, with voice and text prompts
  8. The device supports user group configuration, and each user group can specify the access rights of different time periods
  9. The device supports 4-way input: button switch, door magnet, alarm, anti prying; 2-way output: door switch relay, alarm
  10. The equipment supports various functions such as remote door opening and closing, no passing, emergency door opening, alarm linkage, etc
  11. The device supports normal basic functions, such as restoring factory settings, remote upgrade, restart, reading device log, etc

Signaling server function

Detailed description of interface protocol

  1. Activate the device

Factory device must be activated to connect to the server

The activation is realized by independent communication protocol

  1. Register users

Input face information

Set user group

Set time period permissions for each group

  1. Send configuration to face recognition machine

    Synchronize all user information

Synchronization time

Parameter configuration of face recognition algorithm

Level configuration of three-way IO input (door opening button, door magnet, alarm input)

Trigger time length configuration of two IO outputs (door closing relay, alarm output)

  1. Remote control door

    Door normally open

Door normally closed

  1. Device management

Remote upgrade

Restore factory settings

Restart

View log

Data server function

Detailed description of interface protocol

  1. Receive the record with captured photos
  1. Receive offline records
  1. Receive alarm record

Data server function

Detailed description of interface protocol

  1. IC card
  1. Face recognition
  1. Double authentication: IC card and face recognition

  2. Button switch, alarm and remote door opening

  1. Offline record cache
  1. Image + voice prompt
  1. Upload of traffic records
  1. Support the input and output of IO alarm signal

Intranet penetration mechanism

The device side actively connects to the external network server and maintains long connection. The external network server can rely on this long connection and send control commands to the device side to achieve the effect of penetrating the internal network

Access judgement logic

Combination judgment of IC card + face recognition + door status + user permission

Both IC card and face recognition are used to determine whether they are successful by comparing the user database on the device

There are two ways to change the state of the door

  1. IO port input alarm, anti prying and other signals
  1. Remote control command

User permissions are configured in user groups

Flow chart description is provided in subsequent versions


Security mechanism

Considering the application scenario, the current design of secure communication is relatively simple

  1. The face recognition machine needs to configure the IP and port information of the server. These two need to be written through activation mechanism. Otherwise, the IP address is not correct, and the device will not be able to connect to the server
  2. When the face recognition machine logs in, it will carry device_ ID, this ID if it is not registered on the server, the server refuses to log in
  3. Burn IP address and register device_ ID is realized through the activation function on the server
Later version changed to HTTPS


Activation mechanism

Because before activation, the face machine cannot log in to the server, so the server communicates with the device by sending broadcast packets

After the device judges that the broadcast packet is legal, it resolves the IP address and port of the server carried in the packet and writes it to the device

At the same time, send a response packet with UDP and attach your own device_ID After receiving the ID, the server records the ID in the database and completes the registration

Please refer to the interface protocol for specific implementation

The later version is changed to burn the HTTPS certificate provided by the server

Protocol specification

Protocol overview

  1. websocket is adopted for the protocol, version 13

  2. For the convenience of development, only "text frame" in websocket is supported

  3. The load data are all standard JSON strings, encoded as utf8

  4. JSON string should be constructed strictly according to the rules after. If the character type field is empty, please use '' to represent it, and it cannot be deleted directly

  5. user and group data will involve multiple records, and no modification command is defined. Please implement it by del + add mechanism

Request package template

The JSON format of request package includes two parts: CMD and DATE

  1. CMD is the type of request, there are 21 types in total
  2. DATE is the data carried by the request. It is a sub JSON. If some requests do not need data, such as get_ Time, data field can not be added, or an empty JSON: {} can be added
  3. Here is an example

     {
         "cmd": "login",
         "data": {
             "firmware_ver": "1",
             "device_id": "1234567890",
             "device_type": "zhongding_mj"
         }
     }
    

Response package template

The JSON format of the response package contains four fields: CMD, RET, MSG and DATE

  1. CMD is the corresponding request packet with the suffix "_resp" structure

  2. RET has only two values, 200 for success and 500 for failure

  3. The MSG field is used to briefly describe the operation. For example, if the operation fails, the reason for the failure is given

  4. DATA is the response data, which is a sub JSON. If some requests do not need data, you can not add it, or add an empty JSON: {}

  5. Here is an example

   {
        "cmd": "get_time_resp",
        "ret": 200,
        "msg": "get time OK",
        "data": {
            "time": "2020-01-09 12:47:47"
        }
   }
  1. The following is an example when there is no data to carry. When there is a protocol, all response packets without data are defined in this way

    {
         "cmd": "login_resp",
         "ret": 500,
         "msg": "xxx"
    }
    

Signaling server interface protocol

Log in

Command

login

Request data

Field Type Description
device_id string Device ID
password string The server can authenticate according to the device ID and password
device_type string Software compatible with multiple devices
app_ver string Application version, the app can be replaced separately on the same firmware
firmware_ver string Firmware version, upgrade required

Response data

Verified successfully

{
    "cmd": "login_resp",
    "ret": 200
}

verification failed

{
    "cmd": "login_resp",
    "ret": 500
}

Note: the message is sent from the device to the server, and the Socket connection is established

Modify password

Command

change_password

Request data

Field Type Description
old_password string If the old password is incorrect, the modification will fail
new_password string New password, cannot be empty

Response data

Refer to 1.2.3. Response package template

Note: after the password is successfully modified (RET of the returned packet is 200), the connection will be broken and then reconnected

Heartbeat

Command

heartbeat

Request data

Non

Response data

Refer to 1.2.3. Response package template

Note: the heartbeat is server side > device side, which rarely occurs

Time setting

Command

set_time

Request data

Field Type Description
time string Format "yyyy-mm-dd hh:mm:ss"

Response data

Refer to 1.2.3. Response package template

Time query

Command

get_time

Request data

Non

Response data

Field Type Description
time string The current time of the device in the format of "yyyy-mm-dd hh:mm:ss"

Note: if the time setting is not correct, it will lead to abnormal judgment of time related access rights, and the reported access record time is also incorrect

Set language

Command

set_language

Request data

Field Type Description
language string Currently, only three languages are supported:"English",“SimpChinese”,“TradChinese”

Response data

Non

Note: after setting, it will restart automatically

Read language

Command

get_language

Request data

Non

Response data

Field Type Description
language string Currently, only three languages are supported: "English",“SimpChinese”,“TradChinese”

Note: the default is "SimpChinese"

Set sound

Command

set_voice

Request data

Field Type Description
mute string Mute switch, on , off
value int volume
Refer to 1.2.3. Response package template

Command

set_face_cfg

Request data

Field Type Description
min_face_size int The minimum width of face detection is 1800 by default and the range is 910-8192
check_area_left int The X coordinate of the upper left corner of the recognition area is 0 by default, and the range is 0-8192
check_area_top int Y coordinate of the upper left corner of the recognition area, default 0, range 0 -- 8192
check_area_right int The X coordinate of the lower right corner of the recognition area is 5600 by default and the range is 0-8192 (because the right side of the screen is blocked by OSD, this part cannot be regarded as the recognition area)
check_area_bottom int The Y coordinate of the lower right corner of the recognition area is 8190 by default and the range is 0-8192. The Y coordinate of the lower right corner of the recognition area is 8190 by default and the range is 0-8192
recognition_threshold int Recognition rate threshold, range 0-1000, default 500, below the threshold will be uploaded as strangers
clearness_threshold int Image definition threshold, the default value is 92, and the range is 0 – 100. Recognition can be triggered only when the image is clear enough. This can avoid triggering recognition when the image is moving, trailing, blurring and focusing inaccuracy
sensitivity int Recognition sensitivity, default 2, range 0 (low), 1 (medium), 2 (high), high sensitivity can increase the detection effect of motion blurred face, occluded face, complex light face, large angle face, but it will increase the false detection rate
expand_scale int The default range of matting is 4000, and the range is 1000 – 4000. The smaller the coefficient is, the smaller the matting range is, and vice versa
alive_enable int Biometric switch, default 1, range 0 (off), 1 (on). After the configuration is modified, the device must be restarted
alive_threshold int The threshold of living score is 50 by default, and the range is 0-100. If the living score is lower than the threshold, it is considered as false face. Not used now
two_check_time int Double authentication timeout, default 10 seconds
screen_auto_close_time int If the screen doesn't recognize the face within a certain period of time, it will automatically turn off. The default is 15 seconds. 0 seconds means that it is always on

Response data

Non

Face parameter query

Command

get_face_cfg

Request data

Non

Response data

Refer to "face parameter setting", the data is the same as the setting data

Address setting of identification data reporting

Command

set_face_mode

"duration":3,"way":0/1/2

Request data

Field Type Description
way int model: 0/1/2 0、 Temperature measurement mode, 1、 Face mode, 2、 口罩检测(不识别人脸), 3、口罩检测+识别
duration int Detection interval
room int 是否室内 0、室内, 1、室外

Response data

Refer to 1.2.3. Response package template

Reporting address settings

Command

set_upload_url

Request data

Field Type Description
url string Standard URL format, port is not 80, use colon to indicate port

Response data

Refer to 1.2.3. Response package template

Access record report address query

Command

get_upload_url

Request data

Non

Response data

Field Type Description
url string The HTTP address of the traffic record upload, standard URL format

IO port setting

Command

set_io_cfg

Request data

Field Type Description
door_button json Button configuration, the format is nested JSON string
door_magnetic json Door magnetic configuration, the format is nested JSON string
alarm_input json Alarm input configuration, the format is nested JSON string
prevent_pry json Anti prying sensor configuration, the format is nested JSON string
door_relay json Door closing relay configuration, the format is nested JSON string
alarm_output json Alarm output configuration, the format is nested JSON string

door_button,door_magnetic,alarm_input,prevent_pry The nested JSON format is

   {
    "enable": true, //Enable or not
    "level": 0      //0 low level trigger, 1 high level trigger
   }

door_relay The nested JSON format is

{
    "enable": true, //Enable or not
    "duration": 5   //Signal duration, used for automatic door closing, in seconds, 0 for infinite length
                    //Because the door opening relay is special, it is always high level, so there is no need to configure the level here
}

alarm_output The nested JSON format is

{
    "enable": true, //Enable or not
    "level": 0,     //0 low level trigger, 1 high level trigger
    "duration": 5   //Signal duration, used for automatic stop alarm, unit is seconds, 0 is infinite
}

Response data

Refer to 1.2.3. Response package template

IO port query

Command

get_io_cfg

Request data

Non

Response data

Field Type Description
door_button json Button configuration, the format is nested JSON string
door_magnetic json Door magnetic configuration, the format is nested JSON string
alarm_input json Alarm input configuration, the format is nested JSON string
prevent_pry json Anti prying sensor configuration, the format is nested JSON string
door_relay json Door closing relay configuration, the format is nested JSON string
alarm_output json Alarm output configuration, the format is nested JSON string

See "IO port setting" for nested JSON

User add

Command

add_user

Request data

Field Type Description
user_id string User ID, global unique, and the device does not perform uniqueness check. Please make judgment by the server
card_id string The ID of the access control card held by the user is global unique. The uniqueness of the device is not checked. Please judge it by the server
group_id string Associated with the user group, the purpose is to set the user's permission in batch
name string Username
start_time string Valid period start time, format is "yyyy-mm-dd hh:mm:ss"
end_time string Expiration time, format "yyyy-mm-dd hh:mm:ss"
url string 最重要的参数,人脸jpg图片的链接地址, 如果未设置,则下面 face_jpg必须设置
face_jpg string The most important parameter is the binary string of the face JPG image. The data is encoded in "HEX" format, that is, each byte is represented by two hexadecimal capital characters

Response data

Refer to 1.2.3. Response package template

Note: user_id must exist. If the user only uses face recognition, user_id can be an empty string. At present, pure IC card users are not supported (face recognition is required)

User delete

Command

del_user

Request data

Field Type Description
user_id string User ID, the unique identification of the user. If it is equal to "all", all users will be deleted

Response data

Refer to 1.2.3. Response package template

User query

Command

query_user

Request data

Field Type Description
user_id string User ID, the unique identification of the user. If it is equal to "all", it means to get the list of all user IDs

Single user response data

Field Type Description
user_id string User ID, global unique, and the device does not perform uniqueness check. Please make judgment by the server
card_id string The ID of the access control card held by the user is global unique. The uniqueness of the device is not checked. Please judge it by the server
group string Associated with the user group, the purpose is to set the user's permission in batch
name string Username
start_time string Valid period start time, format is "yyyy MM DD HH: mm: SS"
end_time string The end time of validity, in the format of "yyyy MM DD HH: mm: SS"

All user response data

Field Type Description
list_len int Number of users
user_id_list array An array of all user IDs

Example

{
    "list_len": 5,
    "user_id_list": [
        "001",
        "002",
        "003",
        "004"
    ]
}

Note: because of the large amount of data, the query will not return the feature information

Number of users remaining

Command

get_user_capacity

Request data

Non

Response data

Field Type Description
user_used_num int Number of users entered
user_free_num int Number of remaining users that can be entered
storage_total_bytes int Total bytes of storage space
storage_free_bytes int Available bytes of storage space

User group add

Command

add_group

Request data

Field Type Description
group_id string Group ID, global unique, and the device does not perform uniqueness check. Please make judgment by the server
valid_time1 json The valid time interval is 1, and the format is nested JSON string
valid_time2 json The valid time interval is 2, and the format is nested JSON string
valid_time3 json The valid time interval is 3, and the format is nested JSON string
valid_time4 json The valid time interval is 4, and the format is nested JSON string
valid_time5 json The valid time interval is 5, and the format is nested JSON string

The nested JSON format is

{
    "start_time": "00:00", //Start time
    "end_time":"23:59", //The end time, together with the start time, determines what period of time you can work
    "op_type":1 //Operation type: 0: privilege, 1: IC card, 2: face recognition, 3: face recognition or IC card, 4: face recognition + IC card, 5: no access
}

Response data

Non

Note: the purpose of user group is to batch give users permission to open doors in different time periods. For example, a privilege group can be established, and the operation in all time periods can be set as "privilege", so that users can pass freely; Set up an administrative group, which can't open after 5:30 every day; Set up a programmer group, which can't open after 2 a.m. There are five preset groups

Time can be flexibly configured. The device is not responsible for detecting the overlap of time periods, and only operates according to the first time period successfully matched. If a time period is not matched, it will be handled when there is no right to open the door. Pay attention to "0 privilege". When the door status is "no passing", it can still be opened

User group delete

Command

del_group

Request data

Field Type Description
group_id string Group ID, unique identification of the group.

Response data

Refer to 1.2.3. Response package template

Note: if a group associated with a user has been deleted, the user will be prompted with the error of "permission configuration lost" when opening the door, and cannot open the door

User group query

Command

query_group

Request data

Field Type Description
group_id string Group ID, unique identification of the group. If it is equal to "all", it means to get the list of all user group IDs

Single response data

Field Type Description
group_id string Group ID, globally unique, device does not do uniqueness check, please make a good judgment
valid_time1 json The valid time interval is 1, and the format is nested JSON string
valid_time2 json The valid time interval is 2, and the format is nested JSON string
valid_time3 json The valid time interval is 3, and the format is nested JSON string
valid_time4 json The valid time interval is 4, and the format is nested JSON string
valid_time5 json The valid time interval is 5, and the format is nested JSON string

For nested JSON formats, see "user group add"

All group response data

Field Type Description
list_len int Number of users
group_id_list array Array of all user group IDs

Example

{
    "list_len": 5,
    "group_id_list": [
        "001",
        "002",
        "003",
        "004"
    ]
}

Remote control of door

Command

remote_ctrl

Request data

Field Type Description
ctrl_type int Control type: 0: normal, 1: normally open, 2: no access, 3: alarm output, 4: emergency door opening (normally open + alarm)
delay int 延时开门时间,不延时传入 0

Response data

Refer to 1.2.3. Response package template

Note: when the door is switched back to normal state, it will close automatically if the door is open; If there is an alarm output, the alarm output will be automatically turned off. The control type will affect the user access, for example, under "no access", no door can be opened except for privileged users

Door status query

Command

get_door_status

Request data

Non

Response data

Field Type Description
door_status int 0: normal, 1: normally open, 2: no access, 3: alarm output, 4: emergency door opening (normally open + alarm)
door_button boolean False: did not press, true: Press, read the button switch IO port
door_magnetic boolean False: close, true: open, read the door magnetic sensor IO port
alarm_input boolean False: the alarm output is off, true: the alarm output is on, read the alarm output IO port
prevent_pry boolean False: anti prying off, true: anti prying on, read the alarm output IO port

Note: it is convenient for the server to remotely check the status of the door to make corresponding operation. For example, monitoring whether the door is opened illegally. The first item is the logic state of the gate, and the other items are the state value of the sensor (converted through the configuration item of the IO port)

Alarm temperature setting

Command

set_temperature

Request data

Field Type Description
enable boolean 0 disable, 1 enable
mode int 0 Celsius, 1 Fahrenheit
temprature float Temperature alarm threshold

Response data

Refer to 1.2.3. Response package template

Note: there is an alarm when the temperature exceeds (does not include)

QR code distribution

Command

set_qrcode

Request data

Field Type Description
url string QR code content, an arbitrary string

Response data

Refer to 1.2.3. Response package template

Note: after receiving the QR code, the device screen will immediately update the QR code display. After mobile phone scanning, visitors can remotely open the door

Restore factory settings

Command

factory_reset

Request data

Non

Response data

Refer to 1.2.3. Response package template

Note: the device will restart

Remote upgrade

Command

upgrade

Request data

Field Type Description
url string The upgrade file must be placed in an HTTP server, giving its URL, and the device directly downloads the upgrade file pointed to by the URL

Response data

Non

Note: after the upgrade file is downloaded, all functions will be turned off and flash will be started. After the flash is finished, it will be restarted

Remote Reboot

Command

restart

Request data

Non

Response data

Refer to 1.2.3. Response package template

Debug log read

Command

get_log

Request data

Non

Response data

Field Type Description
message string Device operation log

Note: a circular log file written on the device, which can be read through the protocol, and is easy to test

Debug switch

Command

debug_enable

Request data

Field Type Description
debug int 0 off, 1 on

Response data

Refer to 1.2.3. Response package template

Note: after debugging is started, the device will write a lot of debugging information into the log to facilitate remote access. Debugging is turned off by default. When the debug field is 1, it will take effect immediately, but it will not be saved. After restart, it will return to 0

Wiegand query

Command

get_weigand_cfg

Request data

Field Type Description
mode int 0 Wiegand 6,1 Wiegand 34,Default 0
msg_form int Output the personnel field corresponding to the Wiegand number 0:user_id,1:card_id, Default 0

Response data

Non

Remarks: When the mode is 1, the Wiegand 34 card number will be displayed on the screen when swiping the card, and the corresponding user_id or card_id will be processed as type 34 when outputting.

Wiegand settings

Command

set_weigand_cfg

Request data

Feild Type Descript
mode int 0 Wiegand 26,1 Wiegand 34, Default 0
msg_form int 0:user_id,1:card_id,Default 0
inout int 0-output 1-input 2-auto input/output, 默认2

Response data

Refer to 1.2.3. Response package template

Data server interface protocol

Access record upload

Command

For /set_ upload_ URL set in URL interface


Request data

The format is multipart message, which is divided into two parts. The first part is JSON string, and the content is as follows

Field Type Description
record_type int Record type: 0: online record, 1: offline record, 2: abnormal record
device_id string Device ID
user_id string User ID
card_id string Card number
group_id string Group
user_name string Username
time string Generation time in the format of "yyyy MM DD HH: mm: SS"
pass_result int As for the passing result, the positive number means passing, and the negative number means refusing. The actual value can reflect the specific reason. Please refer to the description below
message string Used to send a description to a server, such as record_type = 3, you can upload the exception information with this
similarity int Face recognition similarity, ranging from 0 to 100
jpg_len int If the length of face JPEG file is 0, it means that the image is not carried
temperature float If the value is 0, there is no temperature measurement module
auth_code string Used for anti-counterfeiting string, the length of 32 characters. The server needs to check the value to prevent the third party from capturing and forging packets.The algorithm is : md5("record_type=0&device_id=220946575e9da12c&user_id=200811161556&card_id=0000001&group_id=&user_name=2001&time=2020-09-07 02:09:55&pass_result=2&message=OPEN_BY_FACE&similarity=72&jpg_len=184864&password=123456") Password is the device login password

The second part is JPG file. The whole message example is as follows

POST /zdmj/upload HTTP/1.1
Host: 10.2.5.56:8080
Connection: keep-alive
Content-Type: multipart/form-data; boundary=zhongding-boundary
Content-Length: 100

--zhongding-boundary
Content-Disposition: form-data; name="record"
Content-Type: application/json

...json data...
--zhongding-boundary
Content-Disposition: form-data; name="jpg"; filename="000000001.jpg"
Content-Type: image/jpeg

...jpg data...
--zhongding-boundary--

Response data

Refer to 1.2.3. Response package template

pass_result Detailed description:

Type Description
0 This value is not used
1 IC card successfully
2 Face recognition successful
3 IC card and face recognition double authentication successful
4 Either IC card or face recognition is successful
5 Privileged user
6 Account time is about to expire (the function is to add a voice prompt when opening the door)
-1 The door is locked and no access is allowed (VIP users are not affected)
-2 Account expired
-3 Account time not enabled
-4 User open permission is not configured (corresponding user group not found)
-5 The user's permission in the current time period is: no access
-6 The user's current permissions are: IC card must be used (this will be triggered if face recognition is used)
-7 The permission of the user in the current time period is: face recognition must be used (this will be triggered if the IC card is used)
-8 Unknown face, the recognition rate is lower than the recognition rate threshold, see "face parameter settings"
-9 Unknown card number
-10 In face recognition + IC card mode, the card is read first, and then the face is not recognized within x seconds (x can be configured in face parameter setting)
-11 In face recognition + IC card mode, recognize the face first, and then do not read the card in x seconds (x can be configured in face parameter setting)
-12 Face recognition does not match IC card

Remarks:

-IC card access, offline records, abnormal records do not carry snapshot photos, the message will not carry the JPG part -The exception record is only Device_ID, Time and Message fields are valid, and the rest are empty -Record_ Type = 0 means real-time traffic record, Record_ Type = 1 means offline traffic record, Record_ Type = 2 indicates alarm information -Card_ id, Group_ ID and Name seem to be redundant. In fact, they can be queried by User_ ID acquisition is provided here for convenience

Activation protocol

When the activation protocol is used for device deployment, the signaling server address and the IP address of the device itself are configured according to the usage environment

The protocol adopts broadcast packet communication, and the device port 7030

Device query command

Program Value
Direction PC --> Device
Send content ActReq: are you online?
Device response ActResp: yes I am online, id=%s server=%s password=%s over

Background server address setting command

Program Value
Direction PC --> Device
Send content ActReq: activate device, id=%64s server=%64s password=%64s over
Successful response ActResp: activate OK, id=%s over
Wrong response ActResp: activate failed, id=%s over

Device IP configuration command

Program Value
Direction PC --> Device
Send content ActReq: set ip address, id=%64s dhcp=%d ip=%15s mask=%15s gw=%15s dns=%15s over
Successful response ActResp: set ip address OK, id=%s over
Wrong response ActResp: set ip address failed, id=%s over

Note: the protocol adopts natural language interaction, and the characters are case sensitive