Richard Clamp > Device-Ericsson-AccessoryMenu-0.8 > Device::Ericsson::AccessoryMenu

Download:
Device-Ericsson-AccessoryMenu-0.8.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.8   Source  

NAME ^

Device::Ericsson::AccessoryMenu - allows use of a T68i as a remote control

SYNOPSIS ^

 my $remote = Device::Ericsson::AccessoryMenu->new;
 $remote->menu( [ 'Remote' => [ pause  => sub { ... },
                                Volume => [ up   => sub { ... },
                                            down => sub { ... },
                                          ],
                              ],
                ] );

 # on Win32, Win32::SerialPort should be equivalent
 my $port = Device::SerialPort->new('/dev/rfcomm0')
    or die "couldn't connect to T68i";
 $remote->port( $port );

 $remote->register_menu;

 while (1) {
     $remote->control;
 }

DESCRIPTION ^

Device::Ericsson::AccessoryMenu provides a framework for adding an accessory menu to devices that obey the EAM set of AT commands.

This allows you to write programs with similar function to the Romeo and Clicker applications for OSX, only instead of applescript your actions invoke perl subroutines (which of course may invoke applescript events, if that's your desire).

METHODS ^

new

menu

your menus and actions.

If your action is a subroutine, it will be invoked with the Device::Ericsson::AccesoryMenu object as its first parameter.

If the action returns a scalar, this is sent on to the phone via send_text

If your action is, or returns an array reference, then it's taken as a sub menu.

port

The serial port to communicate over.

This may be real serial port, or a bluetooth RFCOMM device, just so long as it looks like a Device::SerialPort or Win32::SerialPort.

send( $what )

send bytes over the serial port to the phone

register_menu

Notify the phone that there's an accessory connected

send_text( $title, @lines )

Send the text as a message dialog and wait for user input.

percent_slider( %args )

 %args = (
    title    => 'Slider',
    steps    => 10,    # 1..10
    value    => 50,
    callback => undef, # a subroutine ref, will be called with the new value
 );

mouse_mode( %args )

Put the T68i into a fullscan mode. Returns keyboard events for every key pressed and released.

 %args = (
    title    => 'Mouse',
    callback => sub ( $key, $updown ) {}, # will be called with the key and
                                          # the updown event (1 = key
                                          # down, 0 = key up)

 );

control

Respond to what the phone is sending back over the port, invoking callbacks and all that jazz.

CAVEATS ^

I have only tested this with a T68i, and with Device::SerialPort. I've consulted the R320 command set, and this seems portable across Ericsson devices, but only time will tell. Feedback welcome.

TODO ^

Convenience methods for other EAID values, like the percent input dialog.

Disconnection (and reconnection) detection. For a straight serial port this isn't really much of a win, but for bluetooth devices it'd be nifty to do a "they've entered/exited the zone" check.

AUTHOR ^

Richard Clamp <richardc@unixbeard.net>

Based on the source of bluexmms by Tom Gilbert.

COPYRIGHT ^

Copyright (C) 2003, Richard Clamp. All Rights Reserved.

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

SEE ALSO ^

bluexmms, Romeo, Device::SerialPort

syntax highlighting: