Skip to content

Commit f4952d2

Browse files
committed
Changes to support ASH window TX_K=5
Signed-off-by: Chris Jackson <[email protected]>
1 parent e6bc2ea commit f4952d2

File tree

1 file changed

+10
-9
lines changed
  • com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash

1 file changed

+10
-9
lines changed

com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandler.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ public class AshFrameHandler implements EzspProtocolHandler {
8383
/**
8484
* Maximum number of DATA frames we can transmit without an ACK
8585
*/
86-
private final int TX_WINDOW = 1;
86+
private final int TX_WINDOW = 5;
8787

8888
private long sentTime;
8989

9090
private static final int ASH_CANCEL_BYTE = 0x1A;
9191
private static final int ASH_FLAG_BYTE = 0x7E;
9292
private static final int ASH_SUBSTITUTE_BYTE = 0x18;
9393
private static final int ASH_XON_BYTE = 0x11;
94-
private static final int ASH_OFF_BYTE = 0x13;
94+
private static final int ASH_XOFF_BYTE = 0x13;
9595
private static final int ASH_TIMEOUT = -1;
9696

9797
private static final int ASH_MAX_LENGTH = 220;
@@ -218,7 +218,7 @@ private int[] getPacket() throws IOException {
218218
case ASH_XON_BYTE:
219219
// XON: Resume transmissionUsed in XON/XOFF flow control. Always ignored if received by the NCP.
220220
break;
221-
case ASH_OFF_BYTE:
221+
case ASH_XOFF_BYTE:
222222
// XOFF: Stop transmissionUsed in XON/XOFF flow control. Always ignored if received by the NCP.
223223
break;
224224
case ASH_TIMEOUT:
@@ -300,7 +300,7 @@ public void run() {
300300

301301
AshFrameData dataPacket = (AshFrameData) packet;
302302

303-
// Check for out of sequence frame number
303+
// Check for correct sequence frame number
304304
if (packet.getFrmNum() == ackNum) {
305305
// Clear rejection condition
306306
rejectionCondition = false;
@@ -555,19 +555,20 @@ private synchronized void sendFrame(AshFrame ashFrame) {
555555

556556
private void sendRetry() {
557557
logger.debug("ASH: Retry Sent Queue Length {}", sentQueue.size());
558-
AshFrameData ashFrame = sentQueue.peek();
559-
if (ashFrame == null) {
558+
if (sentQueue.isEmpty()) {
560559
logger.debug("ASH: Retry nothing to resend!");
561560
return;
562561
}
563562

564-
ashFrame.setReTx();
565-
outputFrame(ashFrame);
563+
for (AshFrameData ashFrame : sentQueue) {
564+
ashFrame.setReTx();
565+
outputFrame(ashFrame);
566+
}
566567
}
567568

568569
// Synchronize this method to ensure a packet gets sent as a block
569570
private synchronized void outputFrame(AshFrame ashFrame) {
570-
ashFrame.setAckNum(ackNum);
571+
ashFrame.setAckNum((ackNum + sentQueue.size() - 1) & 0x07);
571572
logger.debug("--> TX ASH frame: {}", ashFrame);
572573

573574
// Send the data

0 commit comments

Comments
 (0)