diff options
author | vlaviano@chromium.org <vlaviano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-25 23:15:27 +0000 |
---|---|---|
committer | vlaviano@chromium.org <vlaviano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-25 23:15:27 +0000 |
commit | f824f91a3b11fabc98dce7c5f9339b7046971f29 (patch) | |
tree | 8d782845c58678527ace62225e9b30f7e1d07c0a /chrome/browser/chromeos/dbus/bluetooth_manager_client.h | |
parent | b42d2c4b9b00622fc5628558406445dd986b6988 (diff) | |
download | chromium_src-f824f91a3b11fabc98dce7c5f9339b7046971f29.zip chromium_src-f824f91a3b11fabc98dce7c5f9339b7046971f29.tar.gz chromium_src-f824f91a3b11fabc98dce7c5f9339b7046971f29.tar.bz2 |
Chrome OS: Add bluetooth dbus clients for device discovery
BUG=chromium-os:21319
TEST=Tested with demo code at http://codereview.chromium.org/8233042/
Change-Id: I53fe54c5bd7d6eea970ea25a5a26fa1ded9bbfad
Review URL: http://codereview.chromium.org/8375042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/dbus/bluetooth_manager_client.h')
-rw-r--r-- | chrome/browser/chromeos/dbus/bluetooth_manager_client.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/dbus/bluetooth_manager_client.h b/chrome/browser/chromeos/dbus/bluetooth_manager_client.h new file mode 100644 index 0000000..5060043 --- /dev/null +++ b/chrome/browser/chromeos/dbus/bluetooth_manager_client.h @@ -0,0 +1,67 @@ +// Copyright (c) 2011 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_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ +#define CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ +#pragma once + +#include <string> + +#include "base/callback.h" +#include "base/observer_list.h" + +namespace dbus { +class Bus; +} // namespace dbus + +namespace chromeos { + +// BluetoothManagerClient is used to communicate with the bluetooth +// daemon's Manager interface. +class BluetoothManagerClient { + public: + // Interface for observing changes from the bluetooth manager. + class Observer { + public: + virtual ~Observer() {} + + // Called when a local bluetooth adapter is removed. + // |adapter| is the dbus object path of the adapter. + virtual void AdapterRemoved(const std::string& adapter) {} + + // Called when the default local bluetooth adapter changes. + // |adapter| is the dbus object path of the new default adapter. + // Not called if all adapters are removed. + virtual void DefaultAdapterChanged(const std::string& adapter) {} + }; + + virtual ~BluetoothManagerClient(); + + // Adds and removes the observer. + virtual void AddObserver(Observer* observer) = 0; + virtual void RemoveObserver(Observer* observer) = 0; + + // The DefaultAdapterCallback receives two arguments: + // std::string adapter - the unique identifier of the default adapter + // bool success - whether or not the request succeeded + typedef base::Callback<void(std::string, bool)> DefaultAdapterCallback; + + // Retrieves the dbus object path for the default adapter. + // The default adapter is the preferred local bluetooth interface when a + // client does not specify a particular interface. + virtual void DefaultAdapter(const DefaultAdapterCallback& callback) = 0; + + // Creates the instance. + static BluetoothManagerClient* Create(dbus::Bus* bus); + + protected: + BluetoothManagerClient(); + + private: + DISALLOW_COPY_AND_ASSIGN(BluetoothManagerClient); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_DBUS_BLUETOOTH_MANAGER_CLIENT_H_ |