Accelerometer plugin
From KuneriLite wiki
Contents |
Introduction
KuneriLite Accelerometer plugin enables Flash Lite developers to use integrated accelerometer on particular S60 devices.
In order to make Accelerometer plugin to work, Nokia N95 Accelerometer plugin package must be installed on target device.
Accelerometer is compatible with Nokia N95, N95 8GB and N82.
Interface
loadVariables("http://127.0.0.1:<Port>/<Key>/accelerometer?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
StartSensor
Starts the accelerometer. Values are ready to be read.
Returns
klError
| Error code (0 if successful) |
ReadSensor
Simply returns the values read from accelerometer.
Note: 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.
Returns
klError
| Error code (0 if successful) |
klXAxis
| X axis value in range of -64 to 64 |
klYAxis
| Y axis value in range of -64 to 64 |
klZAxis
| Z axis value in range of -64 to 64 |
Acceleration axis values are specified as;
- 1G acceleration is equal to 64
- 0G acceleration is equal to 0
- (-1G) acceleration is equal to (-63)
Arguments
None
Examples
loadVariables("http://127.0.0.1:1001/Basic/accelerometer?klCommand=readsensor", MC );
StopSensor
Stops the accelerometer. Values cannot be read anymore
Returns
klError
| Error code (0 if successful) |
Error values
Common error statuses are mentioned below.
| 0 | Success |
| -1 | Phone is not sensor capable / sensor plug-in is not found / KuneriLite components are missing |
| -5 | Plug-in name / command or type in URL is not supported / restricted command |
| -18 | Accelerometer already started/stopped |
| -28 | Given URL is malformed |

