GATT Latency Service

The GATT Latency Service is a custom service containing a single writable characteristic. You can use this characteristic 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, and replies with a write response.

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.

Return values:
  • 0 – If the operation was successful. Otherwise, a negative error code is returned.

  • (-EINVAL) – Special error code used when the input parameters are invalid.

  • (-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.

Param buf:

[in] Latency data.

Param 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.