Class RmtUtils
Static class contains general utilities related to coding and decoding RMT data.
public static class RmtUtils
- Inheritance
-
RmtUtils
- Inherited Members
Methods
DecodeSymbolArrayToBytes(RmtSymbol[], int, bool, int, int, bool)
Decodes a sequence of captured RMT symbols into a packed byte array. This method interprets each symbol as one bit, using the duration of the SPACE level (carrier OFF) to determine whether the bit is 0 or 1.
public static byte[] DecodeSymbolArrayToBytes(RmtSymbol[] symbols, int thresholdMicroseconds, bool msbFirst, int symbolOffset, int symbolLength, bool spaceIsHigh)
Parameters
symbolsRmtSymbol[]The array of RmtSymbol structures captured by an RMT receiver. Each symbol contains two durations and two logic levels representing the waveform transitions.
thresholdMicrosecondsintThe duration threshold, in microseconds, used to classify a bit. Durations shorter than this value are treated as logical 0; durations equal to or longer than this value are treated as logical 1.
msbFirstboolIf true, bits are packed into each byte starting from the most significant bit. If false, bits are packed starting from the least significant bit.
symbolOffsetintThe index of the first symbol to decode. This allows skipping protocol‑specific headers, leaders, or preambles. Must be within the bounds of the symbol array.
symbolLengthintThe number of symbols to decode. If set to -1, all remaining symbols from
symbolOffsetto the end of the array are decoded.spaceIsHighboolIndicates which logic level represents SPACE (carrier OFF). If true, SPACE corresponds to logic HIGH; if false, SPACE corresponds to logic LOW. The duration of the SPACE level is used to determine the bit value.
Returns
- byte[]
A byte array containing the decoded bit stream, packed sequentially from the selected symbols. The array length is
(count + 7) / 8, wherecountis the number of decoded symbols. WhensymbolLengthis -1,countissymbols.Length - symbolOffset.