|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_community.model.dart';
|
|
|
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_space_model.dart';
|
|
|
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_sub_space.dart';
|
|
|
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_subspace.model.dart';
|
|
|
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_tag_model.dart';
|
|
|
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart';
|
|
|
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart';
|
|
|
|
|
import 'package:syncrow_web/pages/routines/models/ac/ac_function.dart';
|
|
|
|
@ -79,38 +81,41 @@ class AllDevicesModel {
|
|
|
|
|
int? batteryLevel;
|
|
|
|
|
String? productName;
|
|
|
|
|
List<DeviceSpaceModel>? spaces;
|
|
|
|
|
List<DeviceTagModel>? deviceTags;
|
|
|
|
|
DeviceSubSpace? deviceSubSpace;
|
|
|
|
|
|
|
|
|
|
AllDevicesModel({
|
|
|
|
|
this.room,
|
|
|
|
|
this.subspace,
|
|
|
|
|
this.unit,
|
|
|
|
|
this.community,
|
|
|
|
|
this.productUuid,
|
|
|
|
|
this.productType,
|
|
|
|
|
this.permissionType,
|
|
|
|
|
this.activeTime,
|
|
|
|
|
this.category,
|
|
|
|
|
this.categoryName,
|
|
|
|
|
this.createTime,
|
|
|
|
|
this.gatewayId,
|
|
|
|
|
this.icon,
|
|
|
|
|
this.ip,
|
|
|
|
|
this.lat,
|
|
|
|
|
this.localKey,
|
|
|
|
|
this.lon,
|
|
|
|
|
this.model,
|
|
|
|
|
this.name,
|
|
|
|
|
this.nodeId,
|
|
|
|
|
this.online,
|
|
|
|
|
this.ownerId,
|
|
|
|
|
this.sub,
|
|
|
|
|
this.timeZone,
|
|
|
|
|
this.updateTime,
|
|
|
|
|
this.uuid,
|
|
|
|
|
this.batteryLevel,
|
|
|
|
|
this.productName,
|
|
|
|
|
this.spaces,
|
|
|
|
|
});
|
|
|
|
|
AllDevicesModel(
|
|
|
|
|
{this.room,
|
|
|
|
|
this.subspace,
|
|
|
|
|
this.unit,
|
|
|
|
|
this.community,
|
|
|
|
|
this.productUuid,
|
|
|
|
|
this.productType,
|
|
|
|
|
this.permissionType,
|
|
|
|
|
this.activeTime,
|
|
|
|
|
this.category,
|
|
|
|
|
this.categoryName,
|
|
|
|
|
this.createTime,
|
|
|
|
|
this.gatewayId,
|
|
|
|
|
this.icon,
|
|
|
|
|
this.ip,
|
|
|
|
|
this.lat,
|
|
|
|
|
this.localKey,
|
|
|
|
|
this.lon,
|
|
|
|
|
this.model,
|
|
|
|
|
this.name,
|
|
|
|
|
this.nodeId,
|
|
|
|
|
this.online,
|
|
|
|
|
this.ownerId,
|
|
|
|
|
this.sub,
|
|
|
|
|
this.timeZone,
|
|
|
|
|
this.updateTime,
|
|
|
|
|
this.uuid,
|
|
|
|
|
this.batteryLevel,
|
|
|
|
|
this.productName,
|
|
|
|
|
this.spaces,
|
|
|
|
|
this.deviceTags,
|
|
|
|
|
this.deviceSubSpace});
|
|
|
|
|
|
|
|
|
|
AllDevicesModel.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
room = (json['room'] != null && (json['room'] is Map))
|
|
|
|
@ -148,12 +153,15 @@ class AllDevicesModel {
|
|
|
|
|
updateTime = int.tryParse(json['updateTime']?.toString() ?? '');
|
|
|
|
|
uuid = json['uuid']?.toString();
|
|
|
|
|
batteryLevel = int.tryParse(json['battery']?.toString() ?? '');
|
|
|
|
|
|
|
|
|
|
productName = json['productName']?.toString();
|
|
|
|
|
deviceTags = json['deviceTag'] != null && json['deviceTag'] is List
|
|
|
|
|
? (json['deviceTag'] as List).map((tag) => DeviceTagModel.fromJson(tag)).toList()
|
|
|
|
|
: [];
|
|
|
|
|
deviceSubSpace = json['subspace'] != null
|
|
|
|
|
? DeviceSubSpace.fromJson(json['subspace'])
|
|
|
|
|
: DeviceSubSpace(subspaceName: '');
|
|
|
|
|
if (json['spaces'] != null && json['spaces'] is List) {
|
|
|
|
|
spaces = (json['spaces'] as List)
|
|
|
|
|
.map((space) => DeviceSpaceModel.fromJson(space))
|
|
|
|
|
.toList();
|
|
|
|
|
spaces = (json['spaces'] as List).map((space) => DeviceSpaceModel.fromJson(space)).toList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -201,8 +209,7 @@ SOS
|
|
|
|
|
String tempIcon = '';
|
|
|
|
|
if (type == DeviceType.LightBulb) {
|
|
|
|
|
tempIcon = Assets.lightBulb;
|
|
|
|
|
} else if (type == DeviceType.CeilingSensor ||
|
|
|
|
|
type == DeviceType.WallSensor) {
|
|
|
|
|
} else if (type == DeviceType.CeilingSensor || type == DeviceType.WallSensor) {
|
|
|
|
|
tempIcon = Assets.sensors;
|
|
|
|
|
} else if (type == DeviceType.AC) {
|
|
|
|
|
tempIcon = Assets.ac;
|
|
|
|
@ -249,76 +256,51 @@ SOS
|
|
|
|
|
switch (productType) {
|
|
|
|
|
case 'AC':
|
|
|
|
|
return [
|
|
|
|
|
SwitchFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ModeFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
TempSetFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
CurrentTempFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
LevelFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ChildLockFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
SwitchFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ModeFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
TempSetFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
CurrentTempFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
LevelFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ChildLockFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
case '1G':
|
|
|
|
|
return [
|
|
|
|
|
OneGangSwitchFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
OneGangCountdownFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
OneGangCountdownFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
case '2G':
|
|
|
|
|
return [
|
|
|
|
|
TwoGangSwitch1Function(deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
TwoGangSwitch2Function(deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
TwoGangCountdown1Function(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
TwoGangCountdown2Function(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
TwoGangCountdown1Function(deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
TwoGangCountdown2Function(deviceId: uuid ?? '', deviceName: name ?? ''),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
case '3G':
|
|
|
|
|
return [
|
|
|
|
|
ThreeGangSwitch1Function(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangSwitch2Function(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangSwitch3Function(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangCountdown1Function(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangCountdown2Function(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangCountdown3Function(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangSwitch1Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangSwitch2Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangSwitch3Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangCountdown1Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangCountdown2Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
ThreeGangCountdown3Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
];
|
|
|
|
|
case 'WPS':
|
|
|
|
|
return [
|
|
|
|
|
//IF Functions
|
|
|
|
|
PresenceStateFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
CurrentDistanceFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
IlluminanceValueFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
PresenceTimeFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
PresenceStateFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
CurrentDistanceFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
IlluminanceValueFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
PresenceTimeFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
|
|
|
|
|
|
|
|
|
|
//THEN Functions
|
|
|
|
|
FarDetectionFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
|
|
|
|
|
MotionSensitivityFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
|
|
|
|
|
MotionLessSensitivityFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
|
|
|
|
|
IndicatorFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
NoOneTimeFunction(
|
|
|
|
|
deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
|
|
|
|
|
|
|
|
|
|
FarDetectionFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
|
|
|
|
|
MotionSensitivityFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
|
|
|
|
|
MotionLessSensitivityFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
|
|
|
|
|
IndicatorFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
|
|
|
|
|
NoOneTimeFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
|
|
|
|
|
];
|
|
|
|
|
case 'GW':
|
|
|
|
|
return [
|
|
|
|
|