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

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

Merge "Floss: Provide default implementations for RPCProxy"

parents 45af1c9b 319b4303
Loading
Loading
Loading
Loading
+0 −48
Original line number Diff line number Diff line
@@ -59,18 +59,10 @@ impl IBluetoothManagerCallback for BtManagerCallback {
}

impl RPCProxy for BtManagerCallback {
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        self.objpath.clone()
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {
        let cr = self.dbus_crossroads.clone();
        let iface = export_bluetooth_manager_callback_dbus_intf(
@@ -227,18 +219,10 @@ impl IBluetoothCallback for BtCallback {
}

impl RPCProxy for BtCallback {
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        self.objpath.clone()
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {
        let cr = self.dbus_crossroads.clone();
        let iface = export_bluetooth_callback_dbus_intf(
@@ -280,18 +264,10 @@ impl IBluetoothConnectionCallback for BtConnectionCallback {
}

impl RPCProxy for BtConnectionCallback {
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        self.objpath.clone()
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {
        let cr = self.dbus_crossroads.clone();
        let iface = export_bluetooth_connection_callback_dbus_intf(
@@ -338,18 +314,10 @@ impl IScannerCallback for ScannerCallback {
}

impl RPCProxy for ScannerCallback {
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        self.objpath.clone()
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {
        let cr = self.dbus_crossroads.clone();
        let iface = export_scanner_callback_dbus_intf(
@@ -509,18 +477,10 @@ impl IBluetoothGattCallback for BtGattCallback {
}

impl RPCProxy for BtGattCallback {
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        self.objpath.clone()
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {
        let cr = self.dbus_crossroads.clone();
        let iface = export_bluetooth_gatt_callback_dbus_intf(
@@ -559,18 +519,10 @@ impl ISuspendCallback for SuspendCallback {
}

impl RPCProxy for SuspendCallback {
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        self.objpath.clone()
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {
        let cr = self.dbus_crossroads.clone();
        let iface = export_suspend_callback_dbus_intf(
+7 −105
Original line number Diff line number Diff line
@@ -127,22 +127,7 @@ pub struct BluetoothDeviceDBus {

struct IBluetoothCallbackDBus {}

impl RPCProxy for IBluetoothCallbackDBus {
    // Dummy implementations just to satisfy impl RPCProxy requirements.
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        String::from("")
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {}
}
impl RPCProxy for IBluetoothCallbackDBus {}

#[generate_dbus_exporter(
    export_bluetooth_callback_dbus_intf,
@@ -186,22 +171,7 @@ impl IBluetoothCallback for IBluetoothCallbackDBus {

struct IBluetoothConnectionCallbackDBus {}

impl RPCProxy for IBluetoothConnectionCallbackDBus {
    // Dummy implementations just to satisfy impl RPCProxy requirements.
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        String::from("")
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {}
}
impl RPCProxy for IBluetoothConnectionCallbackDBus {}

#[generate_dbus_exporter(
    export_bluetooth_connection_callback_dbus_intf,
@@ -217,18 +187,7 @@ impl IBluetoothConnectionCallback for IBluetoothConnectionCallbackDBus {

struct IScannerCallbackDBus {}

impl RPCProxy for IScannerCallbackDBus {
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }
    fn get_object_id(&self) -> String {
        String::from("")
    }
    fn unregister(&mut self, _id: u32) -> bool {
        false
    }
    fn export_for_rpc(self: Box<Self>) {}
}
impl RPCProxy for IScannerCallbackDBus {}

#[generate_dbus_exporter(
    export_scanner_callback_dbus_intf,
@@ -554,22 +513,7 @@ impl IBluetoothManager for BluetoothManagerDBus {

struct IBluetoothManagerCallbackDBus {}

impl RPCProxy for IBluetoothManagerCallbackDBus {
    // Placeholder implementations just to satisfy impl RPCProxy requirements.
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        String::from("")
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {}
}
impl RPCProxy for IBluetoothManagerCallbackDBus {}

#[generate_dbus_exporter(
    export_bluetooth_manager_callback_dbus_intf,
@@ -1023,22 +967,7 @@ impl IBluetoothGatt for BluetoothGattDBus {

struct IBluetoothGattCallbackDBus {}

impl RPCProxy for IBluetoothGattCallbackDBus {
    // Placeholder implementations just to satisfy impl RPCProxy requirements.
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        String::from("")
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {}
}
impl RPCProxy for IBluetoothGattCallbackDBus {}

#[generate_dbus_exporter(
    export_bluetooth_gatt_callback_dbus_intf,
@@ -1246,19 +1175,7 @@ impl IBluetoothSocketManager for BluetoothSocketManagerDBus {

struct IBluetoothSocketManagerCallbacksDBus {}

impl RPCProxy for IBluetoothSocketManagerCallbacksDBus {
    // Placeholder implementations just to satisfy impl RPCProxy requirements.
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }
    fn get_object_id(&self) -> String {
        String::from("")
    }
    fn unregister(&mut self, _id: u32) -> bool {
        false
    }
    fn export_for_rpc(self: Box<Self>) {}
}
impl RPCProxy for IBluetoothSocketManagerCallbacksDBus {}

#[generate_dbus_exporter(export_socket_callback_dbus_intf, "org.chromium.bluetooth.SocketCallback")]
impl IBluetoothSocketManagerCallbacks for IBluetoothSocketManagerCallbacksDBus {
@@ -1334,22 +1251,7 @@ impl ISuspend for SuspendDBus {

struct ISuspendCallbackDBus {}

impl RPCProxy for ISuspendCallbackDBus {
    // Placeholder implementations just to satisfy impl RPCProxy requirements.
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        String::from("")
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {}
}
impl RPCProxy for ISuspendCallbackDBus {}

#[generate_dbus_exporter(
    export_suspend_callback_dbus_intf,
+1 −9
Original line number Diff line number Diff line
@@ -774,14 +774,7 @@ pub fn dbus_proxy_obj(attr: TokenStream, item: TokenStream) -> TokenStream {
    let gen = quote! {
        #ori_item

        impl RPCProxy for #self_ty {
            fn register_disconnect(&mut self, _disconnect_callback: Box<dyn Fn(u32) + Send>) -> u32 { 0 }
            fn get_object_id(&self) -> String {
                String::from("")
            }
            fn unregister(&mut self, _id: u32) -> bool { false }
            fn export_for_rpc(self: Box<Self>) {}
        }
        impl RPCProxy for #self_ty {}

        struct #struct_ident {
            conn: std::sync::Arc<dbus::nonblock::SyncConnection>,
@@ -806,7 +799,6 @@ pub fn dbus_proxy_obj(attr: TokenStream, item: TokenStream) -> TokenStream {
            fn unregister(&mut self, id: u32) -> bool {
                self.disconnect_watcher.lock().unwrap().remove(self.remote.clone(), id)
            }
            fn export_for_rpc(self: Box<Self>) {}
        }

        impl DBusArg for Box<dyn #trait_ + Send> {
+1 −13
Original line number Diff line number Diff line
@@ -55,19 +55,7 @@ impl ISuspend for SuspendDBus {
#[allow(dead_code)]
struct ISuspendCallbackDBus {}

impl RPCProxy for ISuspendCallbackDBus {
    // Placeholder implementations just to satisfy impl RPCProxy requirements.
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }
    fn get_object_id(&self) -> String {
        String::from("")
    }
    fn unregister(&mut self, _id: u32) -> bool {
        false
    }
    fn export_for_rpc(self: Box<Self>) {}
}
impl RPCProxy for ISuspendCallbackDBus {}

#[generate_dbus_exporter(
    export_suspend_callback_dbus_intf,
+0 −8
Original line number Diff line number Diff line
@@ -144,18 +144,10 @@ impl ISuspendCallback for SuspendCallback {
}

impl RPCProxy for SuspendCallback {
    fn register_disconnect(&mut self, _f: Box<dyn Fn(u32) + Send>) -> u32 {
        0
    }

    fn get_object_id(&self) -> String {
        self.objpath.clone()
    }

    fn unregister(&mut self, _id: u32) -> bool {
        false
    }

    fn export_for_rpc(self: Box<Self>) {
        let cr = self.dbus_crossroads.clone();
        let iface = export_suspend_callback_dbus_intf(
Loading