新闻中心
PRESS CENTER请求帧格式 | |||
字段 | 必须 | 类型 | 描述 |
msgType | 是 | string | get_req(读操作)/set_req(写操作) |
msgPath | 是 | string | 指示目标数据点,下文有详细介绍 |
msgId | 是 | string | 默认时间戳,用于匹配请求帧和响应帧 |
data | 是 | string | msgPath不同,data格式不同 |
响应帧格式 | |||
字段 | 必须 | 类型 | 描述 |
msgType | 是 | string | get_res(读响应)/set_res(写响应) |
msgPath | 是 | string | 指示目标数据点,下文有详细介绍 |
msgId | 是 | string | 和请求帧msgId保持一致 |
code | 是 | int | 状态码0-成功;其他-失败错误码 |
data | 是 | string | msgPath不同,data格式不同 |
msgPath支持:/devInfo/devInfo/sn/devInfo/addr/devInfo/ver/devInfo/cmd/devInfo/passwd。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
sn | 读 | string | 产品序列号,纵横产品唯一标识符,长度固定为15 字节 |
addr | 读 | int | 设备Modbus地址(1-255) |
ver | 读 | string | 固件版本号 |
cmd | 写 | int | 系统命令1-重启2-复位3-复位+重启 |
passwd | 读/写 | string | 设备密码,最小6字节,最大64字节,默认值:ET12345678 |
1.1. 读操作
读取设备信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/devInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/devInfo",
"code": 0,
"data": {
"sn": "xxxxxxxxxxxxxxxxxxx",
"addr": 1,
"ver": "xxxxxxxxxxxxxxx" ,
"passwd": "xxxxxxxxxxxxxxx"
}
}
读取设备SN示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/devInfo/sn"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/devInfo/sn",
"code": 0,
"data": "xxxxxxxxxxxxxxx"
}
其余属性读操作类似,不在举例。
1.2. 写操作
设置设备信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/devInfo",
"data": {
"cmd":1
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/devInfo",
"code": 0
}
设置设备密码示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/devInfo/passwd",
"data": "xxxxxxxxxxxxxxxxxxx"
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/devInfo/passwd",
"code": 0
}
其余属性写操作类似,不在举例。
msgPath支持:/ntpInfo/ntpInfo/enable/ntpInfo/server/ntpInfo/timeStamp。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
enable | 读/写 | int | 0-禁用1-启用 |
server | 读/写 | string | 服务器地址,最大字节为128,默认为ntp.ntsc.ac.cn |
timeStamp | 读 | int | 时间戳 |
2.1. 读操作
读取NTP信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/ntpInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/ntpInfo",
"code": 0,
"data": {
"enable": 1,
"server": "xxxxxxxxxxxxxxx",
"timeStamp": 67887887
}
}
读取服务器示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/ntpInfo/server"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/ntpInfo/server",
"code": 0,
"data": "xxxxxxxxxxxxxxx"
}
其余属性读操作类似,不在举例。
2.2. 写操作
设置NTP信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/ntpInfo",
"data": {
"enable": 0,
"server": "xxxxxxxxxxxxxxx"
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/ntpInfo",
"code": 0
}
设置服务器示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/ntpInfo/server",
"data": "xxxxxxxxxxxxxxx"
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/ntpInfo/server",
"code": 0
}
其余属性写操作类似,不在举例。
msgPath支持:/lteInfo/lteInfo/iccid/lteinfo/imei/lteinfo/csq/lteInfo/apn 。不同属性描述如下所示:
字段 | 类型 | 类型 | 描述 |
iccid | 读 | string | 卡号,固定字节长度为15 |
imei | 读 | string | imei号,固定字节长度为20 |
csq | 读 | int | 信号值 |
apn | 读/写 | string | apn帧格式 |
apn帧格式 | |||
字段 | 类型 | 类型 | 描述 |
addr | 读/写 | string | apn地址,最大字节128,默认为空 |
name | 读/写 | string | apn用户名,最大字节64,默认为空 |
passwd | 读/写 | string | apn密码,最大字节64,默认为空 |
3.1. 读操作
读取4G信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/lteInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/lteInfo",
"code": 0,
"data": {
"iccid": "xxxxxxxxxxxxxxxxxxx",
"imei": "xxxxxxxxxxxxxxx",
"csq": 26,
"apn": {
"addr": "xxxxxxxxxxxxxxxxxxx",
"name": "xxxxxxxxxxxxxxxxxxx",
"passwd": "xxxxxxxxxxxxxxxxxxx"
}
}
}
读取APN示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/lteInfo/apn"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/lteInfo/apn",
"code": 0,
"data": {
"addr": "xxxxxxxxxxxxxxxxxxx",
"name": "xxxxxxxxxxxxxxxxxxx",
"passwd": "xxxxxxxxxxxxxxxxxxx"
}
}
其余属性读操作类似,不在举例。
3.2. 写操作
设置APN信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/lteInfo/apn",
"data": {
"addr": "xxxxxxxxxxxxxxxxxxx",
"name": "xxxxxxxxxxxxxxxxxxx",
"passwd": "xxxxxxxxxxxxxxxxxxx"
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/lteInfo/apn",
"code": 0
}
其余属性写操作类似,不在举例。
共8个可用闹钟,msgPath支持:/alarmInfo/alarmInfo/x 。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
mode | 读/写 | int | 0-禁用1-启用 |
hour | 读/写 | int | 小时[0-23] |
min | 读/写 | int | 分钟[0-59] |
sec | 读/写 | int | 秒[0-59] |
target | 读/写 | int | [0-79](表示控制第x路DO);255(表示重启) |
action | 读/写 | int | 0-断开1-闭合 |
4.1. 读操作
读取闹钟信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/alarmInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/alarmInfo",
"code": 0,
"data":{
"0":{
"mode": 1,
"hour": 8,
"min": 45,
"sec": 11,
"target": 55,
"action": 0
},
"7":{
"mode": 1,
"hour": 8,
"min": 45,
"sec": 11,
"target": 55,
"action": 0
}
}
}
读取第一个闹钟信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/alarmInfo/0"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/alarmInfo/0",
"code": 0,
"data": {
"mode": 1,
"hour": 8,
"min": 45,
"sec": 11,
"target": 55,
"action": 0
}
}
其余属性读操作类似,不在举例。
4.2. 写操作
设置闹钟信息示例:
在超市执行,/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/alarmInfo",
"data":{
"0":{
"mode": 1,
"hour": 8,
"min": 45,
"sec": 11,
"target": 55,
"action": 0
},
"7":{
"mode": 1,
"hour": 8,
"min": 45,
"sec": 11,
"target": 55,
"action": 0
}
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/alarmInfo",
"code": 0
}
设置第一个闹钟信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/alarmInfo/0",
"data": {
"mode": 1,
"hour": 8,
"min": 45,
"sec": 11,
"target": 55,
"action": 0
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/alarmInfo/0",
"code": 0
}
其余属性写操作类似,不在举例。
共8条可用逻辑,msgPath支持:/logicInfo/logicInfo/x。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
mode | 读/写 | int | 0-关闭逻辑1-正向跟随2-反向跟随 3-模拟量跟随4-大于等于5-小于等于 |
addr | 读/写 | int | 00H表示本地跟随(本地跟随永不超时),01H-FEH表示跟随远端设备 |
inReg | 读/写 | int | 输入寄存器地址,0表示DI1或者AI1 |
outType | 读/写 | int | 输出寄存器类型,0-DO输出4-AO输出 |
outReg | 读/写 | int | 输出寄存器地址,0表示DO1或者AO1 |
thr | 读/写 | int | 在模式4和模式5时AI比较的阈值,0-25000,单位uA |
outTime | 读/写 | int | 在模式1/2时DO跟随DI断联超时时间,0-65535,单位秒, 在模式3时AO跟随AI断联超时时间,0-65535,单位秒 |
outThr | 读/写 | int | 在模式3时AO跟随AI断联后输出值,0-25000,单位uA |
action | 读/写 | int | 在模式1/2时DO跟随DI断联后DO执行动作, 在模式4/5时条件满足时DO执行动作, 0-断开1-闭合2-翻转 |
5.1. 读操作
读取逻辑信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/logicInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/logicInfo",
"code": 0,
"data":{
"0":{
"mode": 1,
"addr": 60,
"inReg": 55,
"outType": 0,
"outReg": 55,
"thr": 2000,
"outTime": 10,
"outThr": 4000,
"action": 1
},
"7":{
"mode": 1,
"addr": 60,
"inReg": 55,
"outType": 0,
"outReg": 55,
"thr": 2000,
"outTime": 10,
"outThr": 4000,
"action": 1
}
}
}
读取第一条逻辑信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/logicInfo/0"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/logicInfo/0",
"code": 0,
"data": {
"mode": 1,
"addr": 60,
"inReg": 55,
"outType": 0,
"outReg": 55,
"thr": 2000,
"outTime": 10,
"outThr": 4000,
"action": 1
}
}
其余属性读操作类似,不在举例。
5.2. 写操作
设置逻辑信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/logicInfo",
"data":{
"0":{
"mode": 1,
"addr": 60,
"inReg": 55,
"outType": 0,
"outReg": 55,
"thr": 2000,
"outTime": 10,
"outThr": 4000,
"action": 1
},
"7":{
"mode": 1,
"addr": 60,
"inReg": 55,
"outType": 0,
"outReg": 55,
"thr": 2000,
"outTime": 10,
"outThr": 4000,
"action": 1
}
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/logicInfo",
"code": 0
}
设置第一条逻辑信息示例:
,/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/logicInfo/0",
"data": {
"mode": 1,
"addr": 60,
"inReg": 55,
"outType": 0,
"outReg": 55,
"thr": 2000,
"outTime": 10,
"outThr": 4000,
"action": 1
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/logicInfo/0",
"code": 0
}
其余属性写操作类似,不在举例。
msgPath支持:/uartInfo/uartInfo/baudrate/uartInfo/bytesize/uartInfo/parity/uartInfo/stopbit/uartInfo/timeout/uartInfo/hbt/uartInfo/hbt/x。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
baudrate | 读/写 | int | 波特率,2400-921600,默认115200 |
bytesize | 读/写 | int | 数据位,78 |
parity | 读/写 | int | 校验位,0-NONE1-ODD2-EVEN |
stopbit | 读/写 | int | 停止位,11.52 |
timeout | 读/写 | int | 分帧间隔,50-500,单位ms |
hbt | 读/写 | string | 串口心跳(帧格式) |
串口心跳帧格式 | |||
字段 | 读/写 | 类型 | 描述 |
cyc | 读/写 | int | 串口心跳周期,0-65535,单位秒 |
len | 读/写 | int | 串口心跳长度,0-128 |
content | 读/写 | string | 串口心跳内容,最大字节128,base64加密后字符串 |
6.1. 读操作
读取串口信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/uartInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/uartInfo",
"code": 0,
"data": {
"baudrate": 115200,
"bytesize":8 ,
"parity":0 ,
"stopbit": 1,
"timeout": 50,
"hbt": {
"0":{
"cyc": 30,
"len": 3,
"content": "MTIz"
},
"7":{
"cyc": 30,
"len": 3,
"content": "MTIz"
}
}
}
}
读取串口心跳示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/uartInfo/hbt"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/uartInfo/hbt",
"code": 0,
"data": {
"0":{
"cyc": 30,
"len": 3,
"content": "MTIz"
},
"7":{
"cyc": 30,
"len": 3,
"content": "MTIz"
}
}
}
其余属性读操作类似,不在举例。
6.2. 写操作
设置串口信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/uartInfo",
"data": {
"baudrate": 115200,
"bytesize": 8,
"parity": 0,
"stopbit": 1,
"timeout": 50,
"hbt": {
"0":{
"cyc": 30,
"len": 3,
"content": "MTIz"
},
"7":{
"cyc": 30,
"len": 3,
"content": "MTIz"
}
}
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/uartInfo",
"code": 0
}
设置串口心跳示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/uartInfo/hbt",
"data": {
"0":{
"cyc": 30,
"len": 3,
"content": "MTIz"
},
"7":{
"cyc": 30,
"len": 3,
"content": "MTIz"
}
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/uartInfo/hbt",
"code": 0
}
其余属性写操作类似,不在举例。
msgPath支持:/diInfo/diInfo/num/diInfo/rpt_enable/diInfo/rpt_cyc/diInfo/rpt_type/diInfo/rpt_direction/diInfo/value/diInfo/value/x。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
num | 读 | int | DI接口数量,硬件决定,最大为80 |
rpt_enable | 读/写 | int | 主动上报,0-禁用1-启用 |
rpt_cyc | 读/写 | int | 主动上报周期,0-65535,默认为60,单位秒 |
rpt_type | 读/写 | int | 上报数据格式,0-MODBUS-RTU1-MODBUS-TCP 2-JSON |
rpt_direction | 读/写 | int | 上报方向,0-北向 1-南向 2-南北向 |
value | 读 | int | 0-断开 1-闭合 |
7.1. 读操作
读取DI信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/diInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/diInfo",
"code": 0,
"data": {
"num": 2,
"rpt_enable":1,
"rpt_cyc":30 ,
"rpt_type": 1,
"rpt_direction": 1,
"value": {
"0": 0,
"l": 0
}
}
}
读取DI接口数据示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/diInfo/value"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/diInfo/value",
"code": 0,
"data": {
"0": 0,
"l": 0
}
}
其余属性读操作类似,不在举例。
7.2. 写操作
设置DI信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/diInfo",
"data": {
"rpt_enable":1,
"rpt_cyc":30 ,
"rpt_type":1,
"rpt_direction": 1
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/diInfo",
"code": 0
}
其余属性写操作类似,不在举例。
msgPath支持:/doInfo/doInfo/num/doInfo/rpt_enable/doInfo/rpt_type/doInfo/rpt_direction/doInfo/rst_enable/doInfo/hold_time/doInfo/hold_time/x/doInfo/turn_time/doInfo/turn_time/x/doInfo/value/doInfo/value/x。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
num | 读 | int | DO接口数量,硬件决定,最大为80 |
rpt_enable | 读/写 | int | 主动上报,0-禁用1-启用 |
rpt_type | 读/写 | int | 上报数据格式,0-MODBUS-RTU1-MODBUS-TCP 2-JSON |
rpt_direction | 读/写 | int | 上报方向,0-北向 1-南向 2-南北向 |
rst_enable | 读/写 | int | 重启状态保持,0-禁用1-启用 |
hold_time | 读/写 | string | 输出保持时间,0-65535,单位秒 |
turn_time | 读/写 | string | 周期翻转时间,0-65535,单位秒 |
value | 读/写 | string | 0-断开1-闭合 |
8.1. 读操作
读取DO信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/doInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/doInfo",
"code": 0,
"data": {
"num": 2,
"rpt_enable":1,
"rpt_type": 1,
"rpt_direction": 1,
"rst_enable": 0,
"hold_time": {
"0": 30,
"l": 30
},
"turn_time": {
"0": 30,
"l": 30
},
"value": {
"0": 0,
"l": 0
}
}
}
读取DO输出状态示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/doInfo/value"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/doInfo/value",
"code": 0,
"data": {
"0": 1,
"l": 1
}
}
其余属性读操作类似,不在举例。
8.2. 写操作
设置DO信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/doInfo",
"data": {
"rpt_enable":1,
"rpt_type":1,
"rpt_direction": 1,
"rst_enable":1 ,
"hold_time": {
"0": 30,
"l": 30,
"num-1": 30
},
"turn_time": {
"0": 30,
"l": 30,
"num-1": 30
},
"value": {
"0": 0,
"l": 0,
"num-1": 0
}
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/doInfo",
"code": 0
}
设置DO输出示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/doInfo/value",
"data": {
"0": 1,
"l": 1
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/doInfo/value",
"code": 0
}
其余属性写操作类似,不在举例。
msgPath支持:/aiInfo/aiInfo/num/aiInfo/rpt_enable/aiInfo/rpt_cyc/aiInfo/rpt_type/aiInfo/rpt_direction/aiInfo/range/aiInfo/range/x/aiInfo/value/aiInfo/value/x。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
num | 读 | int | AI接口数量,硬件决定,最大为80 |
rpt_enable | 读/写 | int | 主动上报,0-禁用1-启用 |
rpt_cyc | 读/写 | int | 主动上报周期,0-65535,默认为60,单位秒 |
rpt_type | 读/写 | int | 上报数据格式,0-MODBUS-RTU1-MODBUS-TCP 2-JSON |
rpt_direction | 读/写 | int | 上报方向,0-北向 1-南向 2-南北向 |
range | 读/写 | string | 阀值上报(帧格式) |
value | 读 | string | 0-20000,单位uA |
阀值上报帧格式 | |||
字段 | 读/写 | 类型 | 描述 |
min | 读/写 | int | 最小值,4000-20000,单位uA |
max | 读/写 | int | 最大值,4000-20000,单位uA |
rule | 读/写 | int | 上报规则,0-范围内1-范围外 |
9.1. 读操作
读取AI信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/aiInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/aiInfo",
"code": 0,
"data": {
"num": 8,
"rpt_enable":1,
"rpt_cyc":30 ,
"rpt_type": 1,
"rpt_direction": 1,
"range": {
"0": {
"min": 4000,
"max": 20000,
"rule": 0,
},
"1": {
"min": 4000,
"max": 20000,
"rule": 0,
},
"7": {
"min": 4000,
"max": 20000,
"rule": 0,
}
},
"value": {
"0": 4600,
"l": 4600,
"7": 4600
}
}
}
读取AI接口数据示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/aiInfo/value"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/aiInfo/value",
"code": 0,
"data": {
"0": 4600,
"l": 4600,
"7": 4600
}
}
其余属性读操作类似,不在举例。
9.2. 写操作
设置AI信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/aiInfo",
"data": {
"rpt_enable":1,
"rpt_cyc":30 ,
"rpt_type":1,
"rpt_direction": 1,
"range": {
"0": {
"min": 4000,
"max": 20000,
"rule": 0,
},
"1": {
"min": 4000,
"max": 20000,
"rule": 0,
},
"num-1": {
"min": 4000,
"max": 20000,
"rule": 0,
}
}
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/aiInfo",
"code": 0
}
其余属性写操作类似,不在举例。
10. AO信息
msgPath支持:/aoInfo/aoInfo/num/aoInfo/rpt_enable/aoInfo/rpt_type/aoInfo/rpt_direction/aoInfo/value/aoInfo/value/x。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
num | 读 | int | AO接口数量,硬件决定,最大为80 |
rpt_enable | 读/写 | int | 主动上报,0-禁用1-启用 |
rpt_type | 读/写 | int | 上报数据格式,0-MODBUS-RTU1-MODBUS-TCP 2-JSON |
rpt_direction | 读/写 | int | 上报方向,0-北向 1-南向 2-南北向 |
value | 读/写 | string | 0-20000,单位uA |
10.1. 读操作
读取AO信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/aoInfo"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/aoInfo",
"code": 0,
"data": {
"num": 2,
"rpt_enable":1,
"rpt_type": 1,
"rpt_direction": 1,
"value": {
"0": 0,
"l": 0
}
}
}
读取AO接口数据示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/aoInfo/value"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/aoInfo/value",
"code": 0,
"data": {
"0": 0,
"l": 0,
"num-1": 0
}
}
其余属性读操作类似,不在举例。
10.2. 写操作
设置AO信息示例:
/*请求*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/aoInfo",
"data": {
"rpt_enable":1,
"rpt_type":1,
"rpt_direction": 1,
"value": {
"0": 0,
"l": 0,
"num-1": 0
}
}
}
/*响应*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/aoInfo",
"code": 0
}
其余属性写操作类似,不在举例。
msgPath支持:/socketInfo/socketInfo/x/socketInfo/x/enable/socketInfo/x/type/socketInfo/x/state/socketInfo/x/addr/socketInfo/x/port/socketInfo/x/reg/socketInfo/x/hbt/socketInfo/x/mqtt。不同属性描述如下所示:
字段 | 读/写 | 类型 | 描述 |
enable | 读/写 | int | SOCKET工作状态,0-禁用1-启用 |
type | 读/写 | int | 协议类型,0-TCP1-UDP2-MQTT |
state | 读 | int | 连接状态, 0-未连接1-连接 |
addr | 读/写 | string | 连接地址,最大字节为128 |
port | 读/写 | int | 端口 |
reg | 读/写 | string | 注册包 |
hbt | 读/写 | string | 心跳包 |
mqtt | 读/写 | string | mqtt |
注册包帧格式 | |||
字段 | 读/写 | 类型 | 描述 |
type | 读/写 | int | 0-禁用1-设备ID号 2-IMEI号3-ICCID 4-自定义 |
mode | 读/写 | int | 0-连接发送1-数据发送 |
content | 读/写 | string | 注册包内容,最大字节为128,base64字符串 |
len | 读/写 | int | 注册包长度,0-128 |
心跳包帧格式 | |||
字段 | 读/写 | 类型 | 描述 |
type | 读/写 | int | 0-禁用1-启用 |
cyc | 读/写 | int | 心跳包周期,0-65535,单位秒,默认30 |
content | 读/写 | string | 心跳包内容,最大字节为128,base64 字符串,默认为ping!!! |
len | 读/写 | int | 心跳包长度,0-128 |
mqtt帧格式 | |||
字段 | 读/写 | 类型 | 描述 |
clientId | 读/写 | string | 客户端ID,最大字节为128,默认为mqtt-clientId-x |
user | 读/写 | string | 用户名,最大字节为128 |
passwd | 读/写 | string | 密码,最大字节为128 |
keepAlive | 读/写 | int | 心跳,0-65535,单位秒,默认为60 |
clean | 读/写 | int | 清除会话,0-禁用1-启用 |
ssl | 读/写 | int | 0-禁用1-启用 |
sub | 读/写 | string | 订阅(最多同时订阅两个主题) |
pub | 读/写 | string | 发布 |
will | 读/写 | string | 遗嘱 |
pub帧格式 | |||
字段 | 读/写 | 类型 | 描述 |
topic | 读/写 | string | 发布主题,最大字节为128,默认为空 |
qos | 读/写 | int | 012 |
will帧格式 | |||
字段 | 读/写 | 类型 | 描述 |
flag | 读/写 | int | 0-禁用1-启用 |
topic | 读/写 | string | 最大字节为128,默认为will |
msg | 读/写 | string | 最大字节为128,默认为I'm offline! |
11.1. 读操作
读取socket-0信息示例:
/*请求*/
{
"msgType": "get_req",
"msgId": "123456001",
"msgPath": "/socketInfo/0"
}
/*响应*/
{
"msgType": "get_res",
"msgId": "123456001",
"msgPath": "/socketInfo/0",
"code": 0,
"data": {
"enable": 0,
"type": 1,
"state": 1,
"addr":"xxxxxxxxxxxx" ,
"port":5600,
"reg":{
"type": 1,
"mode": 1,
"content":"xxxxxxx" ,
"len":0
},
"hbt":{
"type": 1,
"mode": 1,
"content":"xxxxxxx" ,
"len":7
},
"mqtt":{
"clientId":"xxxxxxxxxxxx" ,
"user":"xxxxxxxxxxxx" ,
"passwd":"xxxxxxxxxxxx" ,
"keepAlive":60,
"clean":1,
"ssl":1,
"sub":{
"0":{
"topic":"xxxxxxxxxxxx" ,
"qos":0,
},
"1":{
"topic":"xxxxxxxxxxxx" ,
"qos":0,
}
},
"pub":{
"0":{
"topic":"xxxxxxxxxxxx" ,
"qos":0,
}
},
"will":{
"flag":0,
"topic":"xxxxxxxxxxxx" ,
"msg":"xxxxxxxxxxxx",
}
}
}
}
其余属性读操作类似,不在举例。
11.2. 写操作
设置socket-0信息示例:
/*请求*/
{
"msgType": "set_res",
"msgId": "123456001",
"msgPath": "/socketInfo/0",
"data": {
"enable": 0,
"type": 1,
"addr":"xxxxxxxxxxxx",
"port":5600,
"reg":{
"type": 1,
"mode": 1,
"content":"xxxxxxxx",
"len":8
},
"hbt":{
"type": 1,
"mode": 1,
"content":"xxxxxxxx",
"len":8
},
"mqtt":{
"clientId":"xxxxxxxxxxxx",
"user":"xxxxxxxxxxxx",
"passwd":"xxxxxxxxxxxx",
"keepAlive":30,
"clean":1,
"ssl":1,
"sub":{
"0":{
"topic":"xxxxxxxxxxxx",
"qos":1
},
"1":{
"topic":"xxxxxxxxxxxx",
"qos":1
}
},
"pub":{
"0":{
"topic":"xxxxxxxxxxxx",
"qos":1,
}
},
"will":{
"flag":1,
"topic":"xxxxxxxxxxxx",
"msg":"xxxxxxxxxxxx",
}
}
}
}
/*响应*/
{
"msgType": "set_req",
"msgId": "123456001",
"msgPath": "/socketInfo/0",
"code": 0
}
其余属性写操作类似,不在举例。