bt_gatt_srv_set_keepalive()

Request to enable or disable a connection keep-alive to the remote device.

Synopsis:

#include <btapi/btgattsrv.h>
 
int bt_gatt_srv_set_keepalive(int instance, const char *addr, uint8_t type, uint8_t enabled)

Since:

BlackBerry 10.2.0

Arguments:

instance

The instance number representing the local GATT service.

addr

The address of the remote device to which the connection update request is to be sent.

type

The device type identifier. Refer to constants prefixed with BT_DEVICE_TYPE_.

enabled

A value of 1 will enable notification support. A value of 0 will disable notification support.

Library:

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

Description:

This function should only be used when the service that enables it knows that the connection to the remote device must remain active. If the keep-alive is enabled, the GATT connection will remain open until either the keep-alive is disabled or the remote device closes the connection. Caution should be used to ensure that the keep-alive is used for services that are actively used by the remote device; otherwise the connection may remain open and never disconnect.

Returns:

EOK when notification support is successfully enabled, otherwise -1 with the errno set otherwise. The error codes that can be returned are as follows:
  • EINVAL: An argument passed is invalid or the connection to the remote Bluetooth-enabled device is unavailable.
  • ENOTSUP: The request is being made on a BR/EDR connection, which is not supported.
  • ENODEV: Unable to find the service connection defined by the instance argument.
  • ENOMEM: Insufficient memory was available to perform the request.
  • ENOTCONN: The keep-alive is currently disabled.
  • EBUSY: The keep-alive is already enabled.
  • ESRVRFAULT: An internal error has occurred.