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

Commit a5dfddfd authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "floss: Add generic adapter property changed callback." am: 9e378c2d...

Merge "floss: Add generic adapter property changed callback." am: 9e378c2d am: b1638921 am: 413fdcda

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



Change-Id: Idd6b1350acc34772059e694dd002d8bbdefd48d4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 607a0d37 413fdcda
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ use crate::dbus_iface::{
};
use crate::ClientContext;
use crate::{console_yellow, print_info};
use bt_topshim::btif::{BtBondState, BtSspVariant};
use bt_topshim::btif::{BtBondState, BtPropertyType, BtSspVariant};
use bt_topshim::profiles::gatt::GattStatus;
use btstack::bluetooth::{
    BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback,
@@ -101,6 +101,8 @@ impl BtCallback {
}

impl IBluetoothCallback for BtCallback {
    fn on_adapter_property_changed(&self, prop: BtPropertyType) {}

    fn on_address_changed(&self, addr: String) {
        print_info!("Address changed to {}", &addr);
        self.context.lock().unwrap().adapter_address = Some(addr);
+5 −1
Original line number Diff line number Diff line
//! D-Bus proxy implementations of the APIs.

use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit};
use bt_topshim::btif::{BtDeviceType, BtPropertyType, BtSspVariant, BtTransport, Uuid128Bit};
use bt_topshim::profiles::gatt::GattStatus;

use btstack::bluetooth::{
@@ -41,6 +41,7 @@ fn make_object_path(idx: i32, name: &str) -> dbus::Path {
}

impl_dbus_arg_enum!(BtDeviceType);
impl_dbus_arg_enum!(BtPropertyType);
impl_dbus_arg_enum!(BtSspVariant);
impl_dbus_arg_enum!(BtTransport);
impl_dbus_arg_enum!(GattStatus);
@@ -123,6 +124,9 @@ impl RPCProxy for IBluetoothCallbackDBus {
    "org.chromium.bluetooth.BluetoothCallback"
)]
impl IBluetoothCallback for IBluetoothCallbackDBus {
    #[dbus_method("OnAdapterPropertyChanged")]
    fn on_adapter_property_changed(&self, prop: BtPropertyType) {}

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

+6 −1
Original line number Diff line number Diff line
extern crate bt_shim;

use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit};
use bt_topshim::btif::{BtDeviceType, BtPropertyType, BtSspVariant, BtTransport, Uuid128Bit};

use btstack::bluetooth::{
    BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback,
@@ -35,6 +35,10 @@ struct BluetoothCallbackDBus {}

#[dbus_proxy_obj(BluetoothCallback, "org.chromium.bluetooth.BluetoothCallback")]
impl IBluetoothCallback for BluetoothCallbackDBus {
    #[dbus_method("OnAdapterPropertyChanged")]
    fn on_adapter_property_changed(&self, prop: BtPropertyType) {
        dbus_generated!()
    }
    #[dbus_method("OnAddressChanged")]
    fn on_address_changed(&self, addr: String) {
        dbus_generated!()
@@ -76,6 +80,7 @@ impl IBluetoothCallback for BluetoothCallbackDBus {
}

impl_dbus_arg_enum!(BtDeviceType);
impl_dbus_arg_enum!(BtPropertyType);
impl_dbus_arg_enum!(BtSspVariant);
impl_dbus_arg_enum!(BtTransport);
impl_dbus_arg_enum!(Profile);
+7 −0
Original line number Diff line number Diff line
@@ -251,6 +251,9 @@ impl BluetoothDeviceContext {

/// The interface for adapter callbacks registered through `IBluetooth::register_callback`.
pub trait IBluetoothCallback: RPCProxy {
    /// When any adapter property changes.
    fn on_adapter_property_changed(&self, prop: BtPropertyType);

    /// When any of the adapter local address is changed.
    fn on_address_changed(&self, addr: String);

@@ -680,6 +683,10 @@ impl BtifBluetoothCallbacks for Bluetooth {
            }

            self.properties.insert(prop.get_type(), prop);

            self.for_all_callbacks(|callback| {
                callback.on_adapter_property_changed(prop.get_type());
            });
        }
    }