bt_gatt_write_value_async()

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

Synopsis:

#include <btapi/btgatt.h>
 
int bt_gatt_write_value_async(int instance, uint16_t handle, uint16_t offset, const uint8_t *data, int size, bt_gatt_write_value_cb cb, void *user_data)

Since:

BlackBerry 10.3.0

Arguments:

instance

The identifier used to reference the connected primary service.

handle

The to the value to be written.

offset

The offset to begin writing from.

data

An array of data to be written.

size

The size of the array to be written.

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:

The size of the value to be written cannot be larger than ATT_MTU-3 bytes.

Returns:

EOK when data writing is successfully completed, -1 with the errno set otherwise. The error codes that can be returned are as follows:
  • 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.
  • ENOMEM: Insufficient memory to perform the request.
  • ESRCH: The service connection was not available.
  • ESRVRFAULT: An internal error has occurred.