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 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 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 TInt GetArrayIndex ()
IMPORT_C void GetMaxValue ( TInt &)
IMPORT_C void GetMaxValue ( TReal &)
IMPORT_C void GetMinValue ( TInt &)
IMPORT_C void GetMinValue ( TReal &)
IMPORT_C TSensrvPropertyId GetPropertyId ()
IMPORT_C TSecurityInfo GetSecurityInfo ()
IMPORT_C void GetValue ( TInt &)
IMPORT_C void GetValue ( TReal &)
IMPORT_C void GetValue ( TDes8 &)
IMPORT_C TDes8 & GetValueRef ()
IMPORT_C TInt PropertyItemIndex ()
IMPORT_C TSensrvPropertyType PropertyType ()
IMPORT_C TBool ReadOnly ()
IMPORT_C void SetArrayIndex (const TInt )
IMPORT_C void SetItemIndex ( TInt )
IMPORT_C void SetMaxValue ( TInt )
IMPORT_C void SetMaxValue (const TReal &)
IMPORT_C void SetMinValue ( TInt )
IMPORT_C void SetMinValue (const TReal &)
IMPORT_C void SetPropertyId ( TSensrvPropertyId )
IMPORT_C void SetReadOnly ( TBool )
IMPORT_C void SetSecurityInfo (const TSecurityInfo &)
IMPORT_C void SetValue (const TInt )
IMPORT_C void SetValue (const TReal )
IMPORT_C void SetValue (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_C TSensrvProperty ( )

Default Constructor

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

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.

Since
S60 5.0

Parameters

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

TSensrvProperty(const TSensrvPropertyId, const TInt, const TInt)

IMPORT_C TSensrvProperty ( const TSensrvPropertyId aPropertyId,
const TInt aItemIndex,
const TInt aValue
)

Constructor to create property object for setting integer property value.

Since
S60 5.0

Parameters

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.

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

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.

Since
S60 5.0

Parameters

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

TSensrvProperty(const TSensrvPropertyId, const TInt, const TReal)

IMPORT_C TSensrvProperty ( const TSensrvPropertyId aPropertyId,
const TInt aItemIndex,
const TReal aValue
)

Constructor to create property object for setting real property value.

Since
S60 5.0

Parameters

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.

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

IMPORT_C TSensrvProperty ( const TSensrvPropertyId aPropertyId,
const TInt aItemIndex,
const TDesC8 & aValue,
const TBool aReadOnly,
const TSensrvPropertyType aPropertyType
)

Constructor to create complete buffer property.

Since
S60 5.0

Parameters

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

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

IMPORT_C TSensrvProperty ( const TSensrvPropertyId aPropertyId,
const TInt aItemIndex,
const TDesC8 & aValue
)

Constructor to create property object for setting buffer property value.

Since
S60 5.0

Parameters

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.

Member Functions Documentation

GetArrayIndex()

IMPORT_C TInt GetArrayIndex ( ) const

Get array index of the property

Since
S60 5.0
TSensrvArrayIndex KSensrvPropIdDataRate for an example

GetMaxValue(TInt &)

IMPORT_C void GetMaxValue ( TInt & aMaxValue ) const

Get property maximum value of integer property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt & aMaxValue Maximum value to get

GetMaxValue(TReal &)

IMPORT_C void GetMaxValue ( TReal & aMaxValue ) const

Get property maximum value of real property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TReal & aMaxValue Maximum value to get

GetMinValue(TInt &)

IMPORT_C void GetMinValue ( TInt & aMinValue ) const

Get property minimum value of integer property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt & aMinValue Minimum value to get

GetMinValue(TReal &)

IMPORT_C void GetMinValue ( TReal & aMinValue ) const

Get property minimum value of real property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TReal & aMinValue Minimum value to get

GetPropertyId()

IMPORT_C TSensrvPropertyId GetPropertyId ( ) const

Return Property Id

Since
S60 5.0

GetSecurityInfo()

IMPORT_C TSecurityInfo GetSecurityInfo ( ) const

Get security info of the property

Since
S60 5.0

GetValue(TInt &)

IMPORT_C void GetValue ( TInt & aValue ) const

Get integer property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt & aValue Value to get

GetValue(TReal &)

IMPORT_C void GetValue ( TReal & aValue ) const

Get real property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TReal & aValue Value to get

GetValue(TDes8 &)

IMPORT_C void GetValue ( TDes8 & aValue ) const

Get buffer property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TDes8 & aValue Destination where a property value is to be copied

GetValueRef()

IMPORT_C TDes8 & GetValueRef ( )

Get reference to buffer property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

PropertyItemIndex()

IMPORT_C TInt PropertyItemIndex ( ) const

Get the property item index number

Since
S60 5.0

PropertyType()

IMPORT_C TSensrvPropertyType PropertyType ( ) const

Return property type

Since
S60 5.0

ReadOnly()

IMPORT_C TBool ReadOnly ( ) const

Checks if the property is readonly

Since
S60 5.0

SetArrayIndex(const TInt)

IMPORT_C void SetArrayIndex ( const TInt aArrayIndex )

Set array index of the property.

Since
S60 5.0
TSensrvArrayIndex KSensrvPropIdDataRate for an example

Parameters

const TInt aArrayIndex Array index to be set

SetItemIndex(TInt)

IMPORT_C void SetItemIndex ( TInt aItemIndex )

Set the property item index for the property.

Since
S60 5.0

Parameters

TInt aItemIndex property item index to be set.

SetMaxValue(TInt)

IMPORT_C void SetMaxValue ( TInt aMaxValue )

Set property maximum value of integer property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt aMaxValue Maximum value to be set

SetMaxValue(const TReal &)

IMPORT_C void SetMaxValue ( const TReal & aMaxValue )

Set property maximum value of real property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TReal & aMaxValue Maximum value to be set.

SetMinValue(TInt)

IMPORT_C void SetMinValue ( TInt aMinValue )

Set property minimum value of integer property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

TInt aMinValue Minimum value to be set

SetMinValue(const TReal &)

IMPORT_C void SetMinValue ( const TReal & aMinValue )

Set property minimum value of real property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TReal & aMinValue Minimum value to be set.

SetPropertyId(TSensrvPropertyId)

IMPORT_C void SetPropertyId ( TSensrvPropertyId aPropertyId )

Set the property Id for the property.

Since
S60 5.0

Parameters

TSensrvPropertyId aPropertyId Property Id to be set.

SetReadOnly(TBool)

IMPORT_C void SetReadOnly ( TBool aReadOnly )

Set the readonly information for the property.

Since
S60 5.0

Parameters

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

SetSecurityInfo(const TSecurityInfo &)

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

Since
S60 5.0

Parameters

const TSecurityInfo & aSecurityInfo Security info to be set

SetValue(const TInt)

IMPORT_C void SetValue ( const TInt aValue )

Set integer property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TInt aValue Value to be set.

SetValue(const TReal)

IMPORT_C void SetValue ( const TReal aValue )

Set real property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TReal aValue Value to be set.

SetValue(const TDesC8 &)

IMPORT_C void SetValue ( const TDesC8 & aValue )

Set buffer property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type

Parameters

const TDesC8 & aValue Value 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]