02-手机发送主题连接主控设备

  1. import communication from "@/common/socket/communication";
  2. // 第一步先建立socket连接
  3. communication.connect(themeId).then(res=>{
  4. // socket连接成功后,使用res发送主控连接信息
  5. if(res.status == true) {
  6. res.socket.sendBytes(res.bytes);
  7. }else{
  8. // 连接失败
  9. }
  10. });

03-手机发送固件升级

  1. import communication from "@/common/socket/communication";
  2. communication.firmwareUpdate(
  3. themeId, // 主题id
  4. todo // 执行指令 '01'执行升级 '02'不执行升级
  5. ).then(res=>{
  6. if(res.status == true) { // 返回是否成功
  7. console.log(res.msg) // 返回的信息
  8. }else{
  9. console.log(res.msg)
  10. }
  11. })
  12. res:{
  13. status:false / true ,
  14. msg: "信息",
  15. bytes: [] , 设备返回
  16. }

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-手机发送控制分区模块

暂无处理