Documentation
¶
Overview ¶
Package ir decodes raw infrared remote-control timing captures into the protocol + address/command — the IR analogue of the Sub-GHz protocol decoders, and the complement to the file-level ir_decode_file (which only reads a .ir file's already-parsed entries).
Wrap-vs-native judgement ¶
Native. Consumer-IR protocols are public, fully-deterministic pulse-distance encodings documented for decades (NEC by NEC/Renesas, reproduced in LIRC, the Flipper IR stack, and Arduino-IRremote). Decoding is a leader-match plus a per-bit mark/space classifier over the captured microsecond timings the operator already has (ir_receive raw, a Flipper RAW .ir entry, or a logic-analyser capture) — no IR hardware at decode time.
Verifiable / no confidently-wrong output ¶
NEC carries a built-in checksum: the 8-bit address is followed by its bitwise inverse and the 8-bit command by its inverse. A standard NEC frame is reported only when BOTH inversions hold; when only the command inversion holds it is reported as NEC-extended (16-bit address, no address inversion); when neither holds the raw 4 bytes are surfaced with a note rather than a guessed address/command. The leader and every bit are tolerance-matched, so a non-NEC pulse train is rejected, not mis-decoded.
Covered / deferred ¶
The NEC family (standard, extended, and the repeat code), Sony SIRC (12 / 15 / 20-bit), Samsung, and Philips RC5 / RC5X (14-bit Manchester) are covered — the most common consumer-IR protocols across the three encoding families (pulse-distance, pulse-width, and bi-phase). NEC is gated by its address/command inverse-byte checksum; the checksum-less protocols are gated structurally instead — SIRC by its 2400µs leader + exact 12/15/20-bit count, and RC5 by an exact 28-half-bit Manchester reconstruction with a valid S1 start bit (a polarity-inverted or non-RC5 train fails the bit-pair or S1 gate and is rejected, not mis-decoded). RC6 (a more complex Manchester variant with a double-width toggle) and the Pronto/`ir_build` parsed formats are deliberately not decoded here yet.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Protocol string `json:"protocol"`
Address int `json:"address"`
AddressHex string `json:"address_hex"`
Command int `json:"command"`
CommandHex string `json:"command_hex"`
Bits int `json:"bits"`
ChecksumValid bool `json:"checksum_valid"`
RawBytesHex string `json:"raw_bytes_hex,omitempty"`
Notes []string `json:"notes,omitempty"`
}
Result is the decoded view of a raw IR capture.