Browse Source

1.合并 调整 蓝牙指令输入
2.添加store ios 测试

apple 5 years ago
parent
commit
7347defcfc

+ 5 - 3
common/config.js

@@ -1,3 +1,8 @@
+//设置游戏列表的更新时间,超过这个时间,不显示出来
+//"2020-07-14"
+const endTime = "2021-01-22"
+
+
 //线上地址,腾讯云服务器
 // const host="https://www.9527fun.cn/api_prd"
 //测试地址,阿里云服务器
@@ -134,9 +139,6 @@ const URL = {
 	APPVERSIONUPDATE:`${host}/app/version_update`,
 }
 
-//设置游戏列表的更新时间,超过这个时间,不显示出来
-//"2020-07-14"
-const endTime = "2021-01-21"
 
 export default {
 	URL,

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "description" : "",
-    "versionName" : "2.1.0",
-    "versionCode" : 21012101,
+    "versionName" : "2.1.1",
+    "versionCode" : 21012201,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 9 - 23
pages/game-page/game-play-sub/subGame/subGame.nvue

@@ -141,16 +141,7 @@
 					_self.onWriteBLEConnectionValue({
 						value: "6"
 					});
-					// _self.onWriteBLEConnectionValue({
-					// 	value: "4",
-					// 	getSuccess:()=>{
-					// 		// 发送获取mac
-					// 		_self.onWriteBLEConnectionValue({
-					// 			value: "6"
-					// 		});
-					// 	}
-					// });
-
+				
 					uni.$off('updateBLEDeviceData', _self.gWatchBLEUpdate);
 				}
 				uni.$emit("game-unload", {
@@ -600,19 +591,14 @@
 						this.onWriteBLEConnectionValue({
 							value: "3"
 						});
-						//开启设备频率 20ms
-						this.onWriteBLEConnectionValue({
-							value: "b"
-						});
-						// this.onWriteBLEConnectionValue({
-						// 	value: "3",
-						// 	getSuccess:()=>{
-						// 		// 发送获取mac
-						// 		this.onWriteBLEConnectionValue({
-						// 			value: "b"
-						// 		});
-						// 	}
-						// });
+						setTimeout(()=>{
+							//设置加速计20ms
+							this.onWriteBLEConnectionValue({
+								value: "b"
+							});
+							
+						},2000)
+						
 						uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
 
 						if (this.BLEConnectDevice.usageMode == "phone" || this.BLEConnectDevice.usageMode == "general") {

+ 10 - 6
pages/personal-page/devices-hardware/devices-hardware.vue

@@ -28,9 +28,6 @@
 			</view>
 		</view>
 
-		<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'M'})">设备版本</button> -->
-		<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'4'})">加速计关</button> -->
-
 	</view>
 
 
@@ -550,17 +547,20 @@
 				}
 				//如果已经连接,加上服务不存在,直接获取服务
 				if (this.bConnection && this.BLEGetServices && this.BLEGetServices.length == 0) {
-					// console.log('onGetBLEDeviceServices');
 					console.log("***直接获取服务*******");
 					this.onGetBLEDeviceServices({
 						item: item,
 						success: (res) => {
-							console.log("onGetBLEDeviceServices************");
+							console.log("*****getBLEDeviceServices************");
 							//连接成功了,设置旧的item
 							this.oldItem = this.currentItem;
 							// 初始化服务后,获取版本,判断
 							// 停止蓝牙加速计
 							this.writeMacTimeout = setTimeout(() => {
+								//停止蓝牙加速计
+								this.onWriteBLEConnectionValue({
+									value: "4"
+								});
 								// 发送获取mac
 								this.onWriteBLEConnectionValue({
 									value: "M"
@@ -598,12 +598,16 @@
 							this.onGetBLEDeviceServices({
 								item: item,
 								success: (res) => {
-									console.log("onGetBLEDeviceServices************", res);
+									console.log("******getBLEDeviceServices************", res);
 									//连接成功了,设置旧的item
 									this.oldItem = this.currentItem;
 									// 初始化服务后,获取版本,判断
 									// 停止蓝牙加速计
 									this.writeMacTimeout = setTimeout(() => {
+										//停止蓝牙加速计
+										this.onWriteBLEConnectionValue({
+											value: "4"
+										});
 										// 发送获取mac
 										this.onWriteBLEConnectionValue({
 											value: "M"

+ 10 - 27
pages/personal-page/personal/personal.vue

@@ -283,20 +283,6 @@
 							</view> -->
 						</view>
 						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'V'})">设备版本</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'M'})">设备版本</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'S'})">关闭设备</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'L'})">设置左手</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'R'})">设置右手</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'1'})">手柄按键开</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'2'})">手柄按键关</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'3'})">加速计开</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'c'})">字符c</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'4'})">加速计关</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'5'})">陀螺仪开</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'6'})">陀螺仪关</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'7'})">沙袋模式开</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'8'})">沙袋模式关</button> -->
-						<!-- <button class="margin" @click="onWriteBLEConnectionValue({value:'A'})">字符A</button> -->
 						<!-- <button class="margin" @click="openAcc">开启手机加速计和方向传感器</button> -->
 						<!-- <button class="margin" @click="closeAcc">关闭手机加速计和方向传感器</button> -->
 						<!-- <button class="margin" @click="openGyro">开启手机加速计和方向传感器</button> -->
@@ -1771,19 +1757,16 @@
 						this.onWriteBLEConnectionValue({
 							value: "3"
 						});
-						//设置加速计20ms
-						this.onWriteBLEConnectionValue({
-							value: "b"
-						});
-						// this.onWriteBLEConnectionValue({
-						// 	value: "3",
-						// 	getSuccess:()=>{
-						// 		// 发送获取mac
-						// 		this.onWriteBLEConnectionValue({
-						// 			value: "b"
-						// 		});
-						// 	}
-						// });
+						
+						setTimeout(()=>{
+							//设置加速计20ms
+							this.onWriteBLEConnectionValue({
+								value: "b"
+							});
+							
+						},1000)
+						
+					
 						//监听蓝牙回调
 						uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
 

+ 20 - 5
util/util-js/store.js

@@ -1388,7 +1388,9 @@ const store = new Vuex.Store({
 					}
 
 					state.getBLEDeviceServicesTimeout = setTimeout(() => {
+						let retryCount = 5;
 						this.commit("B_GetBLEDeviceServices", {
+							retryCount:retryCount,
 							item: item,
 							callback: () => {
 								uni.showToast({
@@ -1533,7 +1535,9 @@ const store = new Vuex.Store({
 				item,
 				success = null,
 			} = context;
+			let retryCount = 5;
 			this.commit("B_GetBLEDeviceServices", {
+				retryCount:retryCount,
 				item: item,
 				callback: success,
 				getServiceList: (serviceList) => {
@@ -1634,7 +1638,7 @@ const store = new Vuex.Store({
 			} else if (value == "6") {
 				state.instructionState.bSteps = false;
 			}
-			let retryCount = 4;
+			let retryCount = 5;
 			this.commit("B_WriteBLECharacteristicValue", {
 				value,
 				retryCount,
@@ -1926,6 +1930,7 @@ const store = new Vuex.Store({
 		B_GetBLEDeviceServices(state, context) {
 
 			let {
+				retryCount,
 				item,
 				callback,
 				getServiceList
@@ -1937,15 +1942,25 @@ const store = new Vuex.Store({
 				success: res => {
 					console.log("getBLEDeviceServices==", JSON.stringify(res), item);
 					serviceList = res.services;
+					if (getServiceList) {
+						getServiceList(serviceList);
+					}
 					if (serviceList.length == 0) {
+						if(retryCount > 0){
+							retryCount --;
+							context.retryCount = retryCount;
+							setTimeout(()=>{
+								this.commit('B_GetBLEDeviceServices',context);
+							},500)
+							return;
+						}
+					
 						uni.hideToast();
 						uni.showModal({
 							title: '提示',
-							content: '获取服务失败,请尝试重新连接。'
+							content: '1.获取服务失败,请尝试重新连接设备。\r\n2.尝试重启设备再重新连接。'
 						})
-					}
-					if (getServiceList) {
-						getServiceList(serviceList);
+						
 					}
 					for (let i = 0; i < serviceList.length; i++) {
 						let service = serviceList[i];