| 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_discovery_manager_mac.h" | 5 #include "device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 if (!pending_) { | 39 if (!pending_) { |
| 40 VLOG(1) << "TryStartDiscovery !pending_"; | 40 VLOG(1) << "TryStartDiscovery !pending_"; |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 | 43 |
| 44 if (!central_manager_) { | 44 if (!central_manager_) { |
| 45 VLOG(1) << "TryStartDiscovery !central_manager_"; | 45 VLOG(1) << "TryStartDiscovery !central_manager_"; |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 | 48 |
| 49 if ([central_manager_ state] != CBCentralManagerStatePoweredOn) { | 49 if ([central_manager_ state] != CBManagerStatePoweredOn) { |
| 50 VLOG(1) << "TryStartDiscovery != CBCentralManagerStatePoweredOn"; | 50 VLOG(1) << "TryStartDiscovery != CBManagerStatePoweredOn"; |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Converts the services UUIDs to a CoreBluetooth data structure. | 54 // Converts the services UUIDs to a CoreBluetooth data structure. |
| 55 NSMutableArray* services = nil; | 55 NSMutableArray* services = nil; |
| 56 if (!services_uuids_.empty()) { | 56 if (!services_uuids_.empty()) { |
| 57 services = [NSMutableArray array]; | 57 services = [NSMutableArray array]; |
| 58 for (auto& service_uuid : services_uuids_) { | 58 for (auto& service_uuid : services_uuids_) { |
| 59 NSString* uuidString = | 59 NSString* uuidString = |
| 60 base::SysUTF8ToNSString(service_uuid.canonical_value().c_str()); | 60 base::SysUTF8ToNSString(service_uuid.canonical_value().c_str()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 BluetoothLowEnergyDiscoveryManagerMac::BluetoothLowEnergyDiscoveryManagerMac( | 104 BluetoothLowEnergyDiscoveryManagerMac::BluetoothLowEnergyDiscoveryManagerMac( |
| 105 Observer* observer) | 105 Observer* observer) |
| 106 : observer_(observer) { | 106 : observer_(observer) { |
| 107 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); | 107 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); |
| 108 discovering_ = false; | 108 discovering_ = false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace device | 111 } // namespace device |
| OLD | NEW |