getPresetCruisePlan method

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

Implementation

Future<bool> getPresetCruisePlan({int timeout = 5}) async {
  bool ret = await _command.writeCgi(
      "trans_cmd_string.cgi?cmd=2017&command=11&mark=781698&type=10&status=0&",
      timeout: timeout);
  if (ret) {
    CommandResult result =
        await _command.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.containsKey("preset_cruise_plan_enable")) {
        presetCruisePlanData = data;
        presetCruisePlanEnable =
            int.tryParse(data["preset_cruise_plan_enable"]) ?? 0;
      }
      return data["result"] == "0";
    }
  }
  return false;
}