OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "device/bluetooth/bluetooth_task_manager_win.h" | 5 #include "device/bluetooth/bluetooth_task_manager_win.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <winsock2.h> | 8 #include <winsock2.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 PVOID, | 147 PVOID, |
148 std::unique_ptr<CharacteristicValueChangedRegistration>> | 148 std::unique_ptr<CharacteristicValueChangedRegistration>> |
149 CharacteristicValueChangedRegistrationMap; | 149 CharacteristicValueChangedRegistrationMap; |
150 | 150 |
151 CharacteristicValueChangedRegistrationMap | 151 CharacteristicValueChangedRegistrationMap |
152 g_characteristic_value_changed_registrations; | 152 g_characteristic_value_changed_registrations; |
153 base::Lock g_characteristic_value_changed_registrations_lock; | 153 base::Lock g_characteristic_value_changed_registrations_lock; |
154 | 154 |
155 // Function to be registered to OS to monitor Bluetooth LE GATT event. It is | 155 // Function to be registered to OS to monitor Bluetooth LE GATT event. It is |
156 // invoked in BluetoothApis.dll thread. | 156 // invoked in BluetoothApis.dll thread. |
157 void OnGetGattEventWin(BTH_LE_GATT_EVENT_TYPE type, | 157 void CALLBACK OnGetGattEventWin(BTH_LE_GATT_EVENT_TYPE type, |
158 PVOID event_parameter, | 158 PVOID event_parameter, |
159 PVOID context) { | 159 PVOID context) { |
160 if (type != CharacteristicValueChangedEvent) { | 160 if (type != CharacteristicValueChangedEvent) { |
161 // Right now, only characteristic value changed event is supported. | 161 // Right now, only characteristic value changed event is supported. |
162 NOTREACHED(); | 162 NOTREACHED(); |
163 return; | 163 return; |
164 } | 164 } |
165 | 165 |
166 BLUETOOTH_GATT_VALUE_CHANGED_EVENT* event = | 166 BLUETOOTH_GATT_VALUE_CHANGED_EVENT* event = |
167 (BLUETOOTH_GATT_VALUE_CHANGED_EVENT*)event_parameter; | 167 (BLUETOOTH_GATT_VALUE_CHANGED_EVENT*)event_parameter; |
168 PBTH_LE_GATT_CHARACTERISTIC_VALUE new_value_win = event->CharacteristicValue; | 168 PBTH_LE_GATT_CHARACTERISTIC_VALUE new_value_win = event->CharacteristicValue; |
169 std::unique_ptr<std::vector<uint8_t>> new_value( | 169 std::unique_ptr<std::vector<uint8_t>> new_value( |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 void BluetoothTaskManagerWin::PostUnregisterGattCharacteristicValueChangedEvent( | 1034 void BluetoothTaskManagerWin::PostUnregisterGattCharacteristicValueChangedEvent( |
1035 PVOID event_handle) { | 1035 PVOID event_handle) { |
1036 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); | 1036 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
1037 bluetooth_task_runner_->PostTask( | 1037 bluetooth_task_runner_->PostTask( |
1038 FROM_HERE, base::Bind(&BluetoothTaskManagerWin:: | 1038 FROM_HERE, base::Bind(&BluetoothTaskManagerWin:: |
1039 UnregisterGattCharacteristicValueChangedEvent, | 1039 UnregisterGattCharacteristicValueChangedEvent, |
1040 this, event_handle)); | 1040 this, event_handle)); |
1041 } | 1041 } |
1042 | 1042 |
1043 } // namespace device | 1043 } // namespace device |
OLD | NEW |