| 1 | package Protocol::IR::Proto::Sony; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 55 | our $VERSION = '1.5'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | package Protocol::IR::Proto::Sony12; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 55 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 55 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 55 | our $VERSION = '1.5'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 55 | ▶ | use Protocol::IR::Code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub new { bless {}, shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1617 | ▶ | sub bits { 12 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bits: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | ▶ | sub address_bits { 5 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
address_bits: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 28 | ▶ | sub extended_bits { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extended_bits: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 18 | ▶ | sub _reverse_bits { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reverse_bits: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 18 | my ($value, $bits) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 18 | my $out = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 18 | for my $i (0 .. $bits - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 282 | $out |= (($value >> $i) & 1) << ($bits - 1 - $i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 18 | return $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | ▶ | sub _logical_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_logical_value: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | my ($class, $addr, $ext, $cmd) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | my $v = $addr & ((1 << $class->address_bits) - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | ▶ | if ($class->extended_bits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | $v |= ($ext & ((1 << $class->extended_bits) - 1)) << $class->address_bits; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 6 | $v = ($v << 7) | ($cmd & 0x7f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 6 | return $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub decode_raw { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_raw: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my ($class, $raw) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $transmitted = $raw + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $transmitted = hex($transmitted) if $transmitted =~ /^0x/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my $logical = _reverse_bits($transmitted, $class->bits); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my $cmd = $logical & 0x7f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $addr = ($logical >> 7) & ((1 << $class->address_bits) - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $ext = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ($class->extended_bits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $ext = ($logical >> (7 + $class->address_bits)) & ((1 << $class->extended_bits) - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | return Protocol::IR::Code->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | protocol => $class->_protocol_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | bits => $class->bits, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | address => $addr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | subaddress => $class->extended_bits ? $ext : -1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | command => $cmd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | data => $logical, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 3 | ▶ | sub decode_params { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_params: called CC=11 SCAR=28.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 3 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 3 | ▶ | my $addr = $args{address} // $args{device} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
($args{"address"} // $args{"device"}) // 0
$args{"address"} // $args{"device"}
MC/DC0%0/2
($args{"address"} // $args{"device"}) // 0
$args{"address"}
$args{"device"}
Truth table33%1/3
A // B
A= $args{"address"}B= $args{"device"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 3 | ▶ | $addr = hex($addr) if $addr =~ /^0x/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 3 | ▶ | my $ext = $args{subaddress} // $args{subdevice} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
($args{"subaddress"} // $args{"subdevice"}) // 0
$args{"subaddress"} // $args{"subdevice"}
MC/DC0%0/2
($args{"subaddress"} // $args{"subdevice"}) // 0
$args{"subaddress"}
$args{"subdevice"}
Truth table33%1/3
A // B
A= $args{"subaddress"}B= $args{"subdevice"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 3 | ▶ | $ext = hex($ext) if $ext =~ /^0x/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3 | ▶ | my $cmd = $args{command} // $args{function} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
($args{"command"} // $args{"function"}) // 0
$args{"command"} // $args{"function"}
MC/DC0%0/2
($args{"command"} // $args{"function"}) // 0
$args{"command"}
$args{"function"}
Truth table33%1/3
A // B
A= $args{"command"}B= $args{"function"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 3 | ▶ | $cmd = hex($cmd) if $cmd =~ /^0x/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 3 | my $logical = $class->_logical_value($addr, $ext, $cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 3 | ▶ | return Protocol::IR::Code->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | protocol => $class->_protocol_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | bits => $class->bits, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | address => $addr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | subaddress => $class->extended_bits ? $ext : -1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | command => $cmd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | data => $logical, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 6 | ▶ | sub _protocol_name { 'SONY12' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_protocol_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1779 | ▶ | sub decode_timing { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_timing: called CC=17 SCAR=28.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1779 | my ($class, $pairs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1779 | ▶ | return undef unless ref $pairs eq 'ARRAY' && @$pairs >= $class->bits + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $pairs eq "ARRAY" and @$pairs >= $class->bits + 1
MC/DC50%1/2
ref $pairs eq "ARRAY" and @$pairs >= $class->bits + 1
ref $pairs eq "ARRAY"
@$pairs >= $class->bits + 1
Truth table66%2/3
A and B
A= ref $pairs eq "ARRAY"B= @$pairs >= $class->bits + 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # Reject frames that carry more bits than this variant (e.g. a 15-bit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # frame must not be accepted by the 12-bit decoder). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1455 | ▶ | if (@$pairs > $class->bits + 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1436 | ▶ | return undef unless ($pairs->[$class->bits + 1][0] // 0) == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$pairs[$class->bits + 1][0] // 0
MC/DC0%0/1
$$pairs[$class->bits + 1][0] // 0
$$pairs[$class->bits + 1][0]
Truth table50%1/2
A
A= $$pairs[$class->bits + 1][0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 25 | my ($hdr_mark, $hdr_space) = @{$pairs->[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 25 | ▶ | return undef unless $hdr_mark >= 2000 && $hdr_mark <= 2800 && $hdr_space >= 400 && $hdr_space <= 800; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$hdr_mark >= 2000 and $hdr_mark <= 2800 and $hdr_space >= 400 and $hdr_space <= 800
$hdr_mark >= 2000 and $hdr_mark <= 2800 and $hdr_space >= 400
$hdr_mark >= 2000 and $hdr_mark <= 2800
MC/DC50%2/4
$hdr_mark >= 2000 and $hdr_mark <= 2800 and $hdr_space >= 400 and $hdr_space <= 800
$hdr_mark >= 2000
$hdr_mark <= 2800
$hdr_space >= 400
$hdr_space <= 800
Truth table60%3/5
A and B and C and D
A= $hdr_mark >= 2000B= $hdr_mark <= 2800C= $hdr_space >= 400D= $hdr_space <= 800
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 15 | my $data = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 15 | for my $k (0 .. $class->bits - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 235 | my $mark = $pairs->[$k + 1][0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 235 | my $bit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 235 | ▶ | if ($mark >= 1000 && $mark <= 1400) { $bit = 1; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$mark >= 1000 and $mark <= 1400
MC/DC50%1/2
$mark >= 1000 and $mark <= 1400
$mark >= 1000
$mark <= 1400
Truth table66%2/3
A and B
A= $mark >= 1000B= $mark <= 1400
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 135 | ▶ | elsif ($mark >= 400 && $mark <= 800) { $bit = 0; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$mark >= 400 and $mark <= 800
MC/DC0%0/2
$mark >= 400 and $mark <= 800
$mark >= 400
$mark <= 800
Truth table33%1/3
A and B
A= $mark >= 400B= $mark <= 800
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | else { return undef; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 235 | $data = ($data << 1) | $bit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 15 | my $logical = _reverse_bits($data, $class->bits); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 15 | my $cmd = $logical & 0x7f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 15 | my $addr = ($logical >> 7) & ((1 << $class->address_bits) - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 15 | my $ext = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 15 | ▶ | if ($class->extended_bits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 5 | $ext = ($logical >> (7 + $class->address_bits)) & ((1 << $class->extended_bits) - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 15 | ▶ | return Protocol::IR::Code->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | protocol => $class->_protocol_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | bits => $class->bits, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | address => $addr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | subaddress => $class->extended_bits ? $ext : -1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | command => $cmd, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | data => $logical, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 3 | ▶ | sub to_pronto { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_pronto: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | my ($class, $code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 3 | my $carrier_hz = 40000; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # freq word | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 3 | my $freq_word = int(1000000.0 / ($carrier_hz * 0.241246) + 0.5); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 3 | my $period_us = $freq_word * 0.241246; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 3 | ▶ | my $us_to_pulses = sub { int($_[0] / $period_us + 0.5) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 3 | my $addr = $code->{address} & ((1 << $class->address_bits) - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 3 | ▶ | my $ext = $class->extended_bits ? ($code->{subaddress} & ((1 << $class->extended_bits) - 1)) : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 3 | my $cmd = $code->{command} & 0x7f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 3 | my $logical = $class->_logical_value($addr, $ext, $cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 3 | my $transmitted = _reverse_bits($logical, $class->bits); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 3 | my @bits; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 3 | for my $i (reverse 0 .. $class->bits - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 47 | push @bits, ($transmitted >> $i) & 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 3 | my @pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 3 | push @pairs, [ $us_to_pulses->(2400), $us_to_pulses->(600) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 3 | for my $bit (@bits) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 47 | ▶ | push @pairs, [ $us_to_pulses->($bit ? 1200 : 600), $us_to_pulses->(600) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 3 | my $seq1 = scalar(@pairs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 3 | my $header = sprintf('0000 %04X %04X 0000', $freq_word, $seq1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3 | my $payload = join(' ', map { sprintf('%04X %04X', $_->[0], $_->[1]) } @pairs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 3 | return "$header $payload"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # --- SONY15 ---------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | package Protocol::IR::Proto::Sony15; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 55 | ▶ | use base 'Protocol::IR::Proto::Sony12'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 1618 | ▶ | sub bits { 15 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bits: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 8 | ▶ | sub address_bits { 8 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
address_bits: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 6 | ▶ | sub _protocol_name { 'SONY15' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_protocol_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # --- SONY20 ---------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | package Protocol::IR::Proto::Sony20; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 55 | ▶ | use base 'Protocol::IR::Proto::Sony12'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 1489 | ▶ | sub bits { 20 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bits: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 15 | ▶ | sub address_bits { 5 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
address_bits: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 22 | ▶ | sub extended_bits { 8 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extended_bits: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 6 | ▶ | sub _protocol_name { 'SONY20' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_protocol_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 55 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | Protocol::IR::Proto::Sony - IR protocol handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | version 1.5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||