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

Commit 5fe550e4 authored by Ying Hsu's avatar Ying Hsu Committed by Gerrit Code Review
Browse files

Merge "Floss: support scan settings parameter for StartScan" into main

parents 5e8ba418 fbfd7880
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ use bt_topshim::profiles::hid_host::BthhReportType;
use bt_topshim::profiles::sdp::{BtSdpMpsRecord, BtSdpRecord};
use bt_topshim::profiles::{gatt::LePhy, ProfileConnectionState};
use btstack::bluetooth::{BluetoothDevice, IBluetooth};
use btstack::bluetooth_gatt::{GattWriteType, IBluetoothGatt, ScanSettings, ScanType};
use btstack::bluetooth_gatt::{GattWriteType, IBluetoothGatt};
use btstack::bluetooth_media::{IBluetoothMedia, IBluetoothTelephony};
use btstack::bluetooth_qa::IBluetoothQA;
use btstack::socket_manager::{IBluetoothSocketManager, SocketResult};
@@ -1267,7 +1267,7 @@ impl CommandHandler {
                    scanner_id,
                    // TODO(b/254870159): Construct real settings and filters depending on
                    // command line options.
                    ScanSettings { interval: 0, window: 0, scan_type: ScanType::Active },
                    None,
                    Some(btstack::bluetooth_gatt::ScanFilter {
                        rssi_high_threshold: 0,
                        rssi_low_threshold: 0,
+1 −1
Original line number Diff line number Diff line
@@ -1433,7 +1433,7 @@ impl IBluetoothGatt for BluetoothGattDBus {
    fn start_scan(
        &mut self,
        _scanner_id: u8,
        _settings: ScanSettings,
        _settings: Option<ScanSettings>,
        _filter: Option<ScanFilter>,
    ) -> BtStatus {
        dbus_generated!()
+1 −1
Original line number Diff line number Diff line
@@ -635,7 +635,7 @@ impl IBluetoothGatt for IBluetoothGattDBus {
    fn start_scan(
        &mut self,
        scanner_id: u8,
        settings: ScanSettings,
        settings: Option<ScanSettings>,
        filter: Option<ScanFilter>,
    ) -> BtStatus {
        dbus_generated!()
+6 −9
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ pub trait IBluetoothGatt {
    fn start_scan(
        &mut self,
        scanner_id: u8,
        settings: ScanSettings,
        settings: Option<ScanSettings>,
        filter: Option<ScanFilter>,
    ) -> BtStatus;

@@ -1804,7 +1804,7 @@ impl BluetoothGatt {
            scan_type: ScanType::Active,
        };

        self.start_scan(scanner_id, settings, /*filter=*/ None)
        self.start_scan(scanner_id, Some(settings), /*filter=*/ None)
    }

    pub(crate) fn stop_active_scan(&mut self, scanner_id: u8) -> BtStatus {
@@ -1934,7 +1934,7 @@ impl IBluetoothGatt for BluetoothGatt {
    fn start_scan(
        &mut self,
        scanner_id: u8,
        _settings: ScanSettings,
        settings: Option<ScanSettings>,
        filter: Option<ScanFilter>,
    ) -> BtStatus {
        let scan_suspend_mode = self.get_scan_suspend_mode();
@@ -1942,15 +1942,12 @@ impl IBluetoothGatt for BluetoothGatt {
            return BtStatus::Busy;
        }

        // We're supposed to directly use the settings provided by the input parameter, but
        // currently UI is sending temporary variables instead. Therefore, load some preset values
        // known to work.
        // TODO(b/217274013): Fix UI plumbing and directly use the provided settings.
        let settings = ScanSettings {
        // If the client is not specifying scan settings, the default one will be used.
        let settings = settings.unwrap_or_else(|| ScanSettings {
            interval: sysprop::get_i32(sysprop::PropertyI32::LeInquiryScanInterval),
            window: sysprop::get_i32(sysprop::PropertyI32::LeInquiryScanWindow),
            scan_type: ScanType::Active,
        };
        });

        // Multiplexing scanners happens at this layer. The implementations of start_scan
        // and stop_scan maintains the state of all registered scanners and based on the states