public bool VhNetworkQualityTest(string vh_id, string adr_id, string sec_id, int acc_dist) { bool isSuccess = false; //Equipment eq = scApp.getEQObjCacheManager().getEquipmentByEQPTID(vh_id); AVEHICLE vh = scApp.getEQObjCacheManager().getVehicletByVHID(vh_id); //string remote_ip = vh.getIPAddress(scApp.getBCFApplication()); System.Net.IPEndPoint remote_ip = vh.getIPEndPoint(scApp.getBCFApplication()); if (remote_ip == null) { return(false); } PingReply reply = null; if (SCUtility.PingIt(remote_ip.Address, out reply)) { //saveAndUpdate(vh_id, adr_id, sec_id, acc_dist, reply.RoundtripTime); //int randomMax = 0; //int randomMin = 0; //if (SCUtility.isMatche(sec_id, "041") || // SCUtility.isMatche(sec_id, "043") || // SCUtility.isMatche(sec_id, "021") || // SCUtility.isMatche(sec_id, "035")) //{ // randomMax = 150; // randomMin = 101; //} //else if (SCUtility.isMatche(sec_id, "006") || // SCUtility.isMatche(sec_id, "202")) //{ // randomMax = 99; // randomMin = 51; //} //else //{ // randomMax = 49; // randomMin = 0; //} //if (SCUtility.isMatche(vh_id, "OHT03")) //{ // randomMax = 150; // randomMin = 101; //} //addNetworkQuality(vh_id, adr_id, sec_id, acc_dist, rnd.Next(randomMin, randomMax)); addNetworkQuality(vh_id, adr_id, sec_id, acc_dist, reply.RoundtripTime); isSuccess = true; } return(isSuccess); }
public bool VhNetworkQualityTest(string vh_id, string adr_id, string sec_id, int acc_dist) { bool isSuccess = false; //Equipment eq = scApp.getEQObjCacheManager().getEquipmentByEQPTID(vh_id); AVEHICLE eq = scApp.getEQObjCacheManager().getVehicletByVHID(vh_id); string remote_ip = eq.getIPAddress(scApp.getBCFApplication()); PingReply reply = null; if (SCUtility.PingIt(remote_ip, out reply)) { //saveAndUpdate(vh_id, adr_id, sec_id, acc_dist, reply.RoundtripTime); int randomMax = 0; int randomMin = 0; if (SCUtility.isMatche(sec_id, "041") || SCUtility.isMatche(sec_id, "043") || SCUtility.isMatche(sec_id, "021") || SCUtility.isMatche(sec_id, "035")) { randomMax = 150; randomMin = 101; } else if (SCUtility.isMatche(sec_id, "006") || SCUtility.isMatche(sec_id, "202")) { randomMax = 99; randomMin = 51; } else { randomMax = 49; randomMin = 0; } if (SCUtility.isMatche(vh_id, "OHT03")) { randomMax = 150; randomMin = 101; } addNetworkQuality(vh_id, adr_id, sec_id, acc_dist, rnd.Next(randomMin, randomMax)); isSuccess = true; } return(isSuccess); }