Sensors Framework Overview

The Sensors Framework consists of a sensor server and channel based client APIs for supporting an extensible set of sensor hardware. The sensor server defines a plug-in interface for adding sensor plug-ins for any type of sensor hardware. The channel APIs enable client applications to interact with the sensor hardware.

Key Concepts and Terms

Sensor Channel

The sensor channel forms a medium of interaction between the sensor hardware and client applications.

The data from one physical sensor can be mapped to several channels. For example, the Sensor System handling an acceleration sensor can provide raw data on one channel and preprocessed tap events on another.

Channel Properties

Channel properties contain properties of a specific channel, such as data rate, availability, connection type and so on.

Data item

A data item is a discrete data package that contains sensor data or an event parsed from sensor data and related values, such as timestamp. Each channel provides a single type of data item only.

Channel condition

A value-operator pair targeting a single value inside a data item, indicated by an index. A condition is met when the channel data value in comparison with the condition value using condition operator is true. The conditions are gathered in condition sets.

There are two condition types: single limit conditions and range conditions. Range conditions are formed from two separate conditions, representing the lower and upper limits of the range.

Channel Condition Set
A set of channel conditions. Following are the two types of condition sets:
  • AND condition set: An AND condition is met only if a data value satisfies all conditions in the set.

  • OR condition: An OR condition is met if a data value satisfies even one single condition in the set.

Description

The sensor server provides a plug-in interface (Sensor Definitions APIs) that enables platform developers to create sensor plug-ins for required sensors hardware. The sensor plug-ins enable the interaction between a client application and the sensor hardware through sensor channels. The Sensor Channel APIs provides access to each sensor channel.

One physical sensor can provide several different types of data. For example, the physical magnetometer can provide data for the Magnetometer channel and the Magnetic North channel. Each sensor channel has its own sensor channel data definition in the Sensor Definitions APIs that defines the format of the data package supplied by the sensor channel. The data definition can also define properties for each data item in the data package.

The sensor server facilitates the transfer of data from one sensor hardware to multiple clients simultaneously. It also resolves any contention between client applications for opening channels or configuring a sensor device.

APIs

API Description
CSensrvChannelFinder The channel finder provides functions to search and find sensor channels that are supported by the Symbian device.
CSensrvChannel The sensor channel provides functions to open and control a sensor channel.
CSensrvChannelCondition The sensor channel provides functions for notifying when a specific condition is met.
CSensrvChannelConditionSet The sensor channel condition set provides functions for adding one or more channel conditions to a condition set.
MSensrvChannelListener The sensor channel listener is a callback interface that tracks for new channels installed on the Symbian device.
MSensrvChannelConditionListener The sensor channel condition listener is a callback interface that notifies the clients when a condition-set is satisfied.
MSensrvDataListener The sensor data listener is a callback interface that notifies the clients when the sensor data is available.
MSensrvPropertyListener The sensor property listener is a callback interface that notifies the client when a channel property changes.

A physical sensor can supply data to several sensor channels (CSensrvChannel) . A sensor channel provides data to an application in a channel-specific data format (for example, TSensrvXyzData) through a callback to the MSensrvDataListener::DataReceived() interface. A sensor channel has a single channel info item (TSensrvChannelInfo) that describes the channel in general. A sensor channel has multiple property items (TSensrvProperty) that describe the channel in more detail. Each property item is referenced by a property id and an index.

Typical Uses

Using the sensor channel APIs, you can perform the following operations: