onConnectionEvent
Use onConnectionEvent for connection details that do not fit the compact DeviceStatus enum.
<BTProvider
{...providerProps}
onConnectionEvent={(event) => {
if (event.kind === "history-download") {
updateHistoryProgress(event.progress?.current, event.progress?.total);
}
if (event.kind === "battery") {
updateBattery(event.batteryLevel);
}
}}
/>
kind is pairing, bonded, history-download, or battery.
| Field | Meaning |
|---|---|
deviceData | The peripheral associated with the event. |
pairingCodeRequired | Present on pairing events when the platform expects user confirmation or a code. |
progress.current | Number of history items reported so far. |
progress.total | Optional total from the device protocol. Do not calculate a percentage when it is absent. |
batteryLevel | Battery percentage when the device exposes the standard Battery Service. |
The callback runs alongside the SDK runtime event stream used by PairingFlow and Bluetooth hooks. Do not interpret a bonded event as a completed health measurement; readings arrive through onResult.
See PairingFlow for a reusable pairing UI.