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

Commit fd6c49b7 authored by Sonny Sasaka's avatar Sonny Sasaka Committed by Automerger Merge Worker
Browse files

Merge changes I5094a3f8,I56cf3cb6 am: 67ef4272

parents 1a1741d5 67ef4272
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -102,7 +102,6 @@ pub struct BluetoothDeviceDBus {
    name: String,
}

#[allow(dead_code)]
struct IBluetoothCallbackDBus {}

impl RPCProxy for IBluetoothCallbackDBus {
@@ -159,7 +158,6 @@ impl IBluetoothCallback for IBluetoothCallbackDBus {
    fn on_bond_state_changed(&self, status: u32, address: String, state: u32) {}
}

#[allow(dead_code)]
struct IBluetoothConnectionCallbackDBus {}

impl RPCProxy for IBluetoothConnectionCallbackDBus {
@@ -501,7 +499,6 @@ impl IBluetoothManager for BluetoothManagerDBus {
    }
}

#[allow(dead_code)]
struct IBluetoothManagerCallbackDBus {}

impl RPCProxy for IBluetoothManagerCallbackDBus {
@@ -549,11 +546,13 @@ impl BluetoothGattDBus {

#[generate_dbus_interface_client]
impl IBluetoothGatt for BluetoothGattDBus {
    #[dbus_method("RegisterScannerCallback")]
    fn register_scanner_callback(&mut self, _callback: Box<dyn IScannerCallback + Send>) -> u32 {
        dbus_generated!()
    }

    fn unregister_scanner_callback(&mut self, _scanner_id: u32) -> bool {
    #[dbus_method("UnregisterScannerCallback")]
    fn unregister_scanner_callback(&mut self, _callback_id: u32) -> bool {
        dbus_generated!()
    }

@@ -719,7 +718,6 @@ impl IBluetoothGatt for BluetoothGattDBus {
    }
}

#[allow(dead_code)]
struct IBluetoothGattCallbackDBus {}

impl RPCProxy for IBluetoothGattCallbackDBus {
@@ -842,7 +840,6 @@ impl ISuspend for SuspendDBus {
    }
}

#[allow(dead_code)]
struct ISuspendCallbackDBus {}

impl RPCProxy for ISuspendCallbackDBus {
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ dbus_macros = { path = "../dbus_projection/dbus_macros" }
dbus = "0.9.2"
dbus-crossroads = "0.4.0"
dbus-tokio = "0.7.3"
env_logger = "0.8.3"
futures = "0.3.13"
log = "0.4.14"
num-traits = "*"
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ impl IBluetoothGatt for IBluetoothGattDBus {
    }

    #[dbus_method("UnregisterScannerCallback")]
    fn unregister_scanner_callback(&mut self, scanner_id: u32) -> bool {
    fn unregister_scanner_callback(&mut self, callback_id: u32) -> bool {
        dbus_generated!()
    }

+30 −11
Original line number Diff line number Diff line
@@ -46,9 +46,18 @@ fn main() -> Result<(), Box<dyn Error>> {
        )
        .arg(Arg::with_name("debug").long("debug").short("d").help("Enables debug level logs"))
        .arg(Arg::from_usage("[init-flags] 'Fluoride INIT_ flags'").multiple(true))
        .arg(
            Arg::with_name("log-output")
                .long("log-output")
                .takes_value(true)
                .possible_values(&["syslog", "stderr"])
                .default_value("syslog")
                .help("Select log output"),
        )
        .get_matches();

    let is_debug = matches.is_present("debug");
    let log_output = matches.value_of("log-output").unwrap_or("syslog");

    let adapter_index = match matches.value_of("hci") {
        Some(idx) => idx.parse::<i32>().unwrap_or(0),
@@ -61,9 +70,19 @@ fn main() -> Result<(), Box<dyn Error>> {
        None => vec![],
    };

    // Set GD debug flag if debug is enabled.
    if is_debug {
        init_flags.push(String::from("INIT_logging_debug_enabled_for_all=true"));
    }

    // Forward --hci to Fluoride.
    init_flags.push(format!("--hci={}", adapter_index));

    let level_filter = if is_debug { LevelFilter::Debug } else { LevelFilter::Info };

    if log_output == "stderr" {
        env_logger::Builder::new().filter(None, level_filter).init();
    } else {
        let formatter = Formatter3164 {
            facility: Facility::LOG_USER,
            hostname: None,
@@ -72,9 +91,9 @@ fn main() -> Result<(), Box<dyn Error>> {
        };

        let logger = syslog::unix(formatter).expect("could not connect to syslog");
    let _ = log::set_boxed_logger(Box::new(BasicLogger::new(logger))).map(|()| {
        log::set_max_level(if is_debug { LevelFilter::Debug } else { LevelFilter::Info })
    });
        let _ = log::set_boxed_logger(Box::new(BasicLogger::new(logger)))
            .map(|()| log::set_max_level(level_filter));
    }

    let (tx, rx) = Stack::create_channel();

+7 −7
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ pub trait IBluetoothGatt {
    fn register_scanner_callback(&mut self, callback: Box<dyn IScannerCallback + Send>) -> u32;

    /// Unregisters an LE scanner callback identified by the given id.
    fn unregister_scanner_callback(&mut self, scanner_id: u32) -> bool;
    fn unregister_scanner_callback(&mut self, callback_id: u32) -> bool;

    fn start_scan(&self, scanner_id: i32, settings: ScanSettings, filters: Vec<ScanFilter>);
    fn stop_scan(&self, scanner_id: i32);
@@ -491,7 +491,7 @@ pub struct BluetoothGatt {

    context_map: ContextMap,
    reliable_queue: HashSet<String>,
    callbacks: Callbacks<dyn IScannerCallback + Send>,
    scanner_callbacks: Callbacks<dyn IScannerCallback + Send>,
}

impl BluetoothGatt {
@@ -502,7 +502,7 @@ impl BluetoothGatt {
            gatt: None,
            context_map: ContextMap::new(),
            reliable_queue: HashSet::new(),
            callbacks: Callbacks::new(tx.clone(), Message::ScannerCallbackDisconnected),
            scanner_callbacks: Callbacks::new(tx.clone(), Message::ScannerCallbackDisconnected),
        }
    }

@@ -532,7 +532,7 @@ impl BluetoothGatt {
    }

    pub fn remove_scanner_callback(&mut self, id: u32) -> bool {
        self.callbacks.remove_callback(id)
        self.scanner_callbacks.remove_callback(id)
    }
}

@@ -569,11 +569,11 @@ pub enum GattWriteRequestStatus {

impl IBluetoothGatt for BluetoothGatt {
    fn register_scanner_callback(&mut self, callback: Box<dyn IScannerCallback + Send>) -> u32 {
        self.callbacks.add_callback(callback)
        self.scanner_callbacks.add_callback(callback)
    }

    fn unregister_scanner_callback(&mut self, scanner_id: u32) -> bool {
        self.callbacks.remove_callback(scanner_id)
    fn unregister_scanner_callback(&mut self, callback_id: u32) -> bool {
        self.scanner_callbacks.remove_callback(callback_id)
    }

    fn start_scan(&self, _scanner_id: i32, _settings: ScanSettings, _filters: Vec<ScanFilter>) {