open-dis / open-dis-python

Python implementation of the IEEE-1278.1 Distributed Interactive Simulation (DIS) application protocol v7

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

signed bytes in signal pdu

HalRules opened this issue · comments

I had issues properly reading data from a signal pdu, and tracked it down to code in the SignalPDu and VariableDatum classes.
Specifically, the write_byte method defaults to a signed byte. I was able to successfully use the library after changing instances of "write_byte" to "write_unsigned_byte" and "read_byte" to "read_byte_unsinged".

Specifically on lines:
3605,3609,3618,3623,7144,7160

I also modified line 7141 to "write_unsigned_short" and line 7157 to "read_unsigned_short"
The unsigned shorts were specifically required to get the proper value for larger data lengths.

I suspect all bytes should be unsigned, but have only tested those required for the signal pud.

Thank-you @HalRules
Would you like to submit a pull request for the change?