bt_gatt_read_value()

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

Synopsis:

#include <btapi/btgatt.h>
 
int bt_gatt_read_value(int instance, uint16_t handle, uint16_t offset, uint8_t *data, uint16_t size, uint8_t *more)

Since:

BlackBerry 10.0.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.

data

A pointer to the array to be populated with the data that is read.

size

The size of the array passed that is passed to the function.

more

(Optional) Use a value of 1 to indicate that there is more data to read and a value of 0 to explicitly indicate that there is no more data to be read.

Library:

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

Description:

You can use the optional more argument to indicate there is more data to read. If you do not provide the value, the function does indicate whether there is more data to be read. The reason being that in most cases, the size of the data is defined by the specifications of the protocol.

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.
  • EBUSY: The stack was busy performing another operation. You can try again later.
  • EDEADLK: A potential deadlock has been avoided.
  • 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.
  • ENOSYS: The operation failed at the stack level.
  • ENXIO: An unknown handle value was provided for a service.
  • EPERM: An attribute could not be read.
  • EPROTO: The operation failed because the response from remote Bluetooth-enabled device had a protocol error.
  • ESRCH: The service connection was not available.
  • ESRVRFAULT: An internal error has occurred.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus