TSensrvProperty Class Reference

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

KSensrvPropIdDataRate

The 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()

CSensrvChannel

Properties 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;  
     };

TSensrvProperty::SetItemIndex()

TSensrvProperty::PropertyItemIndex() sensrvutil.lib

S60 5.0

Public Member Functions
TSensrvProperty()
TSensrvProperty(const TSensrvPropertyId, const TInt, const TInt, const TInt, const TInt, const TBool, const TSensrvPropertyType)
TSensrvProperty(const TSensrvPropertyId, const TInt, const TInt)
TSensrvProperty(const TSensrvPropertyId, const TInt, const TReal, const TReal, const TReal, const TBool, const TSensrvPropertyType)
TSensrvProperty(const TSensrvPropertyId, const TInt, const TReal)
TSensrvProperty(const TSensrvPropertyId, const TInt, const TDesC8 &, const TBool, const TSensrvPropertyType)
TSensrvProperty(const TSensrvPropertyId, const TInt, const TDesC8 &)
IMPORT_C TIntGetArrayIndex()
IMPORT_C voidGetMaxValue(TInt &)
IMPORT_C voidGetMaxValue(TReal &)
IMPORT_C voidGetMinValue(TInt &)
IMPORT_C voidGetMinValue(TReal &)
IMPORT_C TSensrvPropertyIdGetPropertyId()
IMPORT_C TSecurityInfoGetSecurityInfo()
IMPORT_C voidGetValue(TInt &)
IMPORT_C voidGetValue(TReal &)
IMPORT_C voidGetValue(TDes8 &)
IMPORT_C TDes8 &GetValueRef()
IMPORT_C TIntPropertyItemIndex()
IMPORT_C TSensrvPropertyTypePropertyType()
IMPORT_C TBoolReadOnly()
IMPORT_C voidSetArrayIndex(const TInt)
IMPORT_C voidSetItemIndex(TInt)
IMPORT_C voidSetMaxValue(TInt)
IMPORT_C voidSetMaxValue(const TReal &)
IMPORT_C voidSetMinValue(TInt)
IMPORT_C voidSetMinValue(const TReal &)
IMPORT_C voidSetPropertyId(TSensrvPropertyId)
IMPORT_C voidSetReadOnly(TBool)
IMPORT_C voidSetSecurityInfo(const TSecurityInfo &)
IMPORT_C voidSetValue(const TInt)
IMPORT_C voidSetValue(const TReal)
IMPORT_C voidSetValue(const TDesC8 &)
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

Constructor & Destructor Documentation

TSensrvProperty()

IMPORT_CTSensrvProperty()

Default Constructor

TSensrvProperty(const TSensrvPropertyId, const TInt, const TInt, const TInt, const TInt, const TBool, const TSensrvPropertyType)

IMPORT_CTSensrvProperty(const TSensrvPropertyIdaPropertyId,
const TIntaItemIndex,
const TIntaValue,
const TIntaMaxValue,
const TIntaMinValue,
const TBoolaReadOnly,
const TSensrvPropertyTypeaPropertyType
)

Constructor to create complete integer type property.

S60 5.0

Parameters

const TSensrvPropertyId aPropertyIdId of the property
const TInt aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
const TInt aValueValue of the property.
const TInt aMaxValueMaximum value of the property
const TInt aMinValueMinimum value of the property
const TBool aReadOnlyReadonly-flag of the property
const TSensrvPropertyType aPropertyTypeType of the property

TSensrvProperty(const TSensrvPropertyId, const TInt, const TInt)

IMPORT_CTSensrvProperty(const TSensrvPropertyIdaPropertyId,
const TIntaItemIndex,
const TIntaValue
)

Constructor to create property object for setting integer property value.

S60 5.0

Parameters

const TSensrvPropertyId aPropertyIdId of the property
const TInt aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
const TInt aValueValue of the property.

TSensrvProperty(const TSensrvPropertyId, const TInt, const TReal, const TReal, const TReal, const TBool, const TSensrvPropertyType)

IMPORT_CTSensrvProperty(const TSensrvPropertyIdaPropertyId,
const TIntaItemIndex,
const TRealaValue,
const TRealaMaxValue,
const TRealaMinValue,
const TBoolaReadOnly,
const TSensrvPropertyTypeaPropertyType
)

Constructor to create complete TReal type of property.

S60 5.0

Parameters

const TSensrvPropertyId aPropertyIdId of the property
const TInt aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
const TReal aValueValue of the property.
const TReal aMaxValueMaximum value of the property
const TReal aMinValueMinimum value of the property
const TBool aReadOnlyReadonly-flag of the property
const TSensrvPropertyType aPropertyTypeType of the property

TSensrvProperty(const TSensrvPropertyId, const TInt, const TReal)

IMPORT_CTSensrvProperty(const TSensrvPropertyIdaPropertyId,
const TIntaItemIndex,
const TRealaValue
)

Constructor to create property object for setting real property value.

S60 5.0

Parameters

const TSensrvPropertyId aPropertyIdId of the property
const TInt aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
const TReal aValueValue of the property.

TSensrvProperty(const TSensrvPropertyId, const TInt, const TDesC8 &, const TBool, const TSensrvPropertyType)

IMPORT_CTSensrvProperty(const TSensrvPropertyIdaPropertyId,
const TIntaItemIndex,
const TDesC8 &aValue,
const TBoolaReadOnly,
const TSensrvPropertyTypeaPropertyType
)

Constructor to create complete buffer property.

S60 5.0

Parameters

const TSensrvPropertyId aPropertyIdId of the property
const TInt aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
const TDesC8 & aValueValue of the property. Max length is defined in KSensrvPropertyTextBufferSize.
const TBool aReadOnlyReadonly-flag of the property
const TSensrvPropertyType aPropertyTypeType of the property

TSensrvProperty(const TSensrvPropertyId, const TInt, const TDesC8 &)

IMPORT_CTSensrvProperty(const TSensrvPropertyIdaPropertyId,
const TIntaItemIndex,
const TDesC8 &aValue
)

Constructor to create property object for setting buffer property value.

S60 5.0

Parameters

const TSensrvPropertyId aPropertyIdId of the property
const TInt aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
const TDesC8 & aValueValue of the property. Max length is defined in KSensrvPropertyTextBufferSize.

Member Functions Documentation

GetArrayIndex()

IMPORT_C TIntGetArrayIndex()const

Get array index of the property

S60 5.0

Array index of the property.

TSensrvArrayIndex

KSensrvPropIdDataRate for an example

GetMaxValue(TInt &)

IMPORT_C voidGetMaxValue(TInt &aMaxValue)const

Get property maximum value of integer property

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt & aMaxValueMaximum value to get

GetMaxValue(TReal &)

IMPORT_C voidGetMaxValue(TReal &aMaxValue)const

Get property maximum value of real property

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TReal & aMaxValueMaximum value to get

GetMinValue(TInt &)

IMPORT_C voidGetMinValue(TInt &aMinValue)const

Get property minimum value of integer property

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt & aMinValueMinimum value to get

GetMinValue(TReal &)

IMPORT_C voidGetMinValue(TReal &aMinValue)const

Get property minimum value of real property

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TReal & aMinValueMinimum value to get

GetPropertyId()

IMPORT_C TSensrvPropertyIdGetPropertyId()const

Return Property Id

S60 5.0

Property Id

GetSecurityInfo()

IMPORT_C TSecurityInfoGetSecurityInfo()const

Get security info of the property

S60 5.0

Security info of the property

GetValue(TInt &)

IMPORT_C voidGetValue(TInt &aValue)const

Get integer property value

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt & aValueValue to get

GetValue(TReal &)

IMPORT_C voidGetValue(TReal &aValue)const

Get real property value

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TReal & aValueValue to get

GetValue(TDes8 &)

IMPORT_C voidGetValue(TDes8 &aValue)const

Get buffer property value

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TDes8 & aValueDestination where a property value is to be copied

GetValueRef()

IMPORT_C TDes8 &GetValueRef()

Get reference to buffer property value

S60 5.0

Reference to a property value

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

PropertyItemIndex()

IMPORT_C TIntPropertyItemIndex()const

Get the property item index number

S60 5.0

Item index number.

PropertyType()

IMPORT_C TSensrvPropertyTypePropertyType()const

Return property type

S60 5.0

Property type's Id

ReadOnly()

IMPORT_C TBoolReadOnly()const

Checks if the property is readonly

S60 5.0

ETrue value indicates that property is a read only property.

SetArrayIndex(const TInt)

IMPORT_C voidSetArrayIndex(const TIntaArrayIndex)

Set array index of the property.

S60 5.0

TSensrvArrayIndex

KSensrvPropIdDataRate for an example

Parameters

const TInt aArrayIndexArray index to be set

SetItemIndex(TInt)

IMPORT_C voidSetItemIndex(TIntaItemIndex)

Set the property item index for the property.

S60 5.0

Parameters

TInt aItemIndexproperty item index to be set.

SetMaxValue(TInt)

IMPORT_C voidSetMaxValue(TIntaMaxValue)

Set property maximum value of integer property

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt aMaxValueMaximum value to be set

SetMaxValue(const TReal &)

IMPORT_C voidSetMaxValue(const TReal &aMaxValue)

Set property maximum value of real property

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TReal & aMaxValueMaximum value to be set.

SetMinValue(TInt)

IMPORT_C voidSetMinValue(TIntaMinValue)

Set property minimum value of integer property

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt aMinValueMinimum value to be set

SetMinValue(const TReal &)

IMPORT_C voidSetMinValue(const TReal &aMinValue)

Set property minimum value of real property

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TReal & aMinValueMinimum value to be set.

SetPropertyId(TSensrvPropertyId)

IMPORT_C voidSetPropertyId(TSensrvPropertyIdaPropertyId)

Set the property Id for the property.

S60 5.0

Parameters

TSensrvPropertyId aPropertyIdProperty Id to be set.

SetReadOnly(TBool)

IMPORT_C voidSetReadOnly(TBoolaReadOnly)

Set the readonly information for the property.

S60 5.0

Parameters

TBool aReadOnlyreadonly information to be set. EFalse means that the property is not readonly.

SetSecurityInfo(const TSecurityInfo &)

IMPORT_C voidSetSecurityInfo(const TSecurityInfo &aSecurityInfo)

Set security info of the property. This should be set to the Security info for the client process

S60 5.0

Parameters

const TSecurityInfo & aSecurityInfoSecurity info to be set

SetValue(const TInt)

IMPORT_C voidSetValue(const TIntaValue)

Set integer property value

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TInt aValueValue to be set.

SetValue(const TReal)

IMPORT_C voidSetValue(const TRealaValue)

Set real property value

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TReal aValueValue to be set.

SetValue(const TDesC8 &)

IMPORT_C voidSetValue(const TDesC8 &aValue)

Set buffer property value

S60 5.0

panic

KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TDesC8 & aValueValue to be set.

Member Data Documentation

union TSensrvProperty::@26 @27

union TSensrvProperty::@26@27[private]

union TSensrvProperty::@28 @29

union TSensrvProperty::@28@29[private]

union TSensrvProperty::@30 @31

union TSensrvProperty::@30@31[private]

TInt16 iArrayIndex

TInt16 iArrayIndex[private]

TBuf8< KSensrvPropertyTextBufferSize > iBufValue

TBuf8< KSensrvPropertyTextBufferSize >iBufValue[private]

TBitFlags32 iFlags

TBitFlags32 iFlags[private]

TInt iIntValue

TInt iIntValue

TInt iIntValueMax

TInt iIntValueMax

TInt iIntValueMin

TInt iIntValueMin

TInt iItemIndex

TInt iItemIndex[private]

TSensrvPropertyId iPropertyId

TSensrvPropertyId iPropertyId[private]

TSensrvPropertyType iPropertyType

TSensrvPropertyType iPropertyType[private]

TReal iRealValue

TReal iRealValue

TReal iRealValueMax

TReal iRealValueMax

TReal iRealValueMin

TReal iRealValueMin

TInt iReserved

TInt iReserved[private]

TSecurityInfo iSecurityInfo

TSecurityInfo iSecurityInfo[private]