7305修改人员信息的点阵方式
This commit is contained in:
@ -733,16 +733,17 @@ class BleHelper {
|
||||
} catch (ex) {
|
||||
console.error("将数据转文本失败", ex);
|
||||
}
|
||||
let recData = {
|
||||
deviceId: receive.deviceId,
|
||||
serviceId: receive.serviceId,
|
||||
characteristicId: receive.characteristicId,
|
||||
bytes: bytes,
|
||||
str: str,
|
||||
hexs: hexs
|
||||
};
|
||||
// console.log("监听到特征值:" + JSON.stringify(recData));
|
||||
|
||||
try {
|
||||
let recData = {
|
||||
deviceId: receive.deviceId,
|
||||
serviceId: receive.serviceId,
|
||||
characteristicId: receive.characteristicId,
|
||||
bytes: bytes,
|
||||
str: str,
|
||||
hexs: hexs
|
||||
};
|
||||
console.log("监听到特征值:" + JSON.stringify(recData));
|
||||
if (this.cfg.receivDataCallback) {
|
||||
|
||||
if (this.cfg.receivDataCallback.length > 0) {
|
||||
@ -1409,25 +1410,11 @@ class BleHelper {
|
||||
// .LinkedList);
|
||||
|
||||
// 处理 MTU 设置
|
||||
if (plus.os.name === 'Android') {
|
||||
uni.setBLEMTU({
|
||||
deviceId: deviceId,
|
||||
mtu: 512,
|
||||
success: (mtu) => {
|
||||
|
||||
resolve(true);
|
||||
},
|
||||
fail: () => {
|
||||
console.error(
|
||||
"mtu设置失败");
|
||||
resolve(
|
||||
true
|
||||
); // MTU设置失败不影响连接成功
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (plus.os.name === 'Android') {
|
||||
this.setMtu(deviceId);
|
||||
}
|
||||
resolve(true);
|
||||
}
|
||||
|
||||
}).catch((ex) => {
|
||||
reject(this.getError(ex));
|
||||
});
|
||||
@ -1511,6 +1498,30 @@ class BleHelper {
|
||||
|
||||
|
||||
}
|
||||
|
||||
setMtu(deviceId){
|
||||
let prom=new Promise((_succ,_err)=>{
|
||||
uni.setBLEMTU({
|
||||
deviceId: deviceId,
|
||||
mtu: 512,
|
||||
success: (mtuRes) => {
|
||||
console.log("mtu约定成功");
|
||||
_succ(mtuRes);
|
||||
},
|
||||
fail: (ex) => {
|
||||
console.error(
|
||||
"mtu设置失败",ex);
|
||||
ex=this.getError(ex);
|
||||
_err(
|
||||
ex
|
||||
); // MTU设置失败不影响连接成功
|
||||
},complete(){
|
||||
console.log("设置mtu完毕");
|
||||
}
|
||||
});
|
||||
});
|
||||
return prom;
|
||||
}
|
||||
//断开连接
|
||||
disconnectDevice(deviceId) {
|
||||
var disconnect = (id) => {
|
||||
|
||||
Reference in New Issue
Block a user