Menu

#8 Signal PDU Bug in Data Length Field

open
nobody
None
5
2012-10-30
2009-08-26
No

The 'Data Length' field is packed/unpacked as bytes instead of bits.

Regards,

Shane Fernando

Discussion

  • Peter Smith

    Peter Smith - 2009-09-28

    The C# code has corrected this error. The Java code needs to allow the user to enter the Data length field as the current method uses a one byte chunk to determine length, which overrides any user input.
    For marshal method C# used:
    dos.writeShort((short)((_dataLength == 0 && _data.Length > 0) ? _data.Length * 8 : _dataLength)); //If dataLength is zero then default to every byte will use all 8 bits (where _data is the actual signal data).

    For Unmarshal:
    _data = dis.readByteArray((_dataLength / 8) + (_dataLength % 8 > 0 ? 1 : 0)); //Needed to convert from bits to bytes and checks for odd number of bits

    Peter

     
  • Shane Fernando

    Shane Fernando - 2009-09-29

    This is in reference to the C++ code

     
  • Peter Smith

    Peter Smith - 2009-09-29

    Yes, understood. Just outlining what needed to be done to correct the problem as i believe it also is a problem with the Java code.