| 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> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/callback.h" | 13 #include "base/callback.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 14 #include "base/values.h" | 16 #include "base/values.h" |
| 15 #include "dbus/object_path.h" | 17 #include "dbus/object_path.h" |
| 16 #include "dbus/property.h" | 18 #include "dbus/property.h" |
| 17 #include "device/bluetooth/bluetooth_export.h" | 19 #include "device/bluetooth/bluetooth_export.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 | 32 |
| 31 // The Bluetooth friendly name of the device. Read-only, to give a | 33 // The Bluetooth friendly name of the device. Read-only, to give a |
| 32 // different local name, use the |alias| property. | 34 // different local name, use the |alias| property. |
| 33 dbus::Property<std::string> name; | 35 dbus::Property<std::string> name; |
| 34 | 36 |
| 35 // Proposed icon name for the device according to the freedesktop.org | 37 // Proposed icon name for the device according to the freedesktop.org |
| 36 // icon naming specification. Read-only. | 38 // icon naming specification. Read-only. |
| 37 dbus::Property<std::string> icon; | 39 dbus::Property<std::string> icon; |
| 38 | 40 |
| 39 // The Bluetooth class of the device. Read-only. | 41 // The Bluetooth class of the device. Read-only. |
| 40 dbus::Property<uint32> bluetooth_class; | 42 dbus::Property<uint32_t> bluetooth_class; |
| 41 | 43 |
| 42 // The GAP external appearance of the device. Read-only. | 44 // The GAP external appearance of the device. Read-only. |
| 43 dbus::Property<uint16> appearance; | 45 dbus::Property<uint16_t> appearance; |
| 44 | 46 |
| 45 // Unique numeric identifier for the vendor of the device. Read-only. | 47 // Unique numeric identifier for the vendor of the device. Read-only. |
| 46 dbus::Property<uint16> vendor; | 48 dbus::Property<uint16_t> vendor; |
| 47 | 49 |
| 48 // List of 128-bit UUIDs that represent the available remote services. | 50 // List of 128-bit UUIDs that represent the available remote services. |
| 49 // Read-only. | 51 // Read-only. |
| 50 dbus::Property<std::vector<std::string>> uuids; | 52 dbus::Property<std::vector<std::string>> uuids; |
| 51 | 53 |
| 52 // Transmitted power level. This field is avaliable only for LE devices | 54 // Transmitted power level. This field is avaliable only for LE devices |
| 53 // that include this field in AD. Read-only. | 55 // that include this field in AD. Read-only. |
| 54 dbus::Property<int16> tx_power; | 56 dbus::Property<int16_t> tx_power; |
| 55 | 57 |
| 56 // Indicates that the device is currently paired. Read-only. | 58 // Indicates that the device is currently paired. Read-only. |
| 57 dbus::Property<bool> paired; | 59 dbus::Property<bool> paired; |
| 58 | 60 |
| 59 // Indicates that the device is currently connected. Read-only. | 61 // Indicates that the device is currently connected. Read-only. |
| 60 dbus::Property<bool> connected; | 62 dbus::Property<bool> connected; |
| 61 | 63 |
| 62 // Whether the device is trusted, and connections should be always | 64 // Whether the device is trusted, and connections should be always |
| 63 // accepted and attempted when the device is visible. | 65 // accepted and attempted when the device is visible. |
| 64 dbus::Property<bool> trusted; | 66 dbus::Property<bool> trusted; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 // Indicates whether the device is likely to only support pre-2.1 | 78 // Indicates whether the device is likely to only support pre-2.1 |
| 77 // PIN Code pairing rather than 2.1 Secure Simple Pairing, this can | 79 // PIN Code pairing rather than 2.1 Secure Simple Pairing, this can |
| 78 // give false positives. Read-only. | 80 // give false positives. Read-only. |
| 79 dbus::Property<bool> legacy_pairing; | 81 dbus::Property<bool> legacy_pairing; |
| 80 | 82 |
| 81 // Remote Device ID information in Linux kernel modalias format. Read-only. | 83 // Remote Device ID information in Linux kernel modalias format. Read-only. |
| 82 dbus::Property<std::string> modalias; | 84 dbus::Property<std::string> modalias; |
| 83 | 85 |
| 84 // Received signal strength indicator that is set when the device is | 86 // Received signal strength indicator that is set when the device is |
| 85 // discovered during inquiry. Read-only. | 87 // discovered during inquiry. Read-only. |
| 86 dbus::Property<int16> rssi; | 88 dbus::Property<int16_t> rssi; |
| 87 | 89 |
| 88 // List of GATT service object paths. Each referenced object exports the | 90 // List of GATT service object paths. Each referenced object exports the |
| 89 // org.bluez.GattService1 interface and represents a remote GATT service. | 91 // org.bluez.GattService1 interface and represents a remote GATT service. |
| 90 // This property will be updated once all remote GATT services of this | 92 // This property will be updated once all remote GATT services of this |
| 91 // device have been discovered and exported over D-Bus. Read-only. | 93 // device have been discovered and exported over D-Bus. Read-only. |
| 92 dbus::Property<std::vector<dbus::ObjectPath>> gatt_services; | 94 dbus::Property<std::vector<dbus::ObjectPath>> gatt_services; |
| 93 | 95 |
| 94 Properties(dbus::ObjectProxy* object_proxy, | 96 Properties(dbus::ObjectProxy* object_proxy, |
| 95 const std::string& interface_name, | 97 const std::string& interface_name, |
| 96 const PropertyChangedCallback& callback); | 98 const PropertyChangedCallback& callback); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 const ErrorCallback& error_callback) = 0; | 178 const ErrorCallback& error_callback) = 0; |
| 177 | 179 |
| 178 // Cancels an in-progress pairing with the device with object path | 180 // Cancels an in-progress pairing with the device with object path |
| 179 // |object_path| initiated by Pair(). | 181 // |object_path| initiated by Pair(). |
| 180 virtual void CancelPairing(const dbus::ObjectPath& object_path, | 182 virtual void CancelPairing(const dbus::ObjectPath& object_path, |
| 181 const base::Closure& callback, | 183 const base::Closure& callback, |
| 182 const ErrorCallback& error_callback) = 0; | 184 const ErrorCallback& error_callback) = 0; |
| 183 | 185 |
| 184 // The callback invoked for a successful GetConnInfo API call with the | 186 // The callback invoked for a successful GetConnInfo API call with the |
| 185 // RSSI, TX power, and maximum TX power of the current connection. | 187 // RSSI, TX power, and maximum TX power of the current connection. |
| 186 typedef base::Callback<void(int16 rssi, | 188 typedef base::Callback<void(int16_t rssi, |
| 187 int16 transmit_power, | 189 int16_t transmit_power, |
| 188 int16 max_transmit_power)> ConnInfoCallback; | 190 int16_t max_transmit_power)> ConnInfoCallback; |
| 189 | 191 |
| 190 // Returns the RSSI, TX power, and maximum TX power of a connection to the | 192 // Returns the RSSI, TX power, and maximum TX power of a connection to the |
| 191 // device with object path |object_path|. If the device is not connected, then | 193 // device with object path |object_path|. If the device is not connected, then |
| 192 // an error will be returned. | 194 // an error will be returned. |
| 193 virtual void GetConnInfo(const dbus::ObjectPath& object_path, | 195 virtual void GetConnInfo(const dbus::ObjectPath& object_path, |
| 194 const ConnInfoCallback& callback, | 196 const ConnInfoCallback& callback, |
| 195 const ErrorCallback& error_callback) = 0; | 197 const ErrorCallback& error_callback) = 0; |
| 196 | 198 |
| 197 // Creates the instance. | 199 // Creates the instance. |
| 198 static BluetoothDeviceClient* Create(); | 200 static BluetoothDeviceClient* Create(); |
| 199 | 201 |
| 200 // Constants used to indicate exceptional error conditions. | 202 // Constants used to indicate exceptional error conditions. |
| 201 static const char kNoResponseError[]; | 203 static const char kNoResponseError[]; |
| 202 static const char kUnknownDeviceError[]; | 204 static const char kUnknownDeviceError[]; |
| 203 | 205 |
| 204 protected: | 206 protected: |
| 205 BluetoothDeviceClient(); | 207 BluetoothDeviceClient(); |
| 206 | 208 |
| 207 private: | 209 private: |
| 208 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClient); | 210 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClient); |
| 209 }; | 211 }; |
| 210 | 212 |
| 211 } // namespace bluez | 213 } // namespace bluez |
| 212 | 214 |
| 213 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ | 215 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_ |
| OLD | NEW |