|
@@ -245,7 +245,7 @@ export default {
|
|
|
that.SendOrder("09", "关闭脑控");
|
|
|
ble_store.setters.setCurrentToyId("00");
|
|
|
},1000);
|
|
|
- //如果是一代脑机则发送00教具
|
|
|
+ //如果是一代脑机则发送 00 教具
|
|
|
if (isJELLYFISH()) {
|
|
|
setTimeout(()=>{
|
|
|
that.sendConnectOneToMore('00');
|
|
@@ -263,11 +263,10 @@ export default {
|
|
|
let { deviceId, serviceId, characteristicWriteId } = getDeviceWriteInfo();
|
|
|
let $code = ble_store.getters.getDeviceSn();
|
|
|
if (deviceId && serviceId && characteristicWriteId) {
|
|
|
- let that = this;
|
|
|
let $hex_header = "aa cc ";
|
|
|
let $hex_sum = 0;
|
|
|
let $hex_ary = $hex.split(" ");
|
|
|
- $hex_ary.forEach(($val, $index) => {
|
|
|
+ $hex_ary.forEach(($val) => {
|
|
|
$hex_sum += parseInt($val, 16);
|
|
|
})
|
|
|
let $checksum = ($hex_sum ^ parseInt("ffffffff", 16)) & parseInt("ff", 16);
|
|
@@ -283,7 +282,7 @@ export default {
|
|
|
serviceId: serviceId,
|
|
|
characteristicId: characteristicWriteId,
|
|
|
value: buffer,
|
|
|
- success: function (res) {
|
|
|
+ success: function () {
|
|
|
LOG_WECHAT($code, "写入指令:", $hex, $comments);
|
|
|
},
|
|
|
fail: function (err) {
|
|
@@ -504,7 +503,9 @@ export default {
|
|
|
//判断游戏是否游戏中
|
|
|
let $game_status = game_store.getters.getGameStatus();
|
|
|
if ($game_status === 1 || $game_status === 2) {
|
|
|
- $this.endTheGame();
|
|
|
+ if($this && $this.$options.name && $this.$options.name === "StartGames"){
|
|
|
+ $this.endTheGame();
|
|
|
+ }
|
|
|
Notify({
|
|
|
type: 'danger',
|
|
|
duration: 0,
|
|
@@ -519,7 +520,7 @@ export default {
|
|
|
//关闭脑控
|
|
|
// connect_toy = false;
|
|
|
game_store.setters.setGameStatus(0);
|
|
|
- // 清空链接得设备 三值
|
|
|
+ // 清空链接得设备
|
|
|
ble_store.setters.clearDeviceToy();
|
|
|
$this.connect_toy = 0;
|
|
|
//$this.connect_show = false;
|
|
@@ -540,7 +541,7 @@ export default {
|
|
|
*/
|
|
|
reconnect($deviceId, $this) {
|
|
|
let that = this;
|
|
|
- let $deviceInfo = getServicesAndCharateristc();
|
|
|
+ let $deviceInfo = getDeviceWriteInfo();
|
|
|
//重连的次数
|
|
|
let $connect_count = 0;
|
|
|
let $rec = setInterval(() => {
|
|
@@ -563,7 +564,7 @@ export default {
|
|
|
}
|
|
|
// that.sendToyPower();
|
|
|
},
|
|
|
- fail(res) {
|
|
|
+ fail() {
|
|
|
Notify({type: 'danger', message: `第${$connect_count}次重新连接失败`});
|
|
|
game_store.setters.setGameCloseStatus(1);
|
|
|
}
|
|
@@ -595,11 +596,10 @@ export default {
|
|
|
//$this.connect_show = false;
|
|
|
$this.device_bg = false;
|
|
|
//$this.connect_status = false;
|
|
|
-
|
|
|
// 断开教具及蓝牙连接
|
|
|
- that.SendOrder("31", "断开教具及蓝牙连接");
|
|
|
setTimeout(()=>{
|
|
|
- that.SendOrder("09", "关闭脑控");
|
|
|
+ that.SendOrder("31", "断开教具及蓝牙连接");
|
|
|
+ // that.SendOrder("09", "关闭脑控");
|
|
|
// 移除搜索到新设备的事件的全部监听函数
|
|
|
wx.offBluetoothDeviceFound();
|
|
|
// 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。
|