class TSensrvProperty |
TSensrvProperty is a simple data class that contains sensor channel property information. The class has little behaviour and only does sanity checks where it is possible. It is therefore assumed that users of this class are aware of and conform to a properties definition for a given property identifier.
There are 2 groups of properties, General Channel Properties and Specific Channel Properties.
General Channel Properties are properties that are supported by all channels. These are defined in sensrvgeneralproperties.h. Specific Channel Properties are properties that are supported by specific channel types as required. These are defined in the relevant headers files.
The property identifier uniquely identifies the property within a channel. These property ids must fall into the relevant range specified by TSensrvPropertyRangeUsage. Each property will have a constant defined for its identifier. e.g. KSensrvPropIdDataRate.
TSensrvProperty::SetPropertyId() TSensrvProperty::GetPropertyId() TSensrvPropertyRangeUsage KSensrvPropIdDataRateThe property type is used to determine whether the property is TInt, TReal or Buffer. The property type is automatically set when the value of the object is set.
TSensrvPropertyType TSensrvProperty::PropertyType()The value fields are used to indicate the value of a property when the property contains a single int, real or buffer value. The min and max value fields are used when a property has a range of int or real values. A property cannot have a range of buffer values. The value and min/max values of a property will never be set at the same time.
TSensrvProperty::GetValue() TSensrvProperty::SetValue() TSensrvProperty::GetValueRef() TSensrvProperty::GetMinValue() TSensrvProperty::SetMinValue() TSensrvProperty::GetMaxValue() TSensrvProperty::SetMaxValue()Properties can be read only which means it cannot be set by CSensrvChannel::SetPropertyL().
TSensrvProperty::ReadOnly() TSensrvProperty::SetReadOnly() CSensrvChannelProperties can either be single properties, or can be a member of an array of properties. The array index field is set to ESensrvSingleProperty(-1) if the property is single. If a property is part of an array then the array index field will be set to ESensrvArrayPropertyInfo(-2) or the index for the array. When the array index is ESensrvArrayPropertyInfo the property uses the iIntValueMin and iIntValueMax fields to indicate the range of the array. When the array index is an actual index (neither ESensrvArrayPropertyInfo nor ESensrvArrayPropertyInfo) the property contains data.
Example:
A Sensor channel which supports data rates within a given range can use one Data Rate property. The range is defined using the property's maximum and minimum value. E.g. A sensor channel supports a data range from 10Hz to 100Hz and all values within this range are feasible. To implement this use one Data Rate property with a minimum value 10 and a maximum value of 100.
A Sensor channel which supports discrete data rates can use the Data Rate property as an array. E.g. A sensor channel supports the following data rates 10Hz, 40Hz and 50Hz. To implement this four different Data Rate properties are needed. The following table shows the content of the four properties, only mandatory attributes are shown.
property ID Array index Value Min Value Max Value Read only ----------- ----------- ----- --------- --------- --------- 0x00000002 -2 1 0 2 EFalse 0x00000002 0 10 n/a n/a ETrue 0x00000002 1 40 n/a n/a ETrue 0x00000002 2 50 n/a n/a ETrue
The first property (first row in table above) is the header for the property array. It defines that this property is an array property. The attributes of this property are:
Array index: -2 means that the property is an array property Value: 1 means that current value of the property is defined by the property with an array index of 1. The value is 40Hz in this example. Min value 0 is the start index of the property array Max value: 2 is the last index of the property array Read only: EFalse means that the properties current value can be changed,
In this example the possible values of the property are 0, 1, and 2 which corresponds to data rates of 10Hz, 40Hz and 50Hz.
TSensrvArrayIndex TSensrvProperty::SetArrayIndex() TSensrvProperty::GetArraIndex()The property item index is used to identify a specific item in the channel data structure that the property refers to. For example the Accelerometer XYZ-axis data structure defines data for the x, y and Z axis. Individual properties could have been defined for each of these axis. Instead a single property is defined and the Item Index is used to identify the relevant axis in the channel data structure that the property applies to. The indexes for these specific items and the channel data structures themselves are defined in the sensor specific headers files found in epoc32.
Example:
Accelerometer data definition. TSensrvAccelerometerAxisDataIndexes is used to provide an index that relates to each of the class fields.
// ACCELEROMETER RELATED DATATYPES // Accelerometer axis data type class TSensrvAccelerometerAxisData { public: // // Channel data type Id number // static const TSensrvChannelDataTypeId KDataTypeId = 0x1020507E; // // Channel data type index numbers // enum TSensrvAccelerometerAxisDataIndexes { ETimeStamp = 0, EAxisX, EAxisY, EAxisZ }; public: // // - Item name: Sampling time. // - Item Index: 0 // - Conditions: None // - Description: Timestamp for a sample. // TTime iTimeStamp; // // - Item name: Accelerometer x-axis // - Item Index: 1 // - Conditions: Single limit and range // - Description: Accelerometer values from x-axis // TInt iAxisX; // // - Item name: Accelerometer y-axis // - Item Index: 2 // - Conditions: Single limit and range // - Description: Accelerometer values from y-axis // TInt iAxisY; // // - Item name: Accelerometer z-axis // - Item Index: 3 // - Conditions: Single limit and range // - Description: Accelerometer values from z-axis // TInt iAxisZ; };
Public Attributes | |
---|---|
TInt | iIntValue |
TInt | iIntValueMax |
TInt | iIntValueMin |
TReal | iRealValue |
TReal | iRealValueMax |
TReal | iRealValueMin |
Private Attributes | |
---|---|
union TSensrvProperty::@26 | @27 |
union TSensrvProperty::@28 | @29 |
union TSensrvProperty::@30 | @31 |
TInt16 | iArrayIndex |
TBuf8< KSensrvPropertyTextBufferSize > | iBufValue |
TBitFlags32 | iFlags |
TInt | iItemIndex |
TSensrvPropertyId | iPropertyId |
TSensrvPropertyType | iPropertyType |
TInt | iReserved |
TSecurityInfo | iSecurityInfo |
IMPORT_C | TSensrvProperty | ( | const TSensrvPropertyId | aPropertyId, |
const TInt | aItemIndex, | |||
const TInt | aValue, | |||
const TInt | aMaxValue, | |||
const TInt | aMinValue, | |||
const TBool | aReadOnly, | |||
const TSensrvPropertyType | aPropertyType | |||
) |
Constructor to create complete integer type property.
const TSensrvPropertyId aPropertyId | Id of the property |
const TInt aItemIndex | Item index of the property. Mapped to a specific item in channel data structure. |
const TInt aValue | Value of the property. |
const TInt aMaxValue | Maximum value of the property |
const TInt aMinValue | Minimum value of the property |
const TBool aReadOnly | Readonly-flag of the property |
const TSensrvPropertyType aPropertyType | Type of the property |
IMPORT_C | TSensrvProperty | ( | const TSensrvPropertyId | aPropertyId, |
const TInt | aItemIndex, | |||
const TInt | aValue | |||
) |
Constructor to create property object for setting integer property value.
const TSensrvPropertyId aPropertyId | Id of the property |
const TInt aItemIndex | Item index of the property. Mapped to a specific item in channel data structure. |
const TInt aValue | Value of the property. |
IMPORT_C | TSensrvProperty | ( | const TSensrvPropertyId | aPropertyId, |
const TInt | aItemIndex, | |||
const TReal | aValue, | |||
const TReal | aMaxValue, | |||
const TReal | aMinValue, | |||
const TBool | aReadOnly, | |||
const TSensrvPropertyType | aPropertyType | |||
) |
Constructor to create complete TReal type of property.
const TSensrvPropertyId aPropertyId | Id of the property |
const TInt aItemIndex | Item index of the property. Mapped to a specific item in channel data structure. |
const TReal aValue | Value of the property. |
const TReal aMaxValue | Maximum value of the property |
const TReal aMinValue | Minimum value of the property |
const TBool aReadOnly | Readonly-flag of the property |
const TSensrvPropertyType aPropertyType | Type of the property |
IMPORT_C | TSensrvProperty | ( | const TSensrvPropertyId | aPropertyId, |
const TInt | aItemIndex, | |||
const TReal | aValue | |||
) |
Constructor to create property object for setting real property value.
const TSensrvPropertyId aPropertyId | Id of the property |
const TInt aItemIndex | Item index of the property. Mapped to a specific item in channel data structure. |
const TReal aValue | Value of the property. |
IMPORT_C | TSensrvProperty | ( | const TSensrvPropertyId | aPropertyId, |
const TInt | aItemIndex, | |||
const TDesC8 & | aValue, | |||
const TBool | aReadOnly, | |||
const TSensrvPropertyType | aPropertyType | |||
) |
Constructor to create complete buffer property.
const TSensrvPropertyId aPropertyId | Id of the property |
const TInt aItemIndex | Item index of the property. Mapped to a specific item in channel data structure. |
const TDesC8 & aValue | Value of the property. Max length is defined in KSensrvPropertyTextBufferSize. |
const TBool aReadOnly | Readonly-flag of the property |
const TSensrvPropertyType aPropertyType | Type of the property |
IMPORT_C | TSensrvProperty | ( | const TSensrvPropertyId | aPropertyId, |
const TInt | aItemIndex, | |||
const TDesC8 & | aValue | |||
) |
Constructor to create property object for setting buffer property value.
const TSensrvPropertyId aPropertyId | Id of the property |
const TInt aItemIndex | Item index of the property. Mapped to a specific item in channel data structure. |
const TDesC8 & aValue | Value of the property. Max length is defined in KSensrvPropertyTextBufferSize. |
IMPORT_C TInt | GetArrayIndex | ( | ) | const |
Get array index of the property
IMPORT_C void | GetMaxValue | ( | TInt & | aMaxValue | ) | const |
Get property maximum value of integer property
TInt & aMaxValue | Maximum value to get |
IMPORT_C void | GetMaxValue | ( | TReal & | aMaxValue | ) | const |
Get property maximum value of real property
TReal & aMaxValue | Maximum value to get |
IMPORT_C void | GetMinValue | ( | TInt & | aMinValue | ) | const |
Get property minimum value of integer property
TInt & aMinValue | Minimum value to get |
IMPORT_C void | GetMinValue | ( | TReal & | aMinValue | ) | const |
Get property minimum value of real property
TReal & aMinValue | Minimum value to get |
IMPORT_C TSecurityInfo | GetSecurityInfo | ( | ) | const |
Get security info of the property
IMPORT_C void | GetValue | ( | TInt & | aValue | ) | const |
Get integer property value
TInt & aValue | Value to get |
IMPORT_C void | GetValue | ( | TReal & | aValue | ) | const |
Get real property value
TReal & aValue | Value to get |
IMPORT_C void | GetValue | ( | TDes8 & | aValue | ) | const |
Get buffer property value
TDes8 & aValue | Destination where a property value is to be copied |
IMPORT_C TDes8 & | GetValueRef | ( | ) |
Get reference to buffer property value
IMPORT_C TInt | PropertyItemIndex | ( | ) | const |
Get the property item index number
IMPORT_C void | SetArrayIndex | ( | const TInt | aArrayIndex | ) |
Set array index of the property.
const TInt aArrayIndex | Array index to be set |
IMPORT_C void | SetItemIndex | ( | TInt | aItemIndex | ) |
Set the property item index for the property.
TInt aItemIndex | property item index to be set. |
IMPORT_C void | SetMaxValue | ( | TInt | aMaxValue | ) |
Set property maximum value of integer property
TInt aMaxValue | Maximum value to be set |
IMPORT_C void | SetMaxValue | ( | const TReal & | aMaxValue | ) |
Set property maximum value of real property
const TReal & aMaxValue | Maximum value to be set. |
IMPORT_C void | SetMinValue | ( | TInt | aMinValue | ) |
Set property minimum value of integer property
TInt aMinValue | Minimum value to be set |
IMPORT_C void | SetMinValue | ( | const TReal & | aMinValue | ) |
Set property minimum value of real property
const TReal & aMinValue | Minimum value to be set. |
IMPORT_C void | SetPropertyId | ( | TSensrvPropertyId | aPropertyId | ) |
Set the property Id for the property.
TSensrvPropertyId aPropertyId | Property Id to be set. |
IMPORT_C void | SetReadOnly | ( | TBool | aReadOnly | ) |
Set the readonly information for the property.
TBool aReadOnly | readonly information to be set. EFalse means that the property is not readonly. |
IMPORT_C void | SetSecurityInfo | ( | const TSecurityInfo & | aSecurityInfo | ) |
Set security info of the property. This should be set to the Security info for the client process
const TSecurityInfo & aSecurityInfo | Security info to be set |
IMPORT_C void | SetValue | ( | const TInt | aValue | ) |
Set integer property value
const TInt aValue | Value to be set. |
IMPORT_C void | SetValue | ( | const TReal | aValue | ) |
Set real property value
const TReal aValue | Value to be set. |
IMPORT_C void | SetValue | ( | const TDesC8 & | aValue | ) |
Set buffer property value
const TDesC8 & aValue | Value to be set. |
TBuf8< KSensrvPropertyTextBufferSize > | iBufValue | [private] |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.