Handle operation on proximity sensor.

Usage

proximity keyword is needed to instanciate this sting.

var proximity = require('proximity');

Data accessors

Methods

Events

Full Example

var proximity = require('proximity');
var recorder = require('recorder');

var dataResult = proximity.data();


recorder.save({
    'accuracy' : proximity.accuracy(),
    'CLOSE Distance' : proximity.isDistance(proximity.CLOSE),
    'model' : proximity.model(),
    'timestamp' : proximity.timestamp(),
    'vendor' : proximity.vendor(),
    'version' : proximity.version(),
    'json' : proximity.data()
});

proximity.onDistanceChanged(exampleValue, function(data) {
    recorder.save(data);
    recorder.sync();
});

accuracy

Retrieve the Sensor’s current accuracy.

accuracy();

Parameters

  • None.

Return

  • accuracy : SensorAccuracy, Sensor’s current accuracy

distance

Retrieve the Determine the distance to an obstacle.

distance();

Parameters

  • None.

Return

isDistance

Test the current distance value against the given one.

isDistance(value);

Parameters

Return

  • Boolean

model

Retrieve the Sensor’s model name.

model();

Parameters

  • None.

Return

  • model : String, Sensor’s model name

timestamp

Retrieve the represents the time of the operation..

timestamp();

Parameters

  • None.

Return

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

vendor

Retrieve the Sensor’s vendor name.

vendor();

Parameters

  • None.

Return

  • vendor : String, Sensor’s vendor name

version

Retrieve the Version of this sensor.

version();

Parameters

  • None.

Return

  • version : Integer, Version of this sensor

data

Returns every available seed.

data();

Parameters

  • None.

Returns

onDistanceChanged

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

onDistanceChanged(filters, callback);

Parameters

Return

  • token : Token used for canceling event listener.