pluginInfo.json 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. [ {
  2. "createDept" : null,
  3. "createBy" : null,
  4. "createTime" : 1708317062484,
  5. "updateBy" : null,
  6. "updateTime" : 1708317122265,
  7. "id" : 516835985375301,
  8. "pluginId" : "http-plugin",
  9. "name" : "http插件",
  10. "description" : "http示例插件,配置参数:端口(port)默认9081-初次使用,请重新上传",
  11. "deployType" : "upload",
  12. "file" : "http-plugin-1.0.1-repackage.jar",
  13. "version" : "1.0.1",
  14. "type" : null,
  15. "protocol" : null,
  16. "state" : "stopped",
  17. "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]",
  18. "config" : null,
  19. "script" : ""
  20. }, {
  21. "createDept" : null,
  22. "createBy" : null,
  23. "createTime" : 1708317067797,
  24. "updateBy" : null,
  25. "updateTime" : 1708317171964,
  26. "id" : 516836007116869,
  27. "pluginId" : "mqtt-plugin",
  28. "name" : "mqtt插件",
  29. "description" : "mqtt示例插件-初次使用,请重新上传",
  30. "deployType" : "upload",
  31. "file" : "mqtt-plugin-1.0.1-repackage.jar",
  32. "version" : "1.0.1",
  33. "type" : null,
  34. "protocol" : null,
  35. "state" : "stopped",
  36. "configSchema" : "[\n {\n \"id\": \"port\",\n \"name\": \"端口\",\n \"type\": \"number\",\n \"value\": 1883,\n \"desc\": \"mqtt端口,默认为1883\"\n }\n]",
  37. "config" : null,
  38. "script" : ""
  39. }, {
  40. "createDept" : null,
  41. "createBy" : null,
  42. "createTime" : 1708317072837,
  43. "updateBy" : null,
  44. "updateTime" : 1708317204758,
  45. "id" : 516836027760709,
  46. "pluginId" : "tcp-plugin",
  47. "name" : "tcp插件",
  48. "description" : "tcp示例插件-初次使用,请重新上传",
  49. "deployType" : "upload",
  50. "file" : "tcp-plugin-1.0.4-repackage.jar",
  51. "version" : "1.0.4",
  52. "type" : null,
  53. "protocol" : null,
  54. "state" : "stopped",
  55. "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]",
  56. "config" : null,
  57. "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}"
  58. } ]