Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 // newly discovered |num| of |descriptors|. | 73 // newly discovered |num| of |descriptors|. |
| 74 static bool DoesDescriptorExist(PBTH_LE_GATT_DESCRIPTOR descriptors, | 74 static bool DoesDescriptorExist(PBTH_LE_GATT_DESCRIPTOR descriptors, |
| 75 uint16_t num, | 75 uint16_t num, |
| 76 BluetoothRemoteGattDescriptorWin* descriptor); | 76 BluetoothRemoteGattDescriptorWin* descriptor); |
| 77 | 77 |
| 78 void OnReadRemoteCharacteristicValueCallback( | 78 void OnReadRemoteCharacteristicValueCallback( |
| 79 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC_VALUE> value, | 79 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC_VALUE> value, |
| 80 HRESULT hr); | 80 HRESULT hr); |
| 81 void OnWriteRemoteCharacteristicValueCallback(HRESULT hr); | 81 void OnWriteRemoteCharacteristicValueCallback(HRESULT hr); |
| 82 BluetoothGattService::GattErrorCode HRESULTToGattErrorCode(HRESULT hr); | 82 BluetoothGattService::GattErrorCode HRESULTToGattErrorCode(HRESULT hr); |
| 83 void OnGattCharacteristicValueChanged( | |
| 84 scoped_ptr<std::vector<uint8_t>> new_value); | |
| 85 void GattEventRegistrationCallback(PVOID event_handle, HRESULT hr); | |
| 86 void StartNotifySession(); | |
|
ortuno
2016/03/30 22:34:23
There are now two functions called StartNotifySess
gogerald1
2016/03/31 17:44:13
Done. no longer needed.
| |
| 87 void ClearIncludedDescriptors(); | |
| 83 | 88 |
| 84 BluetoothRemoteGattServiceWin* parent_service_; | 89 BluetoothRemoteGattServiceWin* parent_service_; |
| 85 scoped_refptr<BluetoothTaskManagerWin> task_manager_; | 90 scoped_refptr<BluetoothTaskManagerWin> task_manager_; |
| 86 | 91 |
| 87 // Characteristic info from OS and used to interact with OS. | 92 // Characteristic info from OS and used to interact with OS. |
| 88 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC> characteristic_info_; | 93 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC> characteristic_info_; |
| 89 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 94 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 90 BluetoothUUID characteristic_uuid_; | 95 BluetoothUUID characteristic_uuid_; |
| 91 std::vector<uint8_t> characteristic_value_; | 96 std::vector<uint8_t> characteristic_value_; |
| 92 std::string characteristic_identifier_; | 97 std::string characteristic_identifier_; |
| 93 | 98 |
| 94 // The key of GattDescriptorMap is the identitfier of | 99 // The key of GattDescriptorMap is the identitfier of |
| 95 // BluetoothRemoteGattDescriptorWin instance. | 100 // BluetoothRemoteGattDescriptorWin instance. |
| 96 typedef std::unordered_map<std::string, | 101 typedef std::unordered_map<std::string, |
| 97 scoped_ptr<BluetoothRemoteGattDescriptorWin>> | 102 scoped_ptr<BluetoothRemoteGattDescriptorWin>> |
| 98 GattDescriptorMap; | 103 GattDescriptorMap; |
| 99 GattDescriptorMap included_descriptors_; | 104 GattDescriptorMap included_descriptors_; |
| 100 | 105 |
| 106 // Flag indicates if get included descriptors has been completed. | |
| 107 bool included_descriptors_discovered_; | |
| 108 | |
| 109 // Identifier of the Client Characteristic Configuration descriptor; | |
| 110 std::string ccc_descriptor_identifier_; | |
| 111 | |
| 101 // Flag indicates if characteristic added notification of this characteristic | 112 // Flag indicates if characteristic added notification of this characteristic |
| 102 // has been sent out to avoid duplicate notification. | 113 // has been sent out to avoid duplicate notification. |
| 103 bool characteristic_added_notified_; | 114 bool characteristic_added_notified_; |
| 104 | 115 |
| 105 // ReadRemoteCharacteristic request callbacks. | 116 // ReadRemoteCharacteristic request callbacks. |
| 106 std::pair<ValueCallback, ErrorCallback> read_characteristic_value_callbacks_; | 117 std::pair<ValueCallback, ErrorCallback> read_characteristic_value_callbacks_; |
| 107 | 118 |
| 108 // WriteRemoteCharacteristic request callbacks. | 119 // WriteRemoteCharacteristic request callbacks. |
| 109 std::pair<base::Closure, ErrorCallback> write_characteristic_value_callbacks_; | 120 std::pair<base::Closure, ErrorCallback> write_characteristic_value_callbacks_; |
| 110 | 121 |
| 111 bool characteristic_value_read_or_write_in_progress_; | 122 bool characteristic_value_read_or_write_in_progress_; |
| 112 | 123 |
| 124 // Vector stores StartNotifySession request callbacks. | |
| 125 std::vector<std::pair<NotifySessionCallback, ErrorCallback>> | |
| 126 start_notify_session_callbacks_; | |
| 127 | |
| 128 // Flag indicates if GATT event registration is in progress. | |
| 129 bool gatt_event_registeration_in_progress_; | |
| 130 | |
| 131 // GATT event handle returned by GattEventRegistrationCallback. | |
| 132 PVOID gatt_event_handle_; | |
| 133 | |
| 113 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_; | 134 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_; |
| 114 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin); | 135 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin); |
| 115 }; | 136 }; |
| 116 | 137 |
| 117 } // namespace device | 138 } // namespace device |
| 118 | 139 |
| 119 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ | 140 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ |
| OLD | NEW |