Pressure
Handle operation on pressure sensor.
Usage
pressure
keyword is needed to instanciate this sting.
var pressure = require('pressure');
Data accessors
Methods
Events
Full Example
var pressure = require('pressure');
var recorder = require('recorder');
var dataResult = pressure.data();
var pressureChangedFilters = {
"period": exampleValue,
"above": exampleValue,
"under": exampleValue,
"delta": exampleValue
};
recorder.save({
'accuracy' : pressure.accuracy(),
'model' : pressure.model(),
'pressure' : pressure.pressure(),
'pressureDelta' : pressure.pressureDelta(),
'timestamp' : pressure.timestamp(),
'vendor' : pressure.vendor(),
'version' : pressure.version(),
'json' : pressure.data()
});
pressure.onPressureChanged(pressureChangedFilters, function(data) {
recorder.save(data);
recorder.sync();
});
accuracy
Retrieve the Sensor’s current accuracy.
accuracy();
Parameters
- None.
Return
- accuracy : SensorAccuracy, Sensor’s current accuracy
model
Retrieve the Sensor’s model name.
model();
Parameters
- None.
Return
- model : String, Sensor’s model name
pressure
Retrieve the Pressure returned by the phone (hPa).
pressure();
Parameters
- None.
Return
- pressure : Double, Pressure returned by the phone (hPa)
pressureDelta
Retrieve the Difference between the last pressure and the current one.
pressureDelta();
Parameters
- None.
Return
- pressureDelta : Double, Difference between the last pressure and the current one
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
onPressureChanged
Starts a listener on the pressure pressure and executes some actions when it changes.
onPressureChanged(filters, callback);
Parameters
- filters : JSON, defines the filters. Can be empty.
- callback : Method executed when event triggered, returns PressureData object.
Return
- token : Token used for canceling event listener.