| Index: device/bluetooth/bluetooth_task_manager_win.cc
|
| diff --git a/device/bluetooth/bluetooth_task_manager_win.cc b/device/bluetooth/bluetooth_task_manager_win.cc
|
| index bcb3823e094a32b7ac84faaa29288fb74af275d2..009d07974fdbf866d94422242e6bba0303c85c7c 100644
|
| --- a/device/bluetooth/bluetooth_task_manager_win.cc
|
| +++ b/device/bluetooth/bluetooth_task_manager_win.cc
|
| @@ -844,6 +844,26 @@ void BluetoothTaskManagerWin::WriteGattCharacteristicValue(
|
| ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, hr));
|
| }
|
|
|
| +void BluetoothTaskManagerWin::RegisterGattCharacteristicValueChangedEvent(
|
| + base::FilePath service_path,
|
| + BTH_LE_GATT_CHARACTERISTIC characteristic,
|
| + const GattEventRegistrationCallback& callback,
|
| + PFNBLUETOOTH_GATT_EVENT_CALLBACK registered_callback,
|
| + void* context) {
|
| + BLUETOOTH_GATT_EVENT_HANDLE event_handle = NULL;
|
| +
|
| + BLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION event_parameter;
|
| + memcpy(&(event_parameter.Characteristics[0]), &characteristic,
|
| + sizeof(BTH_LE_GATT_CHARACTERISTIC));
|
| + event_parameter.NumCharacteristics = 1;
|
| + HRESULT hr =
|
| + win::BluetoothLowEnergyWrapper::GetInstance()->RegisterGattEvents(
|
| + service_path, CharacteristicValueChangedEvent, &event_parameter,
|
| + registered_callback, context, &event_handle);
|
| +
|
| + ui_task_runner_->PostTask(FROM_HERE, base::Bind(callback, event_handle, hr));
|
| +}
|
| +
|
| void BluetoothTaskManagerWin::PostGetGattIncludedCharacteristics(
|
| const base::FilePath& service_path,
|
| const BluetoothUUID& uuid,
|
| @@ -894,4 +914,26 @@ void BluetoothTaskManagerWin::PostWriteGattCharacteristicValue(
|
| OnAttemptWriteGattCharacteristic());
|
| }
|
|
|
| +void BluetoothTaskManagerWin::PostRegisterGattCharacteristicValueChangedEvent(
|
| + const base::FilePath& service_path,
|
| + const PBTH_LE_GATT_CHARACTERISTIC characteristic,
|
| + const GattEventRegistrationCallback& callback,
|
| + PFNBLUETOOTH_GATT_EVENT_CALLBACK registered_callback,
|
| + void* context) {
|
| + DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
|
| + bluetooth_task_runner_->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &BluetoothTaskManagerWin::RegisterGattCharacteristicValueChangedEvent,
|
| + this, service_path, *characteristic, callback, registered_callback,
|
| + context));
|
| +}
|
| +
|
| +void BluetoothTaskManagerWin::UnregisterGattCharacteristicValueChangedEvent(
|
| + BLUETOOTH_GATT_EVENT_HANDLE event_handle) {
|
| + DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
|
| + win::BluetoothLowEnergyWrapper::GetInstance()->UnregisterGattEvent(
|
| + event_handle);
|
| +}
|
| +
|
| } // namespace device
|
|
|