Skip to main content

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
ParameterTypeDetails
deviceDevice—
paramsCreateDeviceParams<CustomDeviceId>—
definitionCustomDeviceDefinition—

Returns: CustomDevice.

Public members​

MemberTypeDetails
idstring—
deviceDataDeviceData—
onError(error: BleError | Error | string) => voidOptional. —
onDeviceStatusChanged(status: DeviceStatus, measurementTypeKey?: MeasurementTypeKey) => voidOptional. —
onResult(data: MeasurementWithCaseType<MeasurementTypeForDevices<[ T ]>>) => voidOptional. —
onDeviceDisconnected() => voidOptional. —
onConnectionEvent(data: DeviceConnectionEvent) => voidOptional. —
deviceDevice—
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.

Source​

View the declaration in the SDK source.