FirmwareUpdateResult
FirmwareUpdateResult = {
status:"idle";start:Promise<void>; } | {phase:FirmwareUpdatePhase;progress:number;status:"updating";cancel:void; } | {installed:FirmwareVersions;status:"done";reset:void; } | {status:"cancelled";reset:void; } | {error:FirmwareError;status:"error";reset:void;retry:Promise<void>; }
Defined in: console-sdk/src/firmware/types.ts:193
The firmware update machine as a discriminated union with
variant-embedded actions (SDK_PLAN.md §3.6.7). useFirmwareUpdate
returns exactly one variant; each exposes only the actions legal in its
state, so the type system forbids illegal calls:
'idle'— no update running.start()begins one (it rejects if no update is available or the device/provider is busy —'command/busy'). There is nocancelto call.'updating'— in progress.phaselabels the leg,progressis a weighted0..1fraction, andcancel()requests an orderly stop. Cancellation is not an error — it drives the machine to'cancelled'.'done'— finished;installedreports the new versions.reset()returns the machine to'idle'.'cancelled'— the user cancelled. Distinct from'error'by type (never a FirmwareError).reset()returns to'idle'so the UI can offer “resume”.'error'— the update failed with a typed FirmwareError.retry()starts a fresh attempt;reset()returns to'idle'.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ status: "idle"; start: Promise<void>; }
status
Section titled “status”status:
"idle"
No update is running.
start()
Section titled “start()”start():
Promise<void>
Begins the update. Rejects with a FirmwareError /
CommandError('command/busy') if no update is available or the
BLE bus is occupied by another update or a workout.
Returns
Section titled “Returns”Promise<void>
Type Literal
Section titled “Type Literal”{ phase: FirmwareUpdatePhase; progress: number; status: "updating"; cancel: void; }
phase:
FirmwareUpdatePhase
Which leg of the update is currently running.
progress
Section titled “progress”progress:
number
Weighted completion fraction across all phases, 0..1.
status
Section titled “status”status:
"updating"
An update is in progress.
cancel()
Section titled “cancel()”cancel():
void
Requests an orderly cancel. Drives the machine to 'cancelled' —
cancellation is a variant, never a rejected promise or an error.
Returns
Section titled “Returns”void
Type Literal
Section titled “Type Literal”{ installed: FirmwareVersions; status: "done"; reset: void; }
installed
Section titled “installed”installed:
FirmwareVersions
The versions now installed on the device.
status
Section titled “status”status:
"done"
The update completed successfully.
reset()
Section titled “reset()”reset():
void
Returns the machine to 'idle'.
Returns
Section titled “Returns”void
Type Literal
Section titled “Type Literal”{ status: "cancelled"; reset: void; }
status
Section titled “status”status:
"cancelled"
The user cancelled the update (distinct from failure by type).
reset()
Section titled “reset()”reset():
void
Returns the machine to 'idle' (the UI can offer “resume”).
Returns
Section titled “Returns”void
Type Literal
Section titled “Type Literal”{ error: FirmwareError; status: "error"; reset: void; retry: Promise<void>; }
error:
FirmwareError
The typed failure.
status
Section titled “status”status:
"error"
The update failed.
reset()
Section titled “reset()”reset():
void
Returns the machine to 'idle'.
Returns
Section titled “Returns”void
retry()
Section titled “retry()”retry():
Promise<void>
Starts a fresh update attempt.
Returns
Section titled “Returns”Promise<void>