|
|
@@ -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];
|