getAiDetectData method
Implementation
Future<bool> getAiDetectData(int aiType, {int timeout = 5}) async {
bool ret = await _command.writeCgi(
"trans_cmd_string.cgi?cmd=2400&command=1&AiType=$aiType&",
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=2400;") && str.contains("command=1;");
}
return false;
}, timeout);
if (result.isSuccess == true) {
Map data = result.getMap();
print('==>>获取getAiDetectData:$data');
Map<String, dynamic> aiCfg = jsonDecode((data["AiCfg"]));
if (aiCfg is Map) {
aiConfigMap = aiCfg;
} else {
print('==>>AiCfg 不是个Map');
}
return data["result"] == "0";
}
}
return false;
}