Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seqn number always the same #2

Open
Links2004 opened this issue Sep 23, 2017 · 0 comments
Open

seqn number always the same #2

Links2004 opened this issue Sep 23, 2017 · 0 comments

Comments

@Links2004
Copy link
Contributor

my KNX network gateway does not work when the seqn is the same on every request.
first write will work but the next one gets a ACK but will never be send on the bus.
not sure if this true for all gateways.

can be fixed with:

  /**
   * Generates next sequence number to number each knx telegram
   */
  protected lastSeqnId: number = -1;
  protected nextSeqn() {
    let id = this.lastSeqnId;
    id++;
    if (id > 0xFF) {
        id = 0;
    }
    while (this.sequenceIds.has(id)) {
        id++;
        if (id > 0xFF) {
            id = 0;
        }
        if (id == this.lastSeqnId) {
            throw new Error('Maximum sequence number reached');
        }
    }
    this.lastSeqnId = id;
    this.sequenceIds.add(id);
    return id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant