feat: add tag picker in sensor calibration flow
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
enum CalibrationPhase { idle, ready, collecting, done, error }
|
||||
enum CalibrationPhase { idle, selectingTag, ready, collecting, done, error }
|
||||
|
||||
const calibrationDistances = [0.5, 1.0, 2.0, 3.0];
|
||||
|
||||
@@ -14,6 +14,8 @@ class CalibrationState {
|
||||
this.avgRssi,
|
||||
this.resultRssiRef,
|
||||
this.resultPathLossExp,
|
||||
this.tagRssiReadings = const {},
|
||||
this.selectedTagId,
|
||||
this.error,
|
||||
});
|
||||
|
||||
@@ -28,6 +30,10 @@ class CalibrationState {
|
||||
final double? avgRssi;
|
||||
final double? resultRssiRef;
|
||||
final double? resultPathLossExp;
|
||||
/// Latest scan RSSI per tag device ID, updated during selectingTag phase.
|
||||
final Map<String, double> tagRssiReadings;
|
||||
/// The tag device ID committed for this calibration session.
|
||||
final String? selectedTagId;
|
||||
final String? error;
|
||||
|
||||
bool get canFinish =>
|
||||
@@ -47,10 +53,14 @@ class CalibrationState {
|
||||
double? avgRssi,
|
||||
double? resultRssiRef,
|
||||
double? resultPathLossExp,
|
||||
Map<String, double>? tagRssiReadings,
|
||||
String? selectedTagId,
|
||||
String? error,
|
||||
bool clearSelectedDistance = false,
|
||||
bool clearLatestRssi = false,
|
||||
bool clearAvgRssi = false,
|
||||
bool clearTagRssiReadings = false,
|
||||
bool clearSelectedTagId = false,
|
||||
bool clearError = false,
|
||||
}) =>
|
||||
CalibrationState(
|
||||
@@ -66,6 +76,11 @@ class CalibrationState {
|
||||
avgRssi: clearAvgRssi ? null : avgRssi ?? this.avgRssi,
|
||||
resultRssiRef: resultRssiRef ?? this.resultRssiRef,
|
||||
resultPathLossExp: resultPathLossExp ?? this.resultPathLossExp,
|
||||
tagRssiReadings: clearTagRssiReadings
|
||||
? const {}
|
||||
: tagRssiReadings ?? this.tagRssiReadings,
|
||||
selectedTagId:
|
||||
clearSelectedTagId ? null : selectedTagId ?? this.selectedTagId,
|
||||
error: clearError ? null : error ?? this.error,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user