CommandSequencer
Decides what to send a device, and when.
These protocols are self-clocking: the device answers a request, and the answer is what says which request comes next. A file read walks its offsets that way, and an identity check gates everything after it on the reply to the first command. Neither can be expressed by re-sending one fixed frame, which is all the SDK could do before.
At most one command is outstanding at a time. The transport serialises writes, so an implementation may assume the frame it is answering is the reply to the command it last returned.
Kind: Interface
Package: @ovok/native
Import
import { CommandSequencer } from '@ovok/native/bt-management';
TypeScript shape
interface CommandSequencer {
initialCommands(): readonly DeviceCommand[];
nextCommand(frame: readonly string[]): readonly DeviceCommand[] | undefined;
commandTimeoutMs?(): number | undefined;
onCommandTimeout?(): CommandTimeoutResult;
commandProgress?(frame: readonly string[]): "ignored" | "partial" | "complete";
isNormalDisconnect?(): boolean;
isHistoryTransfer?(): boolean;
}
This is a type-level export; it has no call parameters.
Public members
| Member | Type | Details |
|---|---|---|
initialCommands | (): readonly DeviceCommand[] | Sent once every characteristic is subscribed. Empty starts a device that only listens. |
nextCommand | (frame: readonly string[]): readonly DeviceCommand[] | undefined | Answers one complete frame. Returning undefined sends nothing, which is how a sequencer waits: an unidentified device is left alone rather than addressed with an opcode that may mean something else on the hardware actually present. |
commandTimeoutMs | number | undefined | Optional. The response timeout for the currently outstanding command, when a protocol needs one. |
onCommandTimeout | CommandTimeoutResult | Optional. Re-sends the current command or ends the exchange after a response timeout. |
commandProgress | "ignored" | "partial" | "complete" | Optional. Describes whether a frame is ignored, partial, or completes the outstanding command. |
isNormalDisconnect | boolean | Optional. True when a timeout-style disconnect is the device's normal completion signal. |
isHistoryTransfer | boolean | Optional. True when accepted results are records downloaded from device history. |
Learn the workflow
Continue with Bluetooth for the workflow context and examples.