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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 // Checks if the descriptor with |uuid| and |attribute_handle| has already | 68 // Checks if the descriptor with |uuid| and |attribute_handle| has already |
69 // been discovered as included descriptor. | 69 // been discovered as included descriptor. |
70 bool IsDescriptorDiscovered(BTH_LE_UUID& uuid, uint16_t attribute_handle); | 70 bool IsDescriptorDiscovered(BTH_LE_UUID& uuid, uint16_t attribute_handle); |
71 | 71 |
72 // Checks if |descriptor| still exists in this characteristic according to | 72 // Checks if |descriptor| still exists in this characteristic according to |
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( | |
79 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC_VALUE> value, | |
80 HRESULT hr); | |
81 void OnWriteRemoteCharacteristicValueCallback(HRESULT hr); | |
82 BluetoothGattService::GattErrorCode HRESULTToGattErrorCode(HRESULT hr); | |
83 | |
78 BluetoothRemoteGattServiceWin* parent_service_; | 84 BluetoothRemoteGattServiceWin* parent_service_; |
79 scoped_refptr<BluetoothTaskManagerWin> task_manager_; | 85 scoped_refptr<BluetoothTaskManagerWin> task_manager_; |
80 | 86 |
81 // Characteristic info from OS and used to interact with OS. | 87 // Characteristic info from OS and used to interact with OS. |
82 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC> characteristic_info_; | 88 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC> characteristic_info_; |
83 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 89 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
84 BluetoothUUID characteristic_uuid_; | 90 BluetoothUUID characteristic_uuid_; |
85 std::vector<uint8_t> characteristic_value_; | 91 std::vector<uint8_t> characteristic_value_; |
86 std::string characteristic_identifier_; | 92 std::string characteristic_identifier_; |
87 | 93 |
88 // The key of GattDescriptorMap is the identitfier of | 94 // The key of GattDescriptorMap is the identitfier of |
89 // BluetoothRemoteGattDescriptorWin instance. | 95 // BluetoothRemoteGattDescriptorWin instance. |
90 typedef std::unordered_map<std::string, | 96 typedef std::unordered_map<std::string, |
91 scoped_ptr<BluetoothRemoteGattDescriptorWin>> | 97 scoped_ptr<BluetoothRemoteGattDescriptorWin>> |
92 GattDescriptorMap; | 98 GattDescriptorMap; |
93 GattDescriptorMap included_descriptors_; | 99 GattDescriptorMap included_descriptors_; |
94 | 100 |
95 // Flag indicates if characteristic added notification of this characteristic | 101 // Flag indicates if characteristic added notification of this characteristic |
96 // has been sent out to avoid duplicate notification. | 102 // has been sent out to avoid duplicate notification. |
97 bool characteristic_added_notified_; | 103 bool characteristic_added_notified_; |
98 | 104 |
105 // ReadRemoteCharacteristic request callbacks. | |
106 std::pair<ValueCallback, ErrorCallback> | |
107 read_remote_characteristic_value_callbacks_; | |
scheib
2016/03/03 00:39:42
optional, but those names seem long vs:
read_callb
gogerald1
2016/03/03 16:09:24
Done.
| |
108 | |
109 // WriteRemoteCharacteristic request callbacks. | |
110 std::pair<base::Closure, ErrorCallback> | |
111 write_remote_characteristic_value_callbacks_; | |
112 | |
113 bool characteristic_value_read_or_write_in_progress_; | |
114 | |
99 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_; | 115 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_; |
100 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin); | 116 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin); |
101 }; | 117 }; |
102 | 118 |
103 } // namespace device | 119 } // namespace device |
104 | 120 |
105 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ | 121 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_ |
OLD | NEW |