Device::Ericsson::AccessoryMenu - allows use of a T68i as a remote control
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; }
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).
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
send_text
If your action is, or returns an array reference, then it's taken as a sub menu.
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 bytes over the serial port to the phone
Notify the phone that there's an accessory connected
Send the text as a message dialog and wait for user input.
%args = ( title => 'Slider', steps => 10, # 1..10 value => 50, callback => undef, # a subroutine ref, will be called with the new value );
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) );
Respond to what the phone is sending back over the port, invoking callbacks and all that jazz.
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.
Convenience methods for other EAID values, like the percent input dialog.
EAID
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.
Richard Clamp <richardc@unixbeard.net>
Based on the source of bluexmms by Tom Gilbert.
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.
bluexmms, Romeo, Device::SerialPort
To install Device::Ericsson::AccessoryMenu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Ericsson::AccessoryMenu
CPAN shell
perl -MCPAN -e shell install Device::Ericsson::AccessoryMenu
For more information on module installation, please visit the detailed CPAN module installation guide.