Updated March 11, 2022
Copyright 2022 Moddable Tech Inc.
This document is a draft of additional sensor classes. It is intended to augment Sensors classes (Section 14) of the first edition of Ecma-419.
The Barometer
class implements access to a barometric pressure sensor. The property name barometer
is used when part of a compound sensor.
See Annex A for the formal algorithms of the Barometer
sensor class.
Property | Description |
---|---|
pressure |
A number that represents the sampled barometric pressure in Pascal. This property is required. |
The CarbonDioxideGasSensor
class implements access to a sensor that detects the amount of carbon dioxide in air. The property name carbonDioxideGasSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the CarbonDioxideGasSensor
sensor class.
Property | Description |
---|---|
CO2 |
A number that represents the sampled carbon dioxide in parts per million. This property is required. |
The CarbonMonoxideGasSensor
class implements access to a sensor that detects the amount of carbon monoxide in air. The property name carbonMonoxideGasSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the CarbonMonoxideGasSensor
sensor class.
Property | Description |
---|---|
CO |
A number that represents the sampled carbon monoxide in parts per million. This property is required. |
The DustSensor
class implements access to a sensor that detects the amount of dust suspended in air. The property name dustSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the DustSensor
sensor class.
Property | Description |
---|---|
dust |
A number that represents the sampled dust levels in micrograms per cubic meter. This property is required. |
The Gyroscope
class implements access to a three-dimensional gyroscope. The property name gyroscope
is used when part of a compound sensor.
See Annex A for the formal algorithms of the Gyroscope
sensor class.
These properties are compatible with the attributes of the same name in the W3C Gyroscope draft.
Property | Description |
---|---|
x |
A number that represents the sampled angular velocity around the x axis in radian per second. This property is required. |
y |
A number that represents the sampled angular velocity around the y axis in radian per second. This property is required. |
z |
A number that represents the sampled angular velocity around the z axis in radian per second. This property is required. |
The sign of the sampled angular velocity depends on the rotation direction, with a positive number indicating a clockwise rotation and a negative number indicating a counterclockwise rotation.
The HydrogenGasSensor
class implements access to a sensor that detects the amount of hydrogen in air. The property name hydrogenGasSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the HydrogenGasSensor
sensor class.
Property | Description |
---|---|
H |
A number that represents the sampled hydrogen in parts per million. This property is required. |
The HydrogenSulfideGasSensor
class implements access to a sensor that detects the amount of hydrogen sulfide in air. The property name hydrogenSulfideGasSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the HydrogenSulfideGasSensor
sensor class.
Property | Description |
---|---|
H2S |
A number that represents the sampled hydrogen sulfide in parts per million. This property is required. |
The Magnetometer
class implements access to a three-dimensional magnetometer. The property name magnetometer
is used when part of a compound sensor.
See Annex A for the formal algorithms of the Magnetometer
sensor class.
These properties are compatible with the attributes of the same name in the W3C Magnetometer draft.
Property | Description |
---|---|
x |
A number that represents the sampled magnetic field around the x axis in microtesla. This property is required. |
y |
A number that represents the sampled magnetic field around the y axis in microtesla. This property is required. |
z |
A number that represents the sampled magnetic field around the z axis in microtesla. This property is required. |
The MethaneGasSensor
class implements access to a sensor that detects the amount of methane in air. The property name methaneGasSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the MethaneGasSensor
sensor class.
Property | Description |
---|---|
CH4 |
A number that represents the sampled methane in parts per million. This property is required. |
The NitricOxideGasSensor
class implements access to a sensor that detects the amount of nitric oxide in air. The property name nitricOxideGasSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the NitricOxideGasSensor
sensor class.
Property | Description |
---|---|
NO |
A number that represents the sampled nitric oxide in parts per million. This property is required. |
The NitricDioxideGasSensor
class implements access to a sensor that detects the amount of nitric dioxide in air. The property name nitricDioxideGasSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the NitricDioxideGasSensor
sensor class.
Property | Description |
---|---|
NO2 |
A number that represents the sampled nitric dioxide in parts per million. This property is required. |
The OxygenGasSensor
class implements access to a sensor that detects the amount of oxygen in air. The property name oxygenGasSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the OxygenGasSensor
sensor class.
Property | Description |
---|---|
O |
A number that represents the sampled oxygen in parts per million. This property is required. |
The ParticulateMatterSensor
class implements access to a sensor that detects the amount of particulate matter suspended in air. The property name particulateMatterSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the ParticulateMatterSensor
sensor class.
Property | Description |
---|---|
particulateMatter |
A number that represents the sampled particulate matter levels in micrograms per cubic meter. This property is required. |
The SoilMoistureSensor
class implements access to a soil moisture sensor. The property name soilmoisturesensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the SoilMoistureSensor
sensor class.
Property | Description |
---|---|
moisture |
A number between 0 and 1 (inclusive) that represents the sampled relative soil moisture level, with 0 being the most dry and 1 the most wet. This property is required. |
The VOCSensor
class implements access to a sensor that detects the amount of volatile organic compounds suspended in air. The property name vocSensor
is used when part of a compound sensor.
See Annex A for the formal algorithms of the VOCSensor
sensor class.
Property | Description |
---|---|
tvoc |
A number that represents the sampled total volatile organic compounds in parts per billion. This property is required. |