Skip to main content

Bluetooth types

Import public Bluetooth types from @ovok/native/bt-management unless noted otherwise. The accepted-device tuple is the source of compile-time narrowing for callbacks such as onResult and onDeviceFound.

Device and session types​

TypeUse
AcceptedDeviceA built-in IntegratedDevices value or a branded CustomDeviceDefinition.
IntegratedDevicesEnum of the integrated device identifiers.
DeviceKey / DeviceKeyOf<T>Device key union and key derived from an accepted-device tuple.
DeviceDataPeripheral ID, name, local name, manufacturer data, optional manufacturer/model, serial, and supported measurement types.
DeviceStatusCompact status values: connected, disconnected, measuring, and low battery.
BTProviderProps<T>Provider options and callbacks for a particular accepted-device tuple.

Event and result types​

TypeUse
ResultCallback<T>Device metadata, normalized reading, and stable enumerable result ID (the runtime property is non-writable).
DeviceStatusChangeCallbackDevice metadata, status, and optional measurement key.
DeviceConnectionEventPairing, bonding, battery, and history-download events.
ErrorCallback / BluetoothErrorNormalized error details and optional stable error code.
DeviceResultPolicy / ResultPolicyResult filtering defaults and per-measurement overrides.

The runtime result.id is enumerable and non-writable, so it is retained by object spreads and JSON serialization. Its TypeScript field is typed as string; treat it as an identifier and do not reassign it. Use it as an explicit idempotency key for retried writes. The event and callback pages document when each payload is delivered.

Background and custom declaration types​

  • BackgroundSyncOptions, BackgroundSyncResult, and BackgroundSyncStorage describe queued delivery, persistence, retries, restoration, notifications, and Android foreground service configuration. See Background sync.
  • CustomDeviceSpec and CustomDeviceDefinition describe the input declaration and its validated runtime result.
  • CustomServiceSpec, CustomMonitorSpec, CustomFrameSpec, CustomCaseSpec, CustomFieldSpec, and CustomChecksumSpec describe GATT, framing, measurement fields, and checksums.
  • CustomMeasurementSpec supports multiple measurements in a frame; CustomLepuSpec describes the specialized Lepu/Viatom framing.
  • DeviceConnectionEventKind, DeviceStatus, and the callback payload types define the app-facing event surface.

For an end-to-end setup, see Bluetooth, BTProvider, and custom devices.