|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <view style="height: 50px;"></view>
|
|
|
+ <view style="height: 20px;"></view>
|
|
|
<view>
|
|
|
<view class="title">Cocos预览地址:{{LocationGameUrl}}</view>
|
|
|
<input class="uni-input" :value="LocationGameUrl" @input="onKeyInput" placeholder="输入cocos预览地址" />
|
|
|
@@ -33,8 +33,10 @@
|
|
|
<button style="margin: 10rpx;" type="primary" @click="writeBLEValue('M')">mac</button>
|
|
|
</view>
|
|
|
<view v-if="currentItem" style="display: flex;flex-direction: row;">
|
|
|
- <button style="margin: 10rpx;" type="primary" @click="writeBLEValue('H')">开启高速</button>
|
|
|
- <button style="margin: 10rpx;" type="primary" @click="writeBLEValue('h')">关闭高速</button>
|
|
|
+ <!-- <button style="margin: 10rpx;" type="primary" @click="writeBLEValue('H')">开启高速</button> -->
|
|
|
+ <!-- <button style="margin: 10rpx;" type="primary" @click="writeBLEValue('h')">关闭高速</button> -->
|
|
|
+ <button style="margin: 10rpx;" type="primary" @click="writeBLEValue('3')">开启</button>
|
|
|
+ <button style="margin: 10rpx;" type="primary" @click="writeBLEValue('4')">关闭</button>
|
|
|
</view>
|
|
|
<scroll-view class="text-box" scroll-y="true">
|
|
|
<scroll-view scroll-x="true">
|
|
|
@@ -42,16 +44,17 @@
|
|
|
</scroll-view>
|
|
|
</scroll-view>
|
|
|
|
|
|
- <button type="warn" :disabled="extraLine.length<=0" @click="remove">
|
|
|
- 清除输入框数据
|
|
|
- </button>
|
|
|
<button style="margin-top: 2px;" type="warn" :disabled="!currentItem" @click="onShowGame">
|
|
|
显示游戏
|
|
|
</button>
|
|
|
+ <button type="warn" :disabled="extraLine.length<=0" @click="remove">
|
|
|
+ 清除输入框数据
|
|
|
+ </button>
|
|
|
|
|
|
- <button style="margin-top: 2px;" type="warn" @click="onEmit">
|
|
|
+
|
|
|
+ <!-- <button style="margin-top: 2px;" type="warn" @click="onEmit">
|
|
|
模拟发送
|
|
|
- </button>
|
|
|
+ </button> -->
|
|
|
|
|
|
<!-- <button style="margin-top: 2px;" type="warn" @click="onClise">
|
|
|
close
|
|
|
@@ -79,7 +82,7 @@
|
|
|
computed: mapState(['bOpenBluetooth', 'bOpenSuccess', 'bListenAdapterStateChange', 'bListenDeviceFound',
|
|
|
'BLEConnectDevice', 'BLEGetServices', 'cIndex', 'bConnection', 'bVerifiedConnection', 'BLEInfoList',
|
|
|
'BLEDeviceShowList', 'finallyUseDevice', 'systemInfo', 'guideUnlockState', 'currentModeIndex',
|
|
|
- "bListenerAccArray", 'LocationGameUrl','bGamePlaying'
|
|
|
+ "bListenerAccArray", 'LocationGameUrl', 'bGamePlaying'
|
|
|
]),
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -128,8 +131,7 @@
|
|
|
uni.$on('retryConnectBLESuccess', this.onRetryConnectBLESuccess);
|
|
|
uni.$on('callbackCloseBLE', this.hardCallbackCloseBLE);
|
|
|
uni.$on('listenerBLE', this.onListenerBLE);
|
|
|
- uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
|
|
|
-
|
|
|
+
|
|
|
this.BLEInfoList.forEach((item, index, selfarr) => {
|
|
|
if (item.deviceType == 'BLEHandle' && item.usageMode == 'hotman') {
|
|
|
let item = Object.assign({}, selfarr[index], {
|
|
|
@@ -145,8 +147,6 @@
|
|
|
* $on 之后要调用 $off,不然会重复绑定
|
|
|
*/
|
|
|
this.onGetLocationGameUrl();
|
|
|
-
|
|
|
-
|
|
|
uni.$on("log", this.add)
|
|
|
|
|
|
},
|
|
|
@@ -154,21 +154,22 @@
|
|
|
uni.$off('retryConnectBLESuccess', this.onRetryConnectBLESuccess);
|
|
|
uni.$off('callbackCloseBLE', this.hardCallbackCloseBLE);
|
|
|
uni.$off('listenerBLE', this.onListenerBLE);
|
|
|
- uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
|
|
|
//清除定时器
|
|
|
this.onClearTimeout();
|
|
|
-
|
|
|
-
|
|
|
uni.$off("log", this.add)
|
|
|
|
|
|
},
|
|
|
onShow() {
|
|
|
this.bShow = true;
|
|
|
+ uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
|
|
|
+
|
|
|
},
|
|
|
onReady() {},
|
|
|
onHide() {
|
|
|
//如果蓝牙弹出匹配框,会触发onHide。这时候处理蓝牙连接流程检测应等onShow 时候,再检测
|
|
|
this.bShow = false;
|
|
|
+
|
|
|
+ uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations(['initAdapter', 'onCreateBLESuccess', 'onGetBLEDeviceServices', 'onOnlyCloseBLEConnection',
|
|
|
@@ -187,7 +188,7 @@
|
|
|
// uni.$emit("showGame");
|
|
|
// this.bShowGame = true;
|
|
|
uni.navigateTo({
|
|
|
- url:"../game/game"
|
|
|
+ url: "../game/game"
|
|
|
})
|
|
|
},
|
|
|
//设备回调事件
|
|
|
@@ -197,17 +198,27 @@
|
|
|
// if (!this.bShow) return;
|
|
|
// this.add(JSON.stringify(data));
|
|
|
if (this.bGamePlaying) return;
|
|
|
- let str = "";
|
|
|
- for (let i = 0; i < data.length; i++) {
|
|
|
- str +=
|
|
|
- "ax:" + data[i].acc.ax + "\n" +
|
|
|
- "ay:" + data[i].acc.ay + "\n" +
|
|
|
- "az:" + data[i].acc.az + "\n" +
|
|
|
- "gx:" + data[i].gyro.gx + "\n" +
|
|
|
- "gy:" + data[i].gyro.gy + "\n" +
|
|
|
- "gz:" + data[i].gyro.gz + "\n" +
|
|
|
- "ms:" + data[i].ms + "\n" ;
|
|
|
- }
|
|
|
+ // let str = "";
|
|
|
+ // for (let i = 0; i < data.length; i++) {
|
|
|
+ // str +=
|
|
|
+ // "ax:" + data[i].acc.ax + "\n" +
|
|
|
+ // "ay:" + data[i].acc.ay + "\n" +
|
|
|
+ // "az:" + data[i].acc.az + "\n" +
|
|
|
+ // "gx:" + data[i].gyro.gx + "\n" +
|
|
|
+ // "gy:" + data[i].gyro.gy + "\n" +
|
|
|
+ // "gz:" + data[i].gyro.gz + "\n" +
|
|
|
+ // "ms:" + data[i].ms + "\n" ;
|
|
|
+ // }
|
|
|
+ let str =
|
|
|
+ "ax:" + data.acc.ax + "\n" +
|
|
|
+ "ay:" + data.acc.ay + "\n" +
|
|
|
+ "az:" + data.acc.az + "\n" +
|
|
|
+ "gx:" + data.gyro.gx + "\n" +
|
|
|
+ "gy:" + data.gyro.gy + "\n" +
|
|
|
+ "gz:" + data.gyro.gz + "\n" +
|
|
|
+ "min:" + data.min + "\n" +
|
|
|
+ "s:" + data.s + "\n" +
|
|
|
+ "ms:" + data.ms + "\n";
|
|
|
this.text = str;
|
|
|
// this.text =
|
|
|
// "ax:" + data.acc.ax + "\n" +
|