public abstract class LynxRespondable<RESPONSE extends LynxMessage> extends LynxMessage
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.CountDownLatch |
ackOrNackReceived |
protected boolean |
isAckOrResponseReceived |
protected LynxNack |
nackReceived |
protected RESPONSE |
response |
protected java.util.concurrent.CountDownLatch |
responseOrNackReceived |
protected int |
retransmissionsRemaining |
hasBeenTransmitted, messageNumber, module, nanotimeLastTransmit, payloadTimeWindow, referenceNumber, serialization
Constructor and Description |
---|
LynxRespondable(LynxModuleIntf module) |
acquireNetworkLock, forgetSerialization, fromPayloadByteArray, getCommandNumber, getDestModuleAddress, getMessageNumber, getModule, getModuleAddress, getNanotimeLastTransmit, getPayloadTimeWindow, getReferenceNumber, getSerialization, hasBeenTransmitted, invokeStaticNullaryMethod, isAck, isNack, isResponse, isResponseExpected, loadFromSerialization, noteHasBeenTransmitted, releaseNetworkLock, resetModulePingTimer, setMessageNumber, setModule, setNanotimeLastTransmit, setPayloadTimeWindow, setReferenceNumber, setSerialization, toPayloadByteArray
protected boolean isAckOrResponseReceived
protected LynxNack nackReceived
protected java.util.concurrent.CountDownLatch ackOrNackReceived
protected int retransmissionsRemaining
protected java.util.concurrent.CountDownLatch responseOrNackReceived
protected RESPONSE extends LynxMessage response
public LynxRespondable(LynxModuleIntf module)
public void onPretendTransmit() throws java.lang.InterruptedException
onPretendTransmit
in class LynxMessage
java.lang.InterruptedException
public boolean isRetransmittable()
public void setUnretransmittable()
public void noteRetransmission()
noteRetransmission
in class LynxMessage
public boolean hasBeenAcknowledged()
public boolean isAckOrResponseReceived()
public boolean isNackReceived()
public LynxNack getNackReceived()
public boolean isAckable()
isAckable
in class LynxMessage
public void pretendFinish() throws java.lang.InterruptedException
java.lang.InterruptedException
public void onAckReceived(LynxAck ack)
protected void noteAttentionRequired()
public void onResponseReceived(LynxMessage response)
public void onNackReceived(LynxNack nack)
public void send() throws java.lang.InterruptedException, LynxNackException
java.lang.InterruptedException
LynxNackException
public RESPONSE sendReceive() throws java.lang.InterruptedException, LynxNackException
java.lang.InterruptedException
LynxNackException
protected boolean usePretendResponseIfRealModuleDoesntSupport()
protected void throwNackForUnsupportedCommand(LynxUnsupportedCommandException e) throws LynxNackException
LynxNackException
protected RESPONSE responseOrThrow() throws LynxNackException
LynxNackException
protected void throwIfNack() throws LynxNackException
LynxNackException
protected int getMsAwaitInterval()
protected int getMsRetransmissionInterval()
protected void awaitAndRetransmit(java.util.concurrent.CountDownLatch latch, LynxNack.ReasonCode nackCode, java.lang.String message) throws java.lang.InterruptedException
java.lang.InterruptedException
protected void awaitAckResponseOrNack() throws java.lang.InterruptedException
java.lang.InterruptedException