Section 7.2

Central and peripheral roles

Definition

Central and peripheral roles are the two roles that the two devices of a Bluetooth Low Energy (BLE) §7.1 connection take. The peripheral is the device that advertises, announcing that it accepts connections; the central is the device that scans, finds the peripheral and starts the connection. While the connection lasts, the central sets its timing: it decides when the two devices meet and transmits first at every meeting, and the peripheral answers. The roles say who manages the link, not who holds the data or who may do what.

The idea

A phone connects to a fitness band. The phone scanned for the band and started the connection, so the phone is the central and the band is the peripheral. The band measures heart rate, and the phone reads it. It is tempting to conclude that the central always asks and the peripheral always answers. The band, however, also needs the current time, which the phone knows, so the band asks the phone for it. In that request the band asks and the phone answers, while the band is still the peripheral.

Three separate questions are at stake. Central or peripheral: who started the connection and keeps its clock. Client or server, in the sense of GATT §7.10 (Generic Attribute Profile, the part of the Bluetooth software that organizes a device’s data into named items): for one request, who asks and who holds the data. Authorization §1.7: whether the asker may have what it asks for. The first two are protocol roles that any device can take. Only the third involves trust, and its answer must come from an identity established by authentication §1.6, not from a role.

How it works

Link roles. The roles are defined by GAP (Generic Access Profile), the part of the Bluetooth Core Specification that says how devices find and connect to each other [283]. GAP defines four roles for BLE:

How a connection forms.

  1. The future peripheral sends connectable advertisements: short packets, on the three channels reserved for advertising, which say that it accepts a connection.

  2. The future central scans, receives one advertisement, and replies on the same channel, 150 microseconds after it ends, with a connection request (a packet named CONNECT_IND). The request carries the connection’s parameters: the connection interval §7.7, which is the time between two meetings of the devices; the peripheral latency, explained below; the supervision timeout §7.8, which is how long the link may stay silent before it counts as lost; and the channels to hop across.

  3. From then on the Link Layers §7.6 of both devices, the parts that control the radios, follow that schedule. Each meeting is called a connection event. At its start, a moment called the anchor point, the central transmits first, and the peripheral, listening at that moment, replies.

What the central controls. The central’s Link Layer chooses the parameters and the anchor point of every connection event, and only the central can put a change of parameters into effect; the peripheral may only ask for one. Peripheral latency is the number of consecutive connection events that the peripheral may skip listening to, which saves its energy when it has nothing to send. The roles are fixed for the life of the connection: BLE has no procedure that swaps them. Before version 5.3, the Link Layer part of the specification called these roles master and slave; version 5.3 renamed them central and peripheral, the names that GAP had used from the start.

Data roles. GATT gives each device a second, independent pair of roles. The server holds a table of attributes, numbered data items such as a heart-rate value or a device name. The client sends requests to read or write those attributes, and receives notifications, updates that the server sends without being asked. These roles belong to each attribute operation, not to the connection. On one connection, each device can be server and client at the same time, whichever device is central.

Several connections. Since version 4.1, the specification allows one device to be central on some connections and peripheral on others at the same time, an optional feature that not every chip supports. A gateway, for example, can be central to several sensors while it is peripheral to a phone.

Worked example

The phone and the band from above are connected with a connection interval of 30 ms and a peripheral latency of 4. Connection subrating, an optional feature added in version 5.3 that lets both devices agree to skip events, is not in use.

Three attribute operations take place on this one connection:

Operation Started by GATT client GATT server
Read heart rate phone phone band
Notify a new heart rate band phone band
Read current time band band phone

In all three rows the phone is central and the band is peripheral. The device that starts the operation changes, and the device that holds the data changes, while the link roles stay the same.

Stated precisely

For one BLE connection between two devices:

  1. Exactly one device is central and the other is peripheral. The central is the device whose Link Layer sent the connection request. The roles hold until the connection ends.

  2. The central sets the anchor point of every connection event and transmits first in it. Let TT be the connection interval and LL the peripheral latency. The peripheral must listen in at least one of every L+1L + 1 consecutive connection events, so at least once every (L+1)T(L + 1)T, and the specification requires (L+1)T(L + 1)T to be less than half of the supervision timeout. This item assumes that connection subrating is not in use.

  3. For one attribute operation, the client is the device that reads, writes or receives a notification, and the server is the device that holds the attribute. These roles are set for each operation, independently of item 1.

  4. Neither pair of roles carries any permission. Whether an operation is allowed depends on the peer’s authenticated identity, on the security of the link, and on the access rules that the server sets for that attribute.

Limits and common mistakes

Central does not mean trusted. Any device in radio range can send a connection request to a peripheral that accepts connections, so taking the central role costs an attacker nothing. A peripheral can restrict which devices may connect with a filter accept list, a list of device addresses that its Controller, the radio part of its Bluetooth system, accepts. A device address is not secret and can be copied, however; only pairing §7.17 that authenticated the peer establishes who the peer is.

Server does not mean trusted or in charge. The GATT server only holds the data, and it must check every request as input that the client chose.

Do not infer the direction of data from the link roles. A central phone is a GATT server whenever it offers data to a peripheral, such as the current time or the phone’s notifications that a watch displays.

Older documents, interfaces and tools still say master for central and slave for peripheral; the roles are the same.

A given chip or software stack may support only some roles, or only a limited number of simultaneous connections. That limit belongs to the implementation, not to BLE.

A broadcaster and an observer form no connection and have no client or server. Whatever a broadcaster sends reaches every observer in range.

Questions answered

Are central/peripheral roles identical to application client/server roles?

No. Central and peripheral are link roles of a Bluetooth Low Energy (BLE) connection: the central is the device that started the connection and keeps its timing, and the peripheral is the device that advertised and accepted it. Client and server are data roles of each operation, defined by GATT (Generic Attribute Profile): the client reads or writes data, and the server holds the data.

The two pairs are independent. A phone that is central becomes a server when a watch, as peripheral and client, reads the current time from it, and both devices can be client and server on the same connection at once. Neither pair grants permission: whether a request is allowed must follow from the peer’s authenticated identity and from the server’s access rules, never from the role a device happens to take.

Related entries: GATT (§7.10), Authorization (§1.7), Authentication (§1.6), Connection interval (§7.7), Supervision timeout (§7.8), Advertising and scanning (§7.3). Further reading: [19, 93, 283].