Class: Toybox.Sensor.Info

Inherits:
Toybox.Lang.Object show all

Overview

The Sensor.Info class contains all of the information provided by enabled sensors.

Sensor.Info can be retrieved on every call of onUpdate() or it can be obtained on demand. Fields in this class may return null so should be checked for null values prior to use.

Since:

API Level 1.0.0

Instance Member Summary collapse

Instance Attribute Details

var accel as Lang.Array<Lang.Number> or Null

The accelerometer reading of the x, y, and z axes as an Array of Number values in millig-units.

Note:

Some devices do not enable the accelerometer at startup. To get valid data from this field on such devices, applications must enable the sensor with a call to registerSensorDataListener.

Since:

API Level 1.2.0

Supported Devices:

Returns:

var altitude as Lang.Float or Null

The altitude above mean sea level in meters (m).

Elevation is derived from the most accurate source: Barometer or GPS in order of descending accuracy. If no GPS is present, then barometer readings will be used.

Since:

API Level 1.0.0

See Also:

Returns:

var cadence as Lang.Number or Null

The cadence in revolutions per minute (rpm).

Cadence is derived from (in order of priority):

  1. Bike sensors (cadence or speed must be enabled)

  2. Advanced running dynamics sensors (e.g. heart strap with running dynamics enabled)

  3. Foot pod

  4. Watch-based cadence calculations

Since:

API Level 1.0.0

Returns:

var heading as Lang.Float or Null

The true north referenced heading in radians.

This provides compass orientation if it is supported by the device.

Since:

API Level 1.0.0

Returns:

var heartRate as Lang.Number or Null

The heart rate in beats per minute (bpm).

Since:

API Level 1.0.0

Returns:

var mag as Lang.Array<Lang.Number> or Null

The magnetometer reading of the x, y, and z axes as an Array of Number values in milliGauss (mG).

Note:

Some devices do not enable the magnetometer at startup. To get valid data from this field on such devices, applications must enable the sensor with a call to registerSensorDataListener.

Since:

API Level 1.2.0

Supported Devices:

Returns:

var oxygenSaturation as Lang.Number or Null

The current oxygen saturation in percent (%)

Since:

API Level 3.2.0

Supported Devices:

Returns:

var power as Lang.Number or Null

The power in Watts (W).

Since:

API Level 1.0.0

Returns:

var pressure as Lang.Float or Null

The barometric pressure in Pascals (Pa).

This returns barometric pressure calibrated to sea level. Since pressure varies dues to several factors, a GPS-based altitude must first be obtained, then the ambient (local) pressure is measured by the pressure sensor before conversion to a calibrated barometric pressure value.

Since:

API Level 1.0.0

Returns:

var speed as Lang.Float or Null

The speed in meters per second (m/s).

Since:

API Level 1.0.0

See Also:

Returns:

var temperature as Lang.Float or Null

The temperature in degrees Celsius (C).

Since:

API Level 1.0.0

Returns:


Generated Sep 23, 2024, 3:32:49 PM