| 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_low_energy_device_mac.h" | 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" |
| 6 | 6 |
| 7 #import <CoreFoundation/CoreFoundation.h> | 7 #import <CoreFoundation/CoreFoundation.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 << error.localizedDescription.UTF8String << " (" << error.domain | 245 << error.localizedDescription.UTF8String << " (" << error.domain |
| 246 << ": " << error.code << ")"; | 246 << ": " << error.code << ")"; |
| 247 return; | 247 return; |
| 248 } | 248 } |
| 249 for (CBService* cb_service in GetPeripheral().services) { | 249 for (CBService* cb_service in GetPeripheral().services) { |
| 250 BluetoothRemoteGattServiceMac* gatt_service = | 250 BluetoothRemoteGattServiceMac* gatt_service = |
| 251 GetBluetoothRemoteGattService(cb_service); | 251 GetBluetoothRemoteGattService(cb_service); |
| 252 if (!gatt_service) { | 252 if (!gatt_service) { |
| 253 gatt_service = new BluetoothRemoteGattServiceMac(this, cb_service, | 253 gatt_service = new BluetoothRemoteGattServiceMac(this, cb_service, |
| 254 true /* is_primary */); | 254 true /* is_primary */); |
| 255 gatt_services_.add(gatt_service->GetIdentifier(), | 255 auto result_iter = gatt_services_.add(gatt_service->GetIdentifier(), |
| 256 base::WrapUnique(gatt_service)); | 256 base::WrapUnique(gatt_service)); |
| 257 DCHECK(result_iter.second); |
| 257 adapter_->NotifyGattServiceAdded(gatt_service); | 258 adapter_->NotifyGattServiceAdded(gatt_service); |
| 258 } | 259 } |
| 259 } | 260 } |
| 260 // TODO(http://crbug.com/609064): Services are fully discovered once all | 261 // TODO(http://crbug.com/609064): Services are fully discovered once all |
| 261 // characteristics have been found. | 262 // characteristics have been found. |
| 262 SetGattServicesDiscoveryComplete(true); | 263 SetGattServicesDiscoveryComplete(true); |
| 263 adapter_->NotifyGattServicesDiscovered(this); | 264 adapter_->NotifyGattServicesDiscovered(this); |
| 264 } | 265 } |
| 265 | 266 |
| 266 void BluetoothLowEnergyDeviceMac::DidModifyServices( | 267 void BluetoothLowEnergyDeviceMac::DidModifyServices( |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 for (const auto& key : service_keys) { | 332 for (const auto& key : service_keys) { |
| 332 gatt_services_.take_and_erase(key); | 333 gatt_services_.take_and_erase(key); |
| 333 } | 334 } |
| 334 if (create_gatt_connection_error_callbacks_.empty()) { | 335 if (create_gatt_connection_error_callbacks_.empty()) { |
| 335 // TODO(http://crbug.com/585897): Need to pass the error. | 336 // TODO(http://crbug.com/585897): Need to pass the error. |
| 336 DidDisconnectGatt(); | 337 DidDisconnectGatt(); |
| 337 } else { | 338 } else { |
| 338 DidFailToConnectGatt(error_code); | 339 DidFailToConnectGatt(error_code); |
| 339 } | 340 } |
| 340 } | 341 } |
| OLD | NEW |