• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
7 
8 #include <string>
9 #include <vector>
10 
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"
16 
17 namespace chromeos {
18 
19 // BluetoothAgentManagerClient is used to communicate with the agent manager
20 // object of the Bluetooth daemon.
21 class CHROMEOS_EXPORT BluetoothAgentManagerClient : public DBusClient {
22  public:
23   virtual ~BluetoothAgentManagerClient();
24 
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;
30 
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;
40 
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;
46 
47   // Requests that the agent with the D-Bus object path |agent_path| be made
48   // the default.
49   virtual void RequestDefaultAgent(const dbus::ObjectPath& agent_path,
50                                    const base::Closure& callback,
51                                    const ErrorCallback& error_callback) = 0;
52 
53   // Creates the instance.
54   static BluetoothAgentManagerClient* Create();
55 
56   // Constants used to indicate exceptional error conditions.
57   static const char kNoResponseError[];
58 
59  protected:
60   BluetoothAgentManagerClient();
61 
62  private:
63   DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClient);
64 };
65 
66 }  // namespace chromeos
67 
68 #endif  // CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
69