Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb2ff4b9 authored by Hsin-chen Chuang's avatar Hsin-chen Chuang Committed by Automerger Merge Worker
Browse files

Merge changes I576c0982,I97edd023,Id1152119,I355e215d,Iecac0150, ... into main...

Merge changes I576c0982,I97edd023,Id1152119,I355e215d,Iecac0150, ... into main am: c0f2ede5 am: 5147f726

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/3102685



Change-Id: I19340fd2297fcac70e249429b553a10046f8d78c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 01785daf 5147f726
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -416,7 +416,7 @@ class FlossQAClient(BluetoothQACallbacks):
        Returns:
            True on success, False otherwise.
        """
        self.proxy().FetchHIDReport(addr, report_type, report_id)
        self.proxy().GetHIDReport(addr, report_type, report_id)
        return True

    @utils.glib_call(False)
+57 −31
Original line number Diff line number Diff line
@@ -10,7 +10,9 @@ use crate::dbus_iface::{
};
use crate::{console_red, console_yellow, print_error, print_info};
use crate::{ClientContext, GattRequest};
use bt_topshim::btif::{BtBondState, BtPropertyType, BtSspVariant, BtStatus, Uuid128Bit};
use bt_topshim::btif::{
    BtBondState, BtPropertyType, BtSspVariant, BtStatus, RawAddress, Uuid128Bit,
};
use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LePhy};
use bt_topshim::profiles::hfp::HfpCodecId;
use bt_topshim::profiles::le_audio::{
@@ -140,11 +142,16 @@ impl IBluetoothCallback for BtCallback {
        remote_device: BluetoothDevice,
        props: Vec<BtPropertyType>,
    ) {
        print_info!("Bluetooth properties {:?} changed for {:?}", props, remote_device);
        print_info!(
            "Bluetooth properties {:?} changed for [{}: {:?}]",
            props,
            remote_device.address.to_string(),
            remote_device.name
        );
    }

    fn on_address_changed(&mut self, addr: String) {
        print_info!("Address changed to {}", &addr);
    fn on_address_changed(&mut self, addr: RawAddress) {
        print_info!("Address changed to {}", addr.to_string());
        self.context.lock().unwrap().adapter_address = Some(addr);
    }

@@ -161,19 +168,28 @@ impl IBluetoothCallback for BtCallback {
            .lock()
            .unwrap()
            .found_devices
            .entry(remote_device.address.clone())
            .entry(remote_device.address.to_string())
            .or_insert(remote_device.clone());

        print_info!("Found device: {:?}", remote_device);
        print_info!(
            "Found device: [{}: {:?}]",
            remote_device.address.to_string(),
            remote_device.name
        );
    }

    fn on_device_cleared(&mut self, remote_device: BluetoothDevice) {
        match self.context.lock().unwrap().found_devices.remove(&remote_device.address) {
            Some(_) => print_info!("Removed device: {:?}", remote_device),
        match self.context.lock().unwrap().found_devices.remove(&remote_device.address.to_string())
        {
            Some(_) => print_info!(
                "Removed device: [{}: {:?}]",
                remote_device.address.to_string(),
                remote_device.name
            ),
            None => (),
        };

        self.context.lock().unwrap().bonded_devices.remove(&remote_device.address);
        self.context.lock().unwrap().bonded_devices.remove(&remote_device.address.to_string());
    }

    fn on_discovering_changed(&mut self, discovering: bool) {
@@ -192,9 +208,9 @@ impl IBluetoothCallback for BtCallback {
        match variant {
            BtSspVariant::PasskeyNotification | BtSspVariant::PasskeyConfirmation => {
                print_info!(
                    "Device [{}: {}] would like to pair, enter passkey on remote device: {:06}",
                    &remote_device.address,
                    &remote_device.name,
                    "Device [{}: {:?}] would like to pair, enter passkey on remote device: {:06}",
                    remote_device.address.to_string(),
                    remote_device.name,
                    passkey
                );
            }
@@ -228,9 +244,9 @@ impl IBluetoothCallback for BtCallback {

    fn on_pin_request(&mut self, remote_device: BluetoothDevice, _cod: u32, min_16_digit: bool) {
        print_info!(
            "Device [{}: {}] would like to pair, enter pin code {}",
            &remote_device.address,
            &remote_device.name,
            "Device [{}: {:?}] would like to pair, enter pin code {}",
            remote_device.address.to_string(),
            remote_device.name,
            match min_16_digit {
                true => "with at least 16 digits",
                false => "",
@@ -240,15 +256,20 @@ impl IBluetoothCallback for BtCallback {

    fn on_pin_display(&mut self, remote_device: BluetoothDevice, pincode: String) {
        print_info!(
            "Device [{}: {}] would like to pair, enter pin code {} on the remote",
            &remote_device.address,
            &remote_device.name,
            "Device [{}: {:?}] would like to pair, enter pin code {} on the remote",
            remote_device.address.to_string(),
            remote_device.name,
            pincode
        );
    }

    fn on_bond_state_changed(&mut self, status: u32, address: String, state: u32) {
        print_info!("Bonding state changed: [{}] state: {}, Status = {}", address, state, status);
    fn on_bond_state_changed(&mut self, status: u32, address: RawAddress, state: u32) {
        print_info!(
            "Bonding state changed: [{}] state: {}, Status = {}",
            address.to_string(),
            state,
            status
        );

        // Clear bonding attempt if bonding fails or succeeds
        match BtBondState::from(state) {
@@ -257,7 +278,7 @@ impl IBluetoothCallback for BtCallback {
                    self.context.lock().unwrap().bonding_attempt.as_ref().cloned();
                match bonding_attempt {
                    Some(bd) => {
                        if &address == &bd.address {
                        if address == bd.address {
                            self.context.lock().unwrap().bonding_attempt = None;
                        }
                    }
@@ -267,17 +288,16 @@ impl IBluetoothCallback for BtCallback {
            BtBondState::Bonding => (),
        }

        let device =
            BluetoothDevice { address: address.clone(), name: String::from("Classic device") };
        let device = BluetoothDevice { address: address, name: String::from("Classic device") };

        // If bonded, we should also automatically connect all enabled profiles
        if BtBondState::Bonded == state.into() {
            self.context.lock().unwrap().bonded_devices.insert(address.clone(), device.clone());
            self.context.lock().unwrap().bonded_devices.insert(address.to_string(), device.clone());
            self.context.lock().unwrap().connect_all_enabled_profiles(device.clone());
        }

        if BtBondState::NotBonded == state.into() {
            self.context.lock().unwrap().bonded_devices.remove(&address);
            self.context.lock().unwrap().bonded_devices.remove(&address.to_string());
        }
    }

@@ -288,8 +308,9 @@ impl IBluetoothCallback for BtCallback {
        sdp_records: Vec<BtSdpRecord>,
    ) {
        print_info!(
            "SDP search of {} for UUID {} returned {} results",
            remote_device.address,
            "SDP search of [{}: {:?}] for UUID {} returned {} results",
            remote_device.address.to_string(),
            remote_device.name,
            UuidWrapper(&searched_uuid),
            sdp_records.len()
        );
@@ -350,11 +371,15 @@ impl BtConnectionCallback {

impl IBluetoothConnectionCallback for BtConnectionCallback {
    fn on_device_connected(&mut self, remote_device: BluetoothDevice) {
        print_info!("Connected: [{}]: {}", remote_device.address, remote_device.name);
        print_info!("Connected: [{}: {:?}]", remote_device.address.to_string(), remote_device.name);
    }

    fn on_device_disconnected(&mut self, remote_device: BluetoothDevice) {
        print_info!("Disconnected: [{}]: {}", remote_device.address, remote_device.name);
        print_info!(
            "Disconnected: [{}: {:?}]",
            remote_device.address.to_string(),
            remote_device.name
        );
    }
}

@@ -476,8 +501,9 @@ impl IBluetoothAdminPolicyCallback for AdminCallback {
        new_policy_effect: Option<PolicyEffect>,
    ) {
        print_info!(
            "new device policy effect. Device: {:?}. New Effect: {:?}",
            device,
            "new device policy effect. Device: [{}: {:?}]. New Effect: {:?}",
            device.address.to_string(),
            device.name,
            new_policy_effect
        );
    }
+31 −32
Original line number Diff line number Diff line
@@ -9,7 +9,9 @@ use crate::bt_gatt::AuthReq;
use crate::callbacks::{BtGattCallback, BtGattServerCallback};
use crate::ClientContext;
use crate::{console_red, console_yellow, print_error, print_info};
use bt_topshim::btif::{BtConnectionState, BtDiscMode, BtStatus, BtTransport, Uuid, INVALID_RSSI};
use bt_topshim::btif::{
    BtConnectionState, BtDiscMode, BtStatus, BtTransport, RawAddress, Uuid, INVALID_RSSI,
};
use bt_topshim::profiles::gatt::{GattStatus, LePhy};
use bt_topshim::profiles::hid_host::BthhReportType;
use bt_topshim::profiles::sdp::{BtSdpMpsRecord, BtSdpRecord};
@@ -532,10 +534,7 @@ impl CommandHandler {
                }

                let enabled = self.lock_context().enabled;
                let address = match self.lock_context().adapter_address.as_ref() {
                    Some(x) => x.clone(),
                    None => String::from(""),
                };
                let address = self.lock_context().adapter_address.unwrap_or_default();
                let context = self.lock_context();
                let adapter_dbus = context.adapter_dbus.as_ref().unwrap();
                let qa_dbus = context.qa_dbus.as_ref().unwrap();
@@ -563,7 +562,7 @@ impl CommandHandler {
                qa_dbus.fetch_connectable();
                qa_dbus.fetch_alias();
                qa_dbus.fetch_discoverable_mode();
                print_info!("Address: {}", address);
                print_info!("Address: {}", address.to_string());
                print_info!("Name: {}", name);
                print_info!("Modalias: {}", modalias);
                print_info!("State: {}", if enabled { "enabled" } else { "disabled" });
@@ -662,7 +661,7 @@ impl CommandHandler {
        }

        let address = self.lock_context().update_adapter_address();
        print_info!("Local address = {}", &address);
        print_info!("Local address = {}", address.to_string());
        Ok(())
    }

@@ -769,7 +768,7 @@ impl CommandHandler {
        match &command[..] {
            "add" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from("Classic Device"),
                };

@@ -778,7 +777,7 @@ impl CommandHandler {
                if bonding_attempt.is_some() {
                    return Err(format!(
                        "Already bonding [{}]. Cancel bonding first.",
                        bonding_attempt.as_ref().unwrap().address,
                        bonding_attempt.as_ref().unwrap().address.to_string(),
                    )
                    .into());
                }
@@ -796,7 +795,7 @@ impl CommandHandler {
            }
            "remove" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from("Classic Device"),
                };

@@ -804,7 +803,7 @@ impl CommandHandler {
            }
            "cancel" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from("Classic Device"),
                };

@@ -828,7 +827,7 @@ impl CommandHandler {
        match &command[..] {
            "connect" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from("Classic Device"),
                };

@@ -840,14 +839,14 @@ impl CommandHandler {
                    .connect_all_enabled_profiles(device.clone());

                if status == BtStatus::Success {
                    println!("Connecting to {}", &device.address);
                    println!("Connecting to {}", &device.address.to_string());
                } else {
                    println!("Can't connect to {}", &device.address);
                    println!("Can't connect to {}", &device.address.to_string());
                }
            }
            "disconnect" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from("Classic Device"),
                };

@@ -859,14 +858,14 @@ impl CommandHandler {
                    .disconnect_all_enabled_profiles(device.clone());

                if success {
                    println!("Disconnecting from {}", &device.address);
                    println!("Disconnecting from {}", &device.address.to_string());
                } else {
                    println!("Can't disconnect from {}", &device.address);
                    println!("Can't disconnect from {}", &device.address.to_string());
                }
            }
            "info" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from("Classic Device"),
                };

@@ -914,7 +913,7 @@ impl CommandHandler {
                    )
                };

                print_info!("Address: {}", &device.address);
                print_info!("Address: {}", &device.address.to_string());
                print_info!("Name: {}", name);
                print_info!("Alias: {}", alias);
                print_info!("Device Type: {:?}", device_type);
@@ -937,7 +936,7 @@ impl CommandHandler {
            "set-alias" => {
                let new_alias = get_arg(args, 2)?;
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from(""),
                };
                let old_alias = self
@@ -960,7 +959,7 @@ impl CommandHandler {
            }
            "set-pairing-confirmation" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from(""),
                };
                let accept = match &get_arg(args, 2)?[..] {
@@ -979,7 +978,7 @@ impl CommandHandler {
            }
            "set-pairing-pin" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from(""),
                };
                let pin = get_arg(args, 2)?;
@@ -997,7 +996,7 @@ impl CommandHandler {
            }
            "set-pairing-passkey" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from(""),
                };
                let passkey = get_arg(args, 2)?;
@@ -1017,7 +1016,7 @@ impl CommandHandler {
            }
            "get-rssi" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from(""),
                };

@@ -1735,7 +1734,7 @@ impl CommandHandler {
        match &command[..] {
            "search" => {
                let device = BluetoothDevice {
                    address: String::from(get_arg(args, 1)?),
                    address: RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?,
                    name: String::from(""),
                };
                let uuid = match UuidHelper::parse_string(get_arg(args, 2)?) {
@@ -1795,7 +1794,7 @@ impl CommandHandler {
            "send-msc" => {
                let dlci =
                    String::from(get_arg(args, 1)?).parse::<u8>().or(Err("Failed parsing DLCI"))?;
                let addr = String::from(get_arg(args, 2)?);
                let addr = RawAddress::from_string(get_arg(args, 2)?).ok_or("Invalid Address")?;
                self.context.lock().unwrap().qa_dbus.as_mut().unwrap().rfcomm_send_msc(dlci, addr);
            }
            "listen-rfcomm" => {
@@ -1862,7 +1861,7 @@ impl CommandHandler {
                let (addr, sock_type, psm_or_uuid) =
                    (&get_arg(args, 1)?, &get_arg(args, 2)?, &get_arg(args, 3)?);
                let device = BluetoothDevice {
                    address: String::from(*addr),
                    address: RawAddress::from_string(*addr).ok_or("Invalid Address")?,
                    name: String::from("Socket Connect Device"),
                };

@@ -1985,7 +1984,7 @@ impl CommandHandler {

        match &command[..] {
            "get-report" => {
                let addr = String::from(get_arg(args, 1)?);
                let addr = RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?;
                let report_type = match &get_arg(args, 2)?[..] {
                    "Input" => BthhReportType::InputReport,
                    "Output" => BthhReportType::OutputReport,
@@ -2005,7 +2004,7 @@ impl CommandHandler {
                );
            }
            "set-report" => {
                let addr = String::from(get_arg(args, 1)?);
                let addr = RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?;
                let report_type = match &get_arg(args, 2)?[..] {
                    "Input" => BthhReportType::InputReport,
                    "Output" => BthhReportType::OutputReport,
@@ -2023,7 +2022,7 @@ impl CommandHandler {
                );
            }
            "send-data" => {
                let addr = String::from(get_arg(args, 1)?);
                let addr = RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?;
                let data = String::from(get_arg(args, 2)?);

                self.context.lock().unwrap().qa_dbus.as_mut().unwrap().send_hid_data(addr, data);
@@ -2052,7 +2051,7 @@ impl CommandHandler {
                let devices =
                    self.lock_context().adapter_dbus.as_ref().unwrap().get_bonded_devices();
                for device in devices.iter() {
                    print_info!("[{:17}] {}", device.address, device.name);
                    print_info!("[{}] {}", device.address.to_string(), device.name);
                }
            }
            "found" => {
@@ -2066,7 +2065,7 @@ impl CommandHandler {
                let devices =
                    self.lock_context().adapter_dbus.as_ref().unwrap().get_connected_devices();
                for device in devices.iter() {
                    print_info!("[{:17}] {}", device.address, device.name);
                    print_info!("[{}] {}", device.address.to_string(), device.name);
                }
            }
            other => {
+40 −12
Original line number Diff line number Diff line
@@ -2,7 +2,8 @@

use bt_topshim::btif::{
    BtAddrType, BtBondState, BtConnectionState, BtDeviceType, BtDiscMode, BtPropertyType,
    BtSspVariant, BtStatus, BtTransport, BtVendorProductInfo, Uuid, Uuid128Bit,
    BtSspVariant, BtStatus, BtTransport, BtVendorProductInfo, DisplayAddress, RawAddress, Uuid,
    Uuid128Bit,
};
use bt_topshim::profiles::a2dp::{
    A2dpCodecBitsPerSample, A2dpCodecChannelMode, A2dpCodecConfig, A2dpCodecIndex,
@@ -384,6 +385,33 @@ impl DBusArg for BtSdpRecord {
    }
}

impl DBusArg for RawAddress {
    type DBusType = String;
    fn from_dbus(
        data: String,
        _conn: Option<std::sync::Arc<dbus::nonblock::SyncConnection>>,
        _remote: Option<dbus::strings::BusName<'static>>,
        _disconnect_watcher: Option<
            std::sync::Arc<std::sync::Mutex<dbus_projection::DisconnectWatcher>>,
        >,
    ) -> Result<RawAddress, Box<dyn std::error::Error>> {
        Ok(RawAddress::from_string(data.clone()).ok_or_else(|| {
            format!(
                "Invalid Address: last 6 chars=\"{}\"",
                data.chars().rev().take(6).collect::<String>().chars().rev().collect::<String>()
            )
        })?)
    }

    fn to_dbus(addr: RawAddress) -> Result<String, Box<dyn std::error::Error>> {
        Ok(addr.to_string())
    }

    fn log(addr: &RawAddress) -> String {
        format!("{}", DisplayAddress(addr))
    }
}

#[dbus_propmap(BluetoothGattDescriptor)]
pub struct BluetoothGattDescriptorDBus {
    uuid: Uuid128Bit,
@@ -413,7 +441,7 @@ pub struct BluetoothGattServiceDBus {

#[dbus_propmap(BluetoothDevice)]
pub struct BluetoothDeviceDBus {
    address: String,
    address: RawAddress,
    name: String,
}

@@ -617,7 +645,7 @@ impl IBluetoothCallback for IBluetoothCallbackDBus {
    }

    #[dbus_method("OnAddressChanged", DBusLog::Disable)]
    fn on_address_changed(&mut self, addr: String) {}
    fn on_address_changed(&mut self, addr: RawAddress) {}

    #[dbus_method("OnNameChanged", DBusLog::Disable)]
    fn on_name_changed(&mut self, name: String) {}
@@ -651,7 +679,7 @@ impl IBluetoothCallback for IBluetoothCallbackDBus {
    fn on_pin_display(&mut self, remote_device: BluetoothDevice, pincode: String) {}

    #[dbus_method("OnBondStateChanged", DBusLog::Disable)]
    fn on_bond_state_changed(&mut self, status: u32, address: String, state: u32) {}
    fn on_bond_state_changed(&mut self, status: u32, address: RawAddress, state: u32) {}

    #[dbus_method("OnSdpSearchComplete", DBusLog::Disable)]
    fn on_sdp_search_complete(
@@ -793,7 +821,7 @@ impl IBluetooth for BluetoothDBus {
    }

    #[dbus_method("GetAddress")]
    fn get_address(&self) -> String {
    fn get_address(&self) -> RawAddress {
        dbus_generated!()
    }

@@ -1075,7 +1103,7 @@ impl IBluetoothQALegacy for BluetoothQALegacyDBus {
    #[dbus_method("GetHIDReport")]
    fn get_hid_report(
        &mut self,
        addr: String,
        addr: RawAddress,
        report_type: BthhReportType,
        report_id: u8,
    ) -> BtStatus {
@@ -1085,7 +1113,7 @@ impl IBluetoothQALegacy for BluetoothQALegacyDBus {
    #[dbus_method("SetHIDReport")]
    fn set_hid_report(
        &mut self,
        addr: String,
        addr: RawAddress,
        report_type: BthhReportType,
        report: String,
    ) -> BtStatus {
@@ -1093,7 +1121,7 @@ impl IBluetoothQALegacy for BluetoothQALegacyDBus {
    }

    #[dbus_method("SendHIDData")]
    fn send_hid_data(&mut self, addr: String, data: String) -> BtStatus;
    fn send_hid_data(&mut self, addr: RawAddress, data: String) -> BtStatus;
}

#[dbus_propmap(AdapterWithEnabled)]
@@ -2497,7 +2525,7 @@ impl IBluetoothQA for BluetoothQADBus {
        dbus_generated!()
    }
    #[dbus_method("RfcommSendMsc")]
    fn rfcomm_send_msc(&self, dlci: u8, addr: String) {
    fn rfcomm_send_msc(&self, dlci: u8, addr: RawAddress) {
        dbus_generated!()
    }
    #[dbus_method("FetchDiscoverableMode")]
@@ -2521,15 +2549,15 @@ impl IBluetoothQA for BluetoothQADBus {
        dbus_generated!()
    }
    #[dbus_method("GetHIDReport")]
    fn get_hid_report(&self, addr: String, report_type: BthhReportType, report_id: u8) {
    fn get_hid_report(&self, addr: RawAddress, report_type: BthhReportType, report_id: u8) {
        dbus_generated!()
    }
    #[dbus_method("SetHIDReport")]
    fn set_hid_report(&self, addr: String, report_type: BthhReportType, report: String) {
    fn set_hid_report(&self, addr: RawAddress, report_type: BthhReportType, report: String) {
        dbus_generated!()
    }
    #[dbus_method("SendHIDData")]
    fn send_hid_data(&self, addr: String, data: String) {
    fn send_hid_data(&self, addr: RawAddress, data: String) {
        dbus_generated!()
    }
}
+5 −5
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ use crate::dbus_iface::{
    BluetoothTelephonyDBus, SuspendDBus,
};
use crate::editor::AsyncEditor;
use bt_topshim::topstack;
use bt_topshim::{btif::RawAddress, topstack};
use btstack::bluetooth::{BluetoothDevice, IBluetooth};
use btstack::suspend::ISuspend;
use manager_service::iface_bluetooth_manager::IBluetoothManager;
@@ -64,7 +64,7 @@ pub(crate) struct ClientContext {
    pub(crate) adapter_ready: bool,

    /// Current adapter address if known.
    pub(crate) adapter_address: Option<String>,
    pub(crate) adapter_address: Option<RawAddress>,

    /// Currently active bonding attempt. If it is not none, we are currently attempting to bond
    /// this device.
@@ -281,7 +281,7 @@ impl ClientContext {
    }

    // Foreground-only: Updates the adapter address.
    fn update_adapter_address(&mut self) -> String {
    fn update_adapter_address(&mut self) -> RawAddress {
        let address = self.adapter_dbus.as_ref().unwrap().get_address();
        self.adapter_address = Some(address.clone());

@@ -293,7 +293,7 @@ impl ClientContext {
        let bonded_devices = self.adapter_dbus.as_ref().unwrap().get_bonded_devices();

        for device in bonded_devices {
            self.bonded_devices.insert(device.address.clone(), device.clone());
            self.bonded_devices.insert(device.address.to_string(), device.clone());
        }
    }

@@ -759,7 +759,7 @@ async fn handle_client_command(
                let adapter_address = context.lock().unwrap().update_adapter_address();
                context.lock().unwrap().update_bonded_devices();

                print_info!("Adapter {} is ready", adapter_address);
                print_info!("Adapter {} is ready", adapter_address.to_string());

                // Run the command with the command arguments as the client is
                // non-interactive.
Loading