FetchStateManager class

Manages the state of measurement fetch operations for a single device.

Tracks received bytes, accumulates data, and emits progress events. Data processing (block extraction, CRC validation) is handled by the datasource. Fetch completion is detected when an empty array is received per BLE spec.

Inheritance

Constructors

FetchStateManager({required String deviceId})

Properties

currentProgress FetchProgress
Current progress state (last emitted).
no setterinherited
deviceId String
finalinherited
hashCode int
The hash code for this object.
no setterinherited
idleState FetchProgress
Returns the idle state for this operation type.
no setteroverride
isActive bool
Whether an operation is currently active.
getter/setter pairinherited
isFetching bool
Whether a fetch is currently active.
no setter
progressStream Stream<FetchProgress>
Stream of progress events.
no setterinherited
receivedBytes int
Bytes received so far.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

completeFetchWithData({required Uint8List data, required bool crcValid}) → void
Manually complete the fetch with processed data.
dispose() → void
Disposes the manager and closes the stream.
inherited
emitProgress(FetchProgress progress) → void
Emits a progress event to subscribers.
inherited
failFetch(String message, [int? code]) → void
Marks the fetch as failed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDataReceived(List<int> data) → void
Called when data is received from the download characteristic.
reset() → void
Resets the fetch state to idle.
override
startFetch() → void
Prepares the manager for a new fetch operation.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited