Files
wangjun c99999b8c9 modbus: add 64-bit byte order support for WS and WR
Add support for WS (34 12 78 56) and WR (56 78 12 34) as additional 64-bit byte orders for Modbus int64, uint64, and double tags.

This change extends address suffix parsing, updates 64-bit endian conversion in the Modbus read/write paths, updates the Modbus TCP/RTU schemas, and adds functional test coverage.

Signed-off-by: wangjun <794997265@qq.com>
2026-04-16 13:59:53 +08:00

323 lines
6.4 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"tag_regex": [
{
"type": 3,
"regex": "^[0-9]+![3-4][0-9]+(#B|#L|)$"
},
{
"type": 4,
"regex": "^[0-9]+![3-4][0-9]+(#B|#L|)$"
},
{
"type": 5,
"regex": "^[0-9]+![3-4][0-9]+(#BB|#BL|#LL|#LB|)$"
},
{
"type": 6,
"regex": "^[0-9]+![3-4][0-9]+(#BB|#BL|#LL|#LB|)$"
},
{
"type": 7,
"regex": "^[0-9]+![3-4][0-9]+(#B|#L|#BB|#BL|#LL|#LB|#WS|#WR|)$"
},
{
"type": 8,
"regex": "^[0-9]+![3-4][0-9]+(#B|#L|#BB|#BL|#LL|#LB|#WS|#WR|)$"
},
{
"type": 9,
"regex": "^[0-9]+![3-4][0-9]+(#BB|#BL|#LL|#LB|)$"
},
{
"type": 10,
"regex": "^[0-9]+![3-4][0-9]+(#B|#L|#BB|#BL|#LL|#LB|#WS|#WR|)$"
},
{
"type": 11,
"regex": "^[0-9]+!([0-1][0-9]+|[3-4][0-9]+\\.([0-9]|[0-1][0-5]))$"
},
{
"type": 13,
"regex": "^[0-9]+![3-4][0-9]+\\.[0-9]+(H|L|)$"
},
{
"type": 14,
"regex": "^[0-9]+![3-4][0-9]+\\.[0-9]+$"
}
],
"group_interval": 1000,
"connection_mode": {
"name": "Connection Mode",
"name_zh": "连接模式",
"description": "Neuron as the client, or as the server",
"description_zh": "Neuron 作为客户端或服务端",
"attribute": "required",
"type": "map",
"default": 0,
"valid": {
"map": [
{
"key": "Client",
"value": 0
},
{
"key": "Server",
"value": 1
}
]
}
},
"check_header": {
"name": "Check Header",
"name_zh": "校验报文头",
"attribute": "required",
"type": "map",
"default": 0,
"valid": {
"map": [
{
"key": "False",
"value": 0
},
{
"key": "True",
"value": 1
}
]
}
},
"device_degrade": {
"name": "Device Degradation",
"name_zh": "设备降级",
"description": "Enable or disable device degradation mechanism",
"description_zh": "启用或禁用设备降级机制",
"attribute": "required",
"type": "map",
"default": 0,
"valid": {
"map": [
{
"key": "False",
"value": 0
},
{
"key": "True",
"value": 1
}
]
}
},
"degrade_cycle": {
"name": "Failure Threshold for Degradation",
"name_zh": "降级失败阈值",
"description": "The number of consecutive failure cycles required to trigger device degradation",
"description_zh": "触发设备降级所需的连续失败周期数",
"attribute": "required",
"type": "int",
"default": 2,
"valid": {
"min": 1,
"max": 65535
},
"condition": {
"field": "device_degrade",
"value": 1
}
},
"degrade_time": {
"name": "Recovery Time After Degradation",
"name_zh": "降级恢复时间",
"description": "The time in seconds after which the device recovers from degradation",
"description_zh": "设备从降级中恢复所需的时间(单位:秒)",
"attribute": "required",
"type": "int",
"default": 600,
"valid": {
"min": 1,
"max": 65535
},
"condition": {
"field": "device_degrade",
"value": 1
}
},
"max_retries": {
"name": "Maximum Retry Times",
"name_zh": "最大重试次数",
"description": "The maximum number of retries after a failed attempt to send a read command",
"description_zh": "发送读指令失败后最大重试次数",
"attribute": "required",
"type": "int",
"default": 0,
"valid": {
"min": 0,
"max": 3
}
},
"retry_interval": {
"name": "Retry Interval (ms)",
"name_zh": "指令重新发送间隔 (ms)",
"attribute": "required",
"type": "int",
"default": 0,
"valid": {
"min": 0,
"max": 10000
}
},
"endianess": {
"name": "Endianess of 4-Byte Data",
"name_zh": "4 字节数据字节序",
"description": "Tag byte order, ABCD corresponds to 1234",
"description_zh": "点位字节序,ABCD 对应 1234",
"attribute": "required",
"type": "map",
"default": 1,
"valid": {
"map": [
{
"key": "ABCD",
"value": 1
},
{
"key": "BADC",
"value": 2
},
{
"key": "DCBA",
"value": 3
},
{
"key": "CDAB",
"value": 4
}
]
}
},
"endianess_64": {
"name": "Endianess of 8-Byte Data",
"name_zh": "8 字节数据字节序",
"description": "Tag byte order, applicable to int64, uint64 and double types",
"description_zh": "点位字节序,适用于 int64,uint64 和 double 类型",
"attribute": "required",
"type": "map",
"default": 1,
"valid": {
"map": [
{
"key": "12 34 56 78",
"value": 1
},
{
"key": "21 43 65 87",
"value": 2
},
{
"key": "87 65 43 21",
"value": 3
},
{
"key": "78 56 34 12",
"value": 4
},
{
"key": "34 12 78 56",
"value": 5
},
{
"key": "56 78 12 34",
"value": 6
}
]
}
},
"address_base": {
"name": "Start Address",
"name_zh": "开始地址",
"description": "Address starts from 1 or 0",
"description_zh": "地址从 1 开始或从 0 开始",
"attribute": "required",
"type": "map",
"default": 1,
"valid": {
"map": [
{
"key": "Protocol Addresses (Base 0)",
"value": 0
},
{
"key": "PLC Addresses (Base 1)",
"value": 1
}
]
}
},
"interval": {
"name": "Send Interval (ms)",
"name_zh": "指令发送间隔 (ms)",
"attribute": "required",
"type": "int",
"default": 20,
"valid": {
"min": 0,
"max": 3000
}
},
"host": {
"name": "IP Address",
"name_zh": "IP地址",
"description": "Local IP in server mode, remote device IP in client mode",
"description_zh": "服务端模式中填写本地 IP,客户端模式中填写目标设备 IP",
"attribute": "required",
"type": "string"
},
"port": {
"name": "Port",
"name_zh": "端口号",
"description": "Local port in server mode, remote device port in client mode",
"description_zh": "服务端模式中填写本地端口号,客户端模式中填写远程设备端口号",
"attribute": "required",
"type": "int",
"default": 502,
"valid": {
"min": 1,
"max": 65535
}
},
"timeout": {
"name": "Connection Timeout (ms)",
"name_zh": "连接超时时间 (ms)",
"attribute": "required",
"type": "int",
"default": 3000,
"valid": {
"min": 1000,
"max": 65535
}
},
"backup_host": {
"name": "Backup IP Address",
"name_zh": "备用 IP 地址",
"attribute": "optional",
"type": "string",
"condition": {
"field": "connection_mode",
"value": 0
}
},
"backup_port": {
"name": "Backup Port",
"name_zh": "备用端口号",
"attribute": "optional",
"type": "int",
"default": 502,
"valid": {
"min": 1,
"max": 65535
},
"condition": {
"field": "connection_mode",
"value": 0
}
}
}