Audio-Radio-Sirius
view release on metacpan or search on metacpan
lib/Audio/Radio/Sirius.pm view on Meta::CPAN
'8005' => {
name => 'signal_info',
handler => \&_signal_update,
removefirst => 2
},
);
our %TYPES = (
command => '00',
ack => '80',
e_busy => '82',
e_checksum => '83'
);
our %ITEM_TYPES = (
0x1 => 'artist',
0x2 => 'title',
0x6 => 'composer',
0x86 => 'pid'
);
lib/Audio/Radio/Sirius.pm view on Meta::CPAN
my $serial = $self->{_serial};
my $attempts=0;
SEND: foreach $attempts (1..5) {
# send/retry logic
if ($self->{debug}) { print "Sending command: $hexcommand sequence: $sequence\n"; }
if ($self->debug >= 3) {print '>> '.$self->_pformat($data)."\n"; }
$serial->write($data);
$self->_receive;
last SEND if ($self->{_lastack} == $sequence );
# we're still here... receiver is probably busy. give it a bit.
sleep(3);
}
$self->{_sequence} = ($self->{_sequence} + 1);
if ($self->{_sequence} > 255) { $self->{_sequence} = 0; }
if (($attempts == 3) && ($self->{lastack} != $sequence) ) {
carp "Command not acknowledged by tuner after 3 attempts.";
return 0;
}
( run in 0.224 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )