02-手机发送主题连接主控设备
import communication from "@/common/socket/communication";// 第一步先建立socket连接communication.connect(themeId).then(res=>{// socket连接成功后,使用res发送主控连接信息if(res.status == true) {res.socket.sendBytes(res.bytes);}else{// 连接失败}});
03-手机发送固件升级
import communication from "@/common/socket/communication";communication.firmwareUpdate(themeId, // 主题idtodo // 执行指令 '01'执行升级 '02'不执行升级).then(res=>{if(res.status == true) { // 返回是否成功console.log(res.msg) // 返回的信息}else{console.log(res.msg)}})res:{status:false / true ,msg: "信息",bytes: [] , 设备返回}
04-手机发送下载程序
import communication from "@/common/socket/communication";
communication.downloadData(themeId).then(res=>{
});
// setTimeout 2000 递归获取下载的结果
this.$connectors.get(themeId).DW_FINISHED = true / false // 检查下载是否完成
this.$connectors.get(themeId).DW_RETURN =
{
status:true,
msg:"提示信息"
}
05-手机发送启动主题
import communication from "@/common/socket/communication";
communication.startUp( themeId , md5 )
06-手机发送复位主题
import communication from "@/common/socket/communication";
communication.reset( themeId , md5 )
07-手机发送主题跳关
import communication from "@/common/socket/communication";
communication.jumpOff( themeId , md5 )
08-手机发送控制输出端口
import communication from "@/common/socket/communication";
communication.outputPort(
themeId,
open, // 触发的端口号数组 [1,2,3,4]
close, // 非触发的端口号数组 [4,5,6]
)
09-手机发送控制MP3
import communication from "@/common/socket/communication";
var config = {
"category":1, // 分区模块值
"type" : "YX", // 类型,YX音效 BJ背景
"value":1,
"play":true
}
communication.mp3(
themeId,
config
)
10-手机发送控制MP4
import communication from "@/common/socket/communication";
var config = {
"category":1,
"label":"视频1",
"type" : "SP", // 类型,TP图片 SP视频
"value":1,
"play":true
}
communication.mp4(
themeId,
config
)
11-手机发送控制电机
12-手机发送控制帕灯
13-手机发送获取输入端口
import communication from "@/common/socket/communication";
// 开始进入调试模式
communication.inputPort(themeId)
// 进入调试后,递归100毫秒,执行监听端口变化 CALLBACK
this.$connectors.get(themeId).CALLBACK
// CALLBACK 的数据格式如下
this.CALLBACK =
{ status: true,
msg: "接收成功",
bytes: arr,
open: open, // 触发的端口号 [1,2,3]
close: close // 非触发的端口号 [4,5,6]
};
14-手机发送获取用户权限
import communication from "@/common/socket/communication";
communication.fetchUserPower( themeId ).then(res=>{
if(res.status == true){
console.log(res.users); // 用户权限数组
}
})
15-手机发送保存用户权限
import communication from "@/common/socket/communication";
communication.saveUserPower(
themeId,
users // 用户权限列表 [ "ABCD1234","SSSS9999" ]
)
16-手机发送试运行机关
17-手机发送控制分区模块
暂无处理
