bt_hid_connect_async()

Asynchronously create a HID Device connection to a service on a remote Bluetooth device (HID Host).

Synopsis:

#include <btapi/bthid.h>
 
int bt_hid_connect_async(const char *addr, bt_hid_service_connected_async_cb cb, void *user_data)

Since:

BlackBerry 10.3.0

Arguments:

addr

The remote Bluetooth device (Host) address.

cb

The callback function to be executed when the operation has completed.

user_data

A user specified pointer that is returned during the callback.

Library:

libbtapi (For the qcc command, use the -l btapi option to link against this library)

Description:

This function attempts to open a HID connection to a Host device at the address specified. Once completed, the specified bt_hid_service_connected_async_cb() callback function is executed.

Returns:

0 if the service connection is successful, or -1 with the errno set otherwise. The error codes that can be returned are as follows:
  • EPERM: The bt_hid_init() function was not called or did not complete successfully.
  • EBUSY: The requested service is already in use.
  • EAGAIN: The link to the Bluetooth stack is unavailable. You can try again.
  • EINVAL: Invalid stack parameters or connection to the remote Bluetooth-enabled device is not available.
  • ENODEV: The requested Bluetooth-enabled device could not be found.
  • ENOMEM: Sufficient memory is not available to perform the request.
  • ENOTSUP: The requested service is not supported by the device.
  • ENOSYS: Cannot create a connection to the device.
  • ESRVRFAULT: An internal error has occurred.
  • ETIMEOUT: The connection attempt has timed out.