跪拜 Guibai
← All articles
Bluetooth · Android · Flutter

Bluetooth LE Connections: Roles, Events, and the Parameters That Keep a Link Alive

By 好的佩奇 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Bluetooth LE's connection model is full of subtle distinctions that routinely cause mismatches, reconnection bugs, and silent data failures in mobile and IoT apps. Knowing exactly what a connection does and does not guarantee saves hours of debugging and prevents designs that misuse roles or parameters.

Summary

Connecting a phone to a smart lock is not a single handshake; it is an agreement on timing, channels, and failure detection. This guide walks through the core mechanics of a Bluetooth LE ACL connection, starting with the distinction between broadcast and connection, and the four GAP roles (Broadcaster, Observer, Peripheral, Central). It stresses that roles are not fixed labels: a phone can act as Central in one connection and Peripheral in another, and Central does not mean GATT Client.

The connection flow itself is precise: a peripheral sends connectable advertising, the central responds with CONNECT_IND, and the two sides then meet in repeated connection events. There is no extra acceptance packet in the traditional path, unlike extended advertising which uses AUX_CONNECT_REQ and AUX_CONNECT_RSP. The guide explains how connection events alternate sends, how channel hopping works, and why link-layer acknowledgment is not the same as business success.

Three parameters determine the rhythm and durability of a connection: connection interval, peripheral latency, and supervision timeout. Their relationship is captured by the constraint that supervision timeout must exceed 2 * (latency + 1) * interval. Newer features like Shorter Connection Intervals (down to 0.375 ms with Core 6.2) and connection subrating add flexibility but require support on both sides. The guide closes with the post-connection tasks: service discovery, pairing vs bonding, and what reconnection actually requires.

Takeaways
— A Bluetooth LE connection is an agreement on timing, channels, and loss detection; it does not reserve a frequency or create a permanent radio link.
— Four GAP roles exist: Broadcaster, Observer, Peripheral, Central. Broadcasting or scanning is an activity, not a fixed role.
— Central initiates connections; Peripheral accepts them. A device can be Central in one connection and Peripheral in another, and role does not change with send direction.
— Central/Peripheral is distinct from GATT Client/Server. A Central can provide GATT services, and a Peripheral can act as a GATT Client.
— In traditional connectable advertising, CONNECT_IND has no separate acceptance response packet; extended advertising uses AUX_CONNECT_REQ and AUX_CONNECT_RSP.
— A connection event is a round of send/receive that can carry multiple packets; the Central sends first, then the Peripheral replies.
— Connection interval controls how often connection events start. Baseline range is 7.5 ms to 4 s in 1.25 ms steps; Bluetooth Core 6.2's Shorter Connection Intervals can go down to 375 microseconds.
— Peripheral latency lets the Peripheral skip a set number of consecutive connection events; the maximum gap between participation opportunities is (latency + 1) * interval.
— Supervision timeout determines when a link is declared lost; it must be strictly greater than 2 * (latency + 1) * interval (ignoring subrating).
— Connection subrating keeps a short base interval but uses only a fraction of events, with continuation events allowing dense activity when needed.
— Pairing generates keys for encryption; bonding saves those keys for future reconnections. Connection, pairing, and bonding are separate processes.
— A link-layer acknowledgment does not mean the peer application successfully executed the operation.
— Reconnection is a new connection; automatic reconnection is a configured process, not a radio behavior.
— After connecting, an app must discover services, check security, and configure notifications before data flows.
Conclusions

The common mental model of Bluetooth pairing conflates connection, pairing, and bonding; this guide separates them cleanly, which is exactly where many Android and Flutter bugs originate.

The distinction between legacy connectable advertising and extended advertising is not just a spec detail; it changes the protocol state machine, and apps that assume a confirmation packet after CONNECT_IND will misread the sequence.

Connection subrating solves a real tradeoff: instead of choosing between a slow idle interval and a fast one, a device can keep a fast base schedule and simply skip events, which is more responsive when burst data arrives.

The supervision timeout formula is a practical constraint that most developers never reason about until they see intermittent disconnects; knowing the math helps set parameters that do not contradict the link layer.

Concepts & terms
LE ACL connection
Asynchronous Connection-Less (ACL) is the Bluetooth LE transport for regular bidirectional data, used for reading status and writing settings, as opposed to isochronous audio streams.
GAP roles
Generic Access Profile defines four roles: Broadcaster, Observer, Peripheral, and Central. They describe how a device participates in discovery and connection, not its performance tier.
Connection event
A scheduled round of send/receive on a data channel within a connection. Multiple packets can be exchanged in one event, and the channel may change between events.
Connection interval
The time between the start of adjacent connection events. A shorter interval offers denser communication opportunities but increases power consumption.
Peripheral latency
The maximum number of consecutive connection events a Peripheral can skip listening to. It allows power saving but adds delay for incoming data.
Connection supervision timeout
The time threshold after which the link layer declares a connection lost if no valid packet is received from the peer.
Connection subrating
An optional mechanism that keeps the base connection interval but uses only a subset of events, with continuation events for bursty data, reducing idle radio activity.
Pairing vs bonding
Pairing negotiates security and generates encryption keys; bonding saves those keys and device identity for future reconnections, so the device does not have to pair again.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗