Comprehensive BLE training

BLE GAP Roles: Peripheral, Central, Broadcaster and Observer

Who advertises, who scans and what is the role of Central and Peripheral in phone, sensor, dual ESP32 and Beacon scenarios?

Contents
Actual view of the ESP-WROOM-32 module and its printed antenna on the development board.
The actual view of the ESP-WROOM-32 module and its printed antenna on the development board. Photo: Brian Krent; Wikimedia Commons resource; CC BY-SA 4.0. The content of the photo has not changed; A Wikimedia preview image is used. This is not a documentary photo of the LCENJ experiment.
Step 5 of 20 ways to master BLE

The terms Central and Peripheral are about the role of communication, not hardware power. The phone is usually Central and the sensor Peripheral, but the same ESP32 can take the role of Central in another project. By knowing the roles, the API path and each party's responsibility becomes clear.

Peripheral and Central

Peripheral usually advertises and provides data or service. Central scans, finds the appropriate device, and initiates the connection. After connection, the role of the Link Layer is not the same as the role of GATT Client and Server; Often Central is the client, but this is not an absolute requirement.

Broadcaster and Observer

Broadcaster broadcasts data without connecting; Beacon is a common example. Observer only receives and analyzes Advertising and does not necessarily make connections. These two roles are for simple telemetry, attendance and low-cost environment scanning.

Phone and sensor

In a thermometer, the sensor advertises, the phone scans it and connects, then discovers services. If the phone activates Notify, the sensor will send a new value when the temperature changes. It is responsible for starting the connection of the phone, but the sensor produces the useful data.

Two ESP32 and multiple roles

An ESP32-C3 can be a peripheral and provide SHT31 data; The second ESP32 is Central and shows it on the screen. Some chips support multiple connections or simultaneous roles, but RAM, radio time, and state management complexity increase.

Role assignment exercise

Write the role of each device for the three scenarios "Store Beacon", "Smart Lock with Mobile" and "Gateway that reads ten sensors". Then specify separately which side is GATT Server and which side is GATT Client.

See two independent roles in one table

The device in the example is a thermometerThe role of GAPCommon role of GATT
the phoneCentral; Starts the connectionclient; Discovers the service and requests the data
Sensor boardPeripherals; Accepts the advertised connectionserver; Provides the Attribute table

This arrangement is common, but there is no "Central is always Client" rule. The role of GAP is related to detection and binding; The role of GATT is to provide or consume Attributes. A device can operate in both GATT directions if the stack supports it.

Do not confuse an unconnected Beacon with a connected GATT Server: receiving Advertising for an Observer does not constitute a connection or service discovery.

Question and answer article

Ask your technical question

Questions and answers are published after moderation. Authors can see their own pending drafts.

No confirmed questions have been registered for this article yet.