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

Commit 75f52229 authored by Katherine Lai's avatar Katherine Lai Committed by Gerrit Code Review
Browse files

Merge "floss: Add IsLEAudioSupported API" into main

parents 1b550663 94cbfa14
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -547,6 +547,7 @@ impl CommandHandler {
                let multi_adv_supported = adapter_dbus.is_multi_advertisement_supported();
                let le_ext_adv_supported = adapter_dbus.is_le_extended_advertising_supported();
                let wbs_supported = adapter_dbus.is_wbs_supported();
                let le_audio_supported = adapter_dbus.is_le_audio_supported();
                let supported_profiles = UuidHelper::get_supported_profiles();
                let connected_profiles: Vec<(Profile, ProfileConnectionState)> = supported_profiles
                    .iter()
@@ -573,6 +574,7 @@ impl CommandHandler {
                print_info!("IsLeExtendedAdvertisingSupported: {}", le_ext_adv_supported);
                print_info!("Connected profiles: {:?}", connected_profiles);
                print_info!("IsWbsSupported: {}", wbs_supported);
                print_info!("IsLeAudioSupported: {}", le_audio_supported);
                print_info!(
                    "Uuids: {}",
                    DisplayList(
+5 −0
Original line number Diff line number Diff line
@@ -1059,6 +1059,11 @@ impl IBluetooth for BluetoothDBus {
    fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool {
        dbus_generated!()
    }

    #[dbus_method("IsLEAudioSupported")]
    fn is_le_audio_supported(&self) -> bool {
        dbus_generated!()
    }
}

pub(crate) struct BluetoothQALegacyDBus {
+5 −0
Original line number Diff line number Diff line
@@ -748,6 +748,11 @@ impl IBluetooth for IBluetoothDBus {
    fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool {
        dbus_generated!()
    }

    #[dbus_method("IsLEAudioSupported", DBusLog::Disable)]
    fn is_le_audio_supported(&self) -> bool {
        dbus_generated!()
    }
}

impl_dbus_arg_enum!(SocketType);
+14 −1
Original line number Diff line number Diff line
@@ -255,6 +255,9 @@ pub trait IBluetooth {

    /// Returns whether the coding format is supported.
    fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool;

    /// Returns whether LE Audio is supported.
    fn is_le_audio_supported(&self) -> bool;
}

/// Adapter API for Bluetooth qualification and verification.
@@ -609,6 +612,7 @@ pub struct Bluetooth {
    pending_create_bond: Option<(BluetoothDevice, BtTransport)>,
    active_pairing_address: Option<RawAddress>,
    le_supported_states: u64,
    le_local_supported_features: u64,

    /// Used to notify signal handler that we have turned off the stack.
    sig_notifier: Arc<SigData>,
@@ -669,6 +673,7 @@ impl Bluetooth {
            pending_create_bond: None,
            active_pairing_address: None,
            le_supported_states: 0u64,
            le_local_supported_features: 0u64,
            sig_notifier,
            uhid_wakeup_source: UHid::new(),
        }
@@ -1571,7 +1576,9 @@ impl BtifBluetoothCallbacks for Bluetooth {

                // Also need to manually request some properties
                self.intf.lock().unwrap().get_adapter_property(BtPropertyType::ClassOfDevice);
                self.le_supported_states = controller::Controller::new().get_ble_supported_states();
                let mut controller = controller::Controller::new();
                self.le_supported_states = controller.get_ble_supported_states();
                self.le_local_supported_features = controller.get_ble_local_supported_features();

                // Initialize the BLE scanner for discovery.
                let callback_id = self.bluetooth_gatt.lock().unwrap().register_scanner_callback(
@@ -2965,6 +2972,12 @@ impl IBluetooth for Bluetooth {
    fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool {
        self.intf.lock().unwrap().is_coding_format_supported(coding_format as u8)
    }

    fn is_le_audio_supported(&self) -> bool {
        // We determine LE Audio support by checking CIS Central support
        // See Core 5.3, Vol 6, 4.6 FEATURE SUPPORT
        self.le_local_supported_features >> 28 & 1 == 1u64
    }
}

impl BtifSdpCallbacks for Bluetooth {
+5 −0
Original line number Diff line number Diff line
@@ -49,6 +49,11 @@ uint64_t ControllerIntf::get_ble_supported_states() const {
  return controller_->GetLeSupportedStates();
}

uint64_t ControllerIntf::get_ble_local_supported_features() const {
  if (!controller_) std::abort();
  return controller_->GetControllerLeLocalSupportedFeatures();
}

}  // namespace rust
}  // namespace topshim
}  // namespace bluetooth
Loading