GPS plugin

From KuneriLite wiki

Contents

Introduction

KuneriLite GPS plug-in enables you to create location aware S60 applications with Flash Lite and benefit the power of GPS. Following features are provided: starting and stopping GPS positioning, reading coordinates and count of visible satellites.

NOTE : S60 applications utilizing GPS should be signed, therefore you should sign your SIS file before installation (giving key and certificate).

NOTE : For testing there is free GPS Tester application available. You can install it and replace \data\others\trusted\KLGpsTester\KLGpsTester.swf file with your own swf-file.
You don't need to go through signing process, for just to test GPS!

Interface

loadVariables("http://127.0.0.1:<Port>/<Key>/gps?klCommand=<Command>&<Arguments>, "<TargetMc>");
General Parameters
<Port> Specific port KuneriLite is listening commands from (default 1001)
<Key> Unique key for your KuneriLite license (default Basic)
<Command> Name of the command to be called.
<Arguments> Required arguments for commands. Each command may have different arguments with various parameter values.
<TargetMC> Flash Lite movie clip that will receive the response back.

Status of a command can be controlled via klError and klEnd variables. klError returns the response message from KuneriLite server application and klEnd value indicates that conversation is finalized and all data is received. For meaning of klError values, please refer to "Error Values" section below

Commands

Start

Starts searching for Bluetooth GPS devices, if built-in GPS is not enabled (N95). Then initiates receiving of GPS coordinates.
Status of operation is returned.

Returns

Returns 0 to klError if successful, or an error code if there is any problem in starting.

Examples

loadVariables("http://127.0.0.1:1001/Basic/GPS?klCommand=start","");

Stop

Stops receiving of GPS coordinates. Status of operation is returned.

Returns

Returns 0 to klError if successful, or an error code if there is any problem in stopping.

Examples

loadVariables("http://127.0.0.1:1001/Basic/GPS?klCommand=stop","");

Read

Reads last GPS position in latitude/longitude format, count of visible satellites and speed. Status of operation is returned.

Returned latitude/longitude value has 6 decimals.


Note 1: In N95 8GB this works much slower if command is called in a loop, due to the security sandbox implementation in Flash Lite 3 player.

Note 2: Dot is separating the numbers in returned xx.yy string values, but in Flash script they can be handled as normal decimal numbers.

Note 3: Speed is not yet supported in "Basic" version.

Returns

Returns 0 to klError if successful, or an error code if there is any problem in reading.

If coordinates are available, returns:

  • Latitude value to klPosLatitude (values -180..180)
  • Longitude value to klPosLongitude (values -90..90).
  • Satellite count to klCount.
  • Speed as meters/second to klSpeed.

Examples

Request:

loadVariables("http://127.0.0.1:1001/Basic/GPS?klCommand=read","");

Response:

klError=0&klPosLatitude=61.504483&klPosLongitude=23.823783&klCount=8&klSpeed=12&klEnd=1&

Error values

Common error statuses are mentioned below.

0 Success
-1 Plug-in is not found/KuneriLite components are missing
-5 Plug-in name / command or type in URL is not supported / restricted command
-11 GPS is already started
-18 GPS is not started yet
-28 Given URL is malformed
Personal tools