mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Refactor CPS functions to implement operational value generation with min, max, and step parameters.
This commit is contained in:
@ -93,7 +93,6 @@ final class CpsSensitivityFunction extends CpsFunctions {
|
|||||||
}) : min = 1,
|
}) : min = 1,
|
||||||
max = 10,
|
max = 10,
|
||||||
step = 1,
|
step = 1,
|
||||||
scale = 0,
|
|
||||||
super(
|
super(
|
||||||
code: 'sensitivity'.correct,
|
code: 'sensitivity'.correct,
|
||||||
operationName: 'Sensitivity',
|
operationName: 'Sensitivity',
|
||||||
@ -103,7 +102,6 @@ final class CpsSensitivityFunction extends CpsFunctions {
|
|||||||
final int min;
|
final int min;
|
||||||
final int max;
|
final int max;
|
||||||
final int step;
|
final int step;
|
||||||
final int scale;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
@ -126,14 +124,29 @@ final class CpsMovingSpeedFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0,
|
||||||
|
max = 32,
|
||||||
|
step = 1,
|
||||||
|
super(
|
||||||
code: 'moving_speed',
|
code: 'moving_speed',
|
||||||
operationName: 'Moving Speed',
|
operationName: 'Moving Speed',
|
||||||
icon: Assets.speedoMeter,
|
icon: Assets.speedoMeter,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final int min;
|
||||||
|
final int max;
|
||||||
|
final int step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
return [];
|
return List.generate(
|
||||||
|
(max - min) ~/ step + 1,
|
||||||
|
(index) => CpsOperationalValue(
|
||||||
|
icon: Assets.speedoMeter,
|
||||||
|
description: '${min + (index * step)}',
|
||||||
|
value: min + (index * step),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,15 +155,29 @@ final class CpsSpatialStaticValueFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0,
|
||||||
|
max = 255,
|
||||||
|
step = 1,
|
||||||
|
super(
|
||||||
code: 'space_static_val'.correct,
|
code: 'space_static_val'.correct,
|
||||||
operationName: 'Spacial Static Value',
|
operationName: 'Spacial Static Value',
|
||||||
icon: Assets.spatialStaticValue,
|
icon: Assets.spatialStaticValue,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final int min;
|
||||||
|
final int max;
|
||||||
|
final int step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
return List.generate(
|
||||||
throw UnimplementedError();
|
(max - min) ~/ step + 1,
|
||||||
|
(index) => CpsOperationalValue(
|
||||||
|
icon: Assets.spatialStaticValue,
|
||||||
|
description: '${min + (index * step)}',
|
||||||
|
value: min + (index * step),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,15 +186,29 @@ final class CpsSpatialMotionValueFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0,
|
||||||
|
max = 255,
|
||||||
|
step = 1,
|
||||||
|
super(
|
||||||
code: 'space_move_val'.correct,
|
code: 'space_move_val'.correct,
|
||||||
operationName: 'Spatial Motion Value',
|
operationName: 'Spatial Motion Value',
|
||||||
icon: Assets.spatialMotionValue,
|
icon: Assets.spatialMotionValue,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final int min;
|
||||||
|
final int max;
|
||||||
|
final int step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
return List.generate(
|
||||||
throw UnimplementedError();
|
(max - min) ~/ step + 1,
|
||||||
|
(index) => CpsOperationalValue(
|
||||||
|
icon: Assets.spatialMotionValue,
|
||||||
|
description: '${min + (index * step)}',
|
||||||
|
value: min + (index * step),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,15 +217,33 @@ final class CpsMaxDistanceOfDetectionFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.0,
|
||||||
|
max = 10.0,
|
||||||
|
step = 0.5,
|
||||||
|
super(
|
||||||
code: 'moving_max_dis'.correct,
|
code: 'moving_max_dis'.correct,
|
||||||
operationName: 'Maximum Distance Of Detection',
|
operationName: 'Maximum Distance Of Detection',
|
||||||
icon: Assets.currentDistanceIcon,
|
icon: Assets.currentDistanceIcon,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.currentDistanceIcon,
|
||||||
|
description: '${value.toStringAsFixed(1)}M',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,15 +252,33 @@ final class CpsMaxDistanceOfStaticDetectionFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.0,
|
||||||
|
max = 10.0,
|
||||||
|
step = 0.5,
|
||||||
|
super(
|
||||||
code: 'static_max_dis'.correct,
|
code: 'static_max_dis'.correct,
|
||||||
operationName: 'Maximum Distance Of Static Detection',
|
operationName: 'Maximum Distance Of Static Detection',
|
||||||
icon: Assets.currentDistanceIcon,
|
icon: Assets.currentDistanceIcon,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.currentDistanceIcon,
|
||||||
|
description: '${value.toStringAsFixed(1)}M',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,15 +287,33 @@ final class CpsDetectionRangeFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.0,
|
||||||
|
max = 25.5,
|
||||||
|
step = 0.1,
|
||||||
|
super(
|
||||||
code: 'moving_range'.correct,
|
code: 'moving_range'.correct,
|
||||||
operationName: 'Detection Range',
|
operationName: 'Detection Range',
|
||||||
icon: Assets.farDetection,
|
icon: Assets.farDetection,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.farDetection,
|
||||||
|
description: '${value.toStringAsFixed(1)}M',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,15 +322,33 @@ final class CpsDistanceOfMovingObjectsFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.0,
|
||||||
|
max = 25.5,
|
||||||
|
step = 0.1,
|
||||||
|
super(
|
||||||
code: 'presence_range'.correct,
|
code: 'presence_range'.correct,
|
||||||
operationName: 'Distance Of Moving Objects',
|
operationName: 'Distance Of Moving Objects',
|
||||||
icon: Assets.currentDistanceIcon,
|
icon: Assets.currentDistanceIcon,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.currentDistanceIcon,
|
||||||
|
description: '${value.toStringAsFixed(1)}M',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,15 +357,29 @@ final class CpsPresenceJudgementThrsholdFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0,
|
||||||
|
max = 255,
|
||||||
|
step = 5,
|
||||||
|
super(
|
||||||
code: 'presence_judgement_threshold'.wrong,
|
code: 'presence_judgement_threshold'.wrong,
|
||||||
operationName: 'Presence Judgement Threshold',
|
operationName: 'Presence Judgement Threshold',
|
||||||
icon: Assets.presenceJudgementThrshold,
|
icon: Assets.presenceJudgementThrshold,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final int min;
|
||||||
|
final int max;
|
||||||
|
final int step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
return List.generate(
|
||||||
throw UnimplementedError();
|
(max - min) ~/ step + 1,
|
||||||
|
(index) => CpsOperationalValue(
|
||||||
|
icon: Assets.presenceJudgementThrshold,
|
||||||
|
description: '${min + (index * step)}',
|
||||||
|
value: min + (index * step),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,15 +388,29 @@ final class CpsMotionAmplitudeTriggerThresholdFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0,
|
||||||
|
max = 255,
|
||||||
|
step = 5,
|
||||||
|
super(
|
||||||
code: 'motion_amplitude_trigger_threshold'.wrong,
|
code: 'motion_amplitude_trigger_threshold'.wrong,
|
||||||
operationName: 'Motion Amplitude Trigger Threshold',
|
operationName: 'Motion Amplitude Trigger Threshold',
|
||||||
icon: Assets.presenceJudgementThrshold,
|
icon: Assets.presenceJudgementThrshold,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final int min;
|
||||||
|
final int max;
|
||||||
|
final int step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
return List.generate(
|
||||||
throw UnimplementedError();
|
(max - min) ~/ step + 1,
|
||||||
|
(index) => CpsOperationalValue(
|
||||||
|
icon: Assets.presenceJudgementThrshold,
|
||||||
|
description: '${min + (index * step)}',
|
||||||
|
value: min + (index * step),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,15 +419,33 @@ final class CpsPerpetualBoundaryFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.00,
|
||||||
|
max = 5.00,
|
||||||
|
step = 0.50,
|
||||||
|
super(
|
||||||
code: 'perceptual_boundary'.correct,
|
code: 'perceptual_boundary'.correct,
|
||||||
operationName: 'Perpetual Boundary',
|
operationName: 'Perpetual Boundary',
|
||||||
icon: Assets.boundary,
|
icon: Assets.boundary,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.boundary,
|
||||||
|
description: '${value.toStringAsFixed(1)}M',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,15 +454,33 @@ final class CpsMotionTriggerBoundaryFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.0,
|
||||||
|
max = 5.0,
|
||||||
|
step = 0.5,
|
||||||
|
super(
|
||||||
code: 'moving_boundary'.correct,
|
code: 'moving_boundary'.correct,
|
||||||
operationName: 'Motion Trigger Boundary',
|
operationName: 'Motion Trigger Boundary',
|
||||||
icon: Assets.motionMeter,
|
icon: Assets.motionMeter,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.motionMeter,
|
||||||
|
description: '${value.toStringAsFixed(1)}M',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,15 +489,33 @@ final class CpsMotionTriggerTimeFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.0,
|
||||||
|
max = 2.0,
|
||||||
|
step = 0.1,
|
||||||
|
super(
|
||||||
code: 'moving_rigger_time'.correct,
|
code: 'moving_rigger_time'.correct,
|
||||||
operationName: 'Motion Trigger Time',
|
operationName: 'Motion Trigger Time',
|
||||||
icon: Assets.motionMeter,
|
icon: Assets.motionMeter,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.motionMeter,
|
||||||
|
description: '${value.toStringAsFixed(3)}sec',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,15 +524,33 @@ final class CpsMotionToStaticTimeFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.0,
|
||||||
|
max = 50.0,
|
||||||
|
step = 1.0,
|
||||||
|
super(
|
||||||
code: 'moving_static_time'.correct,
|
code: 'moving_static_time'.correct,
|
||||||
operationName: 'Motion To Static Time',
|
operationName: 'Motion To Static Time',
|
||||||
icon: Assets.motionMeter,
|
icon: Assets.motionMeter,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.motionMeter,
|
||||||
|
description: '${value.toStringAsFixed(0)}s',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,15 +559,33 @@ final class CpsEnteringNoBodyStateTimeFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 0.0,
|
||||||
|
max = 300.0,
|
||||||
|
step = 5.0,
|
||||||
|
super(
|
||||||
code: 'none_body_time',
|
code: 'none_body_time',
|
||||||
operationName: 'Entering Nobody State Time',
|
operationName: 'Entering Nobody State Time',
|
||||||
icon: Assets.motionMeter,
|
icon: Assets.motionMeter,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.motionMeter,
|
||||||
|
description: '${value.toStringAsFixed(0)}sec',
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,7 +720,7 @@ final class CpsMovementFunctions extends CpsFunctions {
|
|||||||
CpsOperationalValue(
|
CpsOperationalValue(
|
||||||
description: 'Close To',
|
description: 'Close To',
|
||||||
icon: Assets.closeToMotion,
|
icon: Assets.closeToMotion,
|
||||||
value: 'parlour',
|
value: 'close_to',
|
||||||
),
|
),
|
||||||
CpsOperationalValue(
|
CpsOperationalValue(
|
||||||
description: 'Far Away',
|
description: 'Far Away',
|
||||||
@ -618,14 +849,32 @@ final class CpsSportsParaFunction extends CpsFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
}) : super(
|
}) : min = 1,
|
||||||
|
max = 100,
|
||||||
|
step = 1,
|
||||||
|
super(
|
||||||
code: 'sports_para'.correct,
|
code: 'sports_para'.correct,
|
||||||
operationName: 'Sports Para',
|
operationName: 'Sports Para',
|
||||||
icon: Assets.sportsPara,
|
icon: Assets.sportsPara,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final double min;
|
||||||
|
final double max;
|
||||||
|
final double step;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<CpsOperationalValue> getOperationalValues() {
|
List<CpsOperationalValue> getOperationalValues() {
|
||||||
// TODO: implement getOperationalValues
|
final count = ((max - min) / step).round() + 1;
|
||||||
throw UnimplementedError();
|
return List.generate(
|
||||||
|
count,
|
||||||
|
(index) {
|
||||||
|
final value = (min + (index * step));
|
||||||
|
return CpsOperationalValue(
|
||||||
|
icon: Assets.motionMeter,
|
||||||
|
description: value.toStringAsFixed(0),
|
||||||
|
value: value,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user