| 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| 7 | 7 |
| 8 #include <IOKit/IOReturn.h> | 8 #include <IOKit/IOReturn.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 int psm, | 68 int psm, |
| 69 const CreateServiceCallback& callback, | 69 const CreateServiceCallback& callback, |
| 70 const CreateServiceErrorCallback& error_callback) OVERRIDE; | 70 const CreateServiceErrorCallback& error_callback) OVERRIDE; |
| 71 | 71 |
| 72 // BluetoothDiscoveryManagerMac::Observer overrides | 72 // BluetoothDiscoveryManagerMac::Observer overrides |
| 73 virtual void DeviceFound(BluetoothDiscoveryManagerMac* manager, | 73 virtual void DeviceFound(BluetoothDiscoveryManagerMac* manager, |
| 74 IOBluetoothDevice* device) OVERRIDE; | 74 IOBluetoothDevice* device) OVERRIDE; |
| 75 virtual void DiscoveryStopped(BluetoothDiscoveryManagerMac* manager, | 75 virtual void DiscoveryStopped(BluetoothDiscoveryManagerMac* manager, |
| 76 bool unexpected) OVERRIDE; | 76 bool unexpected) OVERRIDE; |
| 77 | 77 |
| 78 // Registers that a new |device| has connected to the local host. |
| 79 void DeviceConnected(IOBluetoothDevice* device); |
| 80 |
| 78 protected: | 81 protected: |
| 79 // BluetoothAdapter: | 82 // BluetoothAdapter: |
| 80 virtual void RemovePairingDelegateInternal( | 83 virtual void RemovePairingDelegateInternal( |
| 81 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE; | 84 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE; |
| 82 | 85 |
| 83 private: | 86 private: |
| 84 friend class BluetoothAdapterMacTest; | 87 friend class BluetoothAdapterMacTest; |
| 85 | 88 |
| 86 BluetoothAdapterMac(); | 89 BluetoothAdapterMac(); |
| 87 virtual ~BluetoothAdapterMac(); | 90 virtual ~BluetoothAdapterMac(); |
| 88 | 91 |
| 89 // BluetoothAdapter: | 92 // BluetoothAdapter: |
| 90 virtual void AddDiscoverySession( | 93 virtual void AddDiscoverySession( |
| 91 const base::Closure& callback, | 94 const base::Closure& callback, |
| 92 const ErrorCallback& error_callback) OVERRIDE; | 95 const ErrorCallback& error_callback) OVERRIDE; |
| 93 virtual void RemoveDiscoverySession( | 96 virtual void RemoveDiscoverySession( |
| 94 const base::Closure& callback, | 97 const base::Closure& callback, |
| 95 const ErrorCallback& error_callback) OVERRIDE; | 98 const ErrorCallback& error_callback) OVERRIDE; |
| 96 | 99 |
| 97 void Init(); | 100 void Init(); |
| 98 void InitForTest(scoped_refptr<base::SequencedTaskRunner> ui_task_runner); | 101 void InitForTest(scoped_refptr<base::SequencedTaskRunner> ui_task_runner); |
| 99 void PollAdapter(); | 102 void PollAdapter(); |
| 100 | 103 |
| 101 // Updates |devices_| to be consistent with |devices|. | 104 // Updates |devices_| to include the currently paired devices, as well as any |
| 102 void UpdateDevices(NSArray* devices); | 105 // connected, but unpaired, devices. Notifies observers if any previously |
| 106 // paired or connected devices are no longer present. |
| 107 void UpdateDevices(); |
| 103 | 108 |
| 104 std::string address_; | 109 std::string address_; |
| 105 std::string name_; | 110 std::string name_; |
| 106 bool powered_; | 111 bool powered_; |
| 107 | 112 |
| 108 int num_discovery_sessions_; | 113 int num_discovery_sessions_; |
| 109 | 114 |
| 110 // Discovery manager for Bluetooth Classic. | 115 // Discovery manager for Bluetooth Classic. |
| 111 scoped_ptr<BluetoothDiscoveryManagerMac> classic_discovery_manager_; | 116 scoped_ptr<BluetoothDiscoveryManagerMac> classic_discovery_manager_; |
| 112 | 117 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 125 ObserverList<BluetoothAdapter::Observer> observers_; | 130 ObserverList<BluetoothAdapter::Observer> observers_; |
| 126 | 131 |
| 127 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; | 132 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; |
| 128 | 133 |
| 129 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); | 134 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); |
| 130 }; | 135 }; |
| 131 | 136 |
| 132 } // namespace device | 137 } // namespace device |
| 133 | 138 |
| 134 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 139 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| OLD | NEW |