| 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 #include "device/bluetooth/bluetooth_discovery_filter.h" | 5 #include "device/bluetooth/bluetooth_discovery_filter.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "device/bluetooth/bluetooth_common.h" | 9 #include "device/bluetooth/bluetooth_common.h" |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 void BluetoothDiscoveryFilter::SetTransport(BluetoothTransport transport) { | 57 void BluetoothDiscoveryFilter::SetTransport(BluetoothTransport transport) { |
| 58 DCHECK(transport != BLUETOOTH_TRANSPORT_INVALID); | 58 DCHECK(transport != BLUETOOTH_TRANSPORT_INVALID); |
| 59 transport_ = transport; | 59 transport_ = transport; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void BluetoothDiscoveryFilter::GetUUIDs( | 62 void BluetoothDiscoveryFilter::GetUUIDs( |
| 63 std::set<device::BluetoothUUID>& out_uuids) const { | 63 std::set<device::BluetoothUUID>& out_uuids) const { |
| 64 out_uuids.clear(); | 64 out_uuids.clear(); |
| 65 | 65 |
| 66 for (auto& uuid : uuids_) | 66 for (auto* uuid : uuids_) |
| 67 out_uuids.insert(*uuid); | 67 out_uuids.insert(*uuid); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void BluetoothDiscoveryFilter::AddUUID(const device::BluetoothUUID& uuid) { | 70 void BluetoothDiscoveryFilter::AddUUID(const device::BluetoothUUID& uuid) { |
| 71 DCHECK(uuid.IsValid()); | 71 DCHECK(uuid.IsValid()); |
| 72 for (auto& uuid_it : uuids_) { | 72 for (auto* uuid_it : uuids_) { |
| 73 if (*uuid_it == uuid) | 73 if (*uuid_it == uuid) |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 | 76 |
| 77 uuids_.push_back(new device::BluetoothUUID(uuid)); | 77 uuids_.push_back(new device::BluetoothUUID(uuid)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void BluetoothDiscoveryFilter::CopyFrom( | 80 void BluetoothDiscoveryFilter::CopyFrom( |
| 81 const BluetoothDiscoveryFilter& filter) { | 81 const BluetoothDiscoveryFilter& filter) { |
| 82 transport_ = filter.transport_; | 82 transport_ = filter.transport_; |
| 83 | 83 |
| 84 if (filter.uuids_.size()) { | 84 if (filter.uuids_.size()) { |
| 85 for (auto& uuid : filter.uuids_) | 85 for (auto* uuid : filter.uuids_) |
| 86 AddUUID(*uuid); | 86 AddUUID(*uuid); |
| 87 } else | 87 } else |
| 88 uuids_.clear(); | 88 uuids_.clear(); |
| 89 | 89 |
| 90 if (filter.rssi_.get()) { | 90 if (filter.rssi_.get()) { |
| 91 SetRSSI(*filter.rssi_); | 91 SetRSSI(*filter.rssi_); |
| 92 } else | 92 } else |
| 93 rssi_.reset(); | 93 rssi_.reset(); |
| 94 | 94 |
| 95 if (filter.pathloss_.get()) { | 95 if (filter.pathloss_.get()) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 return true; | 174 return true; |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool BluetoothDiscoveryFilter::IsDefault() const { | 177 bool BluetoothDiscoveryFilter::IsDefault() const { |
| 178 return !(rssi_.get() || pathloss_.get() || uuids_.size() || | 178 return !(rssi_.get() || pathloss_.get() || uuids_.size() || |
| 179 transport_ != BLUETOOTH_TRANSPORT_DUAL); | 179 transport_ != BLUETOOTH_TRANSPORT_DUAL); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace device | 182 } // namespace device |
| OLD | NEW |