This is the documentation for the latest (master) development branch of Zephyr. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

Universal Unique Identifiers (UUIDs)

API Reference

group bt_uuid

UUIDs.

Defines

BT_UUID_INIT_16(value)
BT_UUID_INIT_32(value)
BT_UUID_INIT_128(value...)
BT_UUID_DECLARE_16(value)
BT_UUID_DECLARE_32(value)
BT_UUID_DECLARE_128(value...)
BT_UUID_16(__u)
BT_UUID_32(__u)
BT_UUID_128(__u)
BT_UUID_128_ENCODE(w32, w1, w2, w3, w48)

Encode 128 bit UUID into an array values.

Helper macro to initialize a 128-bit UUID value from the UUID format. Can be combined with BT_UUID_DECLARE_128 to declare a 128-bit UUID from the readable form of UUIDs.

Example for how to declare the UUID 6E400001-B5A3-F393-E0A9-E50E24DCCA9E

BT_UUID_DECLARE_128(
      BT_UUID_128_ENCODE(0x6E400001, 0xB5A3, 0xF393, 0xE0A9, 0xE50E24DCCA9E))

Just replace the hyphen by the comma and add 0x prefixes.

Return

The comma separated values for UUID 128 initializer that may be used directly as an argument for BT_UUID_INIT_128 or BT_UUID_DECLARE_128

Parameters
  • w32: First part of the UUID (32 bits)

  • w1: Second part of the UUID (16 bits)

  • w2: Third part of the UUID (16 bits)

  • w3: Fourth part of the UUID (16 bits)

  • w48: Fifth part of the UUID (48 bits)

BT_UUID_STR_LEN

Recommended length of user string buffer for Bluetooth UUID.

The recommended length guarantee the output of UUID conversion will not lose valuable information about the UUID being processed. If the length of the UUID is known the string can be shorter.

BT_UUID_GAP

Generic Access.

BT_UUID_GATT

Generic Attribute.

BT_UUID_CTS

Current Time Service.

BT_UUID_HTS

Health Thermometer Service.

BT_UUID_DIS

Device Information Service.

BT_UUID_HRS

Heart Rate Service.

BT_UUID_BAS

Battery Service.

BT_UUID_HIDS

HID Service.

BT_UUID_CSC

Cycling Speed and Cadence Service.

BT_UUID_ESS

Environmental Sensing Service.

BT_UUID_BMS

Bond Management Service.

BT_UUID_IPSS

IP Support Service.

BT_UUID_OTS

Object Transfer Service.

BT_UUID_MESH_PROV

Mesh Provisioning Service.

BT_UUID_MESH_PROXY

Mesh Proxy Service.

BT_UUID_GATT_PRIMARY

GATT Primary Service.

BT_UUID_GATT_SECONDARY

GATT Secondary Service.

BT_UUID_GATT_INCLUDE

GATT Include Service.

BT_UUID_GATT_CHRC

GATT Characteristic.

BT_UUID_GATT_CEP

GATT Characteristic Extended Properties.

BT_UUID_GATT_CUD

GATT Characteristic User Description.

BT_UUID_GATT_CCC

GATT Client Characteristic Configuration.

BT_UUID_GATT_SCC

GATT Server Characteristic Configuration.

BT_UUID_GATT_CPF

GATT Characteristic Presentation Format.

BT_UUID_VALID_RANGE

Valid Range Descriptor.

BT_UUID_HIDS_EXT_REPORT

HID External Report Descriptor.

BT_UUID_HIDS_REPORT_REF

HID Report Reference Descriptor.

BT_UUID_ES_CONFIGURATION

Environmental Sensing Configuration Descriptor.

BT_UUID_ES_MEASUREMENT

Environmental Sensing Measurement Descriptor.

BT_UUID_ES_TRIGGER_SETTING

Environmental Sensing Trigger Setting Descriptor.

BT_UUID_GAP_DEVICE_NAME

GAP Characteristic Device Name.

BT_UUID_GAP_APPEARANCE

GAP Characteristic Appearance.

BT_UUID_GAP_PPCP

GAP Characteristic Peripheral Preferred Connection Parameters.

BT_UUID_GATT_SC

GATT Characteristic Service Changed.

BT_UUID_BAS_BATTERY_LEVEL

BAS Characteristic Battery Level.

BT_UUID_HTS_MEASUREMENT

HTS Characteristic Measurement Value.

BT_UUID_HIDS_BOOT_KB_IN_REPORT

HID Characteristic Boot Keyboard Input Report.

BT_UUID_DIS_SYSTEM_ID

DIS Characteristic System ID.

BT_UUID_DIS_MODEL_NUMBER

DIS Characteristic Model Number String.

BT_UUID_DIS_SERIAL_NUMBER

DIS Characteristic Serial Number String.

BT_UUID_DIS_FIRMWARE_REVISION

DIS Characteristic Firmware Revision String.

BT_UUID_DIS_HARDWARE_REVISION

DIS Characteristic Hardware Revision String.

BT_UUID_DIS_SOFTWARE_REVISION

DIS Characteristic Software Revision String.

BT_UUID_DIS_MANUFACTURER_NAME

DIS Characteristic Manufacturer Name String.

BT_UUID_DIS_PNP_ID

DIS Characteristic PnP ID.

BT_UUID_CTS_CURRENT_TIME

CTS Characteristic Current Time.

BT_UUID_MAGN_DECLINATION

Magnetic Declination Characteristic.

BT_UUID_HIDS_BOOT_KB_OUT_REPORT

HID Boot Keyboard Output Report Characteristic.

BT_UUID_HIDS_BOOT_MOUSE_IN_REPORT

HID Boot Mouse Input Report Characteristic.

BT_UUID_HRS_MEASUREMENT

HRS Characteristic Measurement Interval.

BT_UUID_HRS_BODY_SENSOR

HRS Characteristic Body Sensor Location.

BT_UUID_HRS_CONTROL_POINT

HRS Characteristic Control Point.

BT_UUID_HIDS_INFO

HID Information Characteristic.

BT_UUID_HIDS_REPORT_MAP

HID Report Map Characteristic.

BT_UUID_HIDS_CTRL_POINT

HID Control Point Characteristic.

BT_UUID_HIDS_REPORT

HID Report Characteristic.

BT_UUID_HIDS_PROTOCOL_MODE

HID Protocol Mode Characteristic.

BT_UUID_CSC_MEASUREMENT

CSC Measurement Characteristic.

BT_UUID_CSC_FEATURE

CSC Feature Characteristic.

BT_UUID_SENSOR_LOCATION

Sensor Location Characteristic.

BT_UUID_SC_CONTROL_POINT

SC Control Point Characteristic.

BT_UUID_ELEVATION

Elevation Characteristic.

BT_UUID_PRESSURE

Pressure Characteristic.

BT_UUID_TEMPERATURE

Temperature Characteristic.

BT_UUID_HUMIDITY

Humidity Characteristic.

BT_UUID_TRUE_WIND_SPEED

True Wind Speed Characteristic.

BT_UUID_TRUE_WIND_DIR

True Wind Direction Characteristic.

BT_UUID_APPARENT_WIND_SPEED

Apparent Wind Speed Characteristic.

BT_UUID_APPARENT_WIND_DIR

Apparent Wind Direction Characteristic.

BT_UUID_GUST_FACTOR

Gust Factor Characteristic.

BT_UUID_POLLEN_CONCENTRATION

Pollen Concentration Characteristic.

BT_UUID_UV_INDEX

UV Index Characteristic.

BT_UUID_IRRADIANCE

Irradiance Characteristic.

BT_UUID_RAINFALL

Rainfall Characteristic.

BT_UUID_WIND_CHILL

Wind Chill Characteristic.

BT_UUID_HEAT_INDEX

Heat Index Characteristic.

BT_UUID_DEW_POINT

Dew Point Characteristic.

BT_UUID_DESC_VALUE_CHANGED

Descriptor Value Changed Characteristic.

BT_UUID_MAGN_FLUX_DENSITY_2D

Magnetic Flux Density - 2D Characteristic.

BT_UUID_MAGN_FLUX_DENSITY_3D

Magnetic Flux Density - 3D Characteristic.

BT_UUID_BAR_PRESSURE_TREND

Barometric Pressure Trend Characteristic.

BT_UUID_BMS_CONTROL_POINT

Bond Management Control Point.

BT_UUID_BMS_FEATURE

Bond Management Feature.

BT_UUID_CENTRAL_ADDR_RES

Central Address Resolution Characteristic.

BT_UUID_OTS_FEATURE

OTS Feature Characteristic.

BT_UUID_OTS_NAME

OTS Object Name Characteristic.

BT_UUID_OTS_TYPE

OTS Object Type Characteristic.

BT_UUID_OTS_SIZE

OTS Object Size Characteristic.

BT_UUID_OTS_FIRST_CREATED

OTS Object First-Created Characteristic.

BT_UUID_OTS_LAST_MODIFIED

OTS Object Last-Modified Characteristic.

BT_UUID_OTS_ID

OTS Object ID Characteristic.

BT_UUID_OTS_PROPERTIES

OTS Object Properties Characteristic.

BT_UUID_OTS_ACTION_CP

OTS Object Action Control Point Characteristic.

BT_UUID_OTS_LIST_CP

OTS Object List Control Point Characteristic.

BT_UUID_OTS_LIST_FILTER

OTS Object List Filter Characteristic.

BT_UUID_OTS_CHANGED

OTS Object Changed Characteristic.

BT_UUID_MESH_PROV_DATA_IN

Mesh Provisioning Data In.

BT_UUID_MESH_PROV_DATA_OUT

Mesh Provisioning Data Out.

BT_UUID_MESH_PROXY_DATA_IN

Mesh Proxy Data In.

BT_UUID_MESH_PROXY_DATA_OUT

Mesh Proxy Data Out.

BT_UUID_GATT_CLIENT_FEATURES

Client Supported Features.

BT_UUID_GATT_DB_HASH

Database Hash.

BT_UUID_GATT_SERVER_FEATURES

Server Supported Features.

BT_UUID_SDP
BT_UUID_UDP
BT_UUID_RFCOMM
BT_UUID_TCP
BT_UUID_TCS_BIN
BT_UUID_TCS_AT
BT_UUID_ATT
BT_UUID_OBEX
BT_UUID_IP
BT_UUID_FTP
BT_UUID_HTTP
BT_UUID_BNEP
BT_UUID_UPNP
BT_UUID_HIDP
BT_UUID_HCRP_CTRL
BT_UUID_HCRP_DATA
BT_UUID_HCRP_NOTE
BT_UUID_AVCTP
BT_UUID_AVDTP
BT_UUID_CMTP
BT_UUID_UDI
BT_UUID_MCAP_CTRL
BT_UUID_MCAP_DATA
BT_UUID_L2CAP

Enums

enum [anonymous]

Bluetooth UUID types.

Values:

BT_UUID_TYPE_16
BT_UUID_TYPE_32
BT_UUID_TYPE_128

Functions

int bt_uuid_cmp(const struct bt_uuid *u1, const struct bt_uuid *u2)

Compare Bluetooth UUIDs.

Compares 2 Bluetooth UUIDs, if the types are different both UUIDs are first converted to 128 bits format before comparing.

Return

negative value if u1 < u2, 0 if u1 == u2, else positive

Parameters
  • u1: First Bluetooth UUID to compare

  • u2: Second Bluetooth UUID to compare

bool bt_uuid_create(struct bt_uuid *uuid, const uint8_t *data, uint8_t data_len)

Create a bt_uuid from a little-endian data buffer.

Create a bt_uuid from a little-endian data buffer. The data_len parameter is used to determine whether the UUID is in 16, 32 or 128 bit format (length 2, 4 or 16). Note: 32 bit format is not allowed over the air.

Return

true if the data was valid and the UUID was successfully created.

Parameters
  • uuid: Pointer to the bt_uuid variable

  • data: pointer to UUID stored in little-endian data buffer

  • data_len: length of the UUID in the data buffer

void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len)

Convert Bluetooth UUID to string.

Converts Bluetooth UUID to string. UUID can be in any format, 16-bit, 32-bit or 128-bit.

Return

N/A

Parameters
  • uuid: Bluetooth UUID

  • str: pointer where to put converted string

  • len: length of str

struct bt_uuid
#include <uuid.h>

This is a ‘tentative’ type and should be used as a pointer only.