Skip to content

Commit

Permalink
fix seq num starting point
Browse files Browse the repository at this point in the history
  • Loading branch information
splitice committed Sep 19, 2023
1 parent 2da433a commit e8dd0b0
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/Af.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e8dd0b0

Please sign in to comment.