SignalCodec
Transport-independent DBC signal encoding and decoding.
Bit numbers use DBC’s least-significant-bit numbering within each byte. Motorola traversal decreases within a byte, then moves to the most significant bit of the next byte. Signals must fit in the payload and have lengths from 1 to 64 bits. Raw values are unsigned bit patterns, including for signed signals. Failed operations leave output arguments unchanged. Physical conversion uses double precision and may lose integer precision for wide signals; use the raw methods when exact 64-bit values are required.
Public Static Methods
Section titled “Public Static Methods”| Return | Name | Description |
|---|---|---|
bool | readRaw static | Extracts the raw bit pattern; returns false for an invalid layout. |
bool | writeRaw static | Inserts a raw bit pattern, preserving other bits; rejects values that do not fit. |
bool | decode static | Decodes a signed or unsigned raw value as raw * factor + offset. |
bool | encode static | Encodes a physical value using (physical - offset) / factor. |
static
readRaw
Section titled “readRaw”Extracts the raw bit pattern; returns false for an invalid layout.
static
writeRaw
Section titled “writeRaw”Inserts a raw bit pattern, preserving other bits; rejects values that do not fit.
static
decode
Section titled “decode”Decodes a signed or unsigned raw value as raw * factor + offset.
Returns
Section titled “Returns”False for an invalid layout, non-finite conversion, or non-finite factor or offset.
static
encode
Section titled “encode”Encodes a physical value using (physical - offset) / factor.
The result is rounded to nearest integer, with ties away from zero. Returns false for non-finite values, zero factor, invalid layouts, or results outside the signed or unsigned signal range. No bits change on failure.