| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_adapter_mac.h" | 5 #include "device/bluetooth/bluetooth_adapter_mac.h" |
| 6 | 6 |
| 7 #import <IOBluetooth/objc/IOBluetoothDevice.h> | 7 #import <IOBluetooth/objc/IOBluetoothDevice.h> |
| 8 #import <IOBluetooth/objc/IOBluetoothHostController.h> | 8 #import <IOBluetooth/objc/IOBluetoothHostController.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 } | 643 } |
| 644 | 644 |
| 645 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { | 645 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { |
| 646 BluetoothLowEnergyDeviceMac* device_mac = | 646 BluetoothLowEnergyDeviceMac* device_mac = |
| 647 GetBluetoothLowEnergyDeviceMac(peripheral); | 647 GetBluetoothLowEnergyDeviceMac(peripheral); |
| 648 if (!device_mac) { | 648 if (!device_mac) { |
| 649 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; | 649 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
| 650 return; | 650 return; |
| 651 } | 651 } |
| 652 device_mac->DidConnectGatt(); | 652 device_mac->DidConnectGatt(); |
| 653 [device_mac->GetPeripheral() discoverServices:nil]; | 653 device_mac->DiscoverPrimaryServices(); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral, | 656 void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral, |
| 657 NSError* error) { | 657 NSError* error) { |
| 658 BluetoothLowEnergyDeviceMac* device_mac = | 658 BluetoothLowEnergyDeviceMac* device_mac = |
| 659 GetBluetoothLowEnergyDeviceMac(peripheral); | 659 GetBluetoothLowEnergyDeviceMac(peripheral); |
| 660 if (!device_mac) { | 660 if (!device_mac) { |
| 661 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; | 661 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
| 662 return; | 662 return; |
| 663 } | 663 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 // hash the probability of this occuring with 10,000 devices | 716 // hash the probability of this occuring with 10,000 devices |
| 717 // simultaneously present is 1e-6 (see | 717 // simultaneously present is 1e-6 (see |
| 718 // https://en.wikipedia.org/wiki/Birthday_problem#Probability_table). We | 718 // https://en.wikipedia.org/wiki/Birthday_problem#Probability_table). We |
| 719 // ignore the second device by returning. | 719 // ignore the second device by returning. |
| 720 return true; | 720 return true; |
| 721 } | 721 } |
| 722 return false; | 722 return false; |
| 723 } | 723 } |
| 724 | 724 |
| 725 } // namespace device | 725 } // namespace device |
| OLD | NEW |