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_SERVICE_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_WIN_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_WIN_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "device/bluetooth/bluetooth_gatt_service.h" | |
15 #include "device/bluetooth/bluetooth_low_energy_defs_win.h" | 14 #include "device/bluetooth/bluetooth_low_energy_defs_win.h" |
| 15 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
16 | 16 |
17 namespace device { | 17 namespace device { |
18 | 18 |
19 class BluetoothAdapterWin; | 19 class BluetoothAdapterWin; |
20 class BluetoothDeviceWin; | 20 class BluetoothDeviceWin; |
21 class BluetoothRemoteGattCharacteristicWin; | 21 class BluetoothRemoteGattCharacteristicWin; |
22 class BluetoothTaskManagerWin; | 22 class BluetoothTaskManagerWin; |
23 | 23 |
24 // The BluetoothRemoteGattServiceWin class implements BluetoothGattService | 24 // The BluetoothRemoteGattServiceWin class implements BluetoothRemoteGattService |
25 // for remote GATT services on Windows 8 and later. | 25 // for remote GATT services on Windows 8 and later. |
26 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattServiceWin | 26 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattServiceWin |
27 : public BluetoothGattService { | 27 : public BluetoothRemoteGattService { |
28 public: | 28 public: |
29 BluetoothRemoteGattServiceWin( | 29 BluetoothRemoteGattServiceWin( |
30 BluetoothDeviceWin* device, | 30 BluetoothDeviceWin* device, |
31 base::FilePath service_path, | 31 base::FilePath service_path, |
32 BluetoothUUID service_uuid, | 32 BluetoothUUID service_uuid, |
33 uint16_t service_attribute_handle, | 33 uint16_t service_attribute_handle, |
34 bool is_primary, | 34 bool is_primary, |
35 BluetoothRemoteGattServiceWin* parent_service, | 35 BluetoothRemoteGattServiceWin* parent_service, |
36 scoped_refptr<base::SequencedTaskRunner>& ui_task_runner); | 36 scoped_refptr<base::SequencedTaskRunner>& ui_task_runner); |
37 ~BluetoothRemoteGattServiceWin() override; | 37 ~BluetoothRemoteGattServiceWin() override; |
38 | 38 |
39 // Override BluetoothGattService interfaces. | 39 // Override BluetoothRemoteGattService interfaces. |
40 std::string GetIdentifier() const override; | 40 std::string GetIdentifier() const override; |
41 BluetoothUUID GetUUID() const override; | 41 BluetoothUUID GetUUID() const override; |
42 bool IsLocal() const override; | |
43 bool IsPrimary() const override; | 42 bool IsPrimary() const override; |
44 BluetoothDevice* GetDevice() const override; | 43 BluetoothDevice* GetDevice() const override; |
45 std::vector<BluetoothGattCharacteristic*> GetCharacteristics() const override; | 44 std::vector<BluetoothRemoteGattCharacteristic*> GetCharacteristics() |
46 std::vector<BluetoothGattService*> GetIncludedServices() const override; | 45 const override; |
47 BluetoothGattCharacteristic* GetCharacteristic( | 46 std::vector<BluetoothRemoteGattService*> GetIncludedServices() const override; |
| 47 BluetoothRemoteGattCharacteristic* GetCharacteristic( |
48 const std::string& identifier) const override; | 48 const std::string& identifier) const override; |
49 bool AddCharacteristic(BluetoothGattCharacteristic* characteristic) override; | |
50 bool AddIncludedService(BluetoothGattService* service) override; | |
51 void Register(const base::Closure& callback, | |
52 const ErrorCallback& error_callback) override; | |
53 void Unregister(const base::Closure& callback, | |
54 const ErrorCallback& error_callback) override; | |
55 | 49 |
56 // Notify |characteristic| discovery complete, |characteristic| is the | 50 // Notify |characteristic| discovery complete, |characteristic| is the |
57 // included characteritic of this service. | 51 // included characteritic of this service. |
58 void GattCharacteristicDiscoveryComplete( | 52 void GattCharacteristicDiscoveryComplete( |
59 BluetoothRemoteGattCharacteristicWin* characteristic); | 53 BluetoothRemoteGattCharacteristicWin* characteristic); |
60 | 54 |
61 // Update included services and characteristics. | 55 // Update included services and characteristics. |
62 void Update(); | 56 void Update(); |
63 uint16_t GetAttributeHandle() const { return service_attribute_handle_; } | 57 uint16_t GetAttributeHandle() const { return service_attribute_handle_; } |
64 base::FilePath GetServicePath() { return service_path_; } | 58 base::FilePath GetServicePath() { return service_path_; } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Flag indicates if asynchronous discovery of included characteristic has | 117 // Flag indicates if asynchronous discovery of included characteristic has |
124 // completed. | 118 // completed. |
125 bool included_characteristics_discovered_; | 119 bool included_characteristics_discovered_; |
126 | 120 |
127 base::WeakPtrFactory<BluetoothRemoteGattServiceWin> weak_ptr_factory_; | 121 base::WeakPtrFactory<BluetoothRemoteGattServiceWin> weak_ptr_factory_; |
128 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceWin); | 122 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceWin); |
129 }; | 123 }; |
130 | 124 |
131 } // namespace device. | 125 } // namespace device. |
132 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_WIN_H_ | 126 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_WIN_H_ |
OLD | NEW |