blob: 50600433a9320ef43349329e961da2fbc1c81bb6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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_
|