58 lines
3.2 KiB
JSON
58 lines
3.2 KiB
JSON
[ {
|
||
"createDept" : null,
|
||
"createBy" : null,
|
||
"createTime" : 1708317062484,
|
||
"updateBy" : null,
|
||
"updateTime" : 1708317122265,
|
||
"id" : 516835985375301,
|
||
"pluginId" : "http-plugin",
|
||
"name" : "http插件",
|
||
"description" : "http示例插件,配置参数:端口(port)默认9081",
|
||
"deployType" : "upload",
|
||
"file" : "http-plugin-1.0.1-repackage.jar",
|
||
"version" : "1.0.1",
|
||
"type" : null,
|
||
"protocol" : null,
|
||
"state" : "running",
|
||
"configSchema" : "[\n {\n \"id\": \"port\",\n \"name\": \"端口\",\n \"type\": \"number\",\n \"value\": 9081,\n \"desc\": \"http端口,默认为9081\"\n },\n {\n \"id\": \"a\",\n \"name\": \"测试参数1\",\n \"type\": \"radio\",\n \"value\": 0,\n \"desc\": \"单选参数a\",\n \"options\": [\n {\n \"name\": \"值0\",\n \"value\": 0\n },\n {\n \"name\": \"值1\",\n \"value\": 11\n }\n ]\n }\n]",
|
||
"config" : null,
|
||
"script" : ""
|
||
}, {
|
||
"createDept" : null,
|
||
"createBy" : null,
|
||
"createTime" : 1708317067797,
|
||
"updateBy" : null,
|
||
"updateTime" : 1708317171964,
|
||
"id" : 516836007116869,
|
||
"pluginId" : "mqtt-plugin",
|
||
"name" : "mqtt插件",
|
||
"description" : "mqtt示例插件",
|
||
"deployType" : "upload",
|
||
"file" : "mqtt-plugin-1.0.1-repackage.jar",
|
||
"version" : "1.0.1",
|
||
"type" : null,
|
||
"protocol" : null,
|
||
"state" : "running",
|
||
"configSchema" : "[\n {\n \"id\": \"port\",\n \"name\": \"端口\",\n \"type\": \"number\",\n \"value\": 1883,\n \"desc\": \"mqtt端口,默认为1883\"\n }\n]",
|
||
"config" : null,
|
||
"script" : ""
|
||
}, {
|
||
"createDept" : null,
|
||
"createBy" : null,
|
||
"createTime" : 1708317072837,
|
||
"updateBy" : null,
|
||
"updateTime" : 1708317204758,
|
||
"id" : 516836027760709,
|
||
"pluginId" : "tcp-plugin",
|
||
"name" : "tcp插件",
|
||
"description" : "tcp示例插件",
|
||
"deployType" : "upload",
|
||
"file" : "tcp-plugin-1.0.4-repackage.jar",
|
||
"version" : "1.0.4",
|
||
"type" : null,
|
||
"protocol" : null,
|
||
"state" : "running",
|
||
"configSchema" : "[\n {\n \"id\": \"host\",\n \"name\": \"绑定ip\",\n \"type\": \"text\",\n \"value\": \"127.0.0.1\",\n \"desc\": \"tcp绑定ip,默认为127.0.0.1\"\n },\n {\n \"id\": \"port\",\n \"name\": \"端口\",\n \"type\": \"number\",\n \"value\": 6883,\n \"desc\": \"tcp端口,默认为6883\"\n }\n]",
|
||
"config" : null,
|
||
"script" : "function hexToByte(hexString) {\n if (hexString.length % 2 !== 0) {\n throw new Error('Invalid hex string. String must have an even number of characters.');\n }\n\n let byteArray = [];\n for (let i = 0; i < hexString.length; i += 4) {\n byteArray.push(parseInt(hexString.substr(i, 4), 16));\n }\n\n return byteArray;\n}\nfunction byteToHex(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n return hex.join(\"\");\n}\n\nthis.decode=function(data){\n hex=data.payload;\n const bytes=hexToByte(hex);\n return {\n \"rssi\":bytes[0],\n \"powerstate\":bytes[1]\n };\n}\n\nthis.encode=function(params){\n const hex=byteToHex([params.powerstate]);\n return hex;\n}"
|
||
} ] |