fix:重新优化猫眼设置项逻辑,增加省电模式下的监控和远程开锁限制

This commit is contained in:
liyi 2025-02-27 16:22:38 +08:00
parent 602050b90c
commit f6f10f1bcd
10 changed files with 299 additions and 150 deletions

View File

@ -1131,6 +1131,8 @@
"已静音": "The sound has been turned off", "已静音": "The sound has been turned off",
"该锁的远程开锁功能未启用": "The remote unlocking function of this lock is not enabled", "该锁的远程开锁功能未启用": "The remote unlocking function of this lock is not enabled",
"下载完成,请到相册查看": "Download completed, please go to the album to view", "下载完成,请到相册查看": "Download completed, please go to the album to view",
"猫眼设置为省电模式时无法进行监控,请在猫眼设置中切换为其他模式": "When Cat Eye is set to power-saving mode, monitoring cannot be performed. Please switch to other modes in Cat Eye settings",
"猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式": "Remote unlocking is not possible when Cat Eye is set to power-saving mode. Please switch to another mode in Cat Eye settings",
"重置后,该锁的遥控都将被删除哦,确认要重置吗?": "After reset, the remote control of the lock will be deleted. Do you want to reset it?", "重置后,该锁的遥控都将被删除哦,确认要重置吗?": "After reset, the remote control of the lock will be deleted. Do you want to reset it?",
"版本说明": "Version description", "版本说明": "Version description",
"网关通电后长按重置按钮5秒蓝色指示灯闪烁时点击下一步": "After the gateway is powered on, press and hold the reset button for 5 seconds. Click Next when the blue indicator light flashes", "网关通电后长按重置按钮5秒蓝色指示灯闪烁时点击下一步": "After the gateway is powered on, press and hold the reset button for 5 seconds. Click Next when the blue indicator light flashes",

View File

@ -1132,6 +1132,8 @@
"已静音": "已静音", "已静音": "已静音",
"该锁的远程开锁功能未启用": "该锁的远程开锁功能未启用", "该锁的远程开锁功能未启用": "该锁的远程开锁功能未启用",
"下载完成,请到相册查看": "下载完成,请到相册查看", "下载完成,请到相册查看": "下载完成,请到相册查看",
"猫眼设置为省电模式时无法进行监控,请在猫眼设置中切换为其他模式": "猫眼设置为省电模式时无法进行监控,请在猫眼设置中切换为其他模式",
"猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式": "猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式",
"重置后,该锁的遥控都将被删除哦,确认要重置吗?": "重置后,该锁的遥控都将被删除哦,确认要重置吗?", "重置后,该锁的遥控都将被删除哦,确认要重置吗?": "重置后,该锁的遥控都将被删除哦,确认要重置吗?",
"版本说明": "版本说明", "版本说明": "版本说明",
"网关添加成功": "网关添加成功" "网关添加成功": "网关添加成功"

View File

@ -1132,6 +1132,8 @@
"已静音": "已静音", "已静音": "已静音",
"该锁的远程开锁功能未启用": "该锁的远程开锁功能未启用", "该锁的远程开锁功能未启用": "该锁的远程开锁功能未启用",
"下载完成,请到相册查看": "下载完成,请到相册查看", "下载完成,请到相册查看": "下载完成,请到相册查看",
"猫眼设置为省电模式时无法进行监控,请在猫眼设置中切换为其他模式": "猫眼设置为省电模式时无法进行监控,请在猫眼设置中切换为其他模式",
"猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式": "猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式",
"重置后,该锁的遥控都将被删除哦,确认要重置吗?": "重置后,该锁的遥控都将被删除哦,确认要重置吗?", "重置后,该锁的遥控都将被删除哦,确认要重置吗?": "重置后,该锁的遥控都将被删除哦,确认要重置吗?",
"版本说明": "版本说明", "版本说明": "版本说明",
"网关添加成功": "网关添加成功" "网关添加成功": "网关添加成功"

View File

@ -638,12 +638,19 @@ class LockDetailLogic extends BaseGetXController {
// //
Future<void> remoteOpenLock() async { Future<void> remoteOpenLock() async {
final LoginEntity entity = await ApiRepository.to.remoteOpenLock( final catEyeConfig = state.keyInfos.value.lockSetting?.catEyeConfig ?? [];
lockId: state.keyInfos.value.lockId.toString(), if (catEyeConfig.isNotEmpty &&
timeOut: 60, catEyeConfig.length > 0 &&
); catEyeConfig[0].catEyeMode != 0) {
if (entity.errorCode!.codeIsSuccessful) { final LoginEntity entity = await ApiRepository.to.remoteOpenLock(
showToast('已开锁'.tr); lockId: state.keyInfos.value.lockId.toString(),
timeOut: 60,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('已开锁'.tr);
}
} else {
showToast('猫眼设置为省电模式时无法进行远程开锁,请在猫眼设置中切换为其他模式'.tr);
} }
} }
@ -752,14 +759,21 @@ class LockDetailLogic extends BaseGetXController {
/// ///
void sendMonitorMessage() { void sendMonitorMessage() {
if (StartChartManage().lockNetworkInfo.wifiName == null || final catEyeConfig = state.keyInfos.value.lockSetting?.catEyeConfig ?? [];
StartChartManage().lockNetworkInfo.wifiName == '') { if (catEyeConfig.isNotEmpty &&
showToast('设备未配网'.tr); catEyeConfig.length > 0 &&
return; catEyeConfig[0].catEyeMode != 0) {
if (StartChartManage().lockNetworkInfo.wifiName == null ||
StartChartManage().lockNetworkInfo.wifiName == '') {
showToast('设备未配网'.tr);
return;
}
// id
StartChartManage().startCallRequestMessageTimer(
ToPeerId: StartChartManage().lockPeerId ?? '');
} else {
showToast('猫眼设置为省电模式时无法进行监控,请在猫眼设置中切换为其他模式'.tr);
} }
// id
StartChartManage().startCallRequestMessageTimer(
ToPeerId: StartChartManage().lockPeerId ?? '');
} }
@override @override
@ -769,6 +783,18 @@ class LockDetailLogic extends BaseGetXController {
await PermissionDialog.request(Permission.location); await PermissionDialog.request(Permission.location);
await PermissionDialog.requestBluetooth(); await PermissionDialog.requestBluetooth();
_requestDeviceNetworkInfo(); _requestDeviceNetworkInfo();
eventBus
.on<PassCurrentLockInformationEvent>()
.listen((PassCurrentLockInformationEvent event) {
if (event.lockSetInfoData.lockSettingInfo != null &&
event.lockSetInfoData.lockSettingInfo!.catEyeConfig != null &&
event.lockSetInfoData.lockSettingInfo!.catEyeConfig!.length > 0) {
state.keyInfos.value.lockSetting!.catEyeConfig![0].catEyeMode = event
.lockSetInfoData.lockSettingInfo!.catEyeConfig![0].catEyeMode ??
1;
state.keyInfos.refresh();
}
});
} }
@override @override

View File

@ -11,6 +11,7 @@ import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dar
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/talk/starChart/star_chart_manage.dart'; import 'package:star_lock/talk/starChart/star_chart_manage.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
import '../../../../../blue/sender_manage.dart'; import '../../../../../blue/sender_manage.dart';
@ -54,7 +55,7 @@ class CatEyeCustomModeLogic extends BaseGetXController {
} }
void updateCustomModeConfig(clickIndex) { void updateCustomModeConfig(clickIndex) {
catEyeSetState.catEyeConfig.value.catEyeMode = 4; catEyeSetState.catEyeConfig.value.catEyeMode = 3;
catEyeSetState.catEyeConfig.value.recordTime = catEyeSetState.catEyeConfig.value.recordTime =
state.showsUpVideoList.value.indexOf(state.recordTime.value); state.showsUpVideoList.value.indexOf(state.recordTime.value);
catEyeSetState.catEyeConfig.value.detectionDistance = catEyeSetState.catEyeConfig.value.detectionDistance =
@ -75,10 +76,23 @@ class CatEyeCustomModeLogic extends BaseGetXController {
.value[catEyeSetState.catEyeConfig.value.recordTime ?? 0]; .value[catEyeSetState.catEyeConfig.value.recordTime ?? 0];
state.detectionDistance.value = state.detectionRangeList state.detectionDistance.value = state.detectionRangeList
.value[catEyeSetState.catEyeConfig.value.detectionDistance ?? 0]; .value[catEyeSetState.catEyeConfig.value.detectionDistance ?? 0];
state.realTimeMode.value = state.realTimeMode.value =
catEyeSetState.catEyeConfig.value.realTimeMode == 0 catEyeSetState.catEyeConfig.value.realTimeMode == 0
? '发生事件时查看'.tr ? '发生事件时查看'.tr
: '实时查看'.tr; : '实时查看'.tr;
eventBus
.on<PassCurrentLockInformationEvent>()
.listen((PassCurrentLockInformationEvent event) {
if (event.lockSetInfoData.lockSettingInfo != null &&
event.lockSetInfoData.lockSettingInfo!.catEyeConfig != null &&
event.lockSetInfoData.lockSettingInfo!.catEyeConfig!.length > 0) {
state.realTimeMode.value = event.lockSetInfoData.lockSettingInfo!
.catEyeConfig![0].catEyeModeConfig!.realTimeMode ==
0
? '发生事件时查看'.tr
: '实时查看'.tr;
state.realTimeMode.refresh();
}
});
} }
} }

View File

@ -29,80 +29,82 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: '自定义模式'.tr, barTitle: '自定义模式'.tr,
haveBack: true, haveBack: true,
backAction: () { backAction: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Obx(() => Column( body: Obx(
children: [ () => Column(
Container( children: [
margin: EdgeInsets.only(left: 20.w), Container(
child: CommonItem( margin: EdgeInsets.only(left: 20.w),
leftTitel: '录像时段'.tr, child: CommonItem(
rightTitle: '', leftTitel: '录像时段'.tr,
isHaveLine: false, rightTitle: '',
isHaveDirection: true, isHaveLine: false,
isHaveRightWidget: true, isHaveDirection: true,
rightWidget: Text(state.selectVideoSlot.value, isHaveRightWidget: true,
style: TextStyle( rightWidget: Text(state.selectVideoSlot.value,
fontSize: 22.sp, style: TextStyle(
color: AppColors.darkGrayTextColor)), fontSize: 22.sp, color: AppColors.darkGrayTextColor)),
action: () { action: () {
Navigator.pushNamed(context, Routers.videoSlotPage, Navigator.pushNamed(context, Routers.videoSlotPage,
arguments: { arguments: {
'lockSetInfoData': state.lockSetInfoData.value, 'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigData': state.lockSetInfoData.value 'catEyeConfigData': state.lockSetInfoData.value
.lockSettingInfo!.catEyeConfig!.isNotEmpty .lockSettingInfo!.catEyeConfig!.isNotEmpty
? state.lockSetInfoData.value.lockSettingInfo! ? state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0] .catEyeConfig![0]
: null : null
}); });
}, },
), ),
), ),
_buildSubTitleItem( _buildSubTitleItem(
'有人出现时录像'.tr, '有人出现时录像'.tr,
'有人在门口出现10秒后开始录像。'.tr + '\n' + '有人按门铃时立即录像'.tr, '有人在门口出现10秒后开始录像。'.tr + '\n' + '有人按门铃时立即录像'.tr,
state.recordTime.value, () { state.recordTime.value, () {
_openBottomItemSheet(state.showsUpVideoList.value, 0); _openBottomItemSheet(state.showsUpVideoList.value, 0);
}), }),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildSubTitleItem('人体侦测距离'.tr, '有人出现在门前1.5米范围时启动录像'.tr, _buildSubTitleItem('人体侦测距离'.tr, '有人出现在门前1.5米范围时启动录像'.tr,
state.detectionDistance.value, () { state.detectionDistance.value, () {
_openBottomItemSheet(state.detectionRangeList.value, 1); _openBottomItemSheet(state.detectionRangeList.value, 1);
}), }),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
Container( Container(
margin: EdgeInsets.only(left: 20.w), margin: EdgeInsets.only(left: 20.w),
child: CommonItem( child: CommonItem(
leftTitel: '实时画面'.tr, leftTitel: '实时画面'.tr,
rightTitle: state.realTimeMode.value, rightTitle: state.realTimeMode.value,
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
isHaveRightWidget: false, isHaveRightWidget: false,
action: () { action: () {
Navigator.pushNamed(context, Routers.liveVideoPage, Navigator.pushNamed(context, Routers.liveVideoPage,
arguments: { arguments: {
'lockSetInfoData': state.lockSetInfoData.value, 'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigData': state.lockSetInfoData.value 'catEyeConfigData': state.lockSetInfoData.value
.lockSettingInfo!.catEyeConfig!.isNotEmpty .lockSettingInfo!.catEyeConfig!.isNotEmpty
? state.lockSetInfoData.value.lockSettingInfo! ? state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0] .catEyeConfig![0]
: null : null
}); });
}, },
), ),
) )
], ],
))); ),
),
);
} }
Widget _buildSubTitleItem( Widget _buildSubTitleItem(

View File

@ -131,7 +131,6 @@ class CatEyeSetLogic extends BaseGetXController {
} }
state.updateCatEyeSetByState(); state.updateCatEyeSetByState();
state.catEyeConfig.refresh();
} }
} }

View File

@ -21,9 +21,10 @@ class LiveVideoLogic extends BaseGetXController {
void updateCatEyeModeConfig() { void updateCatEyeModeConfig() {
catEyeSetState.settingOptions.value = 5; catEyeSetState.settingOptions.value = 5;
catEyeSetState.catEyeConfig.value.catEyeMode = 4; catEyeSetState.catEyeConfig.value.catEyeMode = 3;
catEyeSetState.catEyeConfig.value.realTimeMode = state.realTimeMode.value; catEyeSetState.catEyeConfig.value.realTimeMode = state.realTimeMode.value;
catEyeSetLogic.sendBlueMessage(); catEyeSetLogic.sendBlueMessage();
catEyeSetLogic.refresh();
} }
@override @override
@ -31,5 +32,6 @@ class LiveVideoLogic extends BaseGetXController {
super.onInit(); super.onInit();
state.isLiveView.value = state.isLiveView.value =
catEyeSetState.catEyeConfig.value.realTimeMode == 1; catEyeSetState.catEyeConfig.value.realTimeMode == 1;
state.isLiveView.refresh();
} }
} }

View File

@ -553,11 +553,13 @@ class LockSettingInfo {
stayWarn = json['stayWarn']; stayWarn = json['stayWarn'];
abnormalWarn = json['abnormalWarn']; abnormalWarn = json['abnormalWarn'];
if (json['catEyeConfig'] != null) { if (json['catEyeConfig'] != null) {
catEyeConfig = <CatEyeConfig>[]; catEyeConfig = (json['catEyeConfig'] as List)
json['catEyeConfig'].forEach((v) { .map((item) => CatEyeConfig.fromJson(item))
catEyeConfig!.add(CatEyeConfig.fromJson(v)); .toList();
}); } else {
catEyeConfig = [];
} }
faceSwitch = json['faceSwitch']; faceSwitch = json['faceSwitch'];
faceAutoLightScreen = json['faceAutoLightScreen']; faceAutoLightScreen = json['faceAutoLightScreen'];
faceInductionDistance = json['faceInductionDistance']; faceInductionDistance = json['faceInductionDistance'];
@ -670,60 +672,68 @@ class PassageModeConfig {
} }
} }
// CatEyeConfig
class CatEyeConfig { class CatEyeConfig {
CatEyeConfig({this.catEyeMode, this.catEyeModeConfig}); CatEyeConfig({
this.catEyeMode,
this.catEyeModeConfig,
});
CatEyeConfig.fromJson(Map<String, dynamic> json) { // JSON
catEyeMode = json['catEyeMode']; factory CatEyeConfig.fromJson(Map<String, dynamic> json) {
catEyeModeConfig = json['catEyeModeConfig'] != null return CatEyeConfig(
? CatEyeModeConfig.fromJson(json['catEyeModeConfig']) catEyeMode: json['catEyeMode']?.toInt() ?? 0,
: null; catEyeModeConfig:
CatEyeModeConfig.fromJson(json['catEyeModeConfig'] ?? {}),
);
} }
int? catEyeMode; //1 2 3 4 int? catEyeMode;
CatEyeModeConfig? catEyeModeConfig; CatEyeModeConfig? catEyeModeConfig;
// JSON
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
data['catEyeMode'] = catEyeMode; data['catEyeMode'] = catEyeMode;
if (catEyeModeConfig != null) { if (catEyeModeConfig != null) {
data['catEyeModeConfig'] = catEyeModeConfig!.toJson(); data['catEyeModeConfig'] = catEyeModeConfig!.toJson();
} }
return data; return data;
} }
} }
// CatEyeModeConfig
class CatEyeModeConfig { class CatEyeModeConfig {
// CatEyeModeConfig({
this.recordMode,
this.recordTime,
this.realTimeMode,
this.recordEndTime,
this.recordStartTime,
this.detectionDistance,
});
CatEyeModeConfig( // JSON
{this.recordMode, factory CatEyeModeConfig.fromJson(Map<String, dynamic> json) {
this.recordTime, return CatEyeModeConfig(
this.realTimeMode, recordMode: json['recordMode']?.toInt(),
this.recordEndTime, recordTime: json['recordTime']?.toInt(),
this.recordStartTime, realTimeMode: json['realTimeMode']?.toInt(),
this.detectionDistance}); recordEndTime: json['recordEndTime']?.toInt(),
recordStartTime: json['recordStartTime']?.toInt(),
CatEyeModeConfig.fromJson(Map<String, dynamic> json) { detectionDistance: json['detectionDistance']?.toInt(),
recordMode = json['recordMode']; );
if (json['recordTime'] != null) {
recordTime = json['recordTime'];
} else {
recordTime = '';
}
realTimeMode = json['realTimeMode'];
recordEndTime = json['recordEndTime'];
recordStartTime = json['recordStartTime'];
detectionDistance = json['detectionDistance'];
} }
int? recordMode; // 0 1 int? recordMode;
String? recordTime; // int? recordTime;
int? realTimeMode; // 0 1 int? realTimeMode;
int? recordEndTime; //- int? recordEndTime;
int? recordStartTime; //- int? recordStartTime;
String? detectionDistance; int? detectionDistance;
// JSON
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
data['recordMode'] = recordMode; data['recordMode'] = recordMode;

View File

@ -1,3 +1,5 @@
import 'dart:convert';
class LockListInfoEntity { class LockListInfoEntity {
LockListInfoEntity( LockListInfoEntity(
{this.errorCode, this.description, this.errorMsg, this.data}); {this.errorCode, this.description, this.errorMsg, this.data});
@ -193,9 +195,8 @@ class LockListInfoItemEntity {
mac = json['mac']; mac = json['mac'];
initUserNo = json['initUserNo']; initUserNo = json['initUserNo'];
updateDate = json['updateDate']; updateDate = json['updateDate'];
network = json['network'] != null network =
? NetworkInfo.fromJson(json['network']) json['network'] != null ? NetworkInfo.fromJson(json['network']) : null;
: null;
} }
int? keyId; int? keyId;
@ -298,6 +299,33 @@ class LockListInfoItemEntity {
} }
} }
class NetworkInfo {
NetworkInfo({
this.peerId,
this.isOnline,
this.wifiName,
});
NetworkInfo.fromJson(Map<String, dynamic> json) {
peerId = json['peerId'];
isOnline = json['isOnline'];
wifiName = json['wifiName'];
}
String? peerId;
String? wifiName;
int? isOnline;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['peerId'] = peerId;
data['wifiName'] = wifiName;
data['isOnline'] = isOnline;
return data;
}
}
class Bluetooth { class Bluetooth {
Bluetooth( Bluetooth(
{this.bluetoothDeviceId, {this.bluetoothDeviceId,
@ -406,50 +434,112 @@ class LockSetting {
this.attendance, this.attendance,
this.appUnlockOnline, this.appUnlockOnline,
this.remoteUnlock, this.remoteUnlock,
this.catEyeConfig,
}); });
LockSetting.fromJson(Map<String, dynamic> json) { // JSON
attendance = json['attendance']; factory LockSetting.fromJson(Map<String, dynamic> json) {
appUnlockOnline = json['appUnlockOnline']; return LockSetting(
remoteUnlock = json['remoteUnlock']; attendance: json['attendance']?.toInt(),
appUnlockOnline: json['appUnlockOnline']?.toInt(),
remoteUnlock: json['remoteUnlock']?.toInt(),
// catEyeConfig
catEyeConfig: json['catEyeConfig'] != null
? (json['catEyeConfig'] as List)
.map((item) => CatEyeConfig.fromJson(item))
.toList()
: [],
);
} }
int? attendance; int? attendance;
int? appUnlockOnline; int? appUnlockOnline;
int? remoteUnlock; int? remoteUnlock;
List<CatEyeConfig>? catEyeConfig;
// JSON
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
data['attendance'] = attendance; data['attendance'] = attendance;
data['appUnlockOnline'] = appUnlockOnline; data['appUnlockOnline'] = appUnlockOnline;
data['remoteUnlock'] = remoteUnlock; data['remoteUnlock'] = remoteUnlock;
if (catEyeConfig != null) {
data['catEyeConfig'] =
catEyeConfig!.map((v) => v.toJson()).toList(); // List
}
return data; return data;
} }
} }
class NetworkInfo {
NetworkInfo({
this.peerId,
this.isOnline,
this.wifiName,
// CatEyeConfig
class CatEyeConfig {
CatEyeConfig({
required this.catEyeMode,
required this.catEyeModeConfig,
}); });
NetworkInfo.fromJson(Map<String, dynamic> json) { // JSON
peerId = json['peerId']; factory CatEyeConfig.fromJson(Map<String, dynamic> json) {
isOnline = json['isOnline']; return CatEyeConfig(
wifiName = json['wifiName']; catEyeMode: json['catEyeMode']?.toInt() ?? 0,
catEyeModeConfig: CatEyeModeConfig.fromJson(json['catEyeModeConfig'] ?? {}),
);
} }
String? peerId; int catEyeMode;
String? wifiName; CatEyeModeConfig catEyeModeConfig;
int? isOnline;
// JSON
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
data['peerId'] = peerId; data['catEyeMode'] = catEyeMode;
data['wifiName'] = wifiName; data['catEyeModeConfig'] = catEyeModeConfig.toJson();
data['isOnline'] = isOnline; return data;
}
}
// CatEyeModeConfig
class CatEyeModeConfig {
CatEyeModeConfig({
this.recordMode,
this.recordTime,
this.realTimeMode,
this.recordEndTime,
this.recordStartTime,
this.detectionDistance,
});
// JSON
factory CatEyeModeConfig.fromJson(Map<String, dynamic> json) {
return CatEyeModeConfig(
recordMode: json['recordMode']?.toInt(),
recordTime: json['recordTime']?.toInt(),
realTimeMode: json['realTimeMode']?.toInt(),
recordEndTime: json['recordEndTime']?.toInt(),
recordStartTime: json['recordStartTime']?.toInt(),
detectionDistance: json['detectionDistance']?.toInt(),
);
}
int? recordMode;
int? recordTime;
int? realTimeMode;
int? recordEndTime;
int? recordStartTime;
int? detectionDistance;
// JSON
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['recordMode'] = recordMode;
data['recordTime'] = recordTime;
data['realTimeMode'] = realTimeMode;
data['recordEndTime'] = recordEndTime;
data['recordStartTime'] = recordStartTime;
data['detectionDistance'] = detectionDistance;
return data; return data;
} }
} }