设置设备
调用说明
- 请求参数
参数 | 类型 | 说明 | 备注 |
---|---|---|---|
fun | 字符串 | /device/set | 请求功能名 |
id | 字符串 | 设备唯一ID | 需要设置设备id,多个设备用逗号隔开 |
name | 字符串 | 自定义名称 | - |
vid | 字符串 | im硬件vid | 和pid必须同时设置,设置硬件id只能设置单个设备 |
pid | 字符串 | im硬件pid | 和vid必须同时设置 |
location | 字符串 | 鼠标参数 | - |
location_crc | 字符串 | 鼠标参数crc | - |
gid | 字符串 | 分组id | - |
鼠标参数和鼠标参数crc两个参数区别,二者只需其一,建议用location_crc
鼠标参数
iMouse硬件通过不同的鼠标参数来适配不同型号的手机,用户可以自己采集
鼠标参数crc
已经采集好在鼠标参数库里面对应的参数的crc值
- httpGet请求示例
设置设备自定义名称
curl --request GET \
--url 'http://192.168.9.9:9911/api/device/set?id=9A:97:4E:C9:54:71&name=test002'
同时设置设备自定义名称和分组
curl --request GET \
--url 'http://192.168.9.9:9911/api/device/set?id=9A:97:4E:C9:54:71&name=test001&gid=0'
- httpPost请求示例
设置设备自定义名称
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'content-type: multipart/form-data' \
--form fun=/device/set \
--form id=9A:97:4E:C9:54:71 \
--form name=test002
同时设置设备自定义名称和分组
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'content-type: multipart/form-data' \
--form fun=/device/set \
--form id=9A:97:4E:C9:54:71 \
--form name=test001 \
--form gid=0
- httpPost json请求示例【websocket也可发送同样json请求】
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'Content-Type: application/json' \
--data '{
"fun": "/device/set",
"data": {
"id": "90:81:58:EE:D1:9E",
"name": "test002"
}
}'
同时设置设备自定义名称和分组
curl --request POST \
--url http://192.168.9.9:9911/api \
--header 'Content-Type: application/json' \
--data '{
"fun": "/device/set",
"data": {
"id": "90:81:58:EE:D1:9E",
"name": "test002",
"gid": "0"
}
}'
响应结果
{
"data": {
"list": [
"90:81:58:EE:D1:9E"
],
"code": 0,
"id": "90:81:58:EE:D1:9E",
"message": "成功"
},
"status": 200,
"message": "成功",
"msgid": 0,
"fun": "/device/set"
}
- 响应data数据字段说明
list数组返回所有设置成功的设备唯一id