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