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/memory/scoped_ptr.h"
13 #include "base/values.h"
14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/dbus/dbus_client.h"
16 #include "dbus/object_path.h"
20 // BluetoothProfileManagerClient is used to communicate with the profile
21 // manager object of the Bluetooth daemon.
22 class CHROMEOS_EXPORT BluetoothProfileManagerClient
: public DBusClient
{
24 // Species the role of the object within the profile. SYMMETRIC should be
25 // usually used unless the profile requires you specify as a CLIENT or as a
33 // Options used to register a Profile object.
34 struct CHROMEOS_EXPORT Options
{
38 // Human readable name for the profile.
39 scoped_ptr
<std::string
> name
;
41 // Primary service class UUID (if different from the actual UUID)
42 scoped_ptr
<std::string
> service
;
45 enum ProfileRole role
;
47 // RFCOMM channel number.
48 scoped_ptr
<uint16
> channel
;
51 scoped_ptr
<uint16
> psm
;
53 // Pairing is required before connections will be established.
54 scoped_ptr
<bool> require_authentication
;
56 // Request authorization before connections will be established.
57 scoped_ptr
<bool> require_authorization
;
59 // Force connections when a remote device is connected.
60 scoped_ptr
<bool> auto_connect
;
63 scoped_ptr
<std::string
> service_record
;
66 scoped_ptr
<uint16
> version
;
69 scoped_ptr
<uint16
> features
;
72 virtual ~BluetoothProfileManagerClient();
74 // The ErrorCallback is used by adapter methods to indicate failure.
75 // It receives two arguments: the name of the error in |error_name| and
76 // an optional message in |error_message|.
77 typedef base::Callback
<void(const std::string
& error_name
,
78 const std::string
& error_message
)> ErrorCallback
;
80 // Registers a profile implementation within the local process at the
81 // D-bus object path |profile_path| with the remote profile manager.
82 // |uuid| specifies the identifier of the profile and |options| the way in
83 // which the profile is implemented.
84 virtual void RegisterProfile(const dbus::ObjectPath
& profile_path
,
85 const std::string
& uuid
,
86 const Options
& options
,
87 const base::Closure
& callback
,
88 const ErrorCallback
& error_callback
) = 0;
90 // Unregisters the profile with the D-Bus object path |agent_path| from the
91 // remote profile manager.
92 virtual void UnregisterProfile(const dbus::ObjectPath
& profile_path
,
93 const base::Closure
& callback
,
94 const ErrorCallback
& error_callback
) = 0;
97 // Creates the instance.
98 static BluetoothProfileManagerClient
* Create();
100 // Constants used to indicate exceptional error conditions.
101 static const char kNoResponseError
[];
104 BluetoothProfileManagerClient();
107 DISALLOW_COPY_AND_ASSIGN(BluetoothProfileManagerClient
);
110 } // namespace chromeos
112 #endif // CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_