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 5dd4ec1203bfba8fbd43f4a622f4f0d2bd22f35c..b2bc68cab3a7f0ece81865a4676e44aa26361b81 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 |
@@ -316,6 +316,28 @@ bool BluetoothLowEnergyEventRouter::GetCharacteristic( |
return true; |
} |
+bool BluetoothLowEnergyEventRouter::WriteCharacteristicValue( |
+ const std::string& instance_id, |
+ const std::vector<uint8>& value, |
+ const base::Closure& callback, |
+ const base::Closure& error_callback) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ if (!adapter_) { |
+ VLOG(1) << "BluetoothAdapter not ready."; |
+ return false; |
+ } |
+ |
+ BluetoothGattCharacteristic* characteristic = |
+ FindCharacteristicById(instance_id); |
+ if (!characteristic) { |
+ VLOG(1) << "Characteristic not found: " << instance_id; |
+ return false; |
+ } |
+ |
+ characteristic->WriteRemoteCharacteristic(value, callback, error_callback); |
+ return true; |
+} |
+ |
void BluetoothLowEnergyEventRouter::SetAdapterForTesting( |
device::BluetoothAdapter* adapter) { |
adapter_ = adapter; |