Chromium Code Reviews| Index: chrome/browser/chromeos/bluetooth/bluetooth_adapter_interface.h |
| diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_adapter_interface.h b/chrome/browser/chromeos/bluetooth/bluetooth_adapter_interface.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e1a685dd3acf850b5e2157232554d5ef8d60e7f8 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/bluetooth/bluetooth_adapter_interface.h |
| @@ -0,0 +1,86 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_INTERFACE_H_ |
|
bryeung
2012/09/07 18:35:57
This file can just be "bluetooth_adapter.h"
youngki
2012/09/13 18:05:02
Done.
|
| +#define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_INTERFACE_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| + |
| +namespace chromeos { |
| + |
| +class BluetoothDeviceInterface; |
| + |
| +struct BluetoothOutOfBandPairingData; |
| + |
| +// The BluetoothAdapterInterface represents a local Bluetooth adapter which may |
| +// be used to interact with remote Bluetooth devices. As well as providing |
| +// support for determining whether an adapter is present, and whether the radio |
| +// is powered, this class also provides support for obtaining the list of remote |
| +// devices known to the adapter, discovering new devices, and providing |
| +// notification of updates to device information. |
| +class BluetoothAdapterInterface { |
|
bryeung
2012/09/07 18:35:57
This can just be BluetoothAdapter
youngki
2012/09/13 18:05:02
Done.
|
| + public: |
| + virtual ~BluetoothAdapterInterface() {} |
| + |
| + // The ErrorCallback is used for methods that can fail in which case it |
| + // is called, in the success case the callback is simply not called. |
| + typedef base::Callback<void()> ErrorCallback; |
| + |
| + // The BluetoothOutOfBandPairingDataCallback is used to return |
| + // BluetoothOutOfBandPairingData to the caller. |
| + typedef base::Callback<void(const BluetoothOutOfBandPairingData& data)> |
| + BluetoothOutOfBandPairingDataCallback; |
| + |
| + // The address of this adapter. |
| + virtual const std::string& address() const = 0; |
| + |
| + // The name of the adapter. |
| + virtual const std::string& name() const = 0; |
| + |
| + // Indicates whether the adapter is actually present on the system, for |
| + // the default adapter this indicates whether any adapter is present. |
| + virtual bool IsPresent() const = 0; |
| + |
| + // Indicates whether the adapter radio is powered. |
| + virtual bool IsPowered() const = 0; |
| + |
| + // Indicates whether the adapter is currently discovering new devices, |
| + // note that a typical discovery process has phases of this being true |
| + // followed by phases of being false when the adapter interrogates the |
| + // devices found. |
| + virtual bool IsDiscovering() const = 0; |
| + |
| + // Requests that the adapter either begin discovering new devices when |
| + // |discovering| is true, or cease any discovery when false. On success, |
| + // callback will be called. On failure, |error_callback| will be called. |
| + virtual void SetDiscovering(bool discovering, |
| + const base::Closure& callback, |
| + const ErrorCallback& error_callback) = 0; |
| + |
| + // Requests the list of devices from the adapter, all are returned |
| + // including those currently connected and those paired. Use the |
| + // returned device pointers to determine which they are. |
| + typedef std::vector<BluetoothDeviceInterface*> DeviceList; |
| + virtual DeviceList GetDevices() = 0; |
| + typedef std::vector<const BluetoothDeviceInterface*> ConstDeviceList; |
| + virtual ConstDeviceList GetDevices() const = 0; |
| + |
| + // Returns a pointer to the device with the given address |address| or |
| + // NULL if no such device is known. |
| + virtual BluetoothDeviceInterface* GetDevice(const std::string& address) = 0; |
| + virtual const BluetoothDeviceInterface* GetDevice( |
| + const std::string& address) const = 0; |
| + |
| + // Requests the local Out Of Band pairing data. |
| + virtual void ReadLocalOutOfBandPairingData( |
| + const BluetoothOutOfBandPairingDataCallback& callback, |
| + const ErrorCallback& error_callback) = 0; |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_INTERFACE_H_ |