@Test public void receiveCommandState() { ZigBeeTransportTransmit transport = Mockito.mock(ZigBeeTransportTransmit.class); ApsDataEntity aps = new ApsDataEntity(transport); assertTrue(aps.receiveCommandState(0, ZigBeeTransportProgressState.RX_ACK)); }
public boolean receiveCommandState(int msgTag, ZigBeeTransportProgressState state) { ZigBeeApsFrame outgoingFrame = getFragmentedFrameFromQueue(msgTag); if (outgoingFrame == null) { return true; } logger.debug("receiveCommandState tag={}-{}: Fragment APS Frame: {}", msgTag, state, outgoingFrame); if (state == ZigBeeTransportProgressState.RX_NAK || state == ZigBeeTransportProgressState.TX_NAK) { abortFragmentedFrame(msgTag); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); if (state == ZigBeeTransportProgressState.TX_ACK && !outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.RX_ACK && outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.TX_ACK && outgoingFrame.getAckRequest() && outgoingFrame.getFragmentBase() + 1 == outgoingFrame.getFragmentTotal()) { logger.debug("TX ACKed for last block in frame: {}", outgoingFrame); return true; } if (outgoingFrame.getFragmentBase() == outgoingFrame.getFragmentTotal()) { logger.debug("Completed Sending Fragment APS Frame: {}", outgoingFrame); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); sendNextFragments(outgoingFrame); logger.debug("receiveCommandState DONE"); return false; }
ApsDataEntity { public boolean receiveCommandState(int msgTag, ZigBeeTransportProgressState state) { ZigBeeApsFrame outgoingFrame = getFragmentedFrameFromQueue(msgTag); if (outgoingFrame == null) { return true; } logger.debug("receiveCommandState tag={}-{}: Fragment APS Frame: {}", msgTag, state, outgoingFrame); if (state == ZigBeeTransportProgressState.RX_NAK || state == ZigBeeTransportProgressState.TX_NAK) { abortFragmentedFrame(msgTag); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); if (state == ZigBeeTransportProgressState.TX_ACK && !outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.RX_ACK && outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.TX_ACK && outgoingFrame.getAckRequest() && outgoingFrame.getFragmentBase() + 1 == outgoingFrame.getFragmentTotal()) { logger.debug("TX ACKed for last block in frame: {}", outgoingFrame); return true; } if (outgoingFrame.getFragmentBase() == outgoingFrame.getFragmentTotal()) { logger.debug("Completed Sending Fragment APS Frame: {}", outgoingFrame); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); sendNextFragments(outgoingFrame); logger.debug("receiveCommandState DONE"); return false; } }
ApsDataEntity { public boolean receiveCommandState(int msgTag, ZigBeeTransportProgressState state) { ZigBeeApsFrame outgoingFrame = getFragmentedFrameFromQueue(msgTag); if (outgoingFrame == null) { return true; } logger.debug("receiveCommandState tag={}-{}: Fragment APS Frame: {}", msgTag, state, outgoingFrame); if (state == ZigBeeTransportProgressState.RX_NAK || state == ZigBeeTransportProgressState.TX_NAK) { abortFragmentedFrame(msgTag); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); if (state == ZigBeeTransportProgressState.TX_ACK && !outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.RX_ACK && outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.TX_ACK && outgoingFrame.getAckRequest() && outgoingFrame.getFragmentBase() + 1 == outgoingFrame.getFragmentTotal()) { logger.debug("TX ACKed for last block in frame: {}", outgoingFrame); return true; } if (outgoingFrame.getFragmentBase() == outgoingFrame.getFragmentTotal()) { logger.debug("Completed Sending Fragment APS Frame: {}", outgoingFrame); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); sendNextFragments(outgoingFrame); logger.debug("receiveCommandState DONE"); return false; } ApsDataEntity(ZigBeeTransportTransmit transport); }
ApsDataEntity { public boolean receiveCommandState(int msgTag, ZigBeeTransportProgressState state) { ZigBeeApsFrame outgoingFrame = getFragmentedFrameFromQueue(msgTag); if (outgoingFrame == null) { return true; } logger.debug("receiveCommandState tag={}-{}: Fragment APS Frame: {}", msgTag, state, outgoingFrame); if (state == ZigBeeTransportProgressState.RX_NAK || state == ZigBeeTransportProgressState.TX_NAK) { abortFragmentedFrame(msgTag); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); if (state == ZigBeeTransportProgressState.TX_ACK && !outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.RX_ACK && outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.TX_ACK && outgoingFrame.getAckRequest() && outgoingFrame.getFragmentBase() + 1 == outgoingFrame.getFragmentTotal()) { logger.debug("TX ACKed for last block in frame: {}", outgoingFrame); return true; } if (outgoingFrame.getFragmentBase() == outgoingFrame.getFragmentTotal()) { logger.debug("Completed Sending Fragment APS Frame: {}", outgoingFrame); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); sendNextFragments(outgoingFrame); logger.debug("receiveCommandState DONE"); return false; } ApsDataEntity(ZigBeeTransportTransmit transport); void setDuplicateTimeWindow(Long duplicateTimeWindow); void setFragmentationWindow(int fragmentationWindow); void setFragmentationLength(int fragmentationLength); synchronized ZigBeeApsFrame receive(final ZigBeeApsFrame apsFrame); synchronized boolean send(final int msgTag, final ZigBeeApsFrame apsFrame); boolean receiveCommandState(int msgTag, ZigBeeTransportProgressState state); }
ApsDataEntity { public boolean receiveCommandState(int msgTag, ZigBeeTransportProgressState state) { ZigBeeApsFrame outgoingFrame = getFragmentedFrameFromQueue(msgTag); if (outgoingFrame == null) { return true; } logger.debug("receiveCommandState tag={}-{}: Fragment APS Frame: {}", msgTag, state, outgoingFrame); if (state == ZigBeeTransportProgressState.RX_NAK || state == ZigBeeTransportProgressState.TX_NAK) { abortFragmentedFrame(msgTag); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); if (state == ZigBeeTransportProgressState.TX_ACK && !outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.RX_ACK && outgoingFrame.getAckRequest()) { outgoingFrame.oneFragmentCompleted(); } if (state == ZigBeeTransportProgressState.TX_ACK && outgoingFrame.getAckRequest() && outgoingFrame.getFragmentBase() + 1 == outgoingFrame.getFragmentTotal()) { logger.debug("TX ACKed for last block in frame: {}", outgoingFrame); return true; } if (outgoingFrame.getFragmentBase() == outgoingFrame.getFragmentTotal()) { logger.debug("Completed Sending Fragment APS Frame: {}", outgoingFrame); return true; } logger.debug("receiveCommandState tag={}, fragmentBase={}, fragmentOutstanding={}", msgTag, outgoingFrame.getFragmentBase(), outgoingFrame.getFragmentOutstanding()); sendNextFragments(outgoingFrame); logger.debug("receiveCommandState DONE"); return false; } ApsDataEntity(ZigBeeTransportTransmit transport); void setDuplicateTimeWindow(Long duplicateTimeWindow); void setFragmentationWindow(int fragmentationWindow); void setFragmentationLength(int fragmentationLength); synchronized ZigBeeApsFrame receive(final ZigBeeApsFrame apsFrame); synchronized boolean send(final int msgTag, final ZigBeeApsFrame apsFrame); boolean receiveCommandState(int msgTag, ZigBeeTransportProgressState state);  }