mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-15 01:35:25 +00:00
formatted all files.
This commit is contained in:
@ -23,46 +23,46 @@ class WallSensorModel {
|
||||
required this.noBodyTime});
|
||||
|
||||
factory WallSensorModel.fromJson(List<Status> jsonList) {
|
||||
late String _presenceState;
|
||||
late int _farDetection;
|
||||
late int _presenceTime;
|
||||
late int _motionSensitivity;
|
||||
late int _motionlessSensitivity;
|
||||
late int _currentDistance;
|
||||
late int _illuminance;
|
||||
late bool _indicator;
|
||||
late int _noBodyTime;
|
||||
late String presenceState;
|
||||
late int farDetection;
|
||||
late int presenceTime;
|
||||
late int motionSensitivity;
|
||||
late int motionlessSensitivity;
|
||||
late int currentDistance;
|
||||
late int illuminance;
|
||||
late bool indicator;
|
||||
late int noBodyTime;
|
||||
|
||||
for (int i = 0; i < jsonList.length; i++) {
|
||||
for (var i = 0; i < jsonList.length; i++) {
|
||||
if (jsonList[i].code == 'presence_state') {
|
||||
_presenceState = jsonList[i].value ?? 'none';
|
||||
presenceState = jsonList[i].value ?? 'none';
|
||||
} else if (jsonList[i].code == 'far_detection') {
|
||||
_farDetection = jsonList[i].value ?? 0;
|
||||
farDetection = jsonList[i].value ?? 0;
|
||||
} else if (jsonList[i].code == 'presence_time') {
|
||||
_presenceTime = jsonList[i].value ?? 0;
|
||||
presenceTime = jsonList[i].value ?? 0;
|
||||
} else if (jsonList[i].code == 'motion_sensitivity_value') {
|
||||
_motionSensitivity = jsonList[i].value ?? 0;
|
||||
motionSensitivity = jsonList[i].value ?? 0;
|
||||
} else if (jsonList[i].code == 'motionless_sensitivity') {
|
||||
_motionlessSensitivity = jsonList[i].value ?? 0;
|
||||
motionlessSensitivity = jsonList[i].value ?? 0;
|
||||
} else if (jsonList[i].code == 'dis_current') {
|
||||
_currentDistance = jsonList[i].value ?? 0;
|
||||
currentDistance = jsonList[i].value ?? 0;
|
||||
} else if (jsonList[i].code == 'illuminance_value') {
|
||||
_illuminance = jsonList[i].value ?? 0;
|
||||
illuminance = jsonList[i].value ?? 0;
|
||||
} else if (jsonList[i].code == 'indicator') {
|
||||
_indicator = jsonList[i].value ?? false;
|
||||
indicator = jsonList[i].value ?? false;
|
||||
} else if (jsonList[i].code == 'no_one_time') {
|
||||
_noBodyTime = jsonList[i].value ?? 0;
|
||||
noBodyTime = jsonList[i].value ?? 0;
|
||||
}
|
||||
}
|
||||
return WallSensorModel(
|
||||
presenceState: _presenceState,
|
||||
farDetection: _farDetection,
|
||||
presenceTime: _presenceTime,
|
||||
motionSensitivity: _motionSensitivity,
|
||||
motionlessSensitivity: _motionlessSensitivity,
|
||||
currentDistance: _currentDistance,
|
||||
illuminance: _illuminance,
|
||||
indicator: _indicator,
|
||||
noBodyTime: _noBodyTime);
|
||||
presenceState: presenceState,
|
||||
farDetection: farDetection,
|
||||
presenceTime: presenceTime,
|
||||
motionSensitivity: motionSensitivity,
|
||||
motionlessSensitivity: motionlessSensitivity,
|
||||
currentDistance: currentDistance,
|
||||
illuminance: illuminance,
|
||||
indicator: indicator,
|
||||
noBodyTime: noBodyTime);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user