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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 // cause. | 349 // cause. |
350 typedef base::Callback<void(scoped_refptr<BluetoothSocket>)> | 350 typedef base::Callback<void(scoped_refptr<BluetoothSocket>)> |
351 ConnectToServiceCallback; | 351 ConnectToServiceCallback; |
352 typedef base::Callback<void(const std::string& message)> | 352 typedef base::Callback<void(const std::string& message)> |
353 ConnectToServiceErrorCallback; | 353 ConnectToServiceErrorCallback; |
354 virtual void ConnectToService( | 354 virtual void ConnectToService( |
355 const BluetoothUUID& uuid, | 355 const BluetoothUUID& uuid, |
356 const ConnectToServiceCallback& callback, | 356 const ConnectToServiceCallback& callback, |
357 const ConnectToServiceErrorCallback& error_callback) = 0; | 357 const ConnectToServiceErrorCallback& error_callback) = 0; |
358 | 358 |
359 // Attempts to initiate an insecure outgoing L2CAP or RFCOMM connection to the | |
360 // advertised service on this device matching |uuid|, performing an SDP lookup | |
361 // if necessary to determine the correct protocol and channel for the | |
362 // connection. Unlike ConnectToService, the outgoing connection will request | |
363 // no bonding rather than general bonding. |callback| will be called on a | |
364 // successful connection with a BluetoothSocket instance that is to be owned | |
365 // by the receiver. |error_callback| will be called on failure with a message | |
366 // indicating the cause. | |
367 virtual void ConnectToServiceInsecurely( | |
368 const device::BluetoothUUID& uuid, | |
369 const ConnectToServiceCallback& callback, | |
370 const ConnectToServiceErrorCallback& error_callback) = 0; | |
armansito
2014/10/15 19:02:16
Kind of tangential to this CL, though I wonder why
Ilya Sherman
2014/10/15 22:04:45
I personally find the strings more convenient than
| |
371 | |
359 // Opens a new GATT connection to this device. On success, a new | 372 // Opens a new GATT connection to this device. On success, a new |
360 // BluetoothGattConnection will be handed to the caller via |callback|. On | 373 // BluetoothGattConnection will be handed to the caller via |callback|. On |
361 // error, |error_callback| will be called. The connection will be kept alive, | 374 // error, |error_callback| will be called. The connection will be kept alive, |
362 // as long as there is at least one active GATT connection. In the case that | 375 // as long as there is at least one active GATT connection. In the case that |
363 // the underlying connection gets terminated, either due to a call to | 376 // the underlying connection gets terminated, either due to a call to |
364 // BluetoothDevice::Disconnect or other unexpected circumstances, the | 377 // BluetoothDevice::Disconnect or other unexpected circumstances, the |
365 // returned BluetoothGattConnection will be automatically marked as inactive. | 378 // returned BluetoothGattConnection will be automatically marked as inactive. |
366 // To monitor the state of the connection, observe the | 379 // To monitor the state of the connection, observe the |
367 // BluetoothAdapter::Observer::DeviceChanged method. | 380 // BluetoothAdapter::Observer::DeviceChanged method. |
368 typedef base::Callback<void(scoped_ptr<BluetoothGattConnection>)> | 381 typedef base::Callback<void(scoped_ptr<BluetoothGattConnection>)> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 | 416 |
404 private: | 417 private: |
405 // Returns a localized string containing the device's bluetooth address and | 418 // Returns a localized string containing the device's bluetooth address and |
406 // a device type for display when |name_| is empty. | 419 // a device type for display when |name_| is empty. |
407 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 420 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
408 }; | 421 }; |
409 | 422 |
410 } // namespace device | 423 } // namespace device |
411 | 424 |
412 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 425 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |