Skip to main content

CustomFieldSpec

One measurement property read out of a frame at fixed byte offsets.

The property name and unit are checked at registration against the measurement catalog for the case's measurementTypeKey. A name the SDK does not know, or a unit that is not the canonical one, is rejected - it would otherwise produce a measurement the backend silently drops, or a number in the wrong unit.

Kind: Interface
Package: @ovok/native

Import​

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

TypeScript shape​

interface CustomFieldSpec {
name: string;
byteIndexes: number[];
byteOrder?: CustomByteOrder;
encoding?: CustomFieldEncoding;
scale?: number;
offset?: number;
decimals?: number;
unit: string;
min?: number;
max?: number;
}

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

Public members​

MemberTypeDetails
namestringProperty on the emitted measurement, e.g. "systolic". Must exist for the case's type.
byteIndexesnumber[]Byte offsets into the frame, in the order the device puts them on the wire.
byteOrderCustomByteOrderOptional. Defaults to "big". Use "little" when the least significant byte comes first.
encodingCustomFieldEncodingOptional. Defaults to "uint".
scalenumberOptional. Multiplied onto the raw value. Defaults to 1. Use it for unit and resolution conversion.
offsetnumberOptional. Added after scale. Defaults to 0.
decimalsnumberOptional. Round the result to this many decimals. 0-6.
unitstringCanonical unit for name. Declaring any other unit fails registration.
minnumberOptional. Narrower accepted range than the catalog default. Must sit inside it.
maxnumberOptional. Narrower accepted range than the catalog default. Must sit inside it.

Learn the workflow​

Continue with Bluetooth for the workflow context and examples.

Source​

View the declaration in the SDK source.