Home | History | Annotate | Download | only in proximity_auth
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H
      6 #define COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H
      7 
      8 #include <string>
      9 
     10 #include "base/callback_forward.h"
     11 #include "device/bluetooth/bluetooth_device.h"
     12 
     13 namespace device {
     14 class BluetoothUUID;
     15 }
     16 
     17 namespace proximity_auth {
     18 namespace bluetooth_util {
     19 
     20 typedef base::Callback<void(const std::string& error_message)> ErrorCallback;
     21 
     22 // Connects to the SDP service on the Bluetooth device with the given
     23 // |device_address|, if possible. Calls the |callback| on success, or the
     24 // |error_callback| with an error message on failure. Because this can be an
     25 // expensive operation, the work will be run on the provided |task_runner|,
     26 // which should correspond to a background thread.
     27 void SeekDeviceByAddress(const std::string& device_address,
     28                          const base::Closure& callback,
     29                          const ErrorCallback& error_callback,
     30                          base::TaskRunner* task_runner);
     31 
     32 void ConnectToServiceInsecurely(
     33     device::BluetoothDevice* device,
     34     const device::BluetoothUUID& uuid,
     35     const device::BluetoothDevice::ConnectToServiceCallback& callback,
     36     const device::BluetoothDevice::ConnectToServiceErrorCallback&
     37         error_callback);
     38 
     39 }  // namespace bluetooth_util
     40 }  // namespace proximity_auth
     41 
     42 #endif  // COMPONENTS_PROXIMITY_AUTH_BLUETOOTH_UTIL_H
     43