private void AtComm_PortTimeOutEvent(object sender, AtComm.AtCommEventArgs e) { Console.Write("超时"); AtComm AT = (AtComm)sender; if (AT.Index == atComm.Index) { this.BeginInvoke(new printToWindows(DoPrintToWindows)); } }
private void AtComm_PortSourceSuccessEvent(object sender, AtComm.AtCommEventArgs e) { AtComm AT = (AtComm)sender; Console.WriteLine("S:{0}", AT.SendStr); Console.WriteLine("R:{0}", AT.ReceviceStr); if (AT.Index == atComm.Index) { this.BeginInvoke(new printToWindows(DoPrintToWindows)); } }
void runATCS(object obj) { string[] strs = (string[])obj; for (int i = 0; i < strs.Count(); i++) { myEvent.WaitOne(); atComm = new AtComm(strs[i]); //atComms[i].SendStr = "AT"; atComm.PortReceviceEvent += AtComm_PortReceviceEvent; atComm.PortErrorEvent += AtComm_PortErrorEvent; atComm.PortTimeOutEvent += AtComm_PortTimeOutEvent; atComm.PortSourceSuccessEvent += AtComm_PortSourceSuccessEvent; atComm.Index = i; atComm.Run(serialPort1, true); } atSendOver = true; }
public static void readStr(object sender, AtComm.PortReceviceEventArgs e) { AtComm atComm = (AtComm)sender; if (e.ReceviceStr.Length > 0) { if (atComm.hopeStr.ToUpper() != e.ReceviceStr.ToUpper()) { if (e.ReceviceStr.StartsWith(atComm.sendStr)) { atComm.tempStr += e.ReceviceStr; } } else { Console.WriteLine("True"); } } }