In development. It changes without notice.
Topic
BLE Connection Management
The state of the link as one coherent snapshot, and the parameters of a connection and of advertising.
kleidos::
- See also
- BLE Stack Integration
Files | |
| file | src/ |
| The CCCD changes a host makes, carried from the host task to the snapshot. | |
| file | src/ |
| BLE connection and advertising timing, and the limits a central may negotiate. | |
| file | src/ |
| Thread-safe snapshot of the active BLE link state. | |
Classes | |
| struct | kleidos:: |
| One CCCD change, as the host task saw it. More about kleidos:: | |
| class | kleidos:: |
| A first-in, first-out ring of CCCD changes; the caller holds the lock. More about kleidos:: | |
| struct | kleidos:: |
| A connection-parameter tuple in native GAP units (mirrors ble_ | |
| struct | kleidos:: |
| The timing a live link runs at: one interval, not a requested range. More about kleidos:: | |
| struct | kleidos:: |
| Coherent point-in-time view of the active link. More about kleidos:: | |
| class | kleidos:: |
| Static owner of the live connection snapshot. More about kleidos:: | |
Enumerations | |
| enum class | kleidos:: |
| Outcome of evaluating a central-requested parameter set against the policy. More about kleidos:: | |
| enum class | kleidos:: |
| What the peripheral does with a secured link's timing after an update. More about kleidos:: | |
Functions | |
| constexpr bool | kleidos:: |
| Spec coupling check: timeout must outlast (1+latency) connection events. | |
| constexpr ConnParamSet | kleidos:: |
| Clamp a central-requested parameter set into the accept window. | |
| constexpr ConnParamPolicy | kleidos:: |
| Evaluate a central-requested parameter set against the policy. | |
| constexpr bool | kleidos:: |
| Whether the live link runs inside the accept window. | |
| constexpr bool | kleidos:: |
| Whether no keystroke goes out on a link at this timing. | |
| constexpr bool | kleidos:: |
| Whether a link still at this timing after every request is ended. | |
| constexpr LinkTimingStep | kleidos:: |
| Judge a secured link's live timing after an update (or a refused request). | |
Variables | |
| constexpr uint8_t | kleidos:: |
| CCCD bit: input-report notify. | |
| constexpr uint8_t | kleidos:: |
| CCCD bit: boot keyboard input. | |
| constexpr uint8_t | kleidos:: |
| CCCD bit: battery level. | |
| constexpr std::size_t | kleidos:: |
| How many changes the mailbox holds before the oldest gives way. | |
| constexpr uint16_t | kleidos:: |
| Fast adv min, 30 ms (0.625 ms units). | |
| constexpr uint16_t | kleidos:: |
| Fast adv max, 60 ms (0.625 ms units). | |
| constexpr uint16_t | kleidos:: |
| Slow adv, 1 s (0.625 ms units). | |
| constexpr uint16_t | kleidos:: |
| 15 ms (1.25 ms units). | |
| constexpr uint16_t | kleidos:: |
| 30 ms (1.25 ms units). | |
| constexpr uint16_t | kleidos:: |
| No slave latency while typing. | |
| constexpr uint16_t | kleidos:: |
| 4000 ms (10 ms units). | |
| constexpr uint16_t | kleidos:: |
| 7.5 ms floor (1.25 ms units). | |
| constexpr uint16_t | kleidos:: |
| 75 ms ceiling (1.25 ms units). | |
| constexpr uint16_t | kleidos:: |
| Max accepted slave latency (events). | |
| constexpr uint16_t | kleidos:: |
| 1000 ms floor (10 ms units). | |
| constexpr uint16_t | kleidos:: |
| 6000 ms ceiling (10 ms units). | |
| constexpr ConnParamSet | kleidos:: |
| The HID-grade parameter set the peripheral actively requests after connect. | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Sentinel: no bonded slot. | |
| constexpr uint16_t | kleidos:: |
| ATT default MTU. | |
Enumeration Type Documentation
ConnParamPolicy #
LinkTimingStep #
What the peripheral does with a secured link's timing after an update.
Function Documentation
clampToPolicy() #
Clamp a central-requested parameter set into the accept window.
Used when evaluateConnParamPolicy returns Renegotiate: the returned tuple is the nearest in-policy counter-offer (intervals clamped into the accept window, latency capped, timeout clamped and then raised if needed to satisfy timeoutCoversLatency).
- Parameters
-
Name Direction Meaning req in Central-requested parameters (native GAP units).
- Returns
- An in-policy parameter set closest to
req.
evaluateConnParamPolicy() #
Evaluate a central-requested parameter set against the policy.
Decision rules:
Reject— the request is so far out of policy (e.g. an interval shorter than the spec floor or longer than the typing ceiling) that clamping would change the central's intent unrecognizably; refuse the update outright.Renegotiate— out of policy but safely clamp-able (e.g. a large latency or an over-long timeout); the caller counters withclampToPolicy.Accept— fully inside the accept window and spec-coupling-valid.
Pure logic with no NimBLE dependency so the policy can be unit-tested on host.
- Parameters
-
Name Direction Meaning req in Central-requested parameters (native GAP units).
- Returns
- The policy decision for
req.
linkTimingStep() #
Judge a secured link's live timing after an update (or a refused request).
- Parameters
-
Name Direction Meaning live in The timing the link runs at now. requestsMade in Preferred-window requests made on this link so far.
- Returns
- The step to take.
liveParamsBlockTyping() #
Whether no keystroke goes out on a link at this timing.
Only the slow side: an interval above the typing ceiling, or a supervision timeout above the policy's, at which a keystroke crawls out and a host that vanished mid-burst goes unnoticed for seconds with a key pressed. A short timeout is no reason to hold a keystroke: real hosts connect with one (720 ms is common) and move to the preferred window once asked.
- Parameters
-
Name Direction Meaning live in The timing the link runs at.
- Return values
-
Value Meaning true Refuse the keystroke. false It may go out.
liveParamsEndLink() #
Whether a link still at this timing after every request is ended.
Only a link no keystroke may go out on (liveParamsBlockTyping): it is of no use to the owner and holds the device's one link. Every other timing out of policy keeps the link, and it is logged: a supervision timeout below the policy's floor (a host that keeps its 720 ms one, or refuses every request) types promptly, and a latency or a coupling out of policy alone does too. Ending such a link would cut the owner off from that host at every connection.
- Parameters
-
Name Direction Meaning live in The timing the link runs at.
- Return values
-
Value Meaning true End the link. false Keep it.
liveParamsInPolicy() #
Whether the live link runs inside the accept window.
- Parameters
-
Name Direction Meaning live in The timing the link runs at.
- Return values
-
Value Meaning true The interval, latency, timeout and their coupling are in policy. false Something is out of policy.
timeoutCoversLatency() #
Spec coupling check: timeout must outlast (1+latency) connection events.
Per the Bluetooth Core spec the supervision timeout (in ms) must be strictly greater than (1 + latency) * intervalMax (ms) * 2. A central can otherwise pair a long latency with a short timeout to force spurious disconnects.
- Parameters
-
Name Direction Meaning intervalMaxUnits in Max connection interval (1.25 ms units). latency in Slave latency (skipped events). timeoutUnits in Supervision timeout (10 ms units).
- Return values
-
Value Meaning true The timeout safely covers the configured latency window. false The (interval, latency, timeout) triple violates the coupling.
Variable Documentation
kPreferredParamsMaxRequests #
How many times the peripheral asks a central for kPreferredParams on one link: once after its encryption, and again after each update that leaves the link out of policy, up to this count.