useDeviceScan
useDeviceScan(
options?):ScanResult
Defined in: console-sdk/src/react/hooks/useDeviceScan.ts:63
Declaratively scan for devices while this hook is mounted (SDK_PLAN.md
§3.6.2). Scanning is refcounted across every mounted useDeviceScan:
the engine starts the transport scan for the first retainer (subject to the
Bluetooth adapter being on and the auto-scan cooldown) and stops it when the
last one releases. Results surface as useDevices presence, not here —
this hook returns only scan status.
options.enabled is declarative: true (default) retains the scan while
mounted; false makes the hook inert (no retain), so toggling it from a
focus/visibility flag starts and stops scanning without any imperative call.
Safe from the first render ({ isScanning: false, error: null } before any
commit — §3.9.1). Throws OutsideProviderError when no <ConsoleProvider>
is above the caller.
Parameters
Section titled “Parameters”options?
Section titled “options?”{ enabled } to gate the scan declaratively; models is
accepted for forward-compatibility (the engine currently scans all Rogue
models).
Returns
Section titled “Returns”the reactive ScanResult: { isScanning, error }.
Example
Section titled “Example”const isFocused = useIsFocused();const { isScanning } = useDeviceScan({ enabled: isFocused });