|
@@ -152,7 +152,9 @@ export default {
|
|
|
if (connect_toy) {
|
|
|
that.SendOrder('8a')
|
|
|
}else{
|
|
|
- clearInterval(toy_intv)
|
|
|
+ if ($game_status!=1) {
|
|
|
+ clearInterval(toy_intv)
|
|
|
+ }
|
|
|
}
|
|
|
}, 3000)
|
|
|
} else {
|
|
@@ -293,14 +295,14 @@ export default {
|
|
|
//重连的次数
|
|
|
let $connect_count = 0;
|
|
|
let $rec = setInterval(() => {
|
|
|
- $connect_count += 1;
|
|
|
let $game_status = game_store.getters.getGameStatus();
|
|
|
if ($game_status == 1) {
|
|
|
wx.createBLEConnection({
|
|
|
deviceId: $deviceInfo.deviceId,
|
|
|
success(res) {
|
|
|
+ clearInterval($rec)
|
|
|
Notify({ type: 'success', message: `第${$connect_count}次重新连接成功` });
|
|
|
- LogInDb(`${that.getNowTime} 第${$connect_count}次重新连接成功`)
|
|
|
+ LogInDb(`${that.getNowTime()} 第${$connect_count}次重新连接成功`)
|
|
|
let $system = wx.getSystemInfoSync()
|
|
|
if ($system.platform == 'ios') {
|
|
|
that.getBLEDeviceServices($deviceInfo.deviceId)
|
|
@@ -309,9 +311,8 @@ export default {
|
|
|
that.openNotify($this)
|
|
|
that.watch_bluetooth_status($this);
|
|
|
}
|
|
|
- that.sendToyPower();
|
|
|
+ // that.sendToyPower();
|
|
|
|
|
|
- clearInterval($rec)
|
|
|
},
|
|
|
fail(res) {
|
|
|
Notify({ type: 'danger', message: `第${$connect_count}次重新连接失败` });
|
|
@@ -322,10 +323,11 @@ export default {
|
|
|
$this.game_finished();
|
|
|
clearInterval($rec)
|
|
|
}
|
|
|
+ $connect_count += 1;
|
|
|
} else {
|
|
|
clearInterval($rec)
|
|
|
}
|
|
|
- }, 5000)
|
|
|
+ }, 7000)
|
|
|
|
|
|
},
|
|
|
|
|
@@ -412,7 +414,6 @@ export default {
|
|
|
state: true,
|
|
|
success() {
|
|
|
that.watchingDevice($this)
|
|
|
- that.sendOpenBigData();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -483,6 +484,11 @@ export default {
|
|
|
that.SendOrder("8a")
|
|
|
}
|
|
|
|
|
|
+ //防止在首页 连接的时候重复 选择教具 产生了发送多个教具电量
|
|
|
+ // if(hexStr.toUpperCase().indexOf("AAEE8A000000FF76") != -1){
|
|
|
+ // that.connect_toy = false;
|
|
|
+ // }
|
|
|
+
|
|
|
if (hexStr.toUpperCase().indexOf("AAEE07") != -1) {
|
|
|
that.sendControl();
|
|
|
}
|
|
@@ -523,9 +529,18 @@ export default {
|
|
|
});
|
|
|
$this.toy_connected = true;
|
|
|
connect_toy = true;
|
|
|
+
|
|
|
$this.change_toy_connect_status(2);
|
|
|
//连接成功后 获取一次教具名称
|
|
|
- that.SendOrder('87')
|
|
|
+
|
|
|
+
|
|
|
+ //TODO 2022-5-25 08:51:15 延迟发送教具UUID
|
|
|
+ //2022年5月25日17:21:57 从2秒更换到3秒
|
|
|
+ setTimeout(()=>{
|
|
|
+ that.SendOrder('87')
|
|
|
+ },3000)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if (new RegExp("02").test($hex_index) == true) {
|
|
@@ -536,7 +551,7 @@ export default {
|
|
|
title: "教具重连成功"
|
|
|
})
|
|
|
that.sendControl()
|
|
|
- that.sendToyPower();
|
|
|
+ // that.sendToyPower();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -629,18 +644,6 @@ export default {
|
|
|
if (hexStr.toUpperCase().indexOf("AADD07") != -1) {
|
|
|
ble_store.setters.setBluetoothLinkStatus(true)
|
|
|
FlagOpenControl = true;
|
|
|
- if ($game_status != 1) {
|
|
|
- setTimeout(() => {
|
|
|
- mpvue.navigateTo({
|
|
|
- url: "/pages/start/main",
|
|
|
- success() {
|
|
|
- // 设置游戏状态为游戏中
|
|
|
- game_store.setters.setGameStatus(1);
|
|
|
- $this.gameStart();
|
|
|
- },
|
|
|
- });
|
|
|
- }, 800);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -945,5 +948,25 @@ export default {
|
|
|
const millSeconds = date.getMilliseconds();
|
|
|
|
|
|
return `${year}/${month}/${day} ${hour}:${minutes}:${seconds}.${millSeconds}`;
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自动发送RF重连
|
|
|
+ * @param {Boolean} isOn 是否打开重连功能
|
|
|
+ * @param {[type]} timeOut 有效时间
|
|
|
+ * @return {[type]} [description]
|
|
|
+ * AA CC 03 00 01 0a d0 21
|
|
|
+ */
|
|
|
+ sendAutoConnectRf(isOn,timeOut){
|
|
|
+ let that = this;
|
|
|
+ let onVal = isOn?'01':'00';
|
|
|
+ let mTimeOut = timeOut.toString(16);
|
|
|
+
|
|
|
+ if (mTimeOut.length==1) {
|
|
|
+ mTimeOut = `0${mTimeOut}`
|
|
|
+ }
|
|
|
+
|
|
|
+ let $hexStr = `03 00 ${onVal} ${mTimeOut} d0`;
|
|
|
+ this.WriteBufferInBle($hexStr)
|
|
|
}
|
|
|
};
|