setHumanDetectionLevel method

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

人形侦测等级 关-----0 高-----1 中-----2 低-----3

Implementation

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