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, toPayloadByteArrayprotected 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 LynxMessagejava.lang.InterruptedExceptionpublic boolean isRetransmittable()
public void setUnretransmittable()
public void noteRetransmission()
noteRetransmission in class LynxMessagepublic boolean hasBeenAcknowledged()
public boolean isAckOrResponseReceived()
public boolean isNackReceived()
public LynxNack getNackReceived()
public boolean isAckable()
isAckable in class LynxMessagepublic void pretendFinish()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic 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.InterruptedExceptionLynxNackExceptionpublic RESPONSE sendReceive() throws java.lang.InterruptedException, LynxNackException
java.lang.InterruptedExceptionLynxNackExceptionprotected boolean usePretendResponseIfRealModuleDoesntSupport()
protected void throwNackForUnsupportedCommand(LynxUnsupportedCommandException e) throws LynxNackException
LynxNackExceptionprotected RESPONSE responseOrThrow() throws LynxNackException
LynxNackExceptionprotected void throwIfNack()
throws LynxNackException
LynxNackExceptionprotected 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.InterruptedExceptionprotected void awaitAckResponseOrNack()
throws java.lang.InterruptedException
java.lang.InterruptedException