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_PROFILE_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_PROFILE_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 // BluetoothProfileManagerClient is used to communicate with the profile
20 // manager object of the Bluetooth daemon.
21 class CHROMEOS_EXPORT BluetoothProfileManagerClient
: public DBusClient
{
23 // Species the role of the object within the profile. SYMMETRIC should be
24 // usually used unless the profile requires you specify as a CLIENT or as a
32 // Options used to register a Profile object.
33 struct CHROMEOS_EXPORT Options
{
37 // Human readable name for the profile.
40 // Primary service class UUID (if different from the actual UUID)
44 enum ProfileRole role
;
46 // RFCOMM channel number.
52 // Pairing is required before connections will be established.
53 bool require_authentication
;
55 // Request authorization before connections will be established.
56 bool require_authorization
;
58 // Force connections when a remote device is connected.
62 std::string service_record
;
71 virtual ~BluetoothProfileManagerClient();
73 // The ErrorCallback is used by adapter methods to indicate failure.
74 // It receives two arguments: the name of the error in |error_name| and
75 // an optional message in |error_message|.
76 typedef base::Callback
<void(const std::string
& error_name
,
77 const std::string
& error_message
)> ErrorCallback
;
79 // Registers a profile implementation within the local process at the
80 // D-bus object path |profile_path| with the remote profile manager.
81 // |uuid| specifies the identifier of the profile and |options| the way in
82 // which the profile is implemented.
83 virtual void RegisterProfile(const dbus::ObjectPath
& profile_path
,
84 const std::string
& uuid
,
85 const Options
& options
,
86 const base::Closure
& callback
,
87 const ErrorCallback
& error_callback
) = 0;
89 // Unregisters the profile with the D-Bus object path |agent_path| from the
90 // remote profile manager.
91 virtual void UnregisterProfile(const dbus::ObjectPath
& profile_path
,
92 const base::Closure
& callback
,
93 const ErrorCallback
& error_callback
) = 0;
96 // Creates the instance.
97 static BluetoothProfileManagerClient
* Create();
99 // Constants used to indicate exceptional error conditions.
100 static const char kNoResponseError
[];
103 BluetoothProfileManagerClient();
106 DISALLOW_COPY_AND_ASSIGN(BluetoothProfileManagerClient
);
109 } // namespace chromeos
111 #endif // CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_