getMotionAlarmPlan method

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

Implementation

Future<bool> getMotionAlarmPlan({int timeout = 5}) async {
  bool ret = await writeCgi(
      "trans_cmd_string.cgi?cmd=2017&command=11&mark=212&type=2&",
      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;") &&
            str.contains("type=2;");
      }
      return false;
    }, timeout);
    if (result.isSuccess) {
      Map data = result.getMap();
      if (data.containsKey("motion_push_enable")) {
        motionAlarmPlanData = data;
      }
      return data["result"] == "0";
    }
  }
  return false;
}