configAiDetectPlan method
Implementation
Future<bool> configAiDetectPlan(int type,
{required List records, int enable = 1, int timeout = 5}) async {
var typeString;
switch (type) {
case 12:
//火
typeString = 'fire';
break;
case 14:
//区域入侵
typeString = 'region_entry';
break;
case 15:
//人逗留计划
typeString = 'person_stay';
break;
case 16:
//车违停计划
typeString = 'car_stay';
break;
case 17:
//越线检测计划
typeString = 'line_cross';
break;
case 18:
//离岗检测计划
typeString = 'person_onduty';
break;
case 19:
//车辆逆行计划
typeString = 'car_retrograde';
break;
case 20:
//包裹监测
typeString = 'package_detect';
break;
default:
break;
}
bool ret = await _command.writeCgi(
"trans_cmd_string.cgi?cmd=2017&command=$type&mark=1&"
"${typeString}_plan1=${records[0]}&"
"${typeString}_plan2=${records[1]}&"
"${typeString}_plan3=${records[2]}&"
"${typeString}_plan4=${records[3]}&"
"${typeString}_plan5=${records[4]}&"
"${typeString}_plan6=${records[5]}&"
"${typeString}_plan7=${records[6]}&"
"${typeString}_plan8=${records[7]}&"
"${typeString}_plan9=${records[8]}&"
"${typeString}_plan10=${records[9]}&"
"${typeString}_plan11=${records[10]}&"
"${typeString}_plan12=${records[11]}&"
"${typeString}_plan13=${records[12]}&"
"${typeString}_plan14=${records[13]}&"
"${typeString}_plan15=${records[14]}&"
"${typeString}_plan16=${records[15]}&"
"${typeString}_plan17=${records[16]}&"
"${typeString}_plan18=${records[17]}&"
"${typeString}_plan19=${records[18]}&"
"${typeString}_plan20=${records[19]}&"
"${typeString}_plan21=${records[20]}&"
"${typeString}_plan_enable=$enable&",
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=$type;");
}
return false;
}, timeout);
if (result.isSuccess) {
Map data = result.getMap();
print('==>>configAiDetectPlan:$type的结果:${data}');
if (data["status"] == "0" || data["result"] == "0") {
return true;
}
}
}
return false;
}