mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
250 lines
7.8 KiB
Dart
250 lines
7.8 KiB
Dart
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
|
import 'package:syncrow_app/features/scene/enum/ac_values.dart';
|
|
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|
|
|
mixin SceneHelper {
|
|
List<SceneStaticFunction> getFunctionsWithIcons(
|
|
{DeviceType? type, required List<FunctionModel> functions}) {
|
|
switch (type) {
|
|
case DeviceType.LightBulb:
|
|
return lightBulbFunctions(functions);
|
|
case DeviceType.CeilingSensor:
|
|
return ceilingSensorFunctions(functions);
|
|
case DeviceType.WallSensor:
|
|
return wallSensorFunctions(functions);
|
|
case DeviceType.AC:
|
|
return acFunctions(functions);
|
|
case DeviceType.DoorLock:
|
|
return doorLockFunctions(functions);
|
|
case DeviceType.Curtain:
|
|
return curtainFunctions(functions);
|
|
case DeviceType.ThreeGang:
|
|
return threeGangFunctions(functions);
|
|
case DeviceType.Gateway:
|
|
return gatewayFunctions(functions);
|
|
default:
|
|
return lightBulbFunctions(functions);
|
|
}
|
|
}
|
|
|
|
String getTitle({DeviceType? type}) {
|
|
switch (type) {
|
|
case DeviceType.LightBulb:
|
|
return 'Light Bulb Functions';
|
|
case DeviceType.CeilingSensor:
|
|
return 'Presence Sensor Functions';
|
|
case DeviceType.WallSensor:
|
|
return 'Human Presence Sensor Functions';
|
|
case DeviceType.AC:
|
|
return 'AC Functions';
|
|
case DeviceType.DoorLock:
|
|
return 'Door Lock Functions';
|
|
case DeviceType.Curtain:
|
|
return 'Curtain Functions';
|
|
case DeviceType.ThreeGang:
|
|
return '3G Light Switch Functions';
|
|
case DeviceType.Gateway:
|
|
return 'Gateway Functions';
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
|
|
/// presence sensor
|
|
List<SceneStaticFunction> ceilingSensorFunctions(
|
|
List<FunctionModel> functions) {
|
|
return [
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsSensitivityFunction,
|
|
name: 'Sensitivity',
|
|
code: 'sensitivity',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "1"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "2"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "3"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "4"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "5"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "6"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "7"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "8"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "9"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSensitivityOperationIcon, value: "10"),
|
|
],
|
|
),
|
|
];
|
|
}
|
|
}
|
|
|
|
List<SceneStaticFunction> curtainFunctions(List<FunctionModel> functions) {
|
|
return [];
|
|
}
|
|
|
|
List<SceneStaticFunction> doorLockFunctions(List<FunctionModel> functions) {
|
|
return [];
|
|
}
|
|
|
|
List<SceneStaticFunction> wallSensorFunctions(List<FunctionModel> functions) {
|
|
return [];
|
|
}
|
|
|
|
List<SceneStaticFunction> lightBulbFunctions(List<FunctionModel> functions) {
|
|
return [];
|
|
}
|
|
|
|
List<SceneStaticFunction> gatewayFunctions(List<FunctionModel> functions) {
|
|
return [];
|
|
}
|
|
|
|
List<SceneStaticFunction> threeGangFunctions(List<FunctionModel> functions) {
|
|
return [
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsAcPower,
|
|
name: 'Light 1 Switch',
|
|
code: 'switch_1',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(icon: Assets.assetsAcPower, value: "ON"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcPowerOFF, value: "OFF"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSceneRefresh, value: "Reverse Switch"),
|
|
],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsAcPower,
|
|
name: 'Light 2 Switch',
|
|
code: 'switch_2',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(icon: Assets.assetsAcPower, value: "ON"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcPowerOFF, value: "OFF"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSceneRefresh, value: "Reverse Switch"),
|
|
],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsAcPower,
|
|
name: 'Light 3 Switch',
|
|
code: 'switch_3',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(icon: Assets.assetsAcPower, value: "ON"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcPowerOFF, value: "OFF"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSceneRefresh, value: "Reverse Switch"),
|
|
],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsLightCountdown,
|
|
name: 'Light 1 CountDown',
|
|
code: 'countdown_1',
|
|
operationalValues: [],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsLightCountdown,
|
|
name: 'Light 2 CountDown',
|
|
code: 'countdown_1',
|
|
operationalValues: [],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsLightCountdown,
|
|
name: 'Light 3 CountDown',
|
|
code: 'countdown_1',
|
|
operationalValues: [],
|
|
),
|
|
];
|
|
}
|
|
|
|
/// smart ac thermostat
|
|
List<SceneStaticFunction> acFunctions(List<FunctionModel> functions) {
|
|
return [
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsAcPower,
|
|
name: 'Power',
|
|
code: 'switch',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(icon: Assets.assetsAcPower, value: "ON"),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcPowerOFF, value: "OFF"),
|
|
],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsFreezing,
|
|
name: 'Mode',
|
|
code: 'mode',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcCooling,
|
|
value: AcValuesEnums.Cooling.name,
|
|
),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcHeating,
|
|
value: AcValuesEnums.Heating.name,
|
|
),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsFanSpeed,
|
|
value: AcValuesEnums.Ventilation.name,
|
|
),
|
|
],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsTempreture,
|
|
name: 'Set Temperature',
|
|
code: 'temp_set',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsCelsiusDegrees, value: "COOL TO"),
|
|
],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsFanSpeed,
|
|
name: 'Fan Speed',
|
|
code: 'level',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcFanLow,
|
|
value: ValueACRange.LOW.name,
|
|
),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcFanMiddle,
|
|
value: ValueACRange.MIDDLE.name,
|
|
),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcFanHigh,
|
|
value: ValueACRange.HIGH.name,
|
|
),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsAcFanAuto,
|
|
value: ValueACRange.AUTO.name,
|
|
),
|
|
],
|
|
),
|
|
SceneStaticFunction(
|
|
icon: Assets.assetsChildLock,
|
|
name: 'Child Lock',
|
|
code: 'child_lock',
|
|
operationalValues: [
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSceneChildLock,
|
|
value: 'Lock',
|
|
),
|
|
StaticFunctionOperationHelper(
|
|
icon: Assets.assetsSceneChildUnlock,
|
|
value: 'Unlock',
|
|
),
|
|
],
|
|
),
|
|
];
|
|
}
|