public void Start() { TransactionUser.NuevaSolicitud(pdu, this, Transport); if (pdu.RequiresAnswer) { rta = TransactionUser.RequieroRespuesta(pdu, this, Transport); rta.DeviceId = pdu.DeviceId; rta.Destination = pdu.Destination; rta.Seq = pdu.Seq; } else { rta = new PDU { DeviceId = pdu.DeviceId, Seq = pdu.Seq, Options = pdu.Options, Destination = pdu.Destination, CH = ((byte)Decoder.ComandoH.OKACK), CL = ResponseCL }; } Transport.Send(rta); SetupDisposeTimer(); if (pdu.RequiresACK) { State = States.RESPONDIENDO; SetupRetryTimer(); } else { State = States.CONFIRMANDO; } }
public MRS(PDU _pdu, AbstractTransport t, TransactionUser ut) : base(t, ut) { pdu = _pdu; Seq = pdu.Seq; DeviceId = pdu.DeviceId; }
public MRC(PDU _pdu, AbstractTransport t, TransactionUser ut) : base(t, ut) { pdu = _pdu; Seq = pdu.Seq; DeviceId = pdu.DeviceId; State = States.INICIO; }
public override void DisposeTimerExpired(object sender) { if (State == States.CONFIRMANDO) { State = States.TERMINADO; Transport.TransaccionCompleta(this, pdu); } else if (State == States.RESPONDIENDO) { State = States.TERMINADO; TransactionUser.RespuestaNoEntregada(rta, this, Transport); Transport.TransaccionCompleta(this, pdu); } }
public override void DisposeTimerExpired(object sender) { if (State == States.ENVIANDO) { State = States.TERMINADO; TransactionUser.SolicitudNoEnviada(pdu, this, Transport); Transport.TransaccionCompleta(this, pdu); } else if (State == States.CONFIRMANDO) { State = States.TERMINADO; // no se informa TU Transport.TransaccionCompleta(this, pdu); } }
public override void ReceivedPDU(PDU p) { if (State == States.CONFIRMANDO) { Transport.Send(rta); } else if (State == States.RESPONDIENDO) { if (p.CH != pdu.CH) { State = States.TERMINADO; TransactionUser.RespuestaEntregada(p, this, Transport); Transport.TransaccionCompleta(this, pdu); } } }
public override void ReceivedPDU(PDU response) { if (State == States.ENVIANDO) { if (response.RequiresACK) { State = States.CONFIRMANDO; pdu = TransactionUser.RequieroACK(response, this, Transport); pdu.Destination = response.Destination; Transport.Send(pdu); } else { State = States.TERMINADO; TransactionUser.SolicitudEntregada(response, pdu, this, Transport); Transport.TransaccionCompleta(this, pdu); } } else if (State == States.CONFIRMANDO) { // se reenvia el ack, pues llego la rta nuevamente. Transport.Send(pdu); } }
protected Transaction(AbstractTransport t, TransactionUser ut) { Transport = t; TransactionUser = ut; State = States.INICIO; }