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_ADVERTISEMENT_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | |
10 #include <map> | 9 #include <map> |
11 #include <string> | 10 #include <string> |
| 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "device/bluetooth/bluetooth_export.h" | 19 #include "device/bluetooth/bluetooth_export.h" |
20 | 20 |
21 namespace device { | 21 namespace device { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 using ManufacturerData = std::map<uint16_t, std::vector<uint8_t>>; | 53 using ManufacturerData = std::map<uint16_t, std::vector<uint8_t>>; |
54 using ServiceData = std::map<std::string, std::vector<uint8_t>>; | 54 using ServiceData = std::map<std::string, std::vector<uint8_t>>; |
55 | 55 |
56 // Structure that holds the data for an advertisement. | 56 // Structure that holds the data for an advertisement. |
57 class DEVICE_BLUETOOTH_EXPORT Data { | 57 class DEVICE_BLUETOOTH_EXPORT Data { |
58 public: | 58 public: |
59 explicit Data(AdvertisementType type); | 59 explicit Data(AdvertisementType type); |
60 ~Data(); | 60 ~Data(); |
61 | 61 |
62 AdvertisementType type() { return type_; } | 62 AdvertisementType type() { return type_; } |
63 scoped_ptr<UUIDList> service_uuids() { return service_uuids_.Pass(); } | 63 scoped_ptr<UUIDList> service_uuids() { return std::move(service_uuids_); } |
64 scoped_ptr<ManufacturerData> manufacturer_data() { | 64 scoped_ptr<ManufacturerData> manufacturer_data() { |
65 return manufacturer_data_.Pass(); | 65 return std::move(manufacturer_data_); |
66 } | 66 } |
67 scoped_ptr<UUIDList> solicit_uuids() { return solicit_uuids_.Pass(); } | 67 scoped_ptr<UUIDList> solicit_uuids() { return std::move(solicit_uuids_); } |
68 scoped_ptr<ServiceData> service_data() { return service_data_.Pass(); } | 68 scoped_ptr<ServiceData> service_data() { return std::move(service_data_); } |
69 | 69 |
70 void set_service_uuids(scoped_ptr<UUIDList> service_uuids) { | 70 void set_service_uuids(scoped_ptr<UUIDList> service_uuids) { |
71 service_uuids_ = service_uuids.Pass(); | 71 service_uuids_ = std::move(service_uuids); |
72 } | 72 } |
73 void set_manufacturer_data(scoped_ptr<ManufacturerData> manufacturer_data) { | 73 void set_manufacturer_data(scoped_ptr<ManufacturerData> manufacturer_data) { |
74 manufacturer_data_ = manufacturer_data.Pass(); | 74 manufacturer_data_ = std::move(manufacturer_data); |
75 } | 75 } |
76 void set_solicit_uuids(scoped_ptr<UUIDList> solicit_uuids) { | 76 void set_solicit_uuids(scoped_ptr<UUIDList> solicit_uuids) { |
77 solicit_uuids_ = solicit_uuids.Pass(); | 77 solicit_uuids_ = std::move(solicit_uuids); |
78 } | 78 } |
79 void set_service_data(scoped_ptr<ServiceData> service_data) { | 79 void set_service_data(scoped_ptr<ServiceData> service_data) { |
80 service_data_ = service_data.Pass(); | 80 service_data_ = std::move(service_data); |
81 } | 81 } |
82 | 82 |
83 void set_include_tx_power(bool include_tx_power) { | 83 void set_include_tx_power(bool include_tx_power) { |
84 include_tx_power_ = include_tx_power; | 84 include_tx_power_ = include_tx_power; |
85 } | 85 } |
86 | 86 |
87 private: | 87 private: |
88 Data(); | 88 Data(); |
89 | 89 |
90 AdvertisementType type_; | 90 AdvertisementType type_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // |observers_| are expected to outlive a BluetoothAdvertisement object. | 131 // |observers_| are expected to outlive a BluetoothAdvertisement object. |
132 base::ObserverList<BluetoothAdvertisement::Observer> observers_; | 132 base::ObserverList<BluetoothAdvertisement::Observer> observers_; |
133 | 133 |
134 private: | 134 private: |
135 DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisement); | 135 DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisement); |
136 }; | 136 }; |
137 | 137 |
138 } // namespace device | 138 } // namespace device |
139 | 139 |
140 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_H_ | 140 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_H_ |
OLD | NEW |