Skip to content

Commit

Permalink
chore: Fix API incompat with macOS device updates
Browse files Browse the repository at this point in the history
  • Loading branch information
qdot committed Jul 26, 2021
1 parent 712b153 commit 67a48f0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/corebluetooth/adapter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::internal::{run_corebluetooth_thread, CoreBluetoothEvent, CoreBluetoothMessage};
use super::peripheral::Peripheral;
use crate::api::{BDAddr, Central, CentralEvent};
use crate::api::{Peripheral as _};
use crate::common::adapter_manager::AdapterManager;
use crate::{Error, Result};
use async_trait::async_trait;
Expand Down Expand Up @@ -65,11 +66,8 @@ impl Adapter {
CoreBluetoothEvent::DeviceUpdated(uuid, name) => {
let id = uuid_to_bdaddr(&uuid.to_string());
let peripheral = manager_clone.peripheral(id).unwrap();
{
let mut properties = peripheral.properties.lock().unwrap();
properties.local_name = Some(name);
}
manager_clone.update_peripheral(id, peripheral);
let mut properties = peripheral.properties().await.unwrap();
properties.local_name = Some(name);
manager_clone.emit(CentralEvent::DeviceUpdated(id));
}
CoreBluetoothEvent::DeviceLost(uuid) => {
Expand Down

0 comments on commit 67a48f0

Please sign in to comment.