GATT Latency Service

The GATT Latency Service is a custom service containing a single writable characteristic. This characteristic can be used to calculate the round-trip time of a GATT Write operation.

Service UUID

The 128-bit service UUID is 67136E01-58DB-F39B-3446-FDDE58C0813A.

Characteristics

This service has one characteristic.

Latency Characteristic (67136E02-58DB-F39B-3446-FDDE58C0813A)

Write

The server is waiting for a write request from the client, then it will automatically reply a write response back.

API documentation

Header file: include/bluetooth/services/latency.h
Source file: subsys/bluetooth/services/latency.c
group bt_latency

API for the Bluetooth LE GATT Latency Service.

Defines

BT_UUID_LATENCY_VAL

Latency Service UUID.

BT_UUID_LATENCY
BT_UUID_LATENCY_CHAR_VAL
BT_UUID_LATENCY_CHAR

UUID of the Latency Characteristic.

Functions

int bt_latency_init(struct bt_latency *latency, const struct bt_latency_cb *cb)

Initialize the GATT latency service.

Parameters
  • latency[in] Latency service instance.

  • cb[in] Callbacks.

Returns 0

If the operation was successful. Otherwise, a negative error code is returned.

Returns (-EINVAL)

Special error code used when the input parameters are invalid.

Returns (-EALREADY)

Special error code used when the latency service has been initialed.

struct bt_latency_cb
#include <latency.h>

Latency callback structure.

Public Members

void (*latency_request)(const void *buf, uint16_t len)

Latency received callback.

This function is called when a GATT write request has been received by the Latency characteristic.

It is optional for an application to handle the write request when measuring the latency.

Parameters
  • buf[in] Latency data.

  • len[in] Latency data length.

struct bt_latency
#include <latency.h>

Latency structure.

Public Members

uint16_t handle

Characteristic handle.

struct bt_conn *conn

Connection object.

atomic_t state

Internal state.