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

Commit b70bf1bf authored by Sonny Sasaka's avatar Sonny Sasaka Committed by Gerrit Code Review
Browse files

Merge changes Ica667d0d,I126ef61a

* changes:
  Floss: Add TOPSHIM_SHOULD_REBUILD optional env var
  Floss: Extend OnScannerRegistered to include UUID
parents d64d484f c7fc60e3
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ use crate::dbus_iface::{
};
use crate::ClientContext;
use crate::{console_red, console_yellow, print_error, print_info};
use bt_topshim::btif::{BtBondState, BtPropertyType, BtSspVariant};
use bt_topshim::btif::{BtBondState, BtPropertyType, BtSspVariant, Uuid128Bit};
use bt_topshim::profiles::gatt::GattStatus;
use btstack::bluetooth::{
    BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback,
@@ -14,6 +14,7 @@ use btstack::bluetooth_gatt::{
    BluetoothGattService, IBluetoothGattCallback, IScannerCallback, LePhy,
};
use btstack::suspend::ISuspendCallback;
use btstack::uuid::UuidWrapper;
use btstack::RPCProxy;
use dbus::nonblock::SyncConnection;
use dbus_crossroads::Crossroads;
@@ -315,13 +316,17 @@ impl ScannerCallback {
}

impl IScannerCallback for ScannerCallback {
    fn on_scanner_registered(&self, status: u8, scanner_id: u8) {
    fn on_scanner_registered(&self, uuid: Uuid128Bit, status: u8, scanner_id: u8) {
        if status != 0 {
            print_error!("Failed registering scanner, status = {}", status);
            return;
        }

        print_info!("Scanner callback registered, id = {}", scanner_id);
        print_info!(
            "Scanner callback registered, uuid = {}, id = {}",
            UuidWrapper(&uuid),
            scanner_id
        );
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ impl RPCProxy for IScannerCallbackDBus {
)]
impl IScannerCallback for IScannerCallbackDBus {
    #[dbus_method("OnScannerRegistered")]
    fn on_scanner_registered(&self, status: u8, scanner_id: u8) {}
    fn on_scanner_registered(&self, uuid: Uuid128Bit, status: u8, scanner_id: u8) {}
}

// Implements RPC-friendly wrapper methods for calling IBluetooth, generated by
+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ struct ScannerCallbackDBus {}
#[dbus_proxy_obj(ScannerCallback, "org.chromium.bluetooth.ScannerCallback")]
impl IScannerCallback for ScannerCallbackDBus {
    #[dbus_method("OnScannerRegistered")]
    fn on_scanner_registered(&self, status: u8, scanner_id: u8) {
    fn on_scanner_registered(&self, uuid: Uuid128Bit, status: u8, scanner_id: u8) {
        dbus_generated!()
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -420,7 +420,7 @@ pub trait IBluetoothGattCallback: RPCProxy {
/// `IBluetoothGatt::register_scanner_callback`.
pub trait IScannerCallback: RPCProxy {
    /// When the `register_scanner` request is done.
    fn on_scanner_registered(&self, status: u8, scanner_id: u8);
    fn on_scanner_registered(&self, uuid: Uuid128Bit, status: u8, scanner_id: u8);
}

#[derive(Debug, FromPrimitive, ToPrimitive)]
@@ -1485,7 +1485,7 @@ impl BtifGattScannerCallbacks for BluetoothGatt {
            info.scanner_id = Some(scanner_id);
            let callback = self.scanner_callbacks.get_by_id(info.callback_id);
            if let Some(cb) = callback {
                cb.on_scanner_registered(status, scanner_id);
                cb.on_scanner_registered(uuid.uu, status, scanner_id);
            } else {
                log::warn!("There is no callback for scanner UUID {}", uuid);
            }
+12 −2
Original line number Diff line number Diff line
@@ -29,8 +29,18 @@ fn main() {
    let bt_searches =
        paths.iter().map(|tail| format!("-I{}{}", search_root, tail)).collect::<Vec<String>>();

    // Also re-run bindgen if anything in the C++ source changes
    // Also re-run bindgen if anything in the C++ source changes. Unfortunately the Rust source
    // files also reside in the same directory so any changes of Rust files (and other non-C files
    // actually) will cause topshim to be rebuild. The TOPSHIM_SHOULD_REBUILD env variable is a
    // development tool to speed up build that can be set to "no" if topshim is not expected to be
    // change.
    let topshim_should_rebuild = match env::var("TOPSHIM_SHOULD_REBUILD") {
        Err(_) => true,
        Ok(should_rebuild) => should_rebuild != "no",
    };
    if topshim_should_rebuild {
        println!("cargo:rerun-if-changed={}{}", search_root, "/system/");
    }

    // "-x" and "c++" must be separate due to a bug
    let clang_args: Vec<&str> = vec!["-x", "c++", "-std=c++17"];