修复650id大小写错误
This commit is contained in:
@ -286,55 +286,37 @@
|
||||
ble = BleTool.getBleTool();
|
||||
let eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
//eventChannel.on('receivdata', function(data) {
|
||||
eventChannel.on('detailData', function(data) {
|
||||
|
||||
let data = {
|
||||
data: {
|
||||
deviceMac: '35:06:00:EF:46:51',
|
||||
bluetoothName: 'JQZM-EF4651',
|
||||
deviceName: 'JQZM-EF4651',
|
||||
devicePic: '',
|
||||
id: '35:06:00:EF:46:51'
|
||||
}
|
||||
};
|
||||
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||
var device = data.data;
|
||||
these.device.deviceId = device.deviceMac;
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
console.log("找到设备了");
|
||||
these.device.deviceId = v.deviceId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (!f) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: "当前手机未连接过此设备,请删除后重新使用蓝牙添加"
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
these.formData.name = device.bluetoothName ? device.bluetoothName : device.deviceName;
|
||||
these.formData.img = device.devicePic;
|
||||
these.formData.id = device.id;
|
||||
//});
|
||||
ble.addReceiveCallback(these.bleValueNotify);
|
||||
|
||||
let startLink=()=>{
|
||||
ble.addDeviceFound((res) => {
|
||||
console.log("发现新设备,",res);
|
||||
let f = res.devices.find((v) => {
|
||||
return v.name == device.deviceName;
|
||||
});
|
||||
if (f) {
|
||||
console.log("找到了目标设备,正在连接:"+f.deviceId)
|
||||
these.device.deviceId = f.deviceId;
|
||||
these.formData.id = f.deviceId;
|
||||
ble.LinkBlue(f.deviceId);
|
||||
}
|
||||
});
|
||||
|
||||
ble.StartSearch();
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId);
|
||||
|
||||
|
||||
}
|
||||
if(ble.data.LinkedList && ble.data.LinkedList.length>0){
|
||||
let f=ble.data.LinkedList.find((v)=>{
|
||||
return v.name==device.deviceName;
|
||||
});
|
||||
if(!f){
|
||||
startLink();
|
||||
}else{
|
||||
these.device.deviceId = f.deviceId;
|
||||
these.formData.id = f.deviceId;
|
||||
}
|
||||
}else{
|
||||
startLink();
|
||||
}
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
|
Reference in New Issue
Block a user