GATT Bond Management Service (BMS)

This module implements the Bond Management Service with the corresponding set of characteristics defined in the Bond Management Service Specification.

You can configure the service to support your desired feature set of bond management operations. All the BMS features in the “LE transport only” mode are supported:

  • delete the bond of the requesting device,

  • delete all bonds on the Server,

  • delete all bonds on the Server except the one of the requesting device.

You can enable each feature when initializing the module.

Authorization

You can require authorization to access each BMS feature.

When required, the Client’s request to execute a bond management operation should contain the authorization code. The Server compares the code with its local version and accepts the request only if the codes match.

If you use at least one BMS feature that requires authorization, you need to provide a callback with comparison logic for the authorization codes. You can set this callback when initializing the module.

Deleting the bonds

The Server deletes bonding information on Client’s request right away when there is no active Bluetooth LE connection associated with a bond. Otherwise, the Server removes the bond for a given peer when it disconnects.

API documentation

Header file: include/bluetooth/services/bms.h
Source file: subsys/bluetooth/services/bms.c
group bt_bms

API for the Bond Management Service (BMS).

Enums

enum bt_bms_op

BMS Control Point operation codes (LE transport).

Values:

enumerator BT_BMS_OP_DEL_REQ_BOND
enumerator BT_BMS_OP_DEL_ALL_BONDS
enumerator BT_BMS_OP_DEL_REST_BONDS

Functions

int bt_bms_init(const struct bt_bms_init_params *init_params)

Initialize the BMS Service.

Initialize the BMS Service by specifying a list of supported operations. If any operation is configured as authorized, you need to provide authorize() callback.

Parameters
  • init_params: Initialization parameters.

Return Value
  • 0: If the operation was successful. Otherwise, a (negative) error code is returned.

struct bt_bms_authorize_params
#include <bms.h>

BMS authorization callback parameters.

struct bt_bms_cb
#include <bms.h>

BMS server callback structure.

Public Members

bool (*authorize)(struct bt_conn *conn, struct bt_bms_authorize_params *params)

Operation authorization callback

If this callback is set, support for BMS Authorization Code functionality is enabled. This function is called whenever an authorized operation is requested by the client.

Parameters
  • conn: Connection object.

  • params: Authorization parameters.

Return Value
  • true: If the authorization was successful.

  • false: Otherwise.

struct bt_bms_feature
#include <bms.h>

Bitmask of supported features.

struct bt_bms_features
#include <bms.h>

Bitmask set of supported features.

struct bt_bms_init_params
#include <bms.h>

BMS initialization parameters.