Perl modules for controlling Onkyo/Integra AV Receivers
Perl Perl6


    Device::Onkyo - Perl module to control Onkyo/Integra AV equipment

    version 1.143640

      my $onkyo = Device::Onkyo->new(device => 'discover');
      $onkyo->power('on'); # switch on

      $onkyo = Device::Onkyo->new(device => '/dev/ttyS0');
      $onkyo->write('PWR01'); # switch on
      while (1) {
        my $message = $onkyo->read();
        print $message, "\n";

      $onkyo = Device::Onkyo->new(device => 'hostname:port');
      $onkyo->write('PWR01'); # switch on

    Module for controlling Onkyo/Intregra AV equipment.

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

    This constructor returns a new Device::Onkyo object. The supported
    parameters are:

        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'.

        The name of an existing filehandle to be used instead of the
        'device' parameter.

        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.

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

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

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

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

    Returns the device used to connect to the equipment. If a filehandle was
    provided this method will return undef.

    Returns the type of the device - either 'ISCP' or 'eISCP'.

    Returns the baud rate only makes sense for 'ISCP'-type devices.

    Returns the TCP port for the device only makes sense for 'eISCP'-type

    This method returns the file handle for the device.

    This method blocks until a new message has been received by the device.
    When a message is received the message string is returned. An optional
    timeout (in seconds) may be provided.

    This method attempts to remove a single message from the buffer passed
    in via the scalar reference. When a message is removed a data structure
    is returned that represents the data received. If insufficient data is
    available then undef is returned.

    This method attempts to discover available equipment. It returns a list
    reference of list references of ip and port pairs.

    Currently only the first responding device is returned.

  "write($command, $callback)"
    This method queues a command for sending to the connected device. The
    first write will be written immediately, subsequent writes are queued
    until a response to the previous message is received.

    This method takes a command and formats it for sending to the device.
    The format depends on the device type.

  "command($command, [$callback])"
    This method takes a command and queues it for sending to the device.

    Mark Hindess <>

    This software is copyright (c) 2014 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.