Constitutes the object that enables access to data from the Altimeter native sensor to return the estimated elevation.
Once data gathering is started using the start
method, the API
starts sending data
objects at set intervals.
The object can be established using the following reference:
launchbox.Motion.Altimeter (interval, dataCallback, errorCallback)
Name | Description | Type | Use |
---|---|---|---|
interval | Defined to set an expected interval (in miliseconds) at which data is collected from the sensors. | integer |
required |
dataCallback | Defined to receive the |
function |
required |
errorCallback | Defined to receive the |
function |
required |
The data
JSON object contains the following values:
{ "timestamp" = 1455810375223, // Time of the event in [ms], counted from the 1 January 1970 (long) "relativeAltitude" = 0.375223, // The change in altitude [m] since the last reported event (double) "pressure" = 977.2 // Ambient air pressure in [hPa] (double) }
The error
JSON object contains one attribute that passes an error message
delivered by the device:
{ "message" = "Sensor 'ALTIMETER' is not available on this device." }
Name | Return type | Description |
---|---|---|
start | undefined |
Initiates gathering of data from the Altimeter hardware sensor. |
stop | undefined |
Stops gathering of data from the Altimeter hardware sensor. |