NAME

Protocol::IR::Proto::SAMSUNG20 - SAMSUNG20 protocol handler (20-bit AC)

VERSION

version 1.0

SYNOPSIS

use Protocol::IR::Converter;

my $converter = Protocol::IR::Converter->new();

# From a raw 20-bit value or from parameters
my $code = $converter->import_code('SAMSUNG20', '0x27201');
my $code = $converter->import_code('SAMSUNG20',
    { address => 1, subaddress => 8, command => 39 });

DESCRIPTION

The SAMSUNG20 protocol transmits 20-bit frames at 38.4 kHz: a 6-bit device, a 6-bit subdevice, and an 8-bit function, transmitted LSB-first within each field behind a 4512/4512 us header (the same header Samsung's 32-bit protocol uses). The whole frame is sent once, so a capture is header + 20 bits + stop. IRDB uses it for Samsung air-conditioner handsets.

The data value matches Tasmota's DataLSB field: the function in bits 12-19, subdevice in bits 6-11, and device in bits 0-5. There is no display/accumulated byte-order distinction for a 20-bit word.

A missing subdevice (-1) sends a zero field per the IRP "Default S=0" rule; the stored subaddress stays -1.

METHODS

decode_raw

my $code = $class->decode_raw('0x27201');

Builds an Protocol::IR::Code from the raw 20-bit value.

decode_params

my $code = $class->decode_params(address => 1, subaddress => 8, command => 39);

Builds an Protocol::IR::Code from discrete parameters. Accepts address or device, subaddress or subdevice, and command or function.

decode_timing

my $code = $class->decode_timing(\@burst_pairs_us);

Decodes an arrayref of microsecond [mark_us, space_us] pairs. Returns an Protocol::IR::Code when the header, 20 data bits, and stop bit match the SAMSUNG20 timing signature, otherwise undef.

to_pronto

my $pronto = $class->to_pronto($ir_code);

Encodes an Protocol::IR::Code object as a Pronto Hex string at 38.4 kHz.

SUPPORT

Source code: https://github.com/bwarden/perl-protocol-ir

Bug reports and feature requests: https://github.com/bwarden/perl-protocol-ir/issues

AUTHOR

Brett T. Warden <bwarden@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2026 Brett T. Warden

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.