Browse Source

update 初始化插件数据状态

jay 1 năm trước cách đây
mục cha
commit
4c13d09f27
1 tập tin đã thay đổi với 6 bổ sung6 xóa
  1. 6 6
      data/init/pluginInfo.json

+ 6 - 6
data/init/pluginInfo.json

@@ -7,13 +7,13 @@
   "id" : 516835985375301,
   "pluginId" : "http-plugin",
   "name" : "http插件",
-  "description" : "http示例插件,配置参数:端口(port)默认9081",
+  "description" : "http示例插件,配置参数:端口(port)默认9081-初次使用,请重新上传",
   "deployType" : "upload",
   "file" : "http-plugin-1.0.1-repackage.jar",
   "version" : "1.0.1",
   "type" : null,
   "protocol" : null,
-  "state" : "running",
+  "state" : "stopped",
   "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" : ""
@@ -26,13 +26,13 @@
   "id" : 516836007116869,
   "pluginId" : "mqtt-plugin",
   "name" : "mqtt插件",
-  "description" : "mqtt示例插件",
+  "description" : "mqtt示例插件-初次使用,请重新上传",
   "deployType" : "upload",
   "file" : "mqtt-plugin-1.0.1-repackage.jar",
   "version" : "1.0.1",
   "type" : null,
   "protocol" : null,
-  "state" : "running",
+  "state" : "stopped",
   "configSchema" : "[\n  {\n    \"id\": \"port\",\n    \"name\": \"端口\",\n    \"type\": \"number\",\n    \"value\": 1883,\n    \"desc\": \"mqtt端口,默认为1883\"\n  }\n]",
   "config" : null,
   "script" : ""
@@ -45,13 +45,13 @@
   "id" : 516836027760709,
   "pluginId" : "tcp-plugin",
   "name" : "tcp插件",
-  "description" : "tcp示例插件",
+  "description" : "tcp示例插件-初次使用,请重新上传",
   "deployType" : "upload",
   "file" : "tcp-plugin-1.0.4-repackage.jar",
   "version" : "1.0.4",
   "type" : null,
   "protocol" : null,
-  "state" : "running",
+  "state" : "stopped",
   "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}"