增加蓝牙设备人员信息登记上传
This commit is contained in:
@ -468,9 +468,14 @@ class BleHelper {
|
||||
this.data.LinkedList.find((v) => {
|
||||
if (v.deviceId == receive
|
||||
.deviceId) {
|
||||
v.macAddress = str.replace(
|
||||
str= str.replace(
|
||||
header, "");
|
||||
console.log("收到mac地址:", str)
|
||||
if(str.includes(':')){
|
||||
v.macAddress =str;
|
||||
}else{
|
||||
v.macAddress=str.replace(/(.{2})/g, '$1:').slice(0, -1)
|
||||
}
|
||||
console.log("收到mac地址:", v.macAddress)
|
||||
}
|
||||
});
|
||||
uni.setStorageSync(this.StorageKey, this.data
|
||||
@ -507,22 +512,29 @@ class BleHelper {
|
||||
hexs: hexs
|
||||
};
|
||||
console.log("监听到特征值:" + JSON.stringify(recData));
|
||||
if (this.cfg.receivDataCallback) {
|
||||
|
||||
if (this.cfg.receivDataCallback.length > 0) {
|
||||
|
||||
let path = this.getCurrentPagePath();
|
||||
|
||||
this.cfg.receivDataCallback.forEach((rec) => {
|
||||
|
||||
if (rec.callback) {
|
||||
rec.callback(recData, f, path);
|
||||
}
|
||||
})
|
||||
try{
|
||||
if (this.cfg.receivDataCallback) {
|
||||
|
||||
if (this.cfg.receivDataCallback.length > 0) {
|
||||
console.log("有人订阅消息")
|
||||
let path = this.getCurrentPagePath();
|
||||
|
||||
this.cfg.receivDataCallback.forEach((rec) => {
|
||||
|
||||
if (rec.callback) {
|
||||
rec.callback(recData, f, path);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
console.log("无人订阅消息");
|
||||
}
|
||||
} else {
|
||||
console.log("无人订阅receivDataCallback,不处理数据");
|
||||
}
|
||||
} else {
|
||||
console.log("无人订阅receivDataCallback,不处理数据");
|
||||
}catch(ex){
|
||||
console.log("ex=",ex);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -948,7 +960,7 @@ class BleHelper {
|
||||
var linkDevice = () => {
|
||||
// 添加重试次数限制
|
||||
let retryCount = 0;
|
||||
const maxRetries = 10; // 最大重试次数
|
||||
const maxRetries = 1; // 最大重试次数
|
||||
|
||||
const connect = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user