You are here :

 Leonardo Live Tracking API

Saturday, 9. January 2010 22:24:58, by Manolis Andreadakis

 

There are 2 ways to add live tracking support to your application. You cant mix the 2 ways, stick to and use only one of them in your application.

Both are using HTTP GET requests to www.livetrack24.com/track.php with specific parameters By using test.livetrack24.com/track.php instead the tracks go to the test server. Use this while developing/testing.

Generic - Sessionless protocol

Example URL

/track.php?leolive=1&client=YourProgramName&v=1&lat=22.3&lon=40.2&alt=23&sog=40&cog=160&tm=1241422845&user=yourusername&pass=yourpass

Native - Session aware protocol

START OF TRACK PACKET

/track.php?leolive=2&sid=42664778&pid=1&client=YourProgramName&v=1&user=yourusername&pass=yourpass&phone=Nokia 2600c&gps=BT GPS&trk1=4&vtype=16388&vname=vehicle name and model

PARAMETERS

Values for vtype

1=>"Paraglider"
2=>"Flex wing FAI1"
4=>"Rigid wing FAI5"
8=>"Glider"
16=>"Paramotor"
32=>"Trike"
64=>"Powered flight"
128=>"Hot Air Balloon"

16385=>"Walk"
16386=>"Run" 
16388=>"Bike"

16400=>"Hike"
16401=>"Cycle"
16402=>"Mountain Bike"
16403=>"Motorcycle"

16500=>"Windsurf"
16501=>"Kitesurf"				
16502=>"Sailing"

16600=>"Snowboard"
16601=>"Ski"
16602=>"Snowkite"

17100=>"Car"
17101=>"4x4 Car"

END OF TRACK PACKET

/track.php?leolive=3&sid=42664778&pid=453&prid=0

PARAMETERS

0-> "Everything OK"
1-> "Need retrieve"
2-> "Need some help, nothing broken"
3-> "Need help, maybe something broken"
4-> "HELP, SERIOUS INJURY"

GPS POINT PACKET

/track.php?leolive=4&sid=42664778&pid=321&lat=22.3&lon=40.2&alt=23&sog=40&cog=160&tm=1241422845

PARAMETERS

Info on sessionID

The "sid" (sessionID) parameter uniqcly identifies a single track , it must be the same in all packets

Random SessionID

Use a 4 byte unsigned random int, the leftmost bit ( 0x40000000 ) MUST be set to 0 so you must do a sessionID & 0x7fffffff

Setting the userID inside sessionID

If the user has an account on the server then the sessionID must be constructed in the following way to contain the userID

First of all your application must get the userID based on the username and password of the user. The url to verify user accounts and get back the userID is

http://www.livetrack24.com/client.php?op=login&user=username&pass=pass

The username and password are case INSENSITIVE, because on mobile devices it is not easy for all users to enter the correct case.

The result of the page is an integer, 0 if userdata are incorrect, or else the userID of the user

Here is a sample code in Java to construct a sessionID from a userID

Random a= new Random( System.currentTimeMillis() );
int rnd=Math.abs( a.nextInt() );
// we make an int with leftmost bit=1 ,
// the next 7 bits random 
// (so that the same userID can have multiple active sessions)
// and the next 3 bytes the userID
rnd=( rnd &  0xFF000000 ) | ( userID & 0x00ffffff) | 0x80000000;