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

Commit 8d9d2057 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "floss: wire hid_virtual_unplug from btclient" into main

parents 7f638311 ad045fe9
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -81,6 +81,14 @@ class BluetoothQACallbacks:
        """
        pass

    def on_send_hid_virtual_unplug_completed(self, status):
        """Called when send hid virtual unplug completed.

        Args:
            status: BtStatus.
        """
        pass


class FlossQAClient(BluetoothQACallbacks):
    """Handles method calls to and callbacks from the QA interface."""
@@ -187,6 +195,15 @@ class FlossQAClient(BluetoothQACallbacks):
            for observer in self.observers.values():
                observer.on_send_hid_data_completed(status)

        def OnSendHIDVirtualUnplugComplete(self, status):
            """Handles send HID virtual unplug complete callback.

            Args:
                status: BtStatus.
            """
            for observer in self.observers.values():
                observer.on_send_hid_virtual_unplug_completed(status)

    def __init__(self, bus, hci):
        """Constructs the client.

@@ -269,6 +286,15 @@ class FlossQAClient(BluetoothQACallbacks):
        """
        logging.debug('on_send_hid_data_completed: status: %s', status)

    @utils.glib_callback()
    def on_send_hid_data_completed(self, status):
        """Handles send HID virtual unplug completed callback.

        Args:
            status: BtStatus.
        """
        logging.debug('on_send_hid_virtual_unplug_completed: status: %s', status)

    @utils.glib_call(False)
    def has_proxy(self):
        """Checks whether QA proxy can be acquired."""
+4 −0
Original line number Diff line number Diff line
@@ -1402,6 +1402,10 @@ impl IBluetoothQACallback for QACallback {
    fn on_send_hid_data_completed(&mut self, status: BtStatus) {
        print_info!("Send HID data: {:?}", status);
    }

    fn on_send_hid_virtual_unplug_completed(&mut self, status: BtStatus) {
        print_info!("Send HID virtual unplug: {:?}", status);
    }
}

impl RPCProxy for QACallback {
+11 −0
Original line number Diff line number Diff line
@@ -314,6 +314,7 @@ fn build_commands() -> HashMap<String, CommandOption> {
                String::from("hid get-report <address> <Input|Output|Feature> <report_id>"),
                String::from("hid set-report <address> <Input|Output|Feature> <report_value>"),
                String::from("hid send-data <address> <data>"),
                String::from("hid virtual-unplug <address>"),
            ],
            description: String::from("Socket manager utilities."),
            function_pointer: CommandHandler::cmd_hid,
@@ -2044,6 +2045,16 @@ impl CommandHandler {

                self.context.lock().unwrap().qa_dbus.as_mut().unwrap().send_hid_data(addr, data);
            }
            "virtual-unplug" => {
                let addr = RawAddress::from_string(get_arg(args, 1)?).ok_or("Invalid Address")?;
                self.context
                    .lock()
                    .unwrap()
                    .qa_dbus
                    .as_mut()
                    .unwrap()
                    .send_hid_virtual_unplug(addr);
            }
            _ => return Err(CommandError::InvalidArgs),
        };

+8 −0
Original line number Diff line number Diff line
@@ -2583,6 +2583,10 @@ impl IBluetoothQA for BluetoothQADBus {
    fn send_hid_data(&self, addr: RawAddress, data: String) {
        dbus_generated!()
    }
    #[dbus_method("SendHIDVirtualUnplug")]
    fn send_hid_virtual_unplug(&self, addr: RawAddress) {
        dbus_generated!()
    }
}

#[allow(dead_code)]
@@ -2624,6 +2628,10 @@ impl IBluetoothQACallback for IBluetoothQACallbackDBus {
    fn on_send_hid_data_completed(&mut self, status: BtStatus) {
        dbus_generated!()
    }
    #[dbus_method("OnSendHIDVirtualUnplugComplete", DBusLog::Disable)]
    fn on_send_hid_virtual_unplug_completed(&mut self, status: BtStatus) {
        dbus_generated!()
    }
}

#[derive(Clone)]
+8 −0
Original line number Diff line number Diff line
@@ -65,6 +65,10 @@ impl IBluetoothQA for IBluetoothQADBus {
    fn send_hid_data(&self, addr: RawAddress, data: String) {
        dbus_generated!()
    }
    #[dbus_method("SendHIDVirtualUnplug")]
    fn send_hid_virtual_unplug(&self, addr: RawAddress) {
        dbus_generated!()
    }
}

#[dbus_proxy_obj(QACallback, "org.chromium.bluetooth.QACallback")]
@@ -97,4 +101,8 @@ impl IBluetoothQACallback for IBluetoothQACallbackDBus {
    fn on_send_hid_data_completed(&mut self, status: BtStatus) {
        dbus_generated!()
    }
    #[dbus_method("OnSendHIDVirtualUnplugComplete")]
    fn on_send_hid_virtual_unplug_completed(&mut self, status: BtStatus) {
        dbus_generated!()
    }
}
Loading