Commit 30acaeb5 authored by bryeung@chromium.org's avatar bryeung@chromium.org

Expose the bluetooth address of the adapter.

This is needed for an extension API call:
chrome.experimental.bluetooth.getAddress

BUG=none
TEST=none


Review URL: http://codereview.chromium.org/9826018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128276 0039d316-1c4b-4281-b951-d872f2087c98
parent c083f20c
......@@ -114,6 +114,8 @@ void BluetoothAdapter::ChangeAdapter(const dbus::ObjectPath& adapter_path) {
DBusThreadManager::Get()->GetBluetoothAdapterClient()->
GetProperties(object_path_);
address_ = properties->address.value();
PoweredChanged(properties->powered.value());
DiscoveringChanged(properties->discovering.value());
DevicesChanged(properties->devices.value());
......@@ -133,6 +135,7 @@ void BluetoothAdapter::RemoveAdapter() {
ClearDevices();
object_path_ = dbus::ObjectPath("");
address_.clear();
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
AdapterPresentChanged(this, false));
......
......@@ -91,6 +91,10 @@ class BluetoothAdapter : private BluetoothManagerClient::Observer,
// is called, in the success case the callback is simply not called.
typedef base::Callback<void()> ErrorCallback;
// The address of this adapter. The address format is "XX:XX:XX:XX:XX:XX",
// where each XX is a hexadecimal number.
const std::string& address() const { return address_; }
// Indicates whether the adapter is actually present on the system, for
// the default adapter this indicates whether any adapter is present.
bool IsPresent() const;
......@@ -274,6 +278,9 @@ class BluetoothAdapter : private BluetoothManagerClient::Observer,
bool track_default_;
dbus::ObjectPath object_path_;
// Address of the adapter.
std::string address_;
// Tracked adapter state, cached locally so we only send change notifications
// to observers on a genuine change.
bool powered_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment