OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DISCOVERY_FILTER_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_FILTER_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_FILTER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_FILTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
| 12 #include <vector> |
12 | 13 |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | |
15 #include "device/bluetooth/bluetooth_common.h" | 15 #include "device/bluetooth/bluetooth_common.h" |
16 #include "device/bluetooth/bluetooth_export.h" | 16 #include "device/bluetooth/bluetooth_export.h" |
17 #include "device/bluetooth/bluetooth_uuid.h" | 17 #include "device/bluetooth/bluetooth_uuid.h" |
18 | 18 |
19 namespace device { | 19 namespace device { |
20 | 20 |
21 // Used to keep a discovery filter that can be used to limit reported devices. | 21 // Used to keep a discovery filter that can be used to limit reported devices. |
22 class DEVICE_BLUETOOTH_EXPORT BluetoothDiscoveryFilter { | 22 class DEVICE_BLUETOOTH_EXPORT BluetoothDiscoveryFilter { |
23 public: | 23 public: |
24 BluetoothDiscoveryFilter(BluetoothTransport transport); | 24 BluetoothDiscoveryFilter(BluetoothTransport transport); |
25 ~BluetoothDiscoveryFilter(); | 25 ~BluetoothDiscoveryFilter(); |
26 | 26 |
27 // These getters return true when given field is set in filter, and copy this | 27 // These getters return true when given field is set in filter, and copy this |
28 // value to |out_*| parameter. If value is not set, returns false. | 28 // value to |out_*| parameter. If value is not set, returns false. |
29 // Thes setters assign given value to proper filter field. | 29 // These setters assign given value to proper filter field. |
30 bool GetRSSI(int16_t* out_rssi) const; | 30 bool GetRSSI(int16_t* out_rssi) const; |
31 void SetRSSI(int16_t rssi); | 31 void SetRSSI(int16_t rssi); |
32 bool GetPathloss(uint16_t* out_pathloss) const; | 32 bool GetPathloss(uint16_t* out_pathloss) const; |
33 void SetPathloss(uint16_t pathloss); | 33 void SetPathloss(uint16_t pathloss); |
34 | 34 |
35 // Return and set transport field of this filter. | 35 // Return and set transport field of this filter. |
36 BluetoothTransport GetTransport() const; | 36 BluetoothTransport GetTransport() const; |
37 void SetTransport(BluetoothTransport transport); | 37 void SetTransport(BluetoothTransport transport); |
38 | 38 |
39 // Make |out_uuids| represent all uuids assigned to this filter. | 39 // Make |out_uuids| represent all uuids assigned to this filter. |
(...skipping 15 matching lines...) Expand all Loading... |
55 // Returns result of merging two filters together. If at least one of the | 55 // Returns result of merging two filters together. If at least one of the |
56 // filters is NULL this will return an empty filter | 56 // filters is NULL this will return an empty filter |
57 static std::unique_ptr<device::BluetoothDiscoveryFilter> Merge( | 57 static std::unique_ptr<device::BluetoothDiscoveryFilter> Merge( |
58 const device::BluetoothDiscoveryFilter* filter_a, | 58 const device::BluetoothDiscoveryFilter* filter_a, |
59 const device::BluetoothDiscoveryFilter* filter_b); | 59 const device::BluetoothDiscoveryFilter* filter_b); |
60 | 60 |
61 private: | 61 private: |
62 std::unique_ptr<int16_t> rssi_; | 62 std::unique_ptr<int16_t> rssi_; |
63 std::unique_ptr<uint16_t> pathloss_; | 63 std::unique_ptr<uint16_t> pathloss_; |
64 BluetoothTransport transport_; | 64 BluetoothTransport transport_; |
65 ScopedVector<device::BluetoothUUID> uuids_; | 65 std::vector<std::unique_ptr<device::BluetoothUUID>> uuids_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(BluetoothDiscoveryFilter); | 67 DISALLOW_COPY_AND_ASSIGN(BluetoothDiscoveryFilter); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace device | 70 } // namespace device |
71 | 71 |
72 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_FILTER_H_ | 72 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_FILTER_H_ |
OLD | NEW |