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_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 : public device::BluetoothAdapter, | 37 : public device::BluetoothAdapter, |
38 public chromeos::BluetoothAdapterClient::Observer, | 38 public chromeos::BluetoothAdapterClient::Observer, |
39 public chromeos::BluetoothDeviceClient::Observer, | 39 public chromeos::BluetoothDeviceClient::Observer, |
40 public chromeos::BluetoothInputClient::Observer, | 40 public chromeos::BluetoothInputClient::Observer, |
41 public chromeos::BluetoothAgentServiceProvider::Delegate { | 41 public chromeos::BluetoothAgentServiceProvider::Delegate { |
42 public: | 42 public: |
43 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); | 43 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
44 | 44 |
45 // BluetoothAdapter: | 45 // BluetoothAdapter: |
46 virtual void AddObserver( | 46 virtual void AddObserver( |
47 device::BluetoothAdapter::Observer* observer) OVERRIDE; | 47 device::BluetoothAdapter::Observer* observer) override; |
48 virtual void RemoveObserver( | 48 virtual void RemoveObserver( |
49 device::BluetoothAdapter::Observer* observer) OVERRIDE; | 49 device::BluetoothAdapter::Observer* observer) override; |
50 virtual std::string GetAddress() const OVERRIDE; | 50 virtual std::string GetAddress() const override; |
51 virtual std::string GetName() const OVERRIDE; | 51 virtual std::string GetName() const override; |
52 virtual void SetName(const std::string& name, | 52 virtual void SetName(const std::string& name, |
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 IsInitialized() const OVERRIDE; | 55 virtual bool IsInitialized() const override; |
56 virtual bool IsPresent() const OVERRIDE; | 56 virtual bool IsPresent() const override; |
57 virtual bool IsPowered() const OVERRIDE; | 57 virtual bool IsPowered() const override; |
58 virtual void SetPowered( | 58 virtual void SetPowered( |
59 bool powered, | 59 bool powered, |
60 const base::Closure& callback, | 60 const base::Closure& callback, |
61 const ErrorCallback& error_callback) OVERRIDE; | 61 const ErrorCallback& error_callback) override; |
62 virtual bool IsDiscoverable() const OVERRIDE; | 62 virtual bool IsDiscoverable() const override; |
63 virtual void SetDiscoverable( | 63 virtual void SetDiscoverable( |
64 bool discoverable, | 64 bool discoverable, |
65 const base::Closure& callback, | 65 const base::Closure& callback, |
66 const ErrorCallback& error_callback) OVERRIDE; | 66 const ErrorCallback& error_callback) override; |
67 virtual bool IsDiscovering() const OVERRIDE; | 67 virtual bool IsDiscovering() const override; |
68 virtual void CreateRfcommService( | 68 virtual void CreateRfcommService( |
69 const device::BluetoothUUID& uuid, | 69 const device::BluetoothUUID& uuid, |
70 const ServiceOptions& options, | 70 const ServiceOptions& options, |
71 const CreateServiceCallback& callback, | 71 const CreateServiceCallback& callback, |
72 const CreateServiceErrorCallback& error_callback) OVERRIDE; | 72 const CreateServiceErrorCallback& error_callback) override; |
73 virtual void CreateL2capService( | 73 virtual void CreateL2capService( |
74 const device::BluetoothUUID& uuid, | 74 const device::BluetoothUUID& uuid, |
75 const ServiceOptions& options, | 75 const ServiceOptions& options, |
76 const CreateServiceCallback& callback, | 76 const CreateServiceCallback& callback, |
77 const CreateServiceErrorCallback& error_callback) OVERRIDE; | 77 const CreateServiceErrorCallback& error_callback) override; |
78 | 78 |
79 // Locates the device object by object path (the devices map and | 79 // Locates the device object by object path (the devices map and |
80 // BluetoothDevice methods are by address). | 80 // BluetoothDevice methods are by address). |
81 BluetoothDeviceChromeOS* GetDeviceWithPath( | 81 BluetoothDeviceChromeOS* GetDeviceWithPath( |
82 const dbus::ObjectPath& object_path); | 82 const dbus::ObjectPath& object_path); |
83 | 83 |
84 // Announce to observers a change in device state that is not reflected by | 84 // Announce to observers a change in device state that is not reflected by |
85 // its D-Bus properties. | 85 // its D-Bus properties. |
86 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device); | 86 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device); |
87 | 87 |
(...skipping 17 matching lines...) Expand all Loading... |
105 void NotifyGattDescriptorValueChanged( | 105 void NotifyGattDescriptorValueChanged( |
106 BluetoothRemoteGattDescriptorChromeOS* descriptor, | 106 BluetoothRemoteGattDescriptorChromeOS* descriptor, |
107 const std::vector<uint8>& value); | 107 const std::vector<uint8>& value); |
108 | 108 |
109 // Returns the object path of the adapter. | 109 // Returns the object path of the adapter. |
110 const dbus::ObjectPath& object_path() const { return object_path_; } | 110 const dbus::ObjectPath& object_path() const { return object_path_; } |
111 | 111 |
112 protected: | 112 protected: |
113 // BluetoothAdapter: | 113 // BluetoothAdapter: |
114 virtual void RemovePairingDelegateInternal( | 114 virtual void RemovePairingDelegateInternal( |
115 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE; | 115 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
116 | 116 |
117 private: | 117 private: |
118 friend class BluetoothChromeOSTest; | 118 friend class BluetoothChromeOSTest; |
119 | 119 |
120 // typedef for callback parameters that are passed to AddDiscoverySession | 120 // typedef for callback parameters that are passed to AddDiscoverySession |
121 // and RemoveDiscoverySession. This is used to queue incoming requests while | 121 // and RemoveDiscoverySession. This is used to queue incoming requests while |
122 // a call to BlueZ is pending. | 122 // a call to BlueZ is pending. |
123 typedef std::pair<base::Closure, ErrorCallback> DiscoveryCallbackPair; | 123 typedef std::pair<base::Closure, ErrorCallback> DiscoveryCallbackPair; |
124 typedef std::queue<DiscoveryCallbackPair> DiscoveryCallbackQueue; | 124 typedef std::queue<DiscoveryCallbackPair> DiscoveryCallbackQueue; |
125 | 125 |
126 BluetoothAdapterChromeOS(); | 126 BluetoothAdapterChromeOS(); |
127 virtual ~BluetoothAdapterChromeOS(); | 127 virtual ~BluetoothAdapterChromeOS(); |
128 | 128 |
129 // BluetoothAdapterClient::Observer override. | 129 // BluetoothAdapterClient::Observer override. |
130 virtual void AdapterAdded(const dbus::ObjectPath& object_path) OVERRIDE; | 130 virtual void AdapterAdded(const dbus::ObjectPath& object_path) override; |
131 virtual void AdapterRemoved(const dbus::ObjectPath& object_path) OVERRIDE; | 131 virtual void AdapterRemoved(const dbus::ObjectPath& object_path) override; |
132 virtual void AdapterPropertyChanged( | 132 virtual void AdapterPropertyChanged( |
133 const dbus::ObjectPath& object_path, | 133 const dbus::ObjectPath& object_path, |
134 const std::string& property_name) OVERRIDE; | 134 const std::string& property_name) override; |
135 | 135 |
136 // BluetoothDeviceClient::Observer override. | 136 // BluetoothDeviceClient::Observer override. |
137 virtual void DeviceAdded(const dbus::ObjectPath& object_path) OVERRIDE; | 137 virtual void DeviceAdded(const dbus::ObjectPath& object_path) override; |
138 virtual void DeviceRemoved(const dbus::ObjectPath& object_path) OVERRIDE; | 138 virtual void DeviceRemoved(const dbus::ObjectPath& object_path) override; |
139 virtual void DevicePropertyChanged(const dbus::ObjectPath& object_path, | 139 virtual void DevicePropertyChanged(const dbus::ObjectPath& object_path, |
140 const std::string& property_name) OVERRIDE; | 140 const std::string& property_name) override; |
141 | 141 |
142 // BluetoothInputClient::Observer override. | 142 // BluetoothInputClient::Observer override. |
143 virtual void InputPropertyChanged(const dbus::ObjectPath& object_path, | 143 virtual void InputPropertyChanged(const dbus::ObjectPath& object_path, |
144 const std::string& property_name) OVERRIDE; | 144 const std::string& property_name) override; |
145 | 145 |
146 // BluetoothAgentServiceProvider::Delegate override. | 146 // BluetoothAgentServiceProvider::Delegate override. |
147 virtual void Released() OVERRIDE; | 147 virtual void Released() override; |
148 virtual void RequestPinCode(const dbus::ObjectPath& device_path, | 148 virtual void RequestPinCode(const dbus::ObjectPath& device_path, |
149 const PinCodeCallback& callback) OVERRIDE; | 149 const PinCodeCallback& callback) override; |
150 virtual void DisplayPinCode(const dbus::ObjectPath& device_path, | 150 virtual void DisplayPinCode(const dbus::ObjectPath& device_path, |
151 const std::string& pincode) OVERRIDE; | 151 const std::string& pincode) override; |
152 virtual void RequestPasskey(const dbus::ObjectPath& device_path, | 152 virtual void RequestPasskey(const dbus::ObjectPath& device_path, |
153 const PasskeyCallback& callback) OVERRIDE; | 153 const PasskeyCallback& callback) override; |
154 virtual void DisplayPasskey(const dbus::ObjectPath& device_path, | 154 virtual void DisplayPasskey(const dbus::ObjectPath& device_path, |
155 uint32 passkey, uint16 entered) OVERRIDE; | 155 uint32 passkey, uint16 entered) override; |
156 virtual void RequestConfirmation(const dbus::ObjectPath& device_path, | 156 virtual void RequestConfirmation(const dbus::ObjectPath& device_path, |
157 uint32 passkey, | 157 uint32 passkey, |
158 const ConfirmationCallback& callback) | 158 const ConfirmationCallback& callback) |
159 OVERRIDE; | 159 override; |
160 virtual void RequestAuthorization(const dbus::ObjectPath& device_path, | 160 virtual void RequestAuthorization(const dbus::ObjectPath& device_path, |
161 const ConfirmationCallback& callback) | 161 const ConfirmationCallback& callback) |
162 OVERRIDE; | 162 override; |
163 virtual void AuthorizeService(const dbus::ObjectPath& device_path, | 163 virtual void AuthorizeService(const dbus::ObjectPath& device_path, |
164 const std::string& uuid, | 164 const std::string& uuid, |
165 const ConfirmationCallback& callback) OVERRIDE; | 165 const ConfirmationCallback& callback) override; |
166 virtual void Cancel() OVERRIDE; | 166 virtual void Cancel() override; |
167 | 167 |
168 // Called by dbus:: on completion of the D-Bus method call to register the | 168 // Called by dbus:: on completion of the D-Bus method call to register the |
169 // pairing agent. | 169 // pairing agent. |
170 void OnRegisterAgent(); | 170 void OnRegisterAgent(); |
171 void OnRegisterAgentError(const std::string& error_name, | 171 void OnRegisterAgentError(const std::string& error_name, |
172 const std::string& error_message); | 172 const std::string& error_message); |
173 | 173 |
174 // Called by dbus:: on completion of the D-Bus method call to request that | 174 // Called by dbus:: on completion of the D-Bus method call to request that |
175 // the pairing agent be made the default. | 175 // the pairing agent be made the default. |
176 void OnRequestDefaultAgent(); | 176 void OnRequestDefaultAgent(); |
(...skipping 30 matching lines...) Expand all Loading... |
207 bool success); | 207 bool success); |
208 | 208 |
209 // Called by dbus:: on completion of an adapter property change. | 209 // Called by dbus:: on completion of an adapter property change. |
210 void OnPropertyChangeCompleted(const base::Closure& callback, | 210 void OnPropertyChangeCompleted(const base::Closure& callback, |
211 const ErrorCallback& error_callback, | 211 const ErrorCallback& error_callback, |
212 bool success); | 212 bool success); |
213 | 213 |
214 // BluetoothAdapter: | 214 // BluetoothAdapter: |
215 virtual void AddDiscoverySession( | 215 virtual void AddDiscoverySession( |
216 const base::Closure& callback, | 216 const base::Closure& callback, |
217 const ErrorCallback& error_callback) OVERRIDE; | 217 const ErrorCallback& error_callback) override; |
218 virtual void RemoveDiscoverySession( | 218 virtual void RemoveDiscoverySession( |
219 const base::Closure& callback, | 219 const base::Closure& callback, |
220 const ErrorCallback& error_callback) OVERRIDE; | 220 const ErrorCallback& error_callback) override; |
221 | 221 |
222 // Called by dbus:: on completion of the D-Bus method call to start discovery. | 222 // Called by dbus:: on completion of the D-Bus method call to start discovery. |
223 void OnStartDiscovery(const base::Closure& callback); | 223 void OnStartDiscovery(const base::Closure& callback); |
224 void OnStartDiscoveryError(const base::Closure& callback, | 224 void OnStartDiscoveryError(const base::Closure& callback, |
225 const ErrorCallback& error_callback, | 225 const ErrorCallback& error_callback, |
226 const std::string& error_name, | 226 const std::string& error_name, |
227 const std::string& error_message); | 227 const std::string& error_message); |
228 | 228 |
229 // Called by dbus:: on completion of the D-Bus method call to stop discovery. | 229 // Called by dbus:: on completion of the D-Bus method call to stop discovery. |
230 void OnStopDiscovery(const base::Closure& callback); | 230 void OnStopDiscovery(const base::Closure& callback); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // Note: This should remain the last member so it'll be destroyed and | 272 // Note: This should remain the last member so it'll be destroyed and |
273 // invalidate its weak pointers before any other members are destroyed. | 273 // invalidate its weak pointers before any other members are destroyed. |
274 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 274 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; |
275 | 275 |
276 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 276 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); |
277 }; | 277 }; |
278 | 278 |
279 } // namespace chromeos | 279 } // namespace chromeos |
280 | 280 |
281 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 281 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
OLD | NEW |