mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-24 15:57:55 +00:00
Add status model and fetch device statuses
Added a new StatusModel class to represent device statuses and implemented functionality to fetch and update device statuses in the DevicesCubit and DeviceModel classes. Also updated UI components to display device status information.
This commit is contained in:
@@ -1,27 +1,29 @@
|
||||
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
class DeviceModel {
|
||||
int? activeTime;
|
||||
String? category;
|
||||
String? categoryName;
|
||||
int? createTime;
|
||||
String? gatewayId;
|
||||
String? icon;
|
||||
String? category; //unused
|
||||
String? categoryName; //unused
|
||||
int? createTime; //unused
|
||||
String? gatewayId; //unused
|
||||
String? icon; //unused
|
||||
String? id;
|
||||
String? ip;
|
||||
double? lat;
|
||||
String? ip; //unused
|
||||
double? lat; //unused
|
||||
String? localKey;
|
||||
double? lon;
|
||||
double? lon; //unused
|
||||
String? model;
|
||||
String? name;
|
||||
String? nodeId; //rmeove
|
||||
String? nodeId; //remove
|
||||
bool? isOnline;
|
||||
String? ownerId; //remove
|
||||
String? productId; //remove
|
||||
List<StatusModel> status = [];
|
||||
String? ownerId; //unused
|
||||
String? productId; //unused
|
||||
String? productName;
|
||||
bool? isSub;
|
||||
bool? isSub; //unused
|
||||
String? timeZone;
|
||||
int? updateTime;
|
||||
String? uuid;
|
||||
@@ -44,6 +46,7 @@ class DeviceModel {
|
||||
this.name,
|
||||
this.nodeId,
|
||||
this.isOnline,
|
||||
required this.status,
|
||||
this.ownerId,
|
||||
this.productId,
|
||||
this.productName,
|
||||
@@ -102,6 +105,10 @@ class DeviceModel {
|
||||
updateTime: json['updateTime'],
|
||||
uuid: json['uuid'],
|
||||
productType: type,
|
||||
status: [],
|
||||
// json['status']
|
||||
// .map<StatusModel>((e) => StatusModel.fromJson(e))
|
||||
// .toList(),
|
||||
// devicesTypesMap[json['productName']] ?? DeviceType.Other,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
class StatusModel {
|
||||
String? code;
|
||||
dynamic value;
|
||||
|
||||
StatusModel({
|
||||
required this.code,
|
||||
required this.value,
|
||||
});
|
||||
|
||||
factory StatusModel.fromJson(Map<String, dynamic> json) {
|
||||
return StatusModel(
|
||||
code: json['code'],
|
||||
value: json['value'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'code': code,
|
||||
'value': value,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user