The Sensor Service API allows Flash Lite applications to access data provided by the physical sensors of a device. The data from a given sensor is mapped to one or more sensor channels, which the API can listen to. The available sensors depend on the device. You can use the Sensor Service to create Flash Lite applications that:
Search for sensor channels available on a device
Listen for data provided by one or more sensor channels
Retrieve information about sensor channel properties
For example code snippets that focus on common Sensor Service use cases, see section Flash Lite components and code snippets.
Sensor information involves the following concepts:
Sensor is a physical sensor on a device (a piece of hardware combined with a software plug-in). A single sensor can provide multiple sensor channels, such as a raw data channel and event channels, or incorporate multiple sensor readings into a single sensor channel.
Sensor property is a configuration value of a sensor. The property affects all sensor channels that draw data from the sensor.
Channel is an abstraction of a physical sensor. Data from one physical sensor can be mapped to multiple sensor channels.
Channel property is a configuration value of a sensor channel. The property affects all clients listening to the channel.
To create a service
object for the Sensor Service API, use Service.Sensor to
identify the service provider and ISensor to identify
the supported interface:
var sensor = new Service("Service.Sensor", "ISensor");
The ISensor interface provides the following methods:
Use the FindSensorChannel() method to search for
sensor channels available on the device.
Use the RegisterForNotification() method to receive
data from one sensor channel.
Use the Cancel() method to stop receiving data
provided by a RegisterForNotification() call.
Use the GetChannelProperty() method to retrieve
information about a sensor channel property.