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

Commit 22b00bd0 authored by JohnLai's avatar JohnLai
Browse files

Floss: fix from_db to use attribute_handle

Sometimes, the attribute_handle might not be the same as the
instance_id for an attribute. Change from_db to use the
attribute_handle so it can be the reverse operation of into_db
correctly.

Bug: 267557929
Test: Manually
Tag: #floss
Change-Id: I61e6c6b9befc613c310a201c7baaebdf2b5386b1
parent 5c7ddd47
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -761,7 +761,7 @@ impl BluetoothGattService {
                GattDbElementType::PrimaryService | GattDbElementType::SecondaryService => {
                    db_out.push(BluetoothGattService::new(
                        elem.uuid.uu,
                        elem.id as i32,
                        elem.attribute_handle as i32,
                        elem.type_ as i32,
                    ));
                    // TODO(b/200065274): Mark restricted services.
@@ -771,7 +771,7 @@ impl BluetoothGattService {
                    match db_out.last_mut() {
                        Some(s) => s.characteristics.push(BluetoothGattCharacteristic::new(
                            elem.uuid.uu,
                            elem.id as i32,
                            elem.attribute_handle as i32,
                            elem.properties as i32,
                            0,
                        )),
@@ -787,7 +787,7 @@ impl BluetoothGattService {
                        Some(s) => match s.characteristics.last_mut() {
                            Some(c) => c.descriptors.push(BluetoothGattDescriptor::new(
                                elem.uuid.uu,
                                elem.id as i32,
                                elem.attribute_handle as i32,
                                0,
                            )),
                            None => {
@@ -806,7 +806,7 @@ impl BluetoothGattService {
                        Some(s) => {
                            s.included_services.push(BluetoothGattService::new(
                                elem.uuid.uu,
                                elem.id as i32,
                                elem.attribute_handle as i32,
                                elem.type_ as i32,
                            ));
                        }