OOB Example

Background

You can find the specification of the Out Of Band pairing process in the Bluetooth specification: Bluetooth spec v5.

Description

Purpose of the Example

OOB with legacy pairing and OOB with secure connection pairing are the two OOB pairing modes. This example implements both modes for user’s reference.

Implementing the central and peripheral roles are the two projects in the example.

Central

Peripheral

Because of the different properties of these two characteristics, if the pairing and bonding procedure succeeds, the client will receive notifications and the server will receive write requests. Otherwise, if pairing and bonding procedure fails, the client should not be able to write the characteristic value due to an unauthenticated connection, but it should be able to receive notifications because it doesn’t require authentication.

Key Points of the Example

Pairing Modes

In both projects, a symbol definition, PAIRING_MODE, can either be LEGACY_PAIRING or SECURE_CONNECTION_PAIRING. This symbol determines which pairing mode will be used in the connection.

#define LEGACY_PAIRING                                       1
#define SECURE_CONNECTION_PAIRING                            2

#define PAIRING_MODE                                         SECURE_CONNECTION_PAIRING

Behaviors of Both Roles

Setting up

As shown above, the example requires two devices (e.g., BRD4104a Rev A00) and serial terminal, VCOM has been enabled in the example. Therefore, the serial print information will go out from the USB cable.

Serial terminal (#S1): connect to the central device.

Serial terminal (#S2): connect to the peripheral device.

Usage

Figure 1. OOB with Legacy Pairing Succeeded

Figure 2. OOB with Legacy Pairing Failed

Figure 3. OOB with Secure Connection Pairing Succeeded

Figure 4. OOB with Secure Connection Pairing Failed

Source