public void AddReply(Reply.EType _replyType, int _replySize) { lock (SyncObj) { Lreply.Add(new Reply(_replyType, _replySize)); } }
public void Exec(int _abonent, int _timeout, string _cmd, Request.Etype _request, string request_data, out Reply.EType _replyType, out string _replyData) { lock (SyncObj) { request = new Request(_request, _cmd, request_data); _replyType = Reply.EType.None; _replyData = null; if (!comPort.Write(request.Get(_abonent, _timeout))) { _replyData = "Не смогли послать запрос"; return; } string packet = string.Empty; for (; ;) { byte[] c = comPort.ReadSome(1); if (c.Length != 1) { if (packet.Length == 0) { _replyData = "Нет ответа"; } else { _replyData = "Ответ не разобран"; } return; } packet += Encoding.ASCII.GetString(c); foreach (Reply p in Lreply) { if (p.parse(_abonent, packet)) { _replyType = p.TP; _replyData = p.result; return; } } } } }
public void AddReply(Reply.EType _replyType) { AddReply(_replyType, 0); }