Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1901)

Unified Diff: device/bluetooth/bluetooth_task_manager_win.cc

Issue 1749403002: Implement BluetoothRemoteGattCharacteristicWin::StartNotifySession and related unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adjust comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698