OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BLUETOOTH_DEVICE_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 // Indicates whether the device is bonded to the adapter, bonding is | 172 // Indicates whether the device is bonded to the adapter, bonding is |
173 // formed by pairing and exchanging high-security link keys so that | 173 // formed by pairing and exchanging high-security link keys so that |
174 // connections may be encrypted. | 174 // connections may be encrypted. |
175 virtual bool IsBonded() const; | 175 virtual bool IsBonded() const; |
176 | 176 |
177 // Indicates whether the device is currently connected to the adapter | 177 // Indicates whether the device is currently connected to the adapter |
178 // and at least one service available for use. | 178 // and at least one service available for use. |
179 virtual bool IsConnected() const; | 179 virtual bool IsConnected() const; |
180 | 180 |
| 181 // Indicates whether the bonded device accepts connections initiated from the |
| 182 // adapter. This value is undefined for unbonded devices. |
| 183 virtual bool IsConnectable() const; |
| 184 |
181 // Returns the services (as UUID strings) that this device provides. | 185 // Returns the services (as UUID strings) that this device provides. |
182 typedef std::vector<std::string> ServiceList; | 186 typedef std::vector<std::string> ServiceList; |
183 virtual const ServiceList& GetServices() const = 0; | 187 virtual const ServiceList& GetServices() const = 0; |
184 | 188 |
185 // The ErrorCallback is used for methods that can fail in which case it | 189 // The ErrorCallback is used for methods that can fail in which case it |
186 // is called, in the success case the callback is simply not called. | 190 // is called, in the success case the callback is simply not called. |
187 typedef base::Callback<void()> ErrorCallback; | 191 typedef base::Callback<void()> ErrorCallback; |
188 | 192 |
189 // The ConnectErrorCallback is used for methods that can fail with an error, | 193 // The ConnectErrorCallback is used for methods that can fail with an error, |
190 // passed back as an error code argument to this callback. | 194 // passed back as an error code argument to this callback. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 326 |
323 // The Bluetooth address of the device. | 327 // The Bluetooth address of the device. |
324 std::string address_; | 328 std::string address_; |
325 | 329 |
326 // Tracked device state, updated by the adapter managing the lifecyle of | 330 // Tracked device state, updated by the adapter managing the lifecyle of |
327 // the device. | 331 // the device. |
328 bool visible_; | 332 bool visible_; |
329 bool bonded_; | 333 bool bonded_; |
330 bool connected_; | 334 bool connected_; |
331 | 335 |
| 336 // Indicates whether the device normally accepts connections initiated from |
| 337 // the adapter once paired. |
| 338 bool connectable_; |
| 339 |
332 private: | 340 private: |
333 // Returns a localized string containing the device's bluetooth address and | 341 // Returns a localized string containing the device's bluetooth address and |
334 // a device type for display when |name_| is empty. | 342 // a device type for display when |name_| is empty. |
335 string16 GetAddressWithLocalizedDeviceTypeName() const; | 343 string16 GetAddressWithLocalizedDeviceTypeName() const; |
336 }; | 344 }; |
337 | 345 |
338 } // namespace device | 346 } // namespace device |
339 | 347 |
340 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 348 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |