getAlarmCustomeZone method

Future<bool> getAlarmCustomeZone(
  1. int command, {
  2. int timeout = 5,
  3. int sensor = 0,
})

Implementation

Future<bool> getAlarmCustomeZone(int command,
    {int timeout = 5, int sensor = 0}) async {
  bool ret = await writeCgi(
      "trans_cmd_string.cgi?cmd=2123&command=$command&sensor=${sensor}&",
      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();
      customeZoneData = data;
      return data["result"] == "0";
    }
  }
  return false;
}