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 20 matching lines...) Expand all Loading... |
31 namespace device { | 31 namespace device { |
32 | 32 |
33 class BluetoothAdapterMacTest; | 33 class BluetoothAdapterMacTest; |
34 | 34 |
35 class BluetoothAdapterMac : public BluetoothAdapter, | 35 class BluetoothAdapterMac : public BluetoothAdapter, |
36 public BluetoothDiscoveryManagerMac::Observer { | 36 public BluetoothDiscoveryManagerMac::Observer { |
37 public: | 37 public: |
38 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); | 38 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
39 | 39 |
40 // BluetoothAdapter: | 40 // BluetoothAdapter: |
41 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 41 virtual void AddObserver(BluetoothAdapter::Observer* observer) override; |
42 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 42 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) override; |
43 virtual std::string GetAddress() const OVERRIDE; | 43 virtual std::string GetAddress() const override; |
44 virtual std::string GetName() const OVERRIDE; | 44 virtual std::string GetName() const override; |
45 virtual void SetName(const std::string& name, | 45 virtual void SetName(const std::string& name, |
46 const base::Closure& callback, | 46 const base::Closure& callback, |
47 const ErrorCallback& error_callback) OVERRIDE; | 47 const ErrorCallback& error_callback) override; |
48 virtual bool IsInitialized() const OVERRIDE; | 48 virtual bool IsInitialized() const override; |
49 virtual bool IsPresent() const OVERRIDE; | 49 virtual bool IsPresent() const override; |
50 virtual bool IsPowered() const OVERRIDE; | 50 virtual bool IsPowered() const override; |
51 virtual void SetPowered( | 51 virtual void SetPowered( |
52 bool powered, | 52 bool powered, |
53 const base::Closure& callback, | 53 const base::Closure& callback, |
54 const ErrorCallback& error_callback) OVERRIDE; | 54 const ErrorCallback& error_callback) override; |
55 virtual bool IsDiscoverable() const OVERRIDE; | 55 virtual bool IsDiscoverable() const override; |
56 virtual void SetDiscoverable( | 56 virtual void SetDiscoverable( |
57 bool discoverable, | 57 bool discoverable, |
58 const base::Closure& callback, | 58 const base::Closure& callback, |
59 const ErrorCallback& error_callback) OVERRIDE; | 59 const ErrorCallback& error_callback) override; |
60 virtual bool IsDiscovering() const OVERRIDE; | 60 virtual bool IsDiscovering() const override; |
61 virtual void CreateRfcommService( | 61 virtual void CreateRfcommService( |
62 const BluetoothUUID& uuid, | 62 const BluetoothUUID& uuid, |
63 const ServiceOptions& options, | 63 const ServiceOptions& options, |
64 const CreateServiceCallback& callback, | 64 const CreateServiceCallback& callback, |
65 const CreateServiceErrorCallback& error_callback) OVERRIDE; | 65 const CreateServiceErrorCallback& error_callback) override; |
66 virtual void CreateL2capService( | 66 virtual void CreateL2capService( |
67 const BluetoothUUID& uuid, | 67 const BluetoothUUID& uuid, |
68 const ServiceOptions& options, | 68 const ServiceOptions& options, |
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(IOBluetoothDevice* device) OVERRIDE; | 73 virtual void DeviceFound(IOBluetoothDevice* device) override; |
74 virtual void DiscoveryStopped(bool unexpected) OVERRIDE; | 74 virtual void DiscoveryStopped(bool unexpected) override; |
75 | 75 |
76 // Registers that a new |device| has connected to the local host. | 76 // Registers that a new |device| has connected to the local host. |
77 void DeviceConnected(IOBluetoothDevice* device); | 77 void DeviceConnected(IOBluetoothDevice* device); |
78 | 78 |
79 protected: | 79 protected: |
80 // BluetoothAdapter: | 80 // BluetoothAdapter: |
81 virtual void RemovePairingDelegateInternal( | 81 virtual void RemovePairingDelegateInternal( |
82 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE; | 82 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
83 | 83 |
84 private: | 84 private: |
85 friend class BluetoothAdapterMacTest; | 85 friend class BluetoothAdapterMacTest; |
86 | 86 |
87 BluetoothAdapterMac(); | 87 BluetoothAdapterMac(); |
88 virtual ~BluetoothAdapterMac(); | 88 virtual ~BluetoothAdapterMac(); |
89 | 89 |
90 // BluetoothAdapter: | 90 // BluetoothAdapter: |
91 virtual void AddDiscoverySession( | 91 virtual void AddDiscoverySession( |
92 const base::Closure& callback, | 92 const base::Closure& callback, |
93 const ErrorCallback& error_callback) OVERRIDE; | 93 const ErrorCallback& error_callback) override; |
94 virtual void RemoveDiscoverySession( | 94 virtual void RemoveDiscoverySession( |
95 const base::Closure& callback, | 95 const base::Closure& callback, |
96 const ErrorCallback& error_callback) OVERRIDE; | 96 const ErrorCallback& error_callback) override; |
97 | 97 |
98 void Init(); | 98 void Init(); |
99 void InitForTest(scoped_refptr<base::SequencedTaskRunner> ui_task_runner); | 99 void InitForTest(scoped_refptr<base::SequencedTaskRunner> ui_task_runner); |
100 void PollAdapter(); | 100 void PollAdapter(); |
101 | 101 |
102 // Registers that a new |device| has replied to an Inquiry, is paired, or has | 102 // Registers that a new |device| has replied to an Inquiry, is paired, or has |
103 // connected to the local host. | 103 // connected to the local host. |
104 void DeviceAdded(IOBluetoothDevice* device); | 104 void DeviceAdded(IOBluetoothDevice* device); |
105 | 105 |
106 // Updates |devices_| to include the currently paired devices, as well as any | 106 // Updates |devices_| to include the currently paired devices, as well as any |
(...skipping 16 matching lines...) Expand all Loading... |
123 ObserverList<BluetoothAdapter::Observer> observers_; | 123 ObserverList<BluetoothAdapter::Observer> observers_; |
124 | 124 |
125 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; | 125 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; |
126 | 126 |
127 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); | 127 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); |
128 }; | 128 }; |
129 | 129 |
130 } // namespace device | 130 } // namespace device |
131 | 131 |
132 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 132 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
OLD | NEW |