private void RaisePduErrorEvent(PduException exception, byte[] byteDump, PduHeader header, Pdu pdu) { if (PduError == null) { return; } PduErrorEventArgs e = new PduErrorEventArgs(exception, byteDump, header, pdu); foreach (EventHandler <PduErrorEventArgs> del in PduError.GetInvocationList()) { del.BeginInvoke(this, e, AsyncCallBackRaisePduErrorEvent, del); } }
public PduErrorEventArgs(PduException exception, byte[] byteDump, PduHeader header) { _vException = exception; _vByteDump = byteDump; _vHeader = header; }
public PduErrorEventArgs(PduException exception, byte[] byteDump, PduHeader header, Pdu pdu) : this(exception, byteDump, header) { _vPdu = pdu; }
private async void ReadLoop() { Log.V("Starting read loop, state: {0}", this); Exception error = null; try { var exit = false; do { Log.V("Awaiting for step in read loop, state: {0}", this); ConnectionStepResult step; try { step = await _connection.DoStep().ConfigureAwait(false); } finally { await this.Yield(); } Log.V("Step completed in read loop, state: {0}", this); if (_process.IsCompleted) { Log.V("Exit read loop because state is completed, state: {0}", this); return; } exit = step.Match( disconnected: _ => { Log.V("Disconnected step, state: {0}", this); return(true); }, expectedReply: _ => { Log.V("Expected reply step, state: {0}", this); return(false); }, unexpectedReply: _ => { Log.W("Unexpected reply step, state: {0}", this); return(false); }, unsolicitedEvent: uns => { var pdu = uns.pdu; if (pdu.Action == RtmActions.CoreError) { Log.W("Unsolicited error step, state: {0}, pdu: {1}", this, pdu); error = new PduException(pdu); return(true); } Log.V("Unsolicited event step, state: {0}, pdu: {1}", this, pdu); Fsm.NotifyUnsolicitedEvent(pdu); return(false); }, error: e => { Log.V("Error step, state: {0}, error: {1}", this, e?.error); error = e.error; return(true); }); } while (!exit); } catch (Exception exn) { Log.E(exn, "Exception in ReadLoop methid, state: {0}", this); error = exn; } if (error != null) { Fsm.NotifyError(TaskHelper.Unwrap(error)); } _process.Succeed(new Awaiting(this)); }