tigoe / sACNSource

A library for sending DMX-512 messages in an sACN packet over UDP

Home Page:https://tigoe.github.io/sACNSource/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sequenceNumber is not set in packet

Trickfilm400 opened this issue · comments

Hi,
first: this library is nice, saved me a lot of work, but I have found an issue:

My application which I use for the incoming sACN data (DMXControl 3) needs to have a working sequence number, otherwise it will not accept any sACN data.

I found a bug in this library, were the sequence number stays "0", even if the internal variable is updated - but the value in the byte array packet doesn't get updated?

Here the sequence number gets incremented:

this->setSequenceNumber(this->_sequenceNumber++);

And here is the function for this - but the internal byte Array doesn't get updated:

_sequenceNumber = seqNum;

I made a quick fix:

void sACNSource::setSequenceNumber(byte seqNum) {
  // update sequence number:
  _byteArray[111] = seqNum;
  _sequenceNumber = seqNum;
}

See PR for the mentioned fix


Something to Note: It may be good to reset the sequence counter to 0 if it has reached 256 or something like this to prevent buffer overflow errors if the sequence is too high

void sACNSource::setSequenceNumber(byte seqNum) {
  // update sequence number:
  _byteArray[111] = seqNum;
  _sequenceNumber = seqNum;
  if (_sequenceNumber > 256) _sequenceNumber = 0;
}