Chromium Code Reviews| Index: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc |
| diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc |
| index 3f2d43608bea8f6b67660371b66212a66b977115..bf58f2d581a7e3ecd6f70878f03f7d67796c8822 100644 |
| --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc |
| +++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc |
| @@ -24,6 +24,7 @@ |
| #include "device/bluetooth/bluetooth_gatt_connection.h" |
| #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
| #include "device/bluetooth/bluetooth_gatt_service.h" |
| +#include "device/bluetooth/bluetooth_local_gatt_characteristic.h" |
| #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| #include "device/bluetooth/bluetooth_uuid.h" |
| @@ -1057,6 +1058,33 @@ void BluetoothLowEnergyEventRouter::GattDescriptorValueChanged( |
| std::move(args)); |
| } |
| +void BluetoothLowEnergyEventRouter::AddLocalCharacteristic( |
| + const std::string& id, |
| + const std::string& service_id) { |
| + if (chrc_id_to_service_id_.find(id) != chrc_id_to_service_id_.end()) |
| + VLOG(1) << "Local characteristic with id " << id |
|
scheib
2016/05/04 00:48:53
Consider DVLOG, as we don't expect to need to ask
rkc
2016/05/04 01:56:28
At an early stage of a feature, these VLOGs can be
|
| + << " already exists. Replacing."; |
| + chrc_id_to_service_id_[id] = service_id; |
| +} |
| + |
| +device::BluetoothLocalGattCharacteristic* |
| +BluetoothLowEnergyEventRouter::GetLocalCharacteristic( |
| + const std::string& id) const { |
| + if (chrc_id_to_service_id_.find(id) == chrc_id_to_service_id_.end()) { |
| + VLOG(1) << "Characteristic with id " << id << " not found."; |
| + return nullptr; |
| + } |
| + device::BluetoothLocalGattService* service = |
| + adapter_->GetGattService(chrc_id_to_service_id_.at(id)); |
| + if (!service) { |
| + VLOG(1) << "Parent service of characteristic with id " << id |
| + << " not found."; |
| + return nullptr; |
| + } |
| + |
| + return service->GetCharacteristic(id); |
| +} |
| + |
| void BluetoothLowEnergyEventRouter::OnGetAdapter( |
| const base::Closure& callback, |
| scoped_refptr<device::BluetoothAdapter> adapter) { |