OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" |
12 #include "dbus/bus.h" | 14 #include "dbus/bus.h" |
13 #include "dbus/object_path.h" | 15 #include "dbus/object_path.h" |
14 #include "device/bluetooth/bluetooth_export.h" | 16 #include "device/bluetooth/bluetooth_export.h" |
15 | 17 |
16 namespace bluez { | 18 namespace bluez { |
17 | 19 |
18 // BluetoothAgentServiceProvider is used to provide a D-Bus object that | 20 // BluetoothAgentServiceProvider is used to provide a D-Bus object that |
19 // the bluetooth daemon can communicate with during a remote device pairing | 21 // the bluetooth daemon can communicate with during a remote device pairing |
20 // request. | 22 // request. |
21 // | 23 // |
(...skipping 22 matching lines...) Expand all Loading... |
44 | 46 |
45 // The PinCodeCallback is used for the RequestPinCode() method, it should | 47 // The PinCodeCallback is used for the RequestPinCode() method, it should |
46 // be called with two arguments, the |status| of the request (success, | 48 // be called with two arguments, the |status| of the request (success, |
47 // rejected or cancelled) and the |pincode| requested. | 49 // rejected or cancelled) and the |pincode| requested. |
48 typedef base::Callback<void(Status, const std::string&)> PinCodeCallback; | 50 typedef base::Callback<void(Status, const std::string&)> PinCodeCallback; |
49 | 51 |
50 // The PasskeyCallback is used for the RequestPasskey() method, it should | 52 // The PasskeyCallback is used for the RequestPasskey() method, it should |
51 // be called with two arguments, the |status| of the request (success, | 53 // be called with two arguments, the |status| of the request (success, |
52 // rejected or cancelled) and the |passkey| requested, a numeric in the | 54 // rejected or cancelled) and the |passkey| requested, a numeric in the |
53 // range 0-999999, | 55 // range 0-999999, |
54 typedef base::Callback<void(Status, uint32)> PasskeyCallback; | 56 typedef base::Callback<void(Status, uint32_t)> PasskeyCallback; |
55 | 57 |
56 // The ConfirmationCallback is used for methods which request confirmation | 58 // The ConfirmationCallback is used for methods which request confirmation |
57 // or authorization, it should be called with one argument, the |status| | 59 // or authorization, it should be called with one argument, the |status| |
58 // of the request (success, rejected or cancelled). | 60 // of the request (success, rejected or cancelled). |
59 typedef base::Callback<void(Status)> ConfirmationCallback; | 61 typedef base::Callback<void(Status)> ConfirmationCallback; |
60 | 62 |
61 // This method will be called when the agent is unregistered from the | 63 // This method will be called when the agent is unregistered from the |
62 // Bluetooth daemon, generally at the end of a pairing request. It may be | 64 // Bluetooth daemon, generally at the end of a pairing request. It may be |
63 // used to perform cleanup tasks. This corresponds to the | 65 // used to perform cleanup tasks. This corresponds to the |
64 // org.bluez.Agent1.Release method and is renamed to avoid a conflict | 66 // org.bluez.Agent1.Release method and is renamed to avoid a conflict |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // cancelled. | 108 // cancelled. |
107 // | 109 // |
108 // This is used for Bluetooth 2.1 and later devices that support input | 110 // This is used for Bluetooth 2.1 and later devices that support input |
109 // but not display, such as keyboards. The Passkey is a numeric in the | 111 // but not display, such as keyboards. The Passkey is a numeric in the |
110 // range 0-999999 and should be always presented zero-padded to six | 112 // range 0-999999 and should be always presented zero-padded to six |
111 // digits. | 113 // digits. |
112 // | 114 // |
113 // As the user enters the passkey onto the device, |entered| will be | 115 // As the user enters the passkey onto the device, |entered| will be |
114 // updated to reflect the number of digits entered so far. | 116 // updated to reflect the number of digits entered so far. |
115 virtual void DisplayPasskey(const dbus::ObjectPath& device_path, | 117 virtual void DisplayPasskey(const dbus::ObjectPath& device_path, |
116 uint32 passkey, | 118 uint32_t passkey, |
117 uint16 entered) = 0; | 119 uint16_t entered) = 0; |
118 | 120 |
119 // This method will be called when the Bluetooth daemon requires that the | 121 // This method will be called when the Bluetooth daemon requires that the |
120 // user confirm that the Passkey |passkey| is displayed on the screen | 122 // user confirm that the Passkey |passkey| is displayed on the screen |
121 // of the device with object path |object_path| so that it may be | 123 // of the device with object path |object_path| so that it may be |
122 // authenticated. The agent should display to the user and ask for | 124 // authenticated. The agent should display to the user and ask for |
123 // confirmation, then call |callback| to provide their response (success, | 125 // confirmation, then call |callback| to provide their response (success, |
124 // rejected or cancelled). | 126 // rejected or cancelled). |
125 // | 127 // |
126 // This is used for Bluetooth 2.1 and later devices that support display, | 128 // This is used for Bluetooth 2.1 and later devices that support display, |
127 // such as other computers or phones. The Passkey is a numeric in the | 129 // such as other computers or phones. The Passkey is a numeric in the |
128 // range 0-999999 and should be always present zero-padded to six | 130 // range 0-999999 and should be always present zero-padded to six |
129 // digits. | 131 // digits. |
130 virtual void RequestConfirmation(const dbus::ObjectPath& device_path, | 132 virtual void RequestConfirmation(const dbus::ObjectPath& device_path, |
131 uint32 passkey, | 133 uint32_t passkey, |
132 const ConfirmationCallback& callback) = 0; | 134 const ConfirmationCallback& callback) = 0; |
133 | 135 |
134 // This method will be called when the Bluetooth daemon requires | 136 // This method will be called when the Bluetooth daemon requires |
135 // authorization of an incoming pairing attempt from the device with object | 137 // authorization of an incoming pairing attempt from the device with object |
136 // path |device_path| that would have otherwised triggered the just-works | 138 // path |device_path| that would have otherwised triggered the just-works |
137 // pairing model. | 139 // pairing model. |
138 // | 140 // |
139 // The agent should confirm the incoming pairing with the user and call | 141 // The agent should confirm the incoming pairing with the user and call |
140 // |callback| to provide their response (success, rejected or cancelled). | 142 // |callback| to provide their response (success, rejected or cancelled). |
141 virtual void RequestAuthorization(const dbus::ObjectPath& device_path, | 143 virtual void RequestAuthorization(const dbus::ObjectPath& device_path, |
(...skipping 27 matching lines...) Expand all Loading... |
169 protected: | 171 protected: |
170 BluetoothAgentServiceProvider(); | 172 BluetoothAgentServiceProvider(); |
171 | 173 |
172 private: | 174 private: |
173 DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProvider); | 175 DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProvider); |
174 }; | 176 }; |
175 | 177 |
176 } // namespace bluez | 178 } // namespace bluez |
177 | 179 |
178 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ | 180 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_ |
OLD | NEW |