fix: 修改设备透传默认脚本
This commit is contained in:
parent
d2122de264
commit
d3605ec8f0
|
@ -164,7 +164,16 @@ import { isBoolean } from 'lodash';
|
|||
import { onlyMessage } from '@/utils/comm';
|
||||
|
||||
const defaultValue =
|
||||
'//解码函数\r\nfunction decode(context) {\r\n //原始报文\r\n var buffer = context.payload();\r\n // 转为json\r\n // var json = context.json();\r\n //mqtt 时通过此方法获取topic\r\n // var topic = context.topic();\r\n\r\n // 提取变量\r\n // var topicVars = context.pathVars("/{deviceId}/**",topic)\r\n //温度属性\r\n var temperature = buffer.getShort(3) * 10;\r\n //湿度属性\r\n var humidity = buffer.getShort(6) * 10;\r\n return {\r\n "temperature": temperature,\r\n "humidity": humidity\r\n };\r\n}\r\n';
|
||||
`//注册设备下行数据监听器,当平台下发指令给设备时,回调将被调用,用于构造下发给设备的报文
|
||||
codec.onDownstream(function(ctx){
|
||||
|
||||
});
|
||||
|
||||
//注册设备上行数据监听器,当设备上行数据时,回调将被调用,用于解析设备上报的数据.
|
||||
codec.onUpstream(function(ctx){
|
||||
|
||||
});
|
||||
`;
|
||||
|
||||
const el = ref<HTMLElement | null>(null);
|
||||
const { toggle } = useFullscreen(el);
|
||||
|
|
|
@ -123,7 +123,16 @@ import { isBoolean } from 'lodash';
|
|||
import { onlyMessage } from '@/utils/comm';
|
||||
|
||||
const defaultValue =
|
||||
'//解码函数\r\nfunction decode(context) {\r\n //原始报文\r\n var buffer = context.payload();\r\n // 转为json\r\n // var json = context.json();\r\n //mqtt 时通过此方法获取topic\r\n // var topic = context.topic();\r\n\r\n // 提取变量\r\n // var topicVars = context.pathVars("/{deviceId}/**",topic)\r\n //温度属性\r\n var temperature = buffer.getShort(3) * 10;\r\n //湿度属性\r\n var humidity = buffer.getShort(6) * 10;\r\n return {\r\n "temperature": temperature,\r\n "humidity": humidity\r\n };\r\n}\r\n';
|
||||
`//注册设备下行数据监听器,当平台下发指令给设备时,回调将被调用,用于构造下发给设备的报文
|
||||
codec.onDownstream(function(ctx){
|
||||
|
||||
});
|
||||
|
||||
//注册设备上行数据监听器,当设备上行数据时,回调将被调用,用于解析设备上报的数据.
|
||||
codec.onUpstream(function(ctx){
|
||||
|
||||
});
|
||||
`;
|
||||
|
||||
const el = ref<HTMLElement | null>(null);
|
||||
const { toggle } = useFullscreen(el);
|
||||
|
|
Loading…
Reference in New Issue