CustomDevice
Runs a device registered with defineCustomDevice.
Everything specific to the device is data: the services and characteristics it exposes, how a complete frame is recognised, which frame carries which reading, and how each byte range becomes a number. What is left here is the safety net - a reading is reported only when every property the declaration named decoded to a finite number inside the range the catalog accepts. Anything else is reported through onError and no measurement is emitted.
Kind: Class
Package: @ovok/native
Import
import { CustomDevice } from '@ovok/native/bt-management';
TypeScript signatures
(device: Device, params: CreateDeviceParams<CustomDeviceId>, definition: CustomDeviceDefinition): CustomDevice
| Parameter | Type | Details |
|---|---|---|
device | Device | — |
params | CreateDeviceParams<CustomDeviceId> | — |
definition | CustomDeviceDefinition | — |
Returns: CustomDevice.
Public members
| Member | Type | Details |
|---|---|---|
id | string | — |
deviceData | DeviceData | — |
onError | (error: BleError | Error | string) => void | Optional. — |
onDeviceStatusChanged | (status: DeviceStatus, measurementTypeKey?: MeasurementTypeKey) => void | Optional. — |
onResult | (data: MeasurementWithCaseType<MeasurementTypeForDevices<[ T ]>>) => void | Optional. — |
onDeviceDisconnected | () => void | Optional. — |
onConnectionEvent | (data: DeviceConnectionEvent) => void | Optional. — |
device | Device | — |
destroy | (): void | — |
disconnect | (): Promise<void> | Stops this device's subscriptions and closes its BLE connection. |
connect | (): Promise<void> | — |
Learn the workflow
Continue with Bluetooth for the workflow context and examples.