| 1 | package Protocol::IR::Proto::NEC2; | ||
| 2 | 55 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 55 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 55 | our $VERSION = '1.5'; | |
| 6 | |||
| 7 | 55 | ▶ | use parent 'Protocol::IR::Proto::NEC'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | # NEC2 is the MakeHex nec2.irp protocol: 'Like NEC1, but repeats entire | ||
| 10 | # pattern'. For a single frame its timing and data layout are identical to | ||
| 11 | # NEC1 (full 9000/4500 µs header, Default S=~D), so this class only changes | ||
| 12 | # the protocol name. The repeat difference is invisible to the single-frame | ||
| 13 | # decoders; preserving the name keeps the whole-frame repeat semantics | ||
| 14 | # through conversions. | ||
| 15 | 22 | ▶ | sub _protocol_name { 'NEC2' } |
|
Subroutine
_protocol_name: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 55 | 1; | |
| 18 | |||
| 19 | =encoding utf8 | ||
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | Protocol::IR::Proto::NEC2 - NEC2 protocol handler (repeats the whole frame) | ||
| 24 | |||
| 25 | =head1 VERSION | ||
| 26 | |||
| 27 | version 1.5 | ||
| 28 | |||
| 29 | =head1 SYNOPSIS | ||
| 30 | |||
| 31 | use Protocol::IR::Converter; | ||
| 32 | |||
| 33 | my $converter = Protocol::IR::Converter->new(); | ||
| 34 | |||
| 35 | # NEC2 differs from NEC1 only in its repeat behavior: while NEC1 | ||
| 36 | # repeats a short header+gap "ditto" frame, NEC2 re-transmits the | ||
| 37 | # entire 32-bit frame. A single NEC2 frame is timing-identical to a | ||
| 38 | # NEC1 frame. | ||
| 39 | my $code = $converter->import_code('NEC2', | ||
| 40 | { device => 26, subdevice => 232, command => 5 }); | ||
| 41 | |||
| 42 | =head1 DESCRIPTION | ||
| 43 | |||
| 44 | The NEC2 protocol (MakeHex F<nec2.irp>) transmits the same 32-bit frame as | ||
| 45 | L<Protocol::IR::Proto::NEC> with the same full 9000/4500 µs header and the same | ||
| 46 | "Default S=~D" subaddress rule. The only difference from NEC1 is the repeat | ||
| 47 | frame: NEC1 repeats a short header+gap, NEC2 repeats the whole data frame. | ||
| 48 | That difference is not observable in any single frame, so the timing | ||
| 49 | decoders treat NEC1 and NEC2 identically (see L<Protocol::IR::Proto::NEC> for the | ||
| 50 | data layout and timing). This class exists so that codes imported under the | ||
| 51 | IRDB name C<NEC2> keep that identity and its repeat semantics. | ||
| 52 | |||
| 53 | Because a single NEC2 frame is indistinguishable from a NEC1 frame, the | ||
| 54 | C<decode_timing> decoder of L<Protocol::IR::Proto::NEC> (registered first) matches | ||
| 55 | it in L<Protocol::IR::Converter>; the C<NEC2> name is only produced when a code is | ||
| 56 | imported by name (CSV, C<decode_params>, C<decode_raw>), which is the | ||
| 57 | IRDB-to-wig path this distribution is built around. | ||
| 58 | |||
| 59 | =head1 METHODS | ||
| 60 | |||
| 61 | All methods are inherited from L<Protocol::IR::Proto::NEC>; only the protocol name | ||
| 62 | differs. | ||
| 63 | |||
| 64 | =head1 SUPPORT | ||
| 65 | |||
| 66 | Source code: L<https://github.com/bwarden/perl-protocol-ir> | ||
| 67 | |||
| 68 | Bug reports and feature requests: L<https://github.com/bwarden/perl-protocol-ir/issues> | ||
| 69 | |||
| 70 | =head1 AUTHOR | ||
| 71 | |||
| 72 | Brett T. Warden <bwarden@cpan.org> | ||
| 73 | |||
| 74 | =head1 COPYRIGHT AND LICENSE | ||
| 75 | |||
| 76 | Copyright (c) 2026 Brett T. Warden | ||
| 77 | |||
| 78 | This library is free software; you can redistribute it and/or modify it | ||
| 79 | under the terms of the GNU General Public License as published by the | ||
| 80 | Free Software Foundation; either version 2 of the License, or (at your | ||
| 81 | option) any later version. | ||