bt_gatt_read_value_async()

Perform a Generic Attribute (GATT) call to read a value asynchronously from a provided handle.

Synopsis:

#include <btapi/btgatt.h>
 
int bt_gatt_read_value_async(int instance, uint16_t handle, uint16_t offset, bt_gatt_read_value_cb cb, void *user_data)

Since:

BlackBerry 10.3.0

Arguments:

instance

The identifier used to reference the connected primary service.

handle

The handle of the value to be read.

offset

The offset to begin reading from.

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:

Returns:

The number of bytes that have been read when the function is successfully completed, -1 with the errno set otherwise. The error codes that can be returned are as follows:
  • EACCESS: Insufficient authentication or authorization.
  • EINVAL: The arguments passed are invalid or the connection to the remote Bluetooth-enabled device is unavailable.
  • ENODEV: Unable to find the service connection defined by the instance argument.
  • ENOENT: An invalid handle was provided for the GATT server.
  • ENOMEM: Insufficient memory to perform the request.
  • ESRCH: The service connection was not available.
  • ESRVRFAULT: An internal error has occurred.