Skip to main content

CustomDeviceDefinition

A validated, ready-to-run custom device. Only defineCustomDevice produces one.

Kind: Interface
Package: @ovok/native

Import​

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

TypeScript shape​

interface CustomDeviceDefinition {
readonly [CUSTOM_DEVICE_BRAND]: true;
readonly id: CustomDeviceId;
readonly spec: CustomDeviceSpec;
readonly nameMatch: RegExp;
readonly matchByService: boolean;
readonly oneReadingPerConnection: boolean;
readonly sessionPolicy?: CustomSessionPolicy;
readonly clockSync: ClockSyncCapability;
readonly reportsBondedEvent?: boolean;
readonly mainServices: IService[];
readonly stuckDataTimeout: number;
readonly fields: ReadonlyMap<string, CompiledCustomField>;
readonly frames: ReadonlyMap<string, CustomFrameSpec>;
readonly frameReader?: FrameReader;
readonly preferredMtu?: number;
readonly lepu?: CustomLepuSpec;
readonly tmb?: CustomTmbSpec;
readonly decorateReading?: CustomReadingDecorator;
readonly createFrameHandler?: CustomFrameHandlerFactory;
}

This is a type-level export; it has no call parameters.

Public members​

MemberTypeDetails
idCustomDeviceId—
specCustomDeviceSpec—
nameMatchRegExp—
matchByServiceboolean—
oneReadingPerConnectionboolean—
sessionPolicyCustomSessionPolicyOptional. —
clockSyncClockSyncCapability—
reportsBondedEventbooleanOptional. Emit the bonded connection event after a successful connection.
mainServicesIService[]—
stuckDataTimeoutnumber—
fieldsReadonlyMap<string, CompiledCustomField>Keyed by $&#123;measurementTypeKey&#125;:$&#123;fieldName&#125;, used to bounds-check every reading.
framesReadonlyMap<string, CustomFrameSpec>Frame declaration of every monitor characteristic, keyed by its 128-bit UUID.
frameReaderFrameReaderOptional. Optional protocol frame reader for declarations whose notifications may be batched.
preferredMtunumberOptional. MTU to request once connected, when the declaration asked for one.
lepuCustomLepuSpecOptional. Validated Lepu protocol declaration, with its UUIDs normalised.
tmbCustomTmbSpecOptional. Validated TMB protocol declaration, with its UUIDs normalised.
decorateReadingCustomReadingDecoratorOptional. Adds protocol metadata that is not a numeric measurement field.
createFrameHandlerCustomFrameHandlerFactoryOptional. Creates per-device state for frames that need a protocol-specific decoder.
__@CUSTOM_DEVICE_BRAND@2054true—

Learn the workflow​

Continue with Bluetooth for the workflow context and examples.

Source​

View the declaration in the SDK source.