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_AGENT_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
11 #include "base/callback.h"
12 #include "base/values.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_client.h"
15 #include "dbus/object_path.h"
19 // BluetoothAgentManagerClient is used to communicate with the agent manager
20 // object of the Bluetooth daemon.
21 class CHROMEOS_EXPORT BluetoothAgentManagerClient
: public DBusClient
{
23 ~BluetoothAgentManagerClient() override
;
25 // The ErrorCallback is used by agent manager methods to indicate failure.
26 // It receives two arguments: the name of the error in |error_name| and
27 // an optional message in |error_message|.
28 typedef base::Callback
<void(const std::string
& error_name
,
29 const std::string
& error_message
)> ErrorCallback
;
31 // Registers an agent within the local process at the D-bus object path
32 // |agent_path| with the remote agent manager. The agent is used for pairing
33 // and for authorization of incoming connection requests. |capability|
34 // specifies the input and display capabilities of the agent and should be
35 // one of the constants declared in the bluetooth_agent_manager:: namespace.
36 virtual void RegisterAgent(const dbus::ObjectPath
& agent_path
,
37 const std::string
& capability
,
38 const base::Closure
& callback
,
39 const ErrorCallback
& error_callback
) = 0;
41 // Unregisters the agent with the D-Bus object path |agent_path| from the
42 // remote agent manager.
43 virtual void UnregisterAgent(const dbus::ObjectPath
& agent_path
,
44 const base::Closure
& callback
,
45 const ErrorCallback
& error_callback
) = 0;
47 // Requests that the agent with the D-Bus object path |agent_path| be made
49 virtual void RequestDefaultAgent(const dbus::ObjectPath
& agent_path
,
50 const base::Closure
& callback
,
51 const ErrorCallback
& error_callback
) = 0;
53 // Creates the instance.
54 static BluetoothAgentManagerClient
* Create();
56 // Constants used to indicate exceptional error conditions.
57 static const char kNoResponseError
[];
60 BluetoothAgentManagerClient();
63 DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClient
);
66 } // namespace chromeos
68 #endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_