| 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // - If there is a pending request to the subsystem, queue this request to | 415 // - If there is a pending request to the subsystem, queue this request to |
| 416 // execute once the pending requests are done. | 416 // execute once the pending requests are done. |
| 417 // - If the count is 0, return failure, as there is no active discovery | 417 // - If the count is 0, return failure, as there is no active discovery |
| 418 // session. | 418 // session. |
| 419 // - If the count is 1, issue a request to the subsystem to stop device | 419 // - If the count is 1, issue a request to the subsystem to stop device |
| 420 // discovery and decrement the count to 0 on success. | 420 // discovery and decrement the count to 0 on success. |
| 421 // - If the count is greater than 1, decrement the count and return | 421 // - If the count is greater than 1, decrement the count and return |
| 422 // success. | 422 // success. |
| 423 // | 423 // |
| 424 // |discovery_filter| passed to AddDiscoverySession and RemoveDiscoverySession | 424 // |discovery_filter| passed to AddDiscoverySession and RemoveDiscoverySession |
| 425 // is owned by other objects and shall not be freed. | 425 // is owned by other objects and shall not be freed. When the count is |
| 426 // greater than 0 and AddDiscoverySession or RemoveDiscoverySession is called |
| 427 // the filter being used by the underlying controller must be updated. |
| 426 // | 428 // |
| 427 // These methods invoke |callback| for success and |error_callback| for | 429 // These methods invoke |callback| for success and |error_callback| for |
| 428 // failures. | 430 // failures. |
| 429 virtual void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, | 431 virtual void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, |
| 430 const base::Closure& callback, | 432 const base::Closure& callback, |
| 431 const ErrorCallback& error_callback) = 0; | 433 const ErrorCallback& error_callback) = 0; |
| 432 virtual void RemoveDiscoverySession( | 434 virtual void RemoveDiscoverySession( |
| 433 BluetoothDiscoveryFilter* discovery_filter, | 435 BluetoothDiscoveryFilter* discovery_filter, |
| 434 const base::Closure& callback, | 436 const base::Closure& callback, |
| 435 const ErrorCallback& error_callback) = 0; | 437 const ErrorCallback& error_callback) = 0; |
| 438 |
| 439 // Used to set and update the discovery filter used by the underlying |
| 440 // Bluetooth controller. |
| 436 virtual void SetDiscoveryFilter( | 441 virtual void SetDiscoveryFilter( |
| 437 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, | 442 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, |
| 438 const base::Closure& callback, | 443 const base::Closure& callback, |
| 439 const ErrorCallback& error_callback) = 0; | 444 const ErrorCallback& error_callback) = 0; |
| 440 | 445 |
| 441 // Called by RemovePairingDelegate() in order to perform any class-specific | 446 // Called by RemovePairingDelegate() in order to perform any class-specific |
| 442 // internal functionality necessary to remove the pairing delegate, such as | 447 // internal functionality necessary to remove the pairing delegate, such as |
| 443 // cleaning up ongoing pairings using it. | 448 // cleaning up ongoing pairings using it. |
| 444 virtual void RemovePairingDelegateInternal( | 449 virtual void RemovePairingDelegateInternal( |
| 445 BluetoothDevice::PairingDelegate* pairing_delegate) = 0; | 450 BluetoothDevice::PairingDelegate* pairing_delegate) = 0; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 std::set<BluetoothDiscoverySession*> discovery_sessions_; | 493 std::set<BluetoothDiscoverySession*> discovery_sessions_; |
| 489 | 494 |
| 490 // Note: This should remain the last member so it'll be destroyed and | 495 // Note: This should remain the last member so it'll be destroyed and |
| 491 // invalidate its weak pointers before any other members are destroyed. | 496 // invalidate its weak pointers before any other members are destroyed. |
| 492 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 497 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
| 493 }; | 498 }; |
| 494 | 499 |
| 495 } // namespace device | 500 } // namespace device |
| 496 | 501 |
| 497 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 502 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| OLD | NEW |