NAME

AnyEvent::Onkyo - AnyEvent module for controlling Onkyo/Integra AV equipment

VERSION

version 1.130220

SYNOPSIS

use AnyEvent;
use AnyEvent::Onkyo;
$| = 1;
my $cv = AnyEvent->condvar;
my $onkyo = AnyEvent::Onkyo->new(device => 'discover',
                                 callback => sub {
                                   my $cmd = shift;
                                   print "$cmd\n";
                                   unless ($cmd =~ /^NLS/) {
                                     $cv->send;
                                   }
                                 });
$onkyo->command('volume up');
$cv->recv;

DESCRIPTION

AnyEvent module for controlling Onkyo/Integra AV equipment.

IMPORTANT: This is an early release and the API is still subject to change. The serial port usage is entirely untested.

METHODS

new(%params)

Constructs a new AnyEvent::Onkyo object. The supported parameters are:

device

The name of the device to connect to. The value can be a tty device name or hostname:port for TCP. It may also be the string 'discover' in which case automatic discovery will be attempted. This value defaults to 'discover'. Note that discovery is currently blocking and not recommended.

callback

The code reference to execute when a message is received from the device. The callback is called with the body of the message as a string as the only argument.

type

Whether the protocol should be 'ISCP' or 'eISCP'. The default is 'ISCP' if a tty device was given as the 'device' parameter or 'eISCP' otherwise.

baud

The baud rate for the tty device. The default is 9600.

port

The port for a TCP device. The default is 60128.

broadcast_source_ip

The source IP address that the discovery process uses for its broadcast. The default, '0.0.0.0', should work in most cases but multi-homed hosts might need to specify the correct local interface address.

broadcast_dest_ip

The IP address that the discovery process uses for its broadcast. The default, '255.255.255.255', should work in most cases.

command($command)

This method takes a command and returns a callback to notify the caller when it has been sent.

cleanup()

This method attempts to destroy any resources in the event of a disconnection or fatal error.

anyevent_read_type()

This method is used to register an AnyEvent::Handle read type method to read Current Cost messages.

AUTHOR

Mark Hindess <soft-cpan@temporalanomaly.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Mark Hindess.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.