DeviceSensor Class
A sensor of the device (https://w3c.github.io/sensors/#virtual-sensors), added by DeviceSensorProvider.AddSensor: DeviceSensor.Update makes a new reading available to the sensor objects of the documents.
public sealed class DeviceSensorProperties
| Name | Description |
|---|---|
| CanProvideReadings | Gets whether the sensor works (the can provide readings flag): when false, the sensor objects cannot connect to it. |
| IsRemoved | Gets whether the sensor was removed from the device (DeviceSensorProvider.RemoveSensor). |
| MaximumSamplingFrequency | Gets the maximum sampling frequency of the sensor, in Hz. |
| MinimumSamplingFrequency | Gets the minimum sampling frequency of the sensor, in Hz. |
| Reading | Gets the latest reading of the sensor, or null when it has none. |
| RequestedSamplingFrequency | Gets the sampling frequency requested by the sensor objects that use the sensor, in Hz (https://w3c.github.io/sensors/#virtual-sensor-requested-sampling-frequency): the highest frequency they asked for, within the bounds of the sensor, or 0 when no sensor object uses it. |
| Type | Gets the type of the sensor. |
CanProvideReadings
DeviceSensorProvider.csIsRemoved
DeviceSensorProvider.csGets whether the sensor was removed from the device (DeviceSensorProvider.RemoveSensor).
public bool IsRemoved { get; }Property value
MaximumSamplingFrequency
DeviceSensorProvider.csMinimumSamplingFrequency
DeviceSensorProvider.csReading
DeviceSensorProvider.csGets the latest reading of the sensor, or null when it has none.
public DeviceSensorReading? Reading { get; }Property value
RequestedSamplingFrequency
DeviceSensorProvider.csGets the sampling frequency requested by the sensor objects that use the sensor, in Hz (https://w3c.github.io/sensors/#virtual-sensor-requested-sampling-frequency): the highest frequency they asked for, within the bounds of the sensor, or 0 when no sensor object uses it.
public double RequestedSamplingFrequency { get; }Property value
Methods
| Name | Description |
|---|---|
| Update(DeviceSensorReading) | Makes a new reading available to the sensor objects that use the sensor (https://w3c.github.io/sensors/#update-virtual-sensor-reading-command): they process it from a task (it may be discarded by the threshold check of the sensor type, and it is delivered once the document is visible and focused). It can be called from any thread. |
Update(DeviceSensorReading)
DeviceSensorProvider.csMakes a new reading available to the sensor objects that use the sensor (https://w3c.github.io/sensors/#update-virtual-sensor-reading-command): they process it from a task (it may be discarded by the threshold check of the sensor type, and it is delivered once the document is visible and focused). It can be called from any thread.
public void Update(DeviceSensorReading reading)Parameters
readingDeviceSensorReading
Exceptions
ArgumentException- The reading does not have the shape of the readings of
DeviceSensor.Type.