VtjCommand<TResult> class
abstract
Base class for all VTJ device commands.
Subclasses must implement commandId, buildRequest, and parseResponse. The execute method provides a default implementation that handles:
- Stream subscription setup
- Command ID filtering
- Timeout handling
- Error handling
Override validate for pre-execution validation. Override timeout to customize the command timeout duration.
- Implementers
Constructors
Properties
- commandId → int
-
The unique command identifier byte.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- requiresAuth → bool
-
Whether this command requires prior authentication.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout → Duration
-
Command timeout duration. Override to customize.
no setter
Methods
-
buildRequest(
) → Uint8List - Build the request bytes to send to the device.
-
execute(
BluetoothCharacteristic writeCharacteristic, BluetoothCharacteristic replyCharacteristic) → Future< VtjCommandResult< TResult> > - Execute the command on the device.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseResponse(
Uint8List response) → VtjCommandResult< TResult> - Parse the response bytes from the device.
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
) → VtjCommandResult< TResult> ? - Optional pre-execution validation hook. Return a failure result to abort execution, or null to proceed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited