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

Commit abc379b0 authored by Sarvesh Kalwit's avatar Sarvesh Kalwit Committed by Gerrit Code Review
Browse files

Merge "floss: Align included service handling with Android GattService" into main

parents d551cf93 e41ccc4c
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -787,7 +787,10 @@ impl BluetoothGattService {
        }
    }

    fn from_db(elements: Vec<BtGattDbElement>) -> Vec<BluetoothGattService> {
    fn from_db(
        elements: Vec<BtGattDbElement>,
        with_included_service: bool,
    ) -> Vec<BluetoothGattService> {
        let mut db_out: Vec<BluetoothGattService> = vec![];

        for elem in elements {
@@ -836,6 +839,9 @@ impl BluetoothGattService {
                }

                GattDbElementType::IncludedService => {
                    if !with_included_service {
                        continue;
                    }
                    match db_out.last_mut() {
                        Some(s) => {
                            s.included_services.push(BluetoothGattService::new(
@@ -3340,7 +3346,7 @@ impl BtifGattClientCallbacks for BluetoothGatt {
                    |cb: &mut GattClientCallback| {
                        cb.on_search_complete(
                            addr.to_string(),
                            BluetoothGattService::from_db(elements),
                            BluetoothGattService::from_db(elements, true),
                            GattStatus::Success,
                        );
                        Some(())
@@ -3645,7 +3651,7 @@ impl BtifGattServerCallbacks for BluetoothGatt {
        elements: Vec<BtGattDbElement>,
        _count: usize,
    ) {
        for service in BluetoothGattService::from_db(elements) {
        for service in BluetoothGattService::from_db(elements, false) {
            if status == GattStatus::Success {
                self.server_context_map.add_service(server_id, service.clone());
            }