NAME
WebService::MobileMe - access MobileMe iPhone stuffs from Perl
VERSION
version 0.005
SYNOPSIS
use WebService::MobileMe;
my $mme = WebService::MobileMe->new(
username => 'urmom@me.com', password => 'HUGELOVE' );
my $location = $mme->locate;
$mme->sendMessage( message => 'Hi Yaakov!', alarm => 1 );
$mme->remoteLock( 42 );
DESCRIPTION
THIS MODULE THROWS EXCEPTIONS, USE TRY::TINY OR SIMILIAR IF YOU WISH TO
CATCH THEM.
This module is alpha software released under the release early, release
sort of often principle. It works for me but contains not much error
checking yet, soon to come! (maybe)
This module supports retrieving a latitude/longitude, sending a message,
and remote locking of an iPhone via the 'Find My iPhone' service from
Apple's MobileMe, emulating the Find My iPhone iOS app.
Timestamps returned are those returned in the JSON which are JavaScript
timestamps and thus in miliseconds since the epoch. Divide by 1000 for
seconds.
METHODS
"new"
my $mme = new WebService::MobileMe->new(
username => '', password => '', debug => 1);
Returns a new "WebService::MobileMe" object. The only arguments are
username and password coresponding to your MobileMe login and debug.
If you have a paid MobileMe account, include the @me.com in the
username.
The constructor logs in to Mobile Me and retrieves the currently
available information. If something fails, it will thow an error.
"locate"
my $location = $mme->locate();
Takes an optional device number, starting at 0. Returns the raw json
parsed from Apple.
This is currently:
$location = {
'horizontalAccuracy' => '10',
'longitude' => '-74.4966423982358',
'latitude' => '39.4651979706557',
'positionType' => 'GPS',
'timeStamp' => '1290924314359',
'isOld' => bless( do{\(my $o = 0)}, 'JSON::XS::Boolean' ),
'locationFinished' => bless( do{\(my $o = 1)}, 'JSON::XS::Boolean' )
};
NOTE: The timeStamp is a JavaScript timestamp so it is miliseconds since
the epoch. Divide by 1000 for seconds since.
sendMessage
my $r = $mme->sendMessage( message => 'Hello, World!', alarm => 1);
Takes one required and three optional arguments. Returns a structure
containg the parsed JSON returned by apple
* "message" (REQUIRED)
The message to display.
* "alarm"
A true value cause the iPhone to make noise when the message is
displayed, defaults to false.
* "device"
The device number on the account to send the message to. Defaults to
0, the first device.
The returned structure currently looks like:
$message = {
'createTimestamp' => '1290933263675',
'statusCode' => '200'
}
remoteLock
$mme->remoteLock( 42 );
Sends a remote lock request with the designated passcode. Optionaly also
takes a device number which defaults to 0, the first device.
The returned structure currently looks like:
$lock = {
'createTimestamp' => '1290929589780',
'statusCode' => '2200'
}
device
my $device = $mme->device()
Takes one optional argument, the device number. Defaults to device 0,
the first device. Returns the full structure for the specified device
which currently looks like:
$device = {
'a' => 'NotCharging',
'isLocating' => bless( do{\(my $o = 1)}, 'JSON::XS::Boolean' ),
'deviceModel' => 'FourthGen',
'id' => 'deadbeef',
'remoteLock' => undef,
'msg' => undef,
'remoteWipe' => undef,
'location' => {
'horizontalAccuracy' => '10',
'longitude' => '-74.4966423982358',
'latitude' => '39.4651979706557',
'positionType' => 'GPS',
'timeStamp' => '1290924314359',
'isOld' => bless( do{\(my $o = 0)}, 'JSON::XS::Boolean' ),
'locationFinished' => $VAR1->{'isLocating'}
},
'features' => {
'KEY' => $VAR1->{'isLocating'},
'WIP' => $VAR1->{'isLocating'},
'LCK' => $VAR1->{'isLocating'},
'SND' => $VAR1->{'isLocating'},
'LOC' => $VAR1->{'isLocating'},
'REM' => $VAR1->{'location'}{'isOld'},
'CWP' => $VAR1->{'location'}{'isOld'},
'MSG' => $VAR1->{'isLocating'}
},
'deviceStatus' => '203',
'name' => 'mmm cake',
'thisDevice' => $VAR1->{'location'}{'isOld'},
'b' => '1',
'locationEnabled' => $VAR1->{'isLocating'},
'deviceDisplayName' => 'iPhone 4',
'deviceClass' => 'iPhone'
};
remoteWipe, msg, and remoteLock will contain structures similiar to
those returned by the appropriate methods if they have been used in the
recent past.