Floss: Define on_scan_result_lost API
This defines on_scan_result_lost callback, which is equivalent to
BlueZ's DeviceLost. This callback is triggered when an advertisement is
no longer fulfilling the criteria of MSFT filters.
Bug: 261482382
Tag: #floss
Test: Manual - Build Floss on Linux
Change-Id: Ie3788e938bf96db3f5b68a64cb5206e4abf8ca26
diff --git a/system/gd/rust/linux/client/src/callbacks.rs b/system/gd/rust/linux/client/src/callbacks.rs
index 157b89c..83c1222 100644
--- a/system/gd/rust/linux/client/src/callbacks.rs
+++ b/system/gd/rust/linux/client/src/callbacks.rs
@@ -327,6 +327,12 @@
}
}
+ fn on_scan_result_lost(&self, scan_result: ScanResult) {
+ if self.context.lock().unwrap().active_scanner_ids.len() > 0 {
+ print_info!("Scan result lost: {:#?}", scan_result);
+ }
+ }
+
fn on_suspend_mode_change(&self, _suspend_mode: SuspendMode) {
// No-op, not interesting for btclient.
}
diff --git a/system/gd/rust/linux/client/src/dbus_iface.rs b/system/gd/rust/linux/client/src/dbus_iface.rs
index 687be6c..57cb639 100644
--- a/system/gd/rust/linux/client/src/dbus_iface.rs
+++ b/system/gd/rust/linux/client/src/dbus_iface.rs
@@ -336,6 +336,11 @@
dbus_generated!()
}
+ #[dbus_method("OnScanResultLost")]
+ fn on_scan_result_lost(&self, scan_result: ScanResult) {
+ dbus_generated!()
+ }
+
#[dbus_method("OnSuspendModeChange")]
fn on_suspend_mode_change(&self, suspend_mode: SuspendMode) {
dbus_generated!()
diff --git a/system/gd/rust/linux/service/src/iface_bluetooth_gatt.rs b/system/gd/rust/linux/service/src/iface_bluetooth_gatt.rs
index 3b8196b..9a29aca 100644
--- a/system/gd/rust/linux/service/src/iface_bluetooth_gatt.rs
+++ b/system/gd/rust/linux/service/src/iface_bluetooth_gatt.rs
@@ -169,6 +169,11 @@
dbus_generated!()
}
+ #[dbus_method("OnScanResultLost")]
+ fn on_scan_result_lost(&self, scan_result: ScanResult) {
+ dbus_generated!()
+ }
+
#[dbus_method("OnSuspendModeChange")]
fn on_suspend_mode_change(&self, suspend_mode: SuspendMode) {
dbus_generated!()
diff --git a/system/gd/rust/linux/stack/src/bluetooth_gatt.rs b/system/gd/rust/linux/stack/src/bluetooth_gatt.rs
index 66911ec..9c7dd0f 100644
--- a/system/gd/rust/linux/stack/src/bluetooth_gatt.rs
+++ b/system/gd/rust/linux/stack/src/bluetooth_gatt.rs
@@ -591,6 +591,10 @@
/// requested to be filtered in.
fn on_scan_result(&self, scan_result: ScanResult);
+ /// When an LE advertisement matching aggregate filters is no longer detected. The criteria of
+ /// how a device is considered lost is specified by ScanFilter.
+ fn on_scan_result_lost(&self, scan_result: ScanResult);
+
/// When LE Scan module changes suspend mode due to system suspend/resume.
fn on_suspend_mode_change(&self, suspend_mode: SuspendMode);
}