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

Commit 6b1a0aee authored by Katherine Lai's avatar Katherine Lai Committed by Automerger Merge Worker
Browse files

Merge changes Ifa5eec54,I11e7d4cc,Ib11b2c71 am: bc315587 am: e9143a66 am: d54d8ef4

parents 4f2f0f48 d54d8ef4
Loading
Loading
Loading
Loading
+111 −4
Original line number Diff line number Diff line
@@ -763,12 +763,119 @@ impl IBluetoothGattServerCallback for BtGattServerCallback {
        print_info!("GATT Server registered status = {}, server_id = {}", status, server_id);
    }

    fn on_server_connection_state(&self, _server_id: i32, _connected: bool, _addr: String) {
    fn on_server_connection_state(&self, server_id: i32, connected: bool, addr: String) {
        print_info!(
            "GATT server connection with server_id = {}, connected = {}, addr = {}",
            _server_id,
            _connected,
            _addr
            server_id,
            connected,
            addr
        );
    }

    fn on_service_added(&self, status: GattStatus, service: BluetoothGattService) {
        print_info!("GATT service added with status = {}, service = {:?}", status, service)
    }

    fn on_characteristic_read_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        is_long: bool,
        handle: i32,
    ) {
        print_info!(
            "GATT characteristic read request for addr = {}, trans_id = {}, offset = {}, is_long = {}, handle = {}",
            addr,
            trans_id,
            offset,
            is_long,
            handle
        );
    }

    fn on_descriptor_read_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        is_long: bool,
        handle: i32,
    ) {
        print_info!(
            "GATT descriptor read request for addr = {}, trans_id = {}, offset = {}, is_long = {}, handle = {}",
            addr,
            trans_id,
            offset,
            is_long,
            handle
        );
    }

    fn on_characteristic_write_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        len: i32,
        is_prep: bool,
        need_rsp: bool,
        handle: i32,
        value: Vec<u8>,
    ) {
        print_info!(
            "GATT characteristic write request for \
                addr = {}, trans_id = {}, offset = {}, len = {}, is_prep = {}, need_rsp = {}, handle = {}, value = {:?}",
            addr,
            trans_id,
            offset,
            len,
            is_prep,
            need_rsp,
            handle,
            value
        );
    }

    fn on_descriptor_write_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        len: i32,
        is_prep: bool,
        need_rsp: bool,
        handle: i32,
        value: Vec<u8>,
    ) {
        print_info!(
            "GATT descriptor write request for \
                addr = {}, trans_id = {}, offset = {}, len = {}, is_prep = {}, need_rsp = {}, handle = {}, value = {:?}",
            addr,
            trans_id,
            offset,
            len,
            is_prep,
            need_rsp,
            handle,
            value
        );
    }

    fn on_execute_write(&self, addr: String, trans_id: i32, exec_write: bool) {
        print_info!(
            "GATT executed write for addr = {}, trans_id = {}, exec_write = {}",
            addr,
            trans_id,
            exec_write
        );
    }

    fn on_notification_sent(&self, addr: String, status: GattStatus) {
        print_info!(
            "GATT notification/indication sent for addr = {} with status = {}",
            addr,
            status
        );
    }
}
+99 −0
Original line number Diff line number Diff line
@@ -1327,6 +1327,46 @@ impl IBluetoothGatt for BluetoothGattDBus {
    fn server_disconnect(&self, server_id: i32, addr: String) -> bool {
        dbus_generated!()
    }

    #[dbus_method("AddService")]
    fn add_service(&self, server_id: i32, service: BluetoothGattService) {
        dbus_generated!()
    }

    #[dbus_method("RemoveService")]
    fn remove_service(&self, server_id: i32, handle: i32) {
        dbus_generated!()
    }

    #[dbus_method("ClearServices")]
    fn clear_services(&self, server_id: i32) {
        dbus_generated!()
    }

    #[dbus_method("SendResponse")]
    fn send_response(
        &self,
        server_id: i32,
        addr: String,
        request_id: i32,
        status: GattStatus,
        offset: i32,
        value: Vec<u8>,
    ) -> bool {
        dbus_generated!()
    }

    #[dbus_method("SendNotification")]
    fn send_notification(
        &self,
        server_id: i32,
        addr: String,
        handle: i32,
        confirm: bool,
        value: Vec<u8>,
    ) -> bool {
        dbus_generated!()
    }
}

struct IBluetoothGattCallbackDBus {}
@@ -1422,6 +1462,65 @@ impl IBluetoothGattServerCallback for IBluetoothGattCallbackDBus {

    #[dbus_method("OnServerConnectionState")]
    fn on_server_connection_state(&self, server_id: i32, connected: bool, addr: String) {}

    #[dbus_method("OnServiceAdded")]
    fn on_service_added(&self, status: GattStatus, service: BluetoothGattService) {}

    #[dbus_method("OnCharacteristicReadRequest")]
    fn on_characteristic_read_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        is_long: bool,
        handle: i32,
    ) {
    }

    #[dbus_method("OnDescriptorReadRequest")]
    fn on_descriptor_read_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        is_long: bool,
        handle: i32,
    ) {
    }

    #[dbus_method("OnCharacteristicWriteRequest")]
    fn on_characteristic_write_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        len: i32,
        is_prep: bool,
        need_rsp: bool,
        handle: i32,
        value: Vec<u8>,
    ) {
    }

    #[dbus_method("OnDescriptorWriteRequest")]
    fn on_descriptor_write_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        len: i32,
        is_prep: bool,
        need_rsp: bool,
        handle: i32,
        value: Vec<u8>,
    ) {
    }

    #[dbus_method("OnExecuteWrite")]
    fn on_execute_write(&self, addr: String, trans_id: i32, exec_write: bool) {}

    #[dbus_method("OnNotificationSent")]
    fn on_notification_sent(&self, addr: String, status: GattStatus) {}
}

#[dbus_propmap(BluetoothServerSocket)]
+109 −0
Original line number Diff line number Diff line
@@ -150,6 +150,75 @@ impl IBluetoothGattServerCallback for BluetoothGattServerCallbackDBus {
    fn on_server_connection_state(&self, server_id: i32, connected: bool, addr: String) {
        dbus_generated!()
    }

    #[dbus_method("OnServiceAdded")]
    fn on_service_added(&self, status: GattStatus, service: BluetoothGattService) {
        dbus_generated!()
    }

    #[dbus_method("OnCharacteristicReadRequest")]
    fn on_characteristic_read_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        is_long: bool,
        handle: i32,
    ) {
        dbus_generated!()
    }

    #[dbus_method("OnDescriptorReadRequest")]
    fn on_descriptor_read_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        is_long: bool,
        handle: i32,
    ) {
        dbus_generated!()
    }

    #[dbus_method("OnCharacteristicWriteRequest")]
    fn on_characteristic_write_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        len: i32,
        is_prep: bool,
        need_rsp: bool,
        handle: i32,
        value: Vec<u8>,
    ) {
        dbus_generated!()
    }

    #[dbus_method("OnDescriptorWriteRequest")]
    fn on_descriptor_write_request(
        &self,
        addr: String,
        trans_id: i32,
        offset: i32,
        len: i32,
        is_prep: bool,
        need_rsp: bool,
        handle: i32,
        value: Vec<u8>,
    ) {
        dbus_generated!()
    }

    #[dbus_method("OnExecuteWrite")]
    fn on_execute_write(&self, addr: String, trans_id: i32, exec_write: bool) {
        dbus_generated!()
    }

    #[dbus_method("OnNotificationSent")]
    fn on_notification_sent(&self, addr: String, status: GattStatus) {
        dbus_generated!()
    }
}

// Represents Uuid128Bit as an array in D-Bus.
@@ -801,4 +870,44 @@ impl IBluetoothGatt for IBluetoothGattDBus {
    fn server_disconnect(&self, server_id: i32, addr: String) -> bool {
        dbus_generated!()
    }

    #[dbus_method("AddService")]
    fn add_service(&self, server_id: i32, service: BluetoothGattService) {
        dbus_generated!()
    }

    #[dbus_method("RemoveService")]
    fn remove_service(&self, server_id: i32, handle: i32) {
        dbus_generated!()
    }

    #[dbus_method("ClearServices")]
    fn clear_services(&self, server_id: i32) {
        dbus_generated!()
    }

    #[dbus_method("SendResponse")]
    fn send_response(
        &self,
        server_id: i32,
        addr: String,
        request_id: i32,
        status: GattStatus,
        offset: i32,
        value: Vec<u8>,
    ) -> bool {
        dbus_generated!()
    }

    #[dbus_method("SendNotification")]
    fn send_notification(
        &self,
        server_id: i32,
        addr: String,
        handle: i32,
        confirm: bool,
        value: Vec<u8>,
    ) -> bool {
        dbus_generated!()
    }
}