getAlarmPirVideoPush method

Future<bool> getAlarmPirVideoPush({
  1. int timeout = 5,
})

获取pir视频录像状态(人体侦测)

Implementation

Future<bool> getAlarmPirVideoPush({int timeout = 5}) async {
  bool ret = await writeCgi("trans_cmd_string.cgi?cmd=2106&command=8&",
      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=8;");
      }
      return false;
    }, timeout);
    if (result.isSuccess) {
      Map data = result.getMap();
      if (data["result"] == "0") {
        pushEnable = int.tryParse(data["pirPushSwitch"] ?? "") ?? 0;
        videoEnable = int.tryParse(data["pirPushSwitchVideo"] ?? "") ?? 0;
        if (data.containsKey("CloudVideoDuration")) {
          videoDuration =
              int.tryParse(data["CloudVideoDuration" ?? "15"]) ?? -1;
        } else {
          videoDuration = -1;
        }
        if (data.containsKey("autoRecordModey")) {
          autoRecordVideoMode =
              int.tryParse(data["autoRecordMode" ?? "0"]) ?? -1;
        } else {
          autoRecordVideoMode = 0;
        }
      }
      return data["result"] == "0";
    }
  }
  return false;
}