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_DEVICE_CLIENT_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ |
6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/optional.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "dbus/object_path.h" | 18 #include "dbus/object_path.h" |
18 #include "dbus/property.h" | 19 #include "dbus/property.h" |
19 #include "device/bluetooth/bluetooth_export.h" | 20 #include "device/bluetooth/bluetooth_export.h" |
20 #include "device/bluetooth/dbus/bluez_dbus_client.h" | 21 #include "device/bluetooth/dbus/bluez_dbus_client.h" |
21 | 22 |
22 namespace bluez { | 23 namespace bluez { |
23 | 24 |
24 // BluetoothDeviceClient is used to communicate with objects representing | 25 // BluetoothDeviceClient is used to communicate with objects representing |
25 // remote Bluetooth Devices. | 26 // remote Bluetooth Devices. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const ErrorCallback& error_callback) = 0; | 179 const ErrorCallback& error_callback) = 0; |
179 | 180 |
180 // Cancels an in-progress pairing with the device with object path | 181 // Cancels an in-progress pairing with the device with object path |
181 // |object_path| initiated by Pair(). | 182 // |object_path| initiated by Pair(). |
182 virtual void CancelPairing(const dbus::ObjectPath& object_path, | 183 virtual void CancelPairing(const dbus::ObjectPath& object_path, |
183 const base::Closure& callback, | 184 const base::Closure& callback, |
184 const ErrorCallback& error_callback) = 0; | 185 const ErrorCallback& error_callback) = 0; |
185 | 186 |
186 // The callback invoked for a successful GetConnInfo API call with the | 187 // The callback invoked for a successful GetConnInfo API call with the |
187 // RSSI, TX power, and maximum TX power of the current connection. | 188 // RSSI, TX power, and maximum TX power of the current connection. |
188 typedef base::Callback<void(int16_t rssi, | 189 typedef base::Callback<void( |
189 int16_t transmit_power, | 190 const base::Optional<int16_t>& rssi, |
190 int16_t max_transmit_power)> ConnInfoCallback; | 191 const base::Optional<int16_t>& transmit_power, |
| 192 const base::Optional<int16_t>& max_transmit_power)> |
| 193 ConnInfoCallback; |
191 | 194 |
192 // Returns the RSSI, TX power, and maximum TX power of a connection to the | 195 // Returns the RSSI, TX power, and maximum TX power of a connection to the |
193 // device with object path |object_path|. If the device is not connected, then | 196 // device with object path |object_path|. If the device is not connected, then |
194 // an error will be returned. | 197 // an error will be returned. |
195 virtual void GetConnInfo(const dbus::ObjectPath& object_path, | 198 virtual void GetConnInfo(const dbus::ObjectPath& object_path, |
196 const ConnInfoCallback& callback, | 199 const ConnInfoCallback& callback, |
197 const ErrorCallback& error_callback) = 0; | 200 const ErrorCallback& error_callback) = 0; |
198 | 201 |
199 // Creates the instance. | 202 // Creates the instance. |
200 static BluetoothDeviceClient* Create(); | 203 static BluetoothDeviceClient* Create(); |
201 | 204 |
202 // Constants used to indicate exceptional error conditions. | 205 // Constants used to indicate exceptional error conditions. |
203 static const char kNoResponseError[]; | 206 static const char kNoResponseError[]; |
204 static const char kUnknownDeviceError[]; | 207 static const char kUnknownDeviceError[]; |
205 | 208 |
206 protected: | 209 protected: |
207 BluetoothDeviceClient(); | 210 BluetoothDeviceClient(); |
208 | 211 |
209 private: | 212 private: |
210 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClient); | 213 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClient); |
211 }; | 214 }; |
212 | 215 |
213 } // namespace bluez | 216 } // namespace bluez |
214 | 217 |
215 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ | 218 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ |
OLD | NEW |