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_implementation_type.h" 15 #include "dbus/object_path.h" 16 17 namespace dbus { 18 class Bus; 19 } // namespace dbus 20 21 namespace chromeos { 22 23 // BluetoothAgentManagerClient is used to communicate with the agent manager 24 // object of the Bluetooth daemon. 25 class CHROMEOS_EXPORT BluetoothAgentManagerClient { 26 public: 27 virtual ~BluetoothAgentManagerClient(); 28 29 // The ErrorCallback is used by agent manager methods to indicate failure. 30 // It receives two arguments: the name of the error in |error_name| and 31 // an optional message in |error_message|. 32 typedef base::Callback<void(const std::string& error_name, 33 const std::string& error_message)> ErrorCallback; 34 35 // Registers an agent within the local process at the D-bus object path 36 // |agent_path| with the remote agent manager. The agent is used for pairing 37 // and for authorization of incoming connection requests. |capability| 38 // specifies the input and display capabilities of the agent and should be 39 // one of the constants declared in the bluetooth_agent_manager:: namespace. 40 virtual void RegisterAgent(const dbus::ObjectPath& agent_path, 41 const std::string& capability, 42 const base::Closure& callback, 43 const ErrorCallback& error_callback) = 0; 44 45 // Unregisters the agent with the D-Bus object path |agent_path| from the 46 // remote agent manager. 47 virtual void UnregisterAgent(const dbus::ObjectPath& agent_path, 48 const base::Closure& callback, 49 const ErrorCallback& error_callback) = 0; 50 51 // Requests that the agent with the D-Bus object path |agent_path| be made 52 // the default. 53 virtual void RequestDefaultAgent(const dbus::ObjectPath& agent_path, 54 const base::Closure& callback, 55 const ErrorCallback& error_callback) = 0; 56 57 // Creates the instance. 58 static BluetoothAgentManagerClient* Create(DBusClientImplementationType type, 59 dbus::Bus* bus); 60 61 // Constants used to indicate exceptional error conditions. 62 static const char kNoResponseError[]; 63 64 protected: 65 BluetoothAgentManagerClient(); 66 67 private: 68 DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClient); 69 }; 70 71 } // namespace chromeos 72 73 #endif // CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_ 74