| 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_DESCRIPTOR_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_WIN_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_WIN_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "device/bluetooth/bluetooth_gatt_descriptor.h" | |
| 13 #include "device/bluetooth/bluetooth_low_energy_defs_win.h" | 12 #include "device/bluetooth/bluetooth_low_energy_defs_win.h" |
| 13 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 14 | 14 |
| 15 namespace device { | 15 namespace device { |
| 16 | 16 |
| 17 class BluetoothAdapterWin; | 17 class BluetoothAdapterWin; |
| 18 class BluetoothRemoteGattCharacteristicWin; | 18 class BluetoothRemoteGattCharacteristicWin; |
| 19 class BluetoothTaskManagerWin; | 19 class BluetoothTaskManagerWin; |
| 20 | 20 |
| 21 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorWin | 21 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorWin |
| 22 : public BluetoothGattDescriptor { | 22 : public BluetoothRemoteGattDescriptor { |
| 23 public: | 23 public: |
| 24 BluetoothRemoteGattDescriptorWin( | 24 BluetoothRemoteGattDescriptorWin( |
| 25 BluetoothRemoteGattCharacteristicWin* parent_characteristic, | 25 BluetoothRemoteGattCharacteristicWin* parent_characteristic, |
| 26 BTH_LE_GATT_DESCRIPTOR* descriptor_info, | 26 BTH_LE_GATT_DESCRIPTOR* descriptor_info, |
| 27 scoped_refptr<base::SequencedTaskRunner>& ui_task_runner); | 27 scoped_refptr<base::SequencedTaskRunner>& ui_task_runner); |
| 28 ~BluetoothRemoteGattDescriptorWin() override; | 28 ~BluetoothRemoteGattDescriptorWin() override; |
| 29 | 29 |
| 30 // Override BluetoothGattDescriptor interfaces. | 30 // Override BluetoothRemoteGattDescriptor interfaces. |
| 31 std::string GetIdentifier() const override; | 31 std::string GetIdentifier() const override; |
| 32 BluetoothUUID GetUUID() const override; | 32 BluetoothUUID GetUUID() const override; |
| 33 bool IsLocal() const override; | 33 bool IsLocal() const override; |
| 34 std::vector<uint8_t>& GetValue() const override; | 34 std::vector<uint8_t>& GetValue() const override; |
| 35 BluetoothGattCharacteristic* GetCharacteristic() const override; | 35 BluetoothRemoteGattCharacteristic* GetCharacteristic() const override; |
| 36 BluetoothGattCharacteristic::Permissions GetPermissions() const override; | 36 BluetoothRemoteGattCharacteristic::Permissions GetPermissions() |
| 37 const override; |
| 37 void ReadRemoteDescriptor(const ValueCallback& callback, | 38 void ReadRemoteDescriptor(const ValueCallback& callback, |
| 38 const ErrorCallback& error_callback) override; | 39 const ErrorCallback& error_callback) override; |
| 39 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, | 40 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, |
| 40 const base::Closure& callback, | 41 const base::Closure& callback, |
| 41 const ErrorCallback& error_callback) override; | 42 const ErrorCallback& error_callback) override; |
| 42 | 43 |
| 43 uint16_t GetAttributeHandle() const; | 44 uint16_t GetAttributeHandle() const; |
| 44 PBTH_LE_GATT_DESCRIPTOR GetWinDescriptorInfo() const { | 45 PBTH_LE_GATT_DESCRIPTOR GetWinDescriptorInfo() const { |
| 45 return descriptor_info_.get(); | 46 return descriptor_info_.get(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 BluetoothRemoteGattCharacteristicWin* parent_characteristic_; | 50 BluetoothRemoteGattCharacteristicWin* parent_characteristic_; |
| 50 std::unique_ptr<BTH_LE_GATT_DESCRIPTOR> descriptor_info_; | 51 std::unique_ptr<BTH_LE_GATT_DESCRIPTOR> descriptor_info_; |
| 51 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 52 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 52 | 53 |
| 53 base::FilePath service_path_; | 54 base::FilePath service_path_; |
| 54 scoped_refptr<BluetoothTaskManagerWin> task_manager_; | 55 scoped_refptr<BluetoothTaskManagerWin> task_manager_; |
| 55 BluetoothGattCharacteristic::Permissions descriptor_permissions_; | 56 BluetoothRemoteGattCharacteristic::Permissions descriptor_permissions_; |
| 56 BluetoothUUID descriptor_uuid_; | 57 BluetoothUUID descriptor_uuid_; |
| 57 std::string descriptor_identifier_; | 58 std::string descriptor_identifier_; |
| 58 std::vector<uint8_t> descriptor_value_; | 59 std::vector<uint8_t> descriptor_value_; |
| 59 | 60 |
| 60 base::WeakPtrFactory<BluetoothRemoteGattDescriptorWin> weak_ptr_factory_; | 61 base::WeakPtrFactory<BluetoothRemoteGattDescriptorWin> weak_ptr_factory_; |
| 61 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorWin); | 62 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorWin); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace device. | 65 } // namespace device. |
| 65 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_WIN_H_ | 66 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_WIN_H_ |
| OLD | NEW |