Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(676)

Unified Diff: chrome/browser/chromeos/bluetooth/bluetooth_adapter_interface.h

Issue 10899037: Refactoring bluetooth API code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated the interfaces with class-level comments. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_
+#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 {
+ 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_

Powered by Google App Engine
This is Rietveld 408576698