The supported sensor channels are declared in the Sensor definitions API.
The number of implemented channels may vary between products. For information on supported sensor channels on different devices, see Device specifications on Forum Nokia.
For each channel a channel type ID constant and a short description is provided.
The double tapping channel declaration is shown below as an example.
A sensor channel will provide data in one of three ways: continuous data, on event, or state change. Raw data channels provide data continuously and event channels provide data when an appropriate event occurs. State channels provide data when the channel state changes.
The channel data type describes what type of data the channel provides.
/** * - Name: Double tapping event channel type * - Type: Event * - Datatype: TSensrvTappingData * - Description: Double tapping events */ const TSensrvChannelTypeId KSensrvChannelTypeIdAccelerometerDoubleTappingData = 0x10205081;
Channel data types are declared in each sensor's header file. Channel data type is the type of an object which a sensor channel provides.
The double tapping channel data type declaration is shown below.
class TSensrvTappingData { public: /** * Channel data type Id number */ static const TSensrvChannelDataTypeId KDataTypeId = 0x1020507F; /** * Channel data type enumerations */ enum TSensrvAccelerometerAxisDataIndexes { iTimeStamp = 0, iDirection }; }; public: /** * - Item name: Sampling time. * - Item Index: 0 * - Conditions: None * - Description: Timestamp for a sample. */ TTime iTimeStamp; /** * - Item name: Tapping direction bitmask * - Item Index: 1 * - Conditions: Binary * - Description: Direction bitmask of the tapping event. * See constant definitions above. */ TUint32 iDirection; };
The channel data type ID (e.g. TSensrvTappingData::KDataTypeId
)
is a unique ID for each data type, enabling the separation of data types from
each other. The data type ID is used in TSensrvChannelInfo
to define the data type used in a channel.
The channel data type index (e.g. TSensrvTappingData::iDirection
)
is used to point to an attribute inside a data type. Attributes of the TSensrvTappingData
class
are iTimeStamp
and iDirection
.
The channel data type index is used in:
TSensrvProperty
)
if a property scope is a channel itemCSensrvChannelCondition
) to identify which attribute is used as a conditionChannel properties are declared in sensrvgeneralproperties.h
and sensor specific files. General properties for all channel types
are declared in the sensrvgeneralproperties.h
file and accelerometer
specific properties are declared in the sensrvaccelerometersensor.h
file.
For each property, a property ID constant and a short description are provided.
The property type specifies the type of the value the property contains. It
can be TInt
, TReal
or TBuf
.
Property scope can be defined for:
A mandatory section specifies if the property is required for all channels. Capability section specifies the required capabilities to change value of the property.
The accuracy property is shown below as an example.
/** * - Name: Accuracy of the channel data * - Type: TReal * - Scope: Channel item property * - Mandatory: No * - Capability: None * - Description: Returns the accuracy of this channel of the sensor as a * percentage of reading (=data value). */ const TSensrvPropertyId KSensrvPropIdChannelAccuracy = 0x000000008;
Example content of the Accuracy property is shown below. For properties
that are defined as channel data item specific, the item index defines the
data item the property is related to. If the property is a sensor or channel
property, the item index is KSensrvItemIndexNone
.
The array index is explained in Using array properties.
iPropertyId = KSensrvPropIdChannelAccuracy iItemIndex = KSensrvItemIndexNone iArrayIndex = ESensrvSingleProperty iRealValue = 10.0 iReadOnly = ETrue iRealValueMax = n/a iRealValueMin = n/a iPropertyType = ESensrvRealProperty iSecurityInfo = n/a