Index: device/bluetooth/bluetooth_device.cc |
diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc |
index 81f7d7797891cca50cdfd4ad07e0483de5953831..a2ac95afa34a44e547d427519524c2d6b50426ce 100644 |
--- a/device/bluetooth/bluetooth_device.cc |
+++ b/device/bluetooth/bluetooth_device.cc |
@@ -16,6 +16,7 @@ |
#include "device/bluetooth/bluetooth_adapter.h" |
#include "device/bluetooth/bluetooth_gatt_connection.h" |
#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
#include "device/bluetooth/bluetooth_remote_gatt_service.h" |
#include "device/bluetooth/string_util_icu.h" |
#include "grit/bluetooth_strings.h" |
@@ -496,6 +497,22 @@ BluetoothDevice::GetCharacteristicsByUUID( |
return characteristics; |
} |
+std::vector<device::BluetoothRemoteGattDescriptor*> |
+BluetoothDevice::GetDescriptorsByUUID( |
+ device::BluetoothRemoteGattCharacteristic* characteristic, |
+ const BluetoothUUID& descriptor_uuid) { |
+ std::vector<device::BluetoothRemoteGattDescriptor*> descriptors; |
+ DVLOG(1) << "Looking for descriptor: " << descriptor_uuid.canonical_value(); |
+ for (auto* descriptor : characteristic->GetDescriptors()) { |
+ DVLOG(1) << "Descriptor in cache: " |
+ << descriptor->GetUUID().canonical_value(); |
+ if (descriptor->GetUUID() == descriptor_uuid) { |
+ descriptors.push_back(descriptor); |
+ } |
+ } |
+ return descriptors; |
+} |
+ |
void BluetoothDevice::DidConnectGatt() { |
for (const auto& callback : create_gatt_connection_success_callbacks_) { |
callback.Run( |