setAlarmPirVideoPush method
设置pir视频录像状态(人体侦测)
Implementation
Future<bool> setAlarmPirVideoPush(
{int? pirPushEnable,
int? pirVideoEnable,
int? pirVideoDuration,
int? autoRecordMode,
int timeout = 5}) async {
int? pushEnable1 = pirPushEnable ?? pushEnable;
int? videoEnable1 = pirVideoEnable ?? videoEnable;
int? videoDuration1 = pirVideoDuration ?? videoDuration;
int? autoRecordMode1 = autoRecordMode ?? autoRecordVideoMode;
bool ret = await writeCgi(
"trans_cmd_string.cgi?cmd=2106&command=9&pirPushSwitch=${pushEnable1 == 1 ? 1 : 0}&pirPushSwitchVideo=${videoEnable1 == 1 ? 1 : 0}&CloudVideoDuration=${videoDuration1 ?? 15}&autoRecordMode=${autoRecordMode1 ?? 0}&",
timeout: timeout);
if (ret) {
CommandResult result = await waitCommandResult((int cmd, Uint8List data) {
if (cmd == 24785) {
String str = utf8.decode(data);
return str.contains("cmd=2106;") && str.contains("command=9;");
}
return false;
}, timeout);
if (result.isSuccess) {
Map data = result.getMap();
if (data["result"] == "0") {
pushEnable = pushEnable1;
videoEnable = videoEnable1;
videoDuration = videoDuration1;
autoRecordVideoMode = autoRecordMode1;
return true;
}
}
}
return false;
}