
Mobile::P2kMoto - interface with Motorola P2K phones

use Mobile::P2kMoto;
use constant TIMEOUT => 3000;
Mobile::P2kMoto::easy_openPhone( device => '/dev/ttyACM0',
timeout => TIMEOUT,
);
Mobile::P2kMoto::FS::searchRequest( '/a/*.wav' );
Mobile::P2kMoto::FS::fileList( sub { print $_[0]->name, "\n" } );

This module uses the p2kmoto library to interface with Motorola Mobile phones using an USB cable.

setACMdevice( "/dev/ttyACM1" );
The p2kmoto library uses /dev/ttyACM0 (for Unix) and COM3 (for Win32) as the default device, use this function to change it.
my $rv = detectPhone();
Tries to auto-sense a phone connected to the current ACM device. If succesful, automatically calls setATconfig() and setP2kconfig().
my $rv = findPhone();
Detects current phone state. Returns one of P2K_PHONE_NONE, P2K_PHONE_AT, P2K_PHONE_P2K.
my $rv = setP2Kmode( $timeout );
If the phone is in AT mode, switches it to P2K mode. Must be called before accessing the phone via openPhone().
my $rv = openPhone( $timeout );
Connects to the phone. The phone must be in P2K mode before performing this action.
my $rv = easy_openPhone( device => '/dev/ttyACM0',
timeout => 3000,
p2k_config => [ 0x1, 0x2 ],
acm_config => [ 0x3, 0x4 ],
);
A simplified interface to configuring/detecting/opening the phone: device defaults to '/dev/ttyACM0' and timeout to 3000; p2k_config and acm_config are optional.
This function performa several actions: first it sets the ACM device; if p2k_config and acm_config are specified, calls setP2Kconfig and setACMconfig, otherwise calls detectPhone; switched the phone to P2K mode if it isn't already; calls openPhone.
my $rv = closePhone();
Closes the connection to the phone.
my $rv = suspend();
Suspends the phone.
my $rv = reboot();
Reboots the phone.

You should only need the functions below if autodetection fails and if the defaults values provided by p2kmoto do not work for you.
setATconfig( 0x22b8, 0x4902 );
Sets the vendor/product ID used by p2kmoto for the AT interface.
setP2Kconfig( 0x22b8, 0x4901 );
Sets the vendor/product ID used by p2kmoto for the P2K interface.
my $device = getACMdevice();
Returns the device used to connect to the phone.
my $id = getATproduct();
Sets the product ID used by p2kmoto for the AT interface.
my $id = getATvendor();
Sets the vendor ID used by p2kmoto for the AT interface.
my $id = getP2Kproduct();
Sets the product ID used by p2kmoto for the P2K interface.
my $id = getP2Kvendor();
Sets the vendor ID used by p2kmoto for the P2K interface.

Mobile::P2kMoto::FS, Mobile::P2kMoto::FS::FileInfo

Mattia Barbon, <mbarbon@cpan.org>

Copyright (C) 2006-2007 by Mattia Barbon
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA