Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chromeos / dbus / bluetooth_input_client.h
blob02abf995fb60e0512c169590b94e7515d1f0e41d
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback.h"
12 #include "base/observer_list.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_client.h"
15 #include "dbus/object_path.h"
16 #include "dbus/property.h"
18 namespace chromeos {
20 // BluetoothInputClient is used to communicate with objects representing
21 // Bluetooth Input (HID) devices.
22 class CHROMEOS_EXPORT BluetoothInputClient : public DBusClient {
23 public:
24 // Structure of properties associated with bluetooth input devices.
25 struct Properties : public dbus::PropertySet {
26 // The Bluetooth input device reconnect mode. Read-only.
27 dbus::Property<std::string> reconnect_mode;
29 Properties(dbus::ObjectProxy* object_proxy,
30 const std::string& interface_name,
31 const PropertyChangedCallback& callback);
32 ~Properties() override;
35 // Interface for observing changes from a remote bluetooth input device.
36 class Observer {
37 public:
38 virtual ~Observer() {}
40 // Called when the remote device with object path |object_path| implementing
41 // the Input interface is added to the set of known devices or an already
42 // known device implements the Input interface.
43 virtual void InputAdded(const dbus::ObjectPath& object_path) {}
45 // Called when the remote device with object path |object_path| is removed
46 // from the set of known devices or does not implement the Input interface
47 // anymore.
48 virtual void InputRemoved(const dbus::ObjectPath& object_path) {}
50 // Called when the device with object path |object_path| has a
51 // change in value of the property named |property_name| of its Input
52 // interface.
53 virtual void InputPropertyChanged(const dbus::ObjectPath& object_path,
54 const std::string& property_name) {}
57 ~BluetoothInputClient() override;
59 // Adds and removes observers for events on all remote bluetooth input
60 // devices. Check the |object_path| parameter of observer methods to
61 // determine which device is issuing the event.
62 virtual void AddObserver(Observer* observer) = 0;
63 virtual void RemoveObserver(Observer* observer) = 0;
65 // Obtain the properties for the device with object path |object_path|,
66 // any values should be copied if needed.
67 virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0;
69 // Creates the instance.
70 static BluetoothInputClient* Create();
72 protected:
73 BluetoothInputClient();
75 private:
76 DISALLOW_COPY_AND_ASSIGN(BluetoothInputClient);
79 } // namespace chromeos
81 #endif // CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_