Chromium Code Reviews| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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()); |
| 61 CBUUID* uuid = [CBUUID UUIDWithString:uuidString]; | 61 CBUUID* uuid = [CBUUID UUIDWithString:uuidString]; |
| 62 [services addObject:uuid]; | 62 [services addObject:uuid]; |
| 63 } | 63 } |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 VLOG(1) << "TryStartDiscovery scanForPeripheralsWithServices"; | 66 VLOG(1) << "TryStartDiscovery scanForPeripheralsWithServices"; |
| 67 [central_manager_ scanForPeripheralsWithServices:services options:nil]; | 67 [central_manager_ |
| 68 scanForPeripheralsWithServices:services | |
| 69 options:@{ | |
| 70 CBCentralManagerScanOptionAllowDuplicatesKey : | |
|
scheib
2016/08/05 18:49:31
Add a comment explaining why CBCentralManagerScanO
ortuno
2016/08/05 23:00:17
This has to do with the reason stated in bluetooth
| |
| 71 @YES | |
| 72 }]; | |
| 68 pending_ = false; | 73 pending_ = false; |
| 69 } | 74 } |
| 70 | 75 |
| 71 void BluetoothLowEnergyDiscoveryManagerMac::StopDiscovery() { | 76 void BluetoothLowEnergyDiscoveryManagerMac::StopDiscovery() { |
| 72 VLOG(1) << "StopDiscovery"; | 77 VLOG(1) << "StopDiscovery"; |
| 73 if (discovering_ && !pending_) { | 78 if (discovering_ && !pending_) { |
| 74 [central_manager_ stopScan]; | 79 [central_manager_ stopScan]; |
| 75 } | 80 } |
| 76 discovering_ = false; | 81 discovering_ = false; |
| 77 } | 82 } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 95 } | 100 } |
| 96 | 101 |
| 97 BluetoothLowEnergyDiscoveryManagerMac::BluetoothLowEnergyDiscoveryManagerMac( | 102 BluetoothLowEnergyDiscoveryManagerMac::BluetoothLowEnergyDiscoveryManagerMac( |
| 98 Observer* observer) | 103 Observer* observer) |
| 99 : observer_(observer) { | 104 : observer_(observer) { |
| 100 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); | 105 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); |
| 101 discovering_ = false; | 106 discovering_ = false; |
| 102 } | 107 } |
| 103 | 108 |
| 104 } // namespace device | 109 } // namespace device |
| OLD | NEW |