| 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 634 } |
| 635 } | 635 } |
| 636 connected_devices.push_back(device_mac); | 636 connected_devices.push_back(device_mac); |
| 637 VLOG(1) << *device_mac << ": New connected device."; | 637 VLOG(1) << *device_mac << ": New connected device."; |
| 638 } | 638 } |
| 639 return connected_devices; | 639 return connected_devices; |
| 640 } | 640 } |
| 641 | 641 |
| 642 void BluetoothAdapterMac::CreateGattConnection( | 642 void BluetoothAdapterMac::CreateGattConnection( |
| 643 BluetoothLowEnergyDeviceMac* device_mac) { | 643 BluetoothLowEnergyDeviceMac* device_mac) { |
| 644 VLOG(1) << *device_mac << ": Create gatt connection."; |
| 644 [low_energy_central_manager_ connectPeripheral:device_mac->peripheral_ | 645 [low_energy_central_manager_ connectPeripheral:device_mac->peripheral_ |
| 645 options:nil]; | 646 options:nil]; |
| 646 } | 647 } |
| 647 | 648 |
| 648 void BluetoothAdapterMac::DisconnectGatt( | 649 void BluetoothAdapterMac::DisconnectGatt( |
| 649 BluetoothLowEnergyDeviceMac* device_mac) { | 650 BluetoothLowEnergyDeviceMac* device_mac) { |
| 651 VLOG(1) << *device_mac << ": Disconnect gatt."; |
| 650 [low_energy_central_manager_ | 652 [low_energy_central_manager_ |
| 651 cancelPeripheralConnection:device_mac->peripheral_]; | 653 cancelPeripheralConnection:device_mac->peripheral_]; |
| 652 } | 654 } |
| 653 | 655 |
| 654 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { | 656 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { |
| 655 BluetoothLowEnergyDeviceMac* device_mac = | 657 BluetoothLowEnergyDeviceMac* device_mac = |
| 656 GetBluetoothLowEnergyDeviceMac(peripheral); | 658 GetBluetoothLowEnergyDeviceMac(peripheral); |
| 657 if (!device_mac) { | 659 if (!device_mac) { |
| 658 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; | 660 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
| 659 return; | 661 return; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 NSError* error) { | 730 NSError* error) { |
| 729 if (!error) { | 731 if (!error) { |
| 730 return out << "no error"; | 732 return out << "no error"; |
| 731 } | 733 } |
| 732 return out << "error domain: " << base::SysNSStringToUTF8(error.domain) | 734 return out << "error domain: " << base::SysNSStringToUTF8(error.domain) |
| 733 << ", code: " << std::to_string(error.code) << ", description: " | 735 << ", code: " << std::to_string(error.code) << ", description: " |
| 734 << base::SysNSStringToUTF8(error.localizedDescription); | 736 << base::SysNSStringToUTF8(error.localizedDescription); |
| 735 } | 737 } |
| 736 | 738 |
| 737 } // namespace device | 739 } // namespace device |
| OLD | NEW |