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 CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ | 5 #ifndef CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ |
6 #define CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ | 6 #define CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 device::BluetoothAdvertisement::ErrorCode error_code) override; | 63 device::BluetoothAdvertisement::ErrorCode error_code) override; |
64 }; | 64 }; |
65 | 65 |
66 class IndividualAdvertisement | 66 class IndividualAdvertisement |
67 : public device::BluetoothAdapter::Observer, | 67 : public device::BluetoothAdapter::Observer, |
68 public device::BluetoothAdvertisement::Observer, | 68 public device::BluetoothAdvertisement::Observer, |
69 public base::RefCounted<IndividualAdvertisement> { | 69 public base::RefCounted<IndividualAdvertisement> { |
70 public: | 70 public: |
71 IndividualAdvertisement( | 71 IndividualAdvertisement( |
72 scoped_refptr<device::BluetoothAdapter> adapter, | 72 scoped_refptr<device::BluetoothAdapter> adapter, |
73 std::unique_ptr<cryptauth::ForegroundEidGenerator::DataWithTimestamp> | 73 std::unique_ptr<cryptauth::DataWithTimestamp> advertisement_data, |
74 advertisement_data, | |
75 std::shared_ptr<BleAdvertisementUnregisterHandler> unregister_handler); | 74 std::shared_ptr<BleAdvertisementUnregisterHandler> unregister_handler); |
76 | 75 |
77 // device::BluetoothAdapter::Observer | 76 // device::BluetoothAdapter::Observer |
78 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | 77 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, |
79 bool powered) override; | 78 bool powered) override; |
80 | 79 |
81 // device::BluetoothAdvertisement::Observer | 80 // device::BluetoothAdvertisement::Observer |
82 void AdvertisementReleased( | 81 void AdvertisementReleased( |
83 device::BluetoothAdvertisement* advertisement) override; | 82 device::BluetoothAdvertisement* advertisement) override; |
84 | 83 |
(...skipping 12 matching lines...) Expand all Loading... |
97 std::unique_ptr<device::BluetoothAdvertisement::UUIDList> | 96 std::unique_ptr<device::BluetoothAdvertisement::UUIDList> |
98 CreateServiceUuids() const; | 97 CreateServiceUuids() const; |
99 | 98 |
100 std::unique_ptr<device::BluetoothAdvertisement::ServiceData> | 99 std::unique_ptr<device::BluetoothAdvertisement::ServiceData> |
101 CreateServiceData() const; | 100 CreateServiceData() const; |
102 | 101 |
103 std::string ServiceDataInHex() const; | 102 std::string ServiceDataInHex() const; |
104 | 103 |
105 scoped_refptr<device::BluetoothAdapter> adapter_; | 104 scoped_refptr<device::BluetoothAdapter> adapter_; |
106 bool is_initializing_advertising_; | 105 bool is_initializing_advertising_; |
107 std::unique_ptr<cryptauth::ForegroundEidGenerator::DataWithTimestamp> | 106 std::unique_ptr<cryptauth::DataWithTimestamp> advertisement_data_; |
108 advertisement_data_; | |
109 std::shared_ptr<BleAdvertisementUnregisterHandler> unregister_handler_; | 107 std::shared_ptr<BleAdvertisementUnregisterHandler> unregister_handler_; |
110 scoped_refptr<device::BluetoothAdvertisement> advertisement_; | 108 scoped_refptr<device::BluetoothAdvertisement> advertisement_; |
111 | 109 |
112 base::WeakPtrFactory<IndividualAdvertisement> weak_ptr_factory_; | 110 base::WeakPtrFactory<IndividualAdvertisement> weak_ptr_factory_; |
113 | 111 |
114 DISALLOW_COPY_AND_ASSIGN(IndividualAdvertisement); | 112 DISALLOW_COPY_AND_ASSIGN(IndividualAdvertisement); |
115 }; | 113 }; |
116 | 114 |
117 BleAdvertiser( | 115 BleAdvertiser( |
118 scoped_refptr<device::BluetoothAdapter> adapter, | 116 scoped_refptr<device::BluetoothAdapter> adapter, |
(...skipping 14 matching lines...) Expand all Loading... |
133 device_id_to_advertisement_map_; | 131 device_id_to_advertisement_map_; |
134 | 132 |
135 DISALLOW_COPY_AND_ASSIGN(BleAdvertiser); | 133 DISALLOW_COPY_AND_ASSIGN(BleAdvertiser); |
136 }; | 134 }; |
137 | 135 |
138 } // namespace tether | 136 } // namespace tether |
139 | 137 |
140 } // namespace chromeos | 138 } // namespace chromeos |
141 | 139 |
142 #endif // CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ | 140 #endif // CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ |
OLD | NEW |