mirror of
https://gitee.com/openharmony/applications_settings
synced 2024-11-23 14:30:06 +00:00
!636 [Bug]: 搜索的蓝牙列表中部分设备显示mac地址,不显示设备名称
Merge pull request !636 from 宝宝爱晓梅/master
This commit is contained in:
commit
00e888e8b2
@ -306,9 +306,25 @@ export default class BluetoothDeviceController extends BaseSettingsController {
|
|||||||
} else {
|
} else {
|
||||||
LogUtil.log(this.TAG + 'available bluetooth new device found. availableDevices length = ' + this.availableDevices.length);
|
LogUtil.log(this.TAG + 'available bluetooth new device found. availableDevices length = ' + this.availableDevices.length);
|
||||||
let newDevice = this.getDevice(deviceId);
|
let newDevice = this.getDevice(deviceId);
|
||||||
this.availableDevices.push(newDevice);
|
if (!!newDevice.deviceName) {
|
||||||
|
this.availableDevices.push(newDevice);
|
||||||
|
}
|
||||||
|
|
||||||
LogUtil.log(this.TAG + 'available bluetooth new device pushed. availableDevices length = ' + this.availableDevices.length);
|
LogUtil.log(this.TAG + 'available bluetooth new device pushed. availableDevices length = ' + this.availableDevices.length);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
LogUtil.log(this.TAG + 'bluetooth already exist!');
|
||||||
|
let indexDeviceID = 0;
|
||||||
|
for (let i = 0; i < this.availableDevices.length; i++) {
|
||||||
|
if (this.availableDevices[i].deviceId === deviceId) {
|
||||||
|
indexDeviceID = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let existDevice = this.getDevice(deviceId);
|
||||||
|
if(existDevice.deviceName !== this.availableDevices[indexDeviceID].deviceName){
|
||||||
|
this.availableDevices.splice(indexDeviceID,1,existDevice);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
AppStorage.SetOrCreate('bluetoothAvailableDevices', this.availableDevices);
|
AppStorage.SetOrCreate('bluetoothAvailableDevices', this.availableDevices);
|
||||||
|
Loading…
Reference in New Issue
Block a user