Loading system/bta/gatt/database.cc +1 −1 Original line number Diff line number Diff line Loading @@ -294,7 +294,7 @@ Octet16 Database::Hash() const { } else if (value == GATT_UUID_CHAR_EXT_PROP) { UINT16_TO_STREAM(p, d.handle); UINT16_TO_STREAM(p, d.uuid.As16Bit()); UINT16_TO_STREAM(p, 0x0000); // STORE!!!!! USE PROPER VALUE !!! UINT16_TO_STREAM(p, d.characteristic_extended_properties); } } } Loading system/bta/test/gatt/database_test.cc +5 −1 Original line number Diff line number Diff line Loading @@ -239,6 +239,10 @@ TEST(GattDatabaseTest, hash_test) { builder.AddCharacteristic(0x0015, 0x0016, Uuid::From16Bit(0x2A19), 0x02); // set characteristic extended properties descriptor values std::vector<uint16_t> descriptorValues = {0x0000}; builder.SetValueOfDescriptors(descriptorValues); Database db = builder.Build(); // Big endian example from Bluetooth SPEC V5.2, Vol 3, Part G, APPENDIX B Loading system/stack/Android.bp +9 −3 Original line number Diff line number Diff line Loading @@ -487,24 +487,30 @@ cc_test { host_supported: true, include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/stack/btm", "packages/modules/Bluetooth/system/stack/include", "packages/modules/Bluetooth/system/utils/include", ], srcs: crypto_toolbox_srcs + [ "test/stack_gatt_sr_hash_test.cc", "gatt/gatt_db.cc", "gatt/gatt_sr_hash.cc", "gatt/gatt_utils.cc", "test/gatt/mock_gatt_utils_ref.cc", "test/stack_gatt_sr_hash_test.cc", ], shared_libs: [ "libcutils", "libcrypto", "libprotobuf-cpp-lite", ], static_libs: [ "libbt-common", "libbt-protos-lite", "liblog", "libosi", "libbt-common", ], } // Iso manager unit tests cc_test { name: "net_test_btm_iso", Loading system/stack/gatt/gatt_db.cc +4 −1 Original line number Diff line number Diff line Loading @@ -232,7 +232,10 @@ static tGATT_STATUS read_attr_value(tGATT_ATTR& attr16, uint16_t offset, } if (uuid16 == GATT_UUID_CHAR_EXT_PROP) { uint16_t char_ext_prop = attr16.p_value->char_ext_prop; // sometimes this descriptor is added by users manually, we need to check if // the p_value is nullptr. uint16_t char_ext_prop = attr16.p_value ? attr16.p_value->char_ext_prop : 0x0000; *p_len = 2; UINT16_TO_STREAM(p, char_ext_prop); *p_data = p; Loading system/stack/gatt/gatt_sr_hash.cc +3 −2 Original line number Diff line number Diff line Loading @@ -104,8 +104,9 @@ static void fill_database_info(std::list<tGATT_SRV_LIST_ELEM>* lst_ptr, uint8_t* // Descriptor UINT16_TO_STREAM(p_data, attr_it->handle); UINT16_TO_STREAM(p_data, attr_it->uuid.As16Bit()); // TODO: Store correct data for extended properties UINT16_TO_STREAM(p_data, 0x0000); UINT16_TO_STREAM(p_data, attr_it->p_value ? attr_it->p_value->char_ext_prop : 0x0000); } } } Loading Loading
system/bta/gatt/database.cc +1 −1 Original line number Diff line number Diff line Loading @@ -294,7 +294,7 @@ Octet16 Database::Hash() const { } else if (value == GATT_UUID_CHAR_EXT_PROP) { UINT16_TO_STREAM(p, d.handle); UINT16_TO_STREAM(p, d.uuid.As16Bit()); UINT16_TO_STREAM(p, 0x0000); // STORE!!!!! USE PROPER VALUE !!! UINT16_TO_STREAM(p, d.characteristic_extended_properties); } } } Loading
system/bta/test/gatt/database_test.cc +5 −1 Original line number Diff line number Diff line Loading @@ -239,6 +239,10 @@ TEST(GattDatabaseTest, hash_test) { builder.AddCharacteristic(0x0015, 0x0016, Uuid::From16Bit(0x2A19), 0x02); // set characteristic extended properties descriptor values std::vector<uint16_t> descriptorValues = {0x0000}; builder.SetValueOfDescriptors(descriptorValues); Database db = builder.Build(); // Big endian example from Bluetooth SPEC V5.2, Vol 3, Part G, APPENDIX B Loading
system/stack/Android.bp +9 −3 Original line number Diff line number Diff line Loading @@ -487,24 +487,30 @@ cc_test { host_supported: true, include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/stack/btm", "packages/modules/Bluetooth/system/stack/include", "packages/modules/Bluetooth/system/utils/include", ], srcs: crypto_toolbox_srcs + [ "test/stack_gatt_sr_hash_test.cc", "gatt/gatt_db.cc", "gatt/gatt_sr_hash.cc", "gatt/gatt_utils.cc", "test/gatt/mock_gatt_utils_ref.cc", "test/stack_gatt_sr_hash_test.cc", ], shared_libs: [ "libcutils", "libcrypto", "libprotobuf-cpp-lite", ], static_libs: [ "libbt-common", "libbt-protos-lite", "liblog", "libosi", "libbt-common", ], } // Iso manager unit tests cc_test { name: "net_test_btm_iso", Loading
system/stack/gatt/gatt_db.cc +4 −1 Original line number Diff line number Diff line Loading @@ -232,7 +232,10 @@ static tGATT_STATUS read_attr_value(tGATT_ATTR& attr16, uint16_t offset, } if (uuid16 == GATT_UUID_CHAR_EXT_PROP) { uint16_t char_ext_prop = attr16.p_value->char_ext_prop; // sometimes this descriptor is added by users manually, we need to check if // the p_value is nullptr. uint16_t char_ext_prop = attr16.p_value ? attr16.p_value->char_ext_prop : 0x0000; *p_len = 2; UINT16_TO_STREAM(p, char_ext_prop); *p_data = p; Loading
system/stack/gatt/gatt_sr_hash.cc +3 −2 Original line number Diff line number Diff line Loading @@ -104,8 +104,9 @@ static void fill_database_info(std::list<tGATT_SRV_LIST_ELEM>* lst_ptr, uint8_t* // Descriptor UINT16_TO_STREAM(p_data, attr_it->handle); UINT16_TO_STREAM(p_data, attr_it->uuid.As16Bit()); // TODO: Store correct data for extended properties UINT16_TO_STREAM(p_data, 0x0000); UINT16_TO_STREAM(p_data, attr_it->p_value ? attr_it->p_value->char_ext_prop : 0x0000); } } } Loading