| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 } | 664 } |
| 665 | 665 |
| 666 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { | 666 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { |
| 667 BluetoothLowEnergyDeviceMac* device_mac = | 667 BluetoothLowEnergyDeviceMac* device_mac = |
| 668 GetBluetoothLowEnergyDeviceMac(peripheral); | 668 GetBluetoothLowEnergyDeviceMac(peripheral); |
| 669 if (!device_mac) { | 669 if (!device_mac) { |
| 670 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; | 670 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
| 671 return; | 671 return; |
| 672 } | 672 } |
| 673 device_mac->DidConnectGatt(); | 673 device_mac->DidConnectGatt(); |
| 674 device_mac->DiscoverPrimaryServices(); | |
| 675 } | 674 } |
| 676 | 675 |
| 677 void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral, | 676 void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral, |
| 678 NSError* error) { | 677 NSError* error) { |
| 679 BluetoothLowEnergyDeviceMac* device_mac = | 678 BluetoothLowEnergyDeviceMac* device_mac = |
| 680 GetBluetoothLowEnergyDeviceMac(peripheral); | 679 GetBluetoothLowEnergyDeviceMac(peripheral); |
| 681 if (!device_mac) { | 680 if (!device_mac) { |
| 682 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; | 681 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
| 683 return; | 682 return; |
| 684 } | 683 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 // hash the probability of this occuring with 10,000 devices | 730 // hash the probability of this occuring with 10,000 devices |
| 732 // simultaneously present is 1e-6 (see | 731 // simultaneously present is 1e-6 (see |
| 733 // https://en.wikipedia.org/wiki/Birthday_problem#Probability_table). We | 732 // https://en.wikipedia.org/wiki/Birthday_problem#Probability_table). We |
| 734 // ignore the second device by returning. | 733 // ignore the second device by returning. |
| 735 return true; | 734 return true; |
| 736 } | 735 } |
| 737 return false; | 736 return false; |
| 738 } | 737 } |
| 739 | 738 |
| 740 } // namespace device | 739 } // namespace device |
| OLD | NEW |