Mattia Barbon > Mobile-P2kMoto > Mobile::P2kMoto

Download:
Mobile-P2kMoto-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.03   Source  

NAME ^

Mobile::P2kMoto - interface with Motorola P2K phones

SYNOPSIS ^

    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" } );

DESCRIPTION ^

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

FUNCTIONS ^

setACMdevice

  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.

detectPhone

  my $rv = detectPhone();

Tries to auto-sense a phone connected to the current ACM device. If succesful, automatically calls setATconfig() and setP2kconfig().

findPhone

  my $rv = findPhone();

Detects current phone state. Returns one of P2K_PHONE_NONE, P2K_PHONE_AT, P2K_PHONE_P2K.

setP2Kmode

  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().

openPhone

  my $rv = openPhone( $timeout );

Connects to the phone. The phone must be in P2K mode before performing this action.

easy_openPhone

  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.

closePhone

  my $rv = closePhone();

Closes the connection to the phone.

suspend

  my $rv = suspend();

Suspends the phone.

reboot

  my $rv = reboot();

Reboots the phone.

CONFIGURATION FUNCTIONS ^

You should only need the functions below if autodetection fails and if the defaults values provided by p2kmoto do not work for you.

setATconfig

  setATconfig( 0x22b8, 0x4902 );

Sets the vendor/product ID used by p2kmoto for the AT interface.

setP2Kconfig

  setP2Kconfig( 0x22b8, 0x4901 );

Sets the vendor/product ID used by p2kmoto for the P2K interface.

getACMdevice

  my $device = getACMdevice();

Returns the device used to connect to the phone.

getATproduct

  my $id = getATproduct();

Sets the product ID used by p2kmoto for the AT interface.

getATvendor

  my $id = getATvendor();

Sets the vendor ID used by p2kmoto for the AT interface.

getP2Kproduct

  my $id = getP2Kproduct();

Sets the product ID used by p2kmoto for the P2K interface.

getP2Kvendor

  my $id = getP2Kvendor();

Sets the vendor ID used by p2kmoto for the P2K interface.

SEE ALSO ^

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

AUTHOR ^

Mattia Barbon, <mbarbon@cpan.org>

COPYRIGHT AND LICENSE ^

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