Class Dcc4PcRawDecoder

java.lang.Object
jmri.jmrix.dcc4pc.Dcc4PcRawDecoder

public class Dcc4PcRawDecoder extends Object
Decodes the Raw RailCom encoding of a DCC4PC RailCom reader (Omnibus specification section 9.3). Each packet gives one DCC packet the reader saw, the state of every enabled input and the RailCom bytes each input with RailCom data received in the cutout that followed.

The encoding is stateful: type 1 packets carry no input states and inherit them from the packet before, and the number of duplicate-flag and length bytes that follow depends on those states. RailCom data may also be sent as "duplicate of the 1st, 2nd or 3rd previous" for an input. The decoder therefore only works on an unbroken stream that starts right after a Reset Encoding State, which sets every input to unoccupied. A Get Data reply may end part way through a packet; the leftover bytes are kept and joined to the next reply.