getAlarmPlan method
获取报警计划 type == 2 报警计划
Implementation
Future<bool> getAlarmPlan(int command, int type, {int timeout = 5}) async {
bool ret = await writeCgi(
"trans_cmd_string.cgi?cmd=2017&command=11&type=$type&mark=123456789&",
timeout: timeout);
if (ret) {
CommandResult result = await waitCommandResult((int cmd, Uint8List data) {
if (cmd == 24785) {
String str = utf8.decode(data);
return str.contains("cmd=2017;") && str.contains("command=11;");
}
return false;
}, timeout);
if (result.isSuccess) {
Map data = result.getMap();
if (data["result"] == "0") {
if (data["motion_push_enable"] == "0") {
pirPushEnable = false;
} else {
pirPushEnable = true;
}
//currentAlarmType = int.parse(data["motion_push_enable"]);
return true;
}
}
}
return false;
}