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_
11 #include "base/callback.h"
12 #include "base/observer_list.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_client_implementation_type.h"
15 #include "dbus/object_path.h"
16 #include "dbus/property.h"
24 // BluetoothInputClient is used to communicate with objects representing
25 // Bluetooth Input (HID) devices.
26 class CHROMEOS_EXPORT BluetoothInputClient
{
28 // Structure of properties associated with bluetooth input devices.
29 struct Properties
: public dbus::PropertySet
{
30 // The Bluetooth input device reconnect mode. Read-only.
31 dbus::Property
<std::string
> reconnect_mode
;
33 Properties(dbus::ObjectProxy
* object_proxy
,
34 const std::string
& interface_name
,
35 const PropertyChangedCallback
& callback
);
36 virtual ~Properties();
39 // Interface for observing changes from a remote bluetooth input device.
42 virtual ~Observer() {}
44 // Called when the remote device with object path |object_path| implementing
45 // the Input interface is added to the set of known devices or an already
46 // known device implements the Input interface.
47 virtual void InputAdded(const dbus::ObjectPath
& object_path
) {}
49 // Called when the remote device with object path |object_path| is removed
50 // from the set of known devices or does not implement the Input interface
52 virtual void InputRemoved(const dbus::ObjectPath
& object_path
) {}
54 // Called when the device with object path |object_path| has a
55 // change in value of the property named |property_name| of its Input
57 virtual void InputPropertyChanged(const dbus::ObjectPath
& object_path
,
58 const std::string
& property_name
) {}
61 virtual ~BluetoothInputClient();
63 // Adds and removes observers for events on all remote bluetooth input
64 // devices. Check the |object_path| parameter of observer methods to
65 // determine which device is issuing the event.
66 virtual void AddObserver(Observer
* observer
) = 0;
67 virtual void RemoveObserver(Observer
* observer
) = 0;
69 // Obtain the properties for the device with object path |object_path|,
70 // any values should be copied if needed.
71 virtual Properties
* GetProperties(const dbus::ObjectPath
& object_path
) = 0;
73 // Creates the instance.
74 static BluetoothInputClient
* Create(DBusClientImplementationType type
,
78 BluetoothInputClient();
81 DISALLOW_COPY_AND_ASSIGN(BluetoothInputClient
);
84 } // namespace chromeos
86 #endif // CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_