Compare commits
4 Commits
8487a4303a
...
738ce209a6
| Author | SHA1 | Date | |
|---|---|---|---|
| 738ce209a6 | |||
| 1ac41b3ed5 | |||
| f51b6c5a85 | |||
| 2339c1c8d0 |
@ -731,6 +731,7 @@
|
||||
events: {
|
||||
BindOver: function(data) {
|
||||
console.log(data)
|
||||
these.formData.bleStatu=true;
|
||||
}
|
||||
},
|
||||
success: function(res) {
|
||||
|
||||
@ -692,6 +692,7 @@ console.log("res=",res);
|
||||
events: {
|
||||
BindOver: function(data) {
|
||||
console.log(data)
|
||||
these.formData.bleStatu=true;
|
||||
}
|
||||
},
|
||||
success: function(res) {
|
||||
|
||||
@ -643,6 +643,7 @@
|
||||
events: {
|
||||
BindOver: function(data) {
|
||||
console.log(data)
|
||||
these.formData.bleStatu=true;
|
||||
}
|
||||
},
|
||||
success: function(res) {
|
||||
|
||||
@ -466,10 +466,12 @@
|
||||
return f;
|
||||
},
|
||||
bleValueNotify: function(receive, device, path) {
|
||||
|
||||
if (this.Status.pageHide) {
|
||||
return;
|
||||
}
|
||||
let json = recei.ReceiveData(receive, device, path);
|
||||
|
||||
if (!json) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -470,6 +470,8 @@
|
||||
}
|
||||
hideLoading(these);
|
||||
|
||||
eventChannel.emit('BindOver',these.device);
|
||||
|
||||
ble.updateCache();
|
||||
uni.navigateBack();
|
||||
return true;
|
||||
|
||||
@ -548,7 +548,7 @@ class BleHelper {
|
||||
console.log("蓝牙连接状态变化了", res);
|
||||
// 检查状态是否真的发生了变化
|
||||
if (bleDeviceStates[res.deviceId] === res.connected) {
|
||||
console.error('专业给Uniapp填坑,连接状态');
|
||||
console.error('专业给Uniapp填坑,连接状态重复回调');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -729,12 +729,13 @@ class BleHelper {
|
||||
this.updateCache();
|
||||
}
|
||||
}
|
||||
console.log("str=", str);
|
||||
// console.log("str1=", str);
|
||||
} catch (ex) {
|
||||
console.error("将数据转文本失败", ex);
|
||||
}
|
||||
|
||||
try {
|
||||
console.log("11111");
|
||||
let recData = {
|
||||
deviceId: receive.deviceId,
|
||||
serviceId: receive.serviceId,
|
||||
@ -925,7 +926,7 @@ class BleHelper {
|
||||
return new Promise((resolve, reject) => {
|
||||
Promise.race([p1, p2]).then(resolve).catch(ex => {
|
||||
if (ex.code == -1) {
|
||||
console.error('专业给Uniapp填坑,停止搜索');
|
||||
console.error('专业给Uniapp填坑,停止搜索永无回调处理');
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
@ -1037,7 +1038,7 @@ class BleHelper {
|
||||
Promise.race([p1, p2]).then(succ).catch(ex => {
|
||||
// console.error("异常了:",ex);
|
||||
if (ex.code == -1) {
|
||||
console.error('专业给Uniapp填坑,订阅成功');
|
||||
console.error('专业给Uniapp填坑,订阅消息永无回调了');
|
||||
succ();
|
||||
return;
|
||||
}
|
||||
@ -1222,7 +1223,8 @@ class BleHelper {
|
||||
}
|
||||
setTimeout(function() {
|
||||
startgetService(id);
|
||||
}, 1000);
|
||||
|
||||
}, 100+repeatCnt*300);
|
||||
}
|
||||
},
|
||||
fail: (ex) => {
|
||||
@ -1411,14 +1413,9 @@ class BleHelper {
|
||||
|
||||
// 处理 MTU 设置
|
||||
if (plus.os.name === 'Android') {
|
||||
this.setMtu(deviceId).then(() => {
|
||||
resolve(true);
|
||||
}).catch(() => {
|
||||
resolve(true); //mtu设置失败也算成功
|
||||
})
|
||||
} else {
|
||||
resolve(true);
|
||||
this.setMtu(deviceId);
|
||||
}
|
||||
resolve(true);
|
||||
|
||||
}).catch((ex) => {
|
||||
reject(this.getError(ex));
|
||||
@ -1702,7 +1699,7 @@ class BleHelper {
|
||||
Promise.race([timeOut(ms), promise]).then(resolve).catch((ex) => {
|
||||
// console.error("ex=", ex);
|
||||
if (ex.code == -1) {
|
||||
console.error('专业给Uniapp填坑,发送成功');
|
||||
console.error('专业给Uniapp填坑,发送消息永无回调');
|
||||
resolve(ex);
|
||||
} else {
|
||||
reject(ex);
|
||||
|
||||
Reference in New Issue
Block a user