| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 } | 581 } |
| 582 | 582 |
| 583 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { | 583 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { |
| 584 BluetoothLowEnergyDeviceMac* device_mac = | 584 BluetoothLowEnergyDeviceMac* device_mac = |
| 585 GetBluetoothLowEnergyDeviceMac(peripheral); | 585 GetBluetoothLowEnergyDeviceMac(peripheral); |
| 586 if (!device_mac) { | 586 if (!device_mac) { |
| 587 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; | 587 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
| 588 return; | 588 return; |
| 589 } | 589 } |
| 590 device_mac->DidConnectGatt(); | 590 device_mac->DidConnectGatt(); |
| 591 [device_mac->GetPeripheral() discoverServices:nil]; |
| 591 } | 592 } |
| 592 | 593 |
| 593 void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral, | 594 void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral, |
| 594 NSError* error) { | 595 NSError* error) { |
| 595 BluetoothLowEnergyDeviceMac* device_mac = | 596 BluetoothLowEnergyDeviceMac* device_mac = |
| 596 GetBluetoothLowEnergyDeviceMac(peripheral); | 597 GetBluetoothLowEnergyDeviceMac(peripheral); |
| 597 if (!device_mac) { | 598 if (!device_mac) { |
| 598 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; | 599 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
| 599 return; | 600 return; |
| 600 } | 601 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 628 std::string device_address = | 629 std::string device_address = |
| 629 BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral); | 630 BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral); |
| 630 DevicesMap::const_iterator iter = devices_.find(device_address); | 631 DevicesMap::const_iterator iter = devices_.find(device_address); |
| 631 if (iter == devices_.end()) { | 632 if (iter == devices_.end()) { |
| 632 return nil; | 633 return nil; |
| 633 } | 634 } |
| 634 return static_cast<BluetoothLowEnergyDeviceMac*>(iter->second); | 635 return static_cast<BluetoothLowEnergyDeviceMac*>(iter->second); |
| 635 } | 636 } |
| 636 | 637 |
| 637 } // namespace device | 638 } // namespace device |
| OLD | NEW |