OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 // asynchronous initialization is complete. | 185 // asynchronous initialization is complete. |
186 // Caution: The returned pointer also transfers ownership of the adapter. The | 186 // Caution: The returned pointer also transfers ownership of the adapter. The |
187 // caller is expected to call |AddRef()| on the returned pointer, typically by | 187 // caller is expected to call |AddRef()| on the returned pointer, typically by |
188 // storing it into a |scoped_refptr|. | 188 // storing it into a |scoped_refptr|. |
189 static base::WeakPtr<BluetoothAdapter> CreateAdapter( | 189 static base::WeakPtr<BluetoothAdapter> CreateAdapter( |
190 const InitCallback& init_callback); | 190 const InitCallback& init_callback); |
191 | 191 |
192 // Returns a weak pointer to an existing adapter for testing purposes only. | 192 // Returns a weak pointer to an existing adapter for testing purposes only. |
193 base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting(); | 193 base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting(); |
194 | 194 |
195 #if defined(OS_CHROMEOS) | |
196 // Shutdown the adapter: tear down and clean up all objects owned by | |
197 // BluetoothAdapter. After this call, the BluetoothAdapter will behave as if | |
198 // no Bluetooth controller exists in the local system. |IsPresent| will return | |
199 // false. No futher use of DBusThreadManager will be made. | |
200 void OnDBusThreadManagerShutdown(); | |
armansito
2015/01/16 21:57:18
If we're going to have this in BluetoothAdapter, t
scheib
2015/01/16 22:28:27
Done.
| |
201 #endif | |
202 | |
195 // Adds and removes observers for events on this bluetooth adapter. If | 203 // Adds and removes observers for events on this bluetooth adapter. If |
196 // monitoring multiple adapters, check the |adapter| parameter of observer | 204 // monitoring multiple adapters, check the |adapter| parameter of observer |
197 // methods to determine which adapter is issuing the event. | 205 // methods to determine which adapter is issuing the event. |
198 virtual void AddObserver(BluetoothAdapter::Observer* observer) = 0; | 206 virtual void AddObserver(BluetoothAdapter::Observer* observer) = 0; |
199 virtual void RemoveObserver( | 207 virtual void RemoveObserver( |
200 BluetoothAdapter::Observer* observer) = 0; | 208 BluetoothAdapter::Observer* observer) = 0; |
201 | 209 |
202 // The address of this adapter. The address format is "XX:XX:XX:XX:XX:XX", | 210 // The address of this adapter. The address format is "XX:XX:XX:XX:XX:XX", |
203 // where each XX is a hexadecimal number. | 211 // where each XX is a hexadecimal number. |
204 virtual std::string GetAddress() const = 0; | 212 virtual std::string GetAddress() const = 0; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
443 // Trait for RefCountedThreadSafe that deletes BluetoothAdapter. | 451 // Trait for RefCountedThreadSafe that deletes BluetoothAdapter. |
444 struct BluetoothAdapterDeleter { | 452 struct BluetoothAdapterDeleter { |
445 static void Destruct(const BluetoothAdapter* adapter) { | 453 static void Destruct(const BluetoothAdapter* adapter) { |
446 adapter->DeleteOnCorrectThread(); | 454 adapter->DeleteOnCorrectThread(); |
447 } | 455 } |
448 }; | 456 }; |
449 | 457 |
450 } // namespace device | 458 } // namespace device |
451 | 459 |
452 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 460 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
OLD | NEW |