Skip to main content

BTManager

No behavioral description is attached to this declaration. The public signature, parameter and return types, and source location below document its published contract.

Kind: Class
Package: @ovok/native

Import​

import { BTManager } from '@ovok/native/bt-management';

TypeScript signatures​

<T extends readonly AcceptedDevice[]>(bleManager: BleManager, acceptedDevices: T, options?: BTManagerOptions): BTManager<T>
ParameterTypeDetails
bleManagerBleManager—
acceptedDevicesT—
optionsBTManagerOptions—

Returns: BTManager<T>.

Public members​

MemberTypeDetails
setAutoConnect(enabledOrOptions: boolean | { enabled: boolean; delayMs?: number; onDeviceSelectionRequired?: BTManagerOptions["onDeviceSelectionRequired"]; }, delayMs?: number, onDeviceSelectionRequired?: BTManagerOptions["onDeviceSelectionRequired"]): void—
destroy(): void—
startScan(): void—
setBackgroundScanEnabled(enabled: boolean): voidSwitches only the scan policy; the app can keep a foreground scan broad.
stopScan(): void—
pauseScan(): voidPauses discovery without tearing down devices or their callbacks. Use this when an app temporarily stops scanning, for example while it is in the background but an already-connected device may still deliver a measurement.
resumeScan(): voidResumes discovery without clearing devices or callbacks. Restarting unconditionally also recovers when an app stopped the underlying BLE scan directly while BTManager still believed it was active.
restoreDevices(devices: readonly Device[]): void—
disconnectDevice(deviceId: string): Promise<void>Disconnects one device so it can be rediscovered by a later advertisement.
forget(deviceId: string): Promise<void>Disconnects one device and ignores later advertisements for this manager's lifetime.
onDeviceFound(callback?: (device: BTManagedDevice<DeviceKeyOf<T>>, manager: BTManager<T>) => Promise<void>): void—
onError(callback?: (data: ErrorCallback) => void): void—
onDeviceStatusChanged(callback?: (data: DeviceStatusChangeCallback) => void): void—
onConnectionEvent(callback?: (data: DeviceConnectionEvent) => void): void—
onResult(callback?: (data: ResultCallback<DeviceKeyOf<T>>) => void): void—

Learn the workflow​

Continue with Bluetooth for the workflow context and examples.

Source​

View the declaration in the SDK source.