| 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" |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "components/cryptauth/eid_data_with_timestamp.h" |
| 14 #include "components/cryptauth/foreground_eid_generator.h" | 15 #include "components/cryptauth/foreground_eid_generator.h" |
| 15 #include "components/cryptauth/remote_device.h" | 16 #include "components/cryptauth/remote_device.h" |
| 16 #include "device/bluetooth/bluetooth_adapter.h" | 17 #include "device/bluetooth/bluetooth_adapter.h" |
| 17 #include "device/bluetooth/bluetooth_adapter_factory.h" | 18 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 18 #include "device/bluetooth/bluetooth_advertisement.h" | 19 #include "device/bluetooth/bluetooth_advertisement.h" |
| 19 | 20 |
| 20 namespace cryptauth { | 21 namespace cryptauth { |
| 21 class RemoteBeaconSeedFetcher; | 22 class RemoteBeaconSeedFetcher; |
| 22 } | 23 } |
| 23 | 24 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 device::BluetoothAdvertisement::ErrorCode error_code) override; | 64 device::BluetoothAdvertisement::ErrorCode error_code) override; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 class IndividualAdvertisement | 67 class IndividualAdvertisement |
| 67 : public device::BluetoothAdapter::Observer, | 68 : public device::BluetoothAdapter::Observer, |
| 68 public device::BluetoothAdvertisement::Observer, | 69 public device::BluetoothAdvertisement::Observer, |
| 69 public base::RefCounted<IndividualAdvertisement> { | 70 public base::RefCounted<IndividualAdvertisement> { |
| 70 public: | 71 public: |
| 71 IndividualAdvertisement( | 72 IndividualAdvertisement( |
| 72 scoped_refptr<device::BluetoothAdapter> adapter, | 73 scoped_refptr<device::BluetoothAdapter> adapter, |
| 73 std::unique_ptr<cryptauth::ForegroundEidGenerator::DataWithTimestamp> | 74 std::unique_ptr<cryptauth::EidDataWithTimestamp> advertisement_data, |
| 74 advertisement_data, | |
| 75 std::shared_ptr<BleAdvertisementUnregisterHandler> unregister_handler); | 75 std::shared_ptr<BleAdvertisementUnregisterHandler> unregister_handler); |
| 76 | 76 |
| 77 // device::BluetoothAdapter::Observer | 77 // device::BluetoothAdapter::Observer |
| 78 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | 78 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, |
| 79 bool powered) override; | 79 bool powered) override; |
| 80 | 80 |
| 81 // device::BluetoothAdvertisement::Observer | 81 // device::BluetoothAdvertisement::Observer |
| 82 void AdvertisementReleased( | 82 void AdvertisementReleased( |
| 83 device::BluetoothAdvertisement* advertisement) override; | 83 device::BluetoothAdvertisement* advertisement) override; |
| 84 | 84 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 97 std::unique_ptr<device::BluetoothAdvertisement::UUIDList> | 97 std::unique_ptr<device::BluetoothAdvertisement::UUIDList> |
| 98 CreateServiceUuids() const; | 98 CreateServiceUuids() const; |
| 99 | 99 |
| 100 std::unique_ptr<device::BluetoothAdvertisement::ServiceData> | 100 std::unique_ptr<device::BluetoothAdvertisement::ServiceData> |
| 101 CreateServiceData() const; | 101 CreateServiceData() const; |
| 102 | 102 |
| 103 std::string ServiceDataInHex() const; | 103 std::string ServiceDataInHex() const; |
| 104 | 104 |
| 105 scoped_refptr<device::BluetoothAdapter> adapter_; | 105 scoped_refptr<device::BluetoothAdapter> adapter_; |
| 106 bool is_initializing_advertising_; | 106 bool is_initializing_advertising_; |
| 107 std::unique_ptr<cryptauth::ForegroundEidGenerator::DataWithTimestamp> | 107 std::unique_ptr<cryptauth::EidDataWithTimestamp> advertisement_data_; |
| 108 advertisement_data_; | |
| 109 std::shared_ptr<BleAdvertisementUnregisterHandler> unregister_handler_; | 108 std::shared_ptr<BleAdvertisementUnregisterHandler> unregister_handler_; |
| 110 scoped_refptr<device::BluetoothAdvertisement> advertisement_; | 109 scoped_refptr<device::BluetoothAdvertisement> advertisement_; |
| 111 | 110 |
| 112 base::WeakPtrFactory<IndividualAdvertisement> weak_ptr_factory_; | 111 base::WeakPtrFactory<IndividualAdvertisement> weak_ptr_factory_; |
| 113 | 112 |
| 114 DISALLOW_COPY_AND_ASSIGN(IndividualAdvertisement); | 113 DISALLOW_COPY_AND_ASSIGN(IndividualAdvertisement); |
| 115 }; | 114 }; |
| 116 | 115 |
| 117 BleAdvertiser( | 116 BleAdvertiser( |
| 118 scoped_refptr<device::BluetoothAdapter> adapter, | 117 scoped_refptr<device::BluetoothAdapter> adapter, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 133 device_id_to_advertisement_map_; | 132 device_id_to_advertisement_map_; |
| 134 | 133 |
| 135 DISALLOW_COPY_AND_ASSIGN(BleAdvertiser); | 134 DISALLOW_COPY_AND_ASSIGN(BleAdvertiser); |
| 136 }; | 135 }; |
| 137 | 136 |
| 138 } // namespace tether | 137 } // namespace tether |
| 139 | 138 |
| 140 } // namespace chromeos | 139 } // namespace chromeos |
| 141 | 140 |
| 142 #endif // CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ | 141 #endif // CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ |
| OLD | NEW |