//Kiem tra uid qua cong telnet public bool excuteTelnet() { bool ret = false; var prop_uidresult = testingInfo.GetType().GetProperty("uidResult"); prop_uidresult.SetValue(testingInfo, "Waiting..."); //get logsytem var prop_logsystem = testingInfo.GetType().GetProperty("logSystem"); string log_value = (string)prop_logsystem.GetValue(testingInfo); try { if (!camera.IsConnected()) { goto END; } int count = 0; RE: count++; string data = camera.getUidCode(); log_value += string.Format("{0}\n", data); prop_logsystem.SetValue(testingInfo, log_value); if (data != null) { ret = data.ToUpper().Contains(std_value.ToUpper()); } if (!ret) { if (count < retry_time) { goto RE; } } } catch (Exception ex) { log_value += ex.ToString(); prop_logsystem.SetValue(testingInfo, log_value); goto END; } END: prop_uidresult.SetValue(testingInfo, ret ? "Passed" : "Failed"); return(ret); }
bool _checkUIDCode(Dut.IPCamera <U> camera, string vnpt_uid_header, out string uid_code) { var prop_logsystem = uploadInfo.GetType().GetProperty("logSystem"); string log_value = (string)prop_logsystem.GetValue(uploadInfo); bool ret = false; int count = 0; RE: count++; //đọc uid uid_code = camera.getUidCode(); uid_code = uid_code.Replace("[", "") .Replace("]", "") .Replace("\n", "") .Replace("\r", "") .Replace("~ #", "") .Trim(); log_value += string.Format("...đọc uid: {0}\n", uid_code); prop_logsystem.SetValue(uploadInfo, log_value); //check header ret = uid_code.ToLower().Substring(0, vnpt_uid_header.Length).Contains(vnpt_uid_header.ToLower()); log_value += string.Format("...check header: {0}\n", ret); prop_logsystem.SetValue(uploadInfo, log_value); if (!ret) { if (count < 3) { goto RE; } else { goto END; } } //check trùng khớp với mac string mac = camera.getMacEthernet(); string md5_from_mac = myConverter.stringToMD5(mac); ret = uid_code.ToLower().Contains(md5_from_mac.ToLower()); log_value += string.Format("...check trùng khớp với mac md5 {0}: {1}\n", md5_from_mac, ret); prop_logsystem.SetValue(uploadInfo, log_value); if (!ret) { if (count < 3) { goto RE; } else { goto END; } } END: return(ret); }