| 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 "components/proximity_auth/ble/bluetooth_low_energy_characteristics_fin
der.h" | 5 #include "components/proximity_auth/ble/bluetooth_low_energy_characteristics_fin
der.h" |
| 6 | 6 |
| 7 #include "components/proximity_auth/logging/logging.h" | 7 #include "components/proximity_auth/logging/logging.h" |
| 8 #include "device/bluetooth/bluetooth_adapter.h" | 8 #include "device/bluetooth/bluetooth_adapter.h" |
| 9 #include "device/bluetooth/bluetooth_device.h" | 9 #include "device/bluetooth/bluetooth_device.h" |
| 10 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 10 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 void BluetoothLowEnergyCharacteristicsFinder::ScanRemoteCharacteristics( | 85 void BluetoothLowEnergyCharacteristicsFinder::ScanRemoteCharacteristics( |
| 86 BluetoothDevice* device, | 86 BluetoothDevice* device, |
| 87 const BluetoothUUID& service_uuid) { | 87 const BluetoothUUID& service_uuid) { |
| 88 PA_LOG(INFO) << "Scanning remote characteristics."; | 88 PA_LOG(INFO) << "Scanning remote characteristics."; |
| 89 if (device) { | 89 if (device) { |
| 90 std::vector<BluetoothRemoteGattService*> services = | 90 std::vector<BluetoothRemoteGattService*> services = |
| 91 device->GetGattServices(); | 91 device->GetGattServices(); |
| 92 PA_LOG(INFO) << device->GetAddress() << " has " << services.size() | 92 PA_LOG(INFO) << device->GetAddress() << " has " << services.size() |
| 93 << " services."; | 93 << " services."; |
| 94 for (const auto& service : services) { | 94 for (auto* service : services) { |
| 95 if (service->GetUUID() == service_uuid) { | 95 if (service->GetUUID() == service_uuid) { |
| 96 // Right service found, now scaning its characteristics. | 96 // Right service found, now scaning its characteristics. |
| 97 std::vector<device::BluetoothRemoteGattCharacteristic*> | 97 std::vector<device::BluetoothRemoteGattCharacteristic*> |
| 98 characteristics = service->GetCharacteristics(); | 98 characteristics = service->GetCharacteristics(); |
| 99 PA_LOG(INFO) << "Service " << service_uuid.canonical_value() << " has " | 99 PA_LOG(INFO) << "Service " << service_uuid.canonical_value() << " has " |
| 100 << characteristics.size() << " characteristics."; | 100 << characteristics.size() << " characteristics."; |
| 101 for (const auto& characteristic : characteristics) { | 101 for (auto* characteristic : characteristics) { |
| 102 HandleCharacteristicUpdate(characteristic); | 102 HandleCharacteristicUpdate(characteristic); |
| 103 } | 103 } |
| 104 break; | 104 break; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 void BluetoothLowEnergyCharacteristicsFinder::HandleCharacteristicUpdate( | 110 void BluetoothLowEnergyCharacteristicsFinder::HandleCharacteristicUpdate( |
| 111 BluetoothRemoteGattCharacteristic* characteristic) { | 111 BluetoothRemoteGattCharacteristic* characteristic) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 134 remote_service_.id = service->GetIdentifier(); | 134 remote_service_.id = service->GetIdentifier(); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 void BluetoothLowEnergyCharacteristicsFinder::ResetCallbacks() { | 138 void BluetoothLowEnergyCharacteristicsFinder::ResetCallbacks() { |
| 139 success_callback_.Reset(); | 139 success_callback_.Reset(); |
| 140 error_callback_.Reset(); | 140 error_callback_.Reset(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace proximity_auth | 143 } // namespace proximity_auth |
| OLD | NEW |