-
Notifications
You must be signed in to change notification settings - Fork 35
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
Signal PDU data length is in bytes but should be in bits (DIS 7) #116
Conversation
Thanks @adamwrobinson5 , I'll take a closer look shortly. Do you happen to have a sample dis7 signal and transmitter pdu to include in a unit test? |
Thanks for getting back to me so quickly! Unfortunately, I do not have a sample pdu that I can provide. |
public short getDataLength() { | ||
return (short) data.length; | ||
if (dataLength == 0) { | ||
return (short) (data.length * 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamwrobinson5 Could you explain the importance of checking length for 0 and the line that follows?
We didn't do that on the DIS 6 equivalent Signal PDU and wondering if it's required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required, it was just a way to abstract a DIS-ism. IAW the standard, the data length should be the length of the data field in bits. Since data is a byte array, the data length field would be the length of the byte array multiplied by 8.
I can take it out though if you'd prefer it not be in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok yes let's take it out and just rely on returning the dataLength.
@adamwrobinson5 I think we may also need to modify the This change was required to the open-dis-java/src/main/java/edu/nps/moves/dis/SignalPdu.java Lines 270 to 271 in 4ba5e51
And in the open-dis-java/src/main/java/edu/nps/moves/dis/SignalPdu.java Lines 232 to 249 in 4ba5e51
|
@leif81 Added those changes |
Thank-you @adamwrobinson5 ! |
Fixes issue #56