Handle operation on location sensor.

Usage

location keyword is needed to instanciate this sting.

var gps = require('location');
WARNING: the JavaScript variable named 'location' is already used by browsers, thus the syntactic check will forbid you to use it.

Data accessors

Methods

Events

Full Example

var gps = require('location');
var recorder = require('recorder');

var dataResult = gps.data();

var locationChangedFilters = {
    "mode": ACTIVE,
    "distance": 500,
    "period": "5 min"
};

recorder.save({
    'accuracy' : gps.accuracy(),
    'altitude' : gps.altitude(),
    'bearing' : gps.bearing(),
    'latitude' : gps.latitude(),
    'longitude' : gps.longitude(),
    'ACTIVE Mode' : gps.isMode(gps.ACTIVE),
    'GPS Source' : gps.isSource(gps.GPS),
    'speed' : gps.speed(),
    'timestamp' : gps.timestamp(),
    'json' : gps.data()
});

gps.onLocationChanged(locationChangedFilters, function(data) {
    recorder.save(data);
    recorder.sync();
});

accuracy

Retrieve the Estimated accuracy of this location, in meters.

accuracy();

Parameters

  • None.

Return

  • accuracy : Double, Estimated accuracy of this location, in meters

altitude

Retrieve the Altitude in meters above the WGS 84 reference ellipsoid.

altitude();

Parameters

  • None.

Return

  • altitude : Double, Altitude in meters above the WGS 84 reference ellipsoid

bearing

Retrieve the Bearing in degrees East of true North.

bearing();

Parameters

  • None.

Return

  • bearing : Double, Bearing in degrees East of true North

isMode

Test the current mode value against the given one.

isMode(value);

Parameters

Return

  • Boolean

isSource

Test the current source value against the given one.

isSource(value);

Parameters

Return

  • Boolean

latitude

Retrieve the Latitude in degrees.

latitude();

Parameters

  • None.

Return

  • latitude : Double, Latitude in degrees

longitude

Retrieve the Longitude in degrees.

longitude();

Parameters

  • None.

Return

  • longitude : Double, Longitude in degrees

mode

Retrieve the Fix acquisition mode.

mode();

Parameters

  • None.

Return

source

Retrieve the Source that generated the location fix.

source();

Parameters

  • None.

Return

speed

Retrieve the Speed in meters/second over ground.

speed();

Parameters

  • None.

Return

  • speed : Double, Speed in meters/second over ground

timestamp

Retrieve the represents the time of the operation..

timestamp();

Parameters

  • None.

Return

  • timestamp : Long, represents the time of the operation.

data

Returns every available seed.

data();

Parameters

  • None.

Returns

onLocationChanged

Starts a listener on the location location and executes some actions when it changes.

onLocationChanged(filters, callback);

Parameters

Return

  • token : Token used for canceling event listener.