getAlarmZone method

Future<bool> getAlarmZone(
  1. int command, {
  2. int timeout = 5,
})

获取绘制区域 command ===1 /移动侦测区域 command ===3 /人形侦测区域

Implementation

Future<bool> getAlarmZone(int command, {int timeout = 5}) async {
  bool ret = await writeCgi(
      "trans_cmd_string.cgi?cmd=2123&command=$command&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=2123;") && str.contains("command=$command;");
      }
      return false;
    }, timeout);
    if (result.isSuccess) {
      Map data = result.getMap();
      if (data["result"] == "0") {
        return true;
      }
    }
  }
  return false;
}