From e8dd0b0fab23bcb7128be0d2093cbe946757683b Mon Sep 17 00:00:00 2001 From: Mathew Date: Tue, 19 Sep 2023 14:43:49 +1000 Subject: [PATCH] fix seq num starting point --- lib/Af.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/Af.js b/lib/Af.js index f891982..2947411 100644 --- a/lib/Af.js +++ b/lib/Af.js @@ -13,7 +13,6 @@ const EventEmitter = require('eventemitter2'), var zcl = require('./Packet'), zutils = CcZnp.utils, ZSC = CcZnp.constants, - seqNumber = 0, debug = Debug("zstack-af"), zclDebug = Debug("zstack-af:ZCL"); @@ -67,12 +66,10 @@ class Af extends EventEmitter { } nextZclSeqNum() { - seqNumber ++; // seqNumber is a private var on the top of this module - if (seqNumber >= 253 || seqNumber < 0) - seqNumber = 0; - - this._seq = seqNumber; - return seqNumber; + this._seq ++; // seqNumber is a private var on the top of this module + if (this._seq >= 253 || this._seq < 0) + this._seq = 0; + return this._seq; } // 4 types of message: dataConfirm, reflectError, incomingMsg, incomingMsgExt, zclIncomingMsg