TSensrvProperty Class Reference

#include <sensrvproperty.h>

Link against: sensrvutil.lib

class TSensrvProperty
Public Attributes
TInt iIntValue
TInt iIntValueMax
TInt iIntValueMin
TReal iRealValue
TReal iRealValueMax
TReal iRealValueMin
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 &)

Detailed Description

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.

See also: 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.

See also: 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.

See also: 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().

See also: 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.

See also: 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;  
     };

See also: TSensrvProperty::SetItemIndex() TSensrvProperty::PropertyItemIndex()

library
sensrvutil.lib
Since
S60 5.0

Member Attribute Documentation

iIntValue

TInt iIntValue

iIntValueMax

TInt iIntValueMax

iIntValueMin

TInt iIntValueMin

iRealValue

TReal iRealValue

iRealValueMax

TReal iRealValueMax

iRealValueMin

TReal iRealValueMin

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.

Since
S60 5.0
ParameterDescription
aPropertyIdId of the property
aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
aValueValue of the property.
aMaxValueMaximum value of the property
aMinValueMinimum value of the property
aReadOnlyReadonly-flag of the property
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.

Since
S60 5.0
ParameterDescription
aPropertyIdId of the property
aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
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.

Since
S60 5.0
ParameterDescription
aPropertyIdId of the property
aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
aValueValue of the property.
aMaxValueMaximum value of the property
aMinValueMinimum value of the property
aReadOnlyReadonly-flag of the property
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.

Since
S60 5.0
ParameterDescription
aPropertyIdId of the property
aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
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.

Since
S60 5.0
ParameterDescription
aPropertyIdId of the property
aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
aValueValue of the property. Max length is defined in KSensrvPropertyTextBufferSize.
aReadOnlyReadonly-flag of the property
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.

Since
S60 5.0
ParameterDescription
aPropertyIdId of the property
aItemIndexItem index of the property. Mapped to a specific item in channel data structure.
aValueValue of the property. Max length is defined in KSensrvPropertyTextBufferSize.

Member Function Documentation

GetArrayIndex ( )

IMPORT_C TIntGetArrayIndex()const

Get array index of the property

Since
S60 5.0

See also: TSensrvArrayIndex KSensrvPropIdDataRate for an example

Returns: Array index of the property.

GetMaxValue ( TInt & )

IMPORT_C voidGetMaxValue(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
ParameterDescription
aMaxValueMaximum value to get

GetMaxValue ( TReal & )

IMPORT_C voidGetMaxValue(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
ParameterDescription
aMaxValueMaximum value to get

GetMinValue ( TInt & )

IMPORT_C voidGetMinValue(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
ParameterDescription
aMinValueMinimum value to get

GetMinValue ( TReal & )

IMPORT_C voidGetMinValue(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
ParameterDescription
aMinValueMinimum value to get

GetPropertyId ( )

IMPORT_C TSensrvPropertyIdGetPropertyId()const

Return Property Id

Since
S60 5.0

Returns: Property Id

GetSecurityInfo ( )

IMPORT_C TSecurityInfoGetSecurityInfo()const

Get security info of the property

Since
S60 5.0

Returns: Security info of the property

GetValue ( TInt & )

IMPORT_C voidGetValue(TInt &aValue)const

Get integer property value

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

GetValue ( TReal & )

IMPORT_C voidGetValue(TReal &aValue)const

Get real property value

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

GetValue ( TDes8 & )

IMPORT_C voidGetValue(TDes8 &aValue)const

Get buffer property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type
ParameterDescription
aValueDestination 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

Returns: Reference to a property value

PropertyItemIndex ( )

IMPORT_C TIntPropertyItemIndex()const

Get the property item index number

Since
S60 5.0

Returns: Item index number.

PropertyType ( )

IMPORT_C TSensrvPropertyTypePropertyType()const

Return property type

Since
S60 5.0

Returns: Property type's Id

ReadOnly ( )

IMPORT_C TBoolReadOnly()const

Checks if the property is readonly

Since
S60 5.0

Returns: ETrue value indicates that property is a read only property.

SetArrayIndex ( const TInt )

IMPORT_C voidSetArrayIndex(const TIntaArrayIndex)

Set array index of the property.

Since
S60 5.0

See also: TSensrvArrayIndex KSensrvPropIdDataRate for an example

ParameterDescription
aArrayIndexArray index to be set

SetItemIndex ( TInt )

IMPORT_C voidSetItemIndex(TIntaItemIndex)

Set the property item index for the property.

Since
S60 5.0
ParameterDescription
aItemIndexproperty item index to be set.

SetMaxValue ( TInt )

IMPORT_C voidSetMaxValue(TIntaMaxValue)

Set property maximum value of integer property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type
ParameterDescription
aMaxValueMaximum value to be set

SetMaxValue ( const TReal & )

IMPORT_C voidSetMaxValue(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
ParameterDescription
aMaxValueMaximum value to be set.

SetMinValue ( TInt )

IMPORT_C voidSetMinValue(TIntaMinValue)

Set property minimum value of integer property

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type
ParameterDescription
aMinValueMinimum value to be set

SetMinValue ( const TReal & )

IMPORT_C voidSetMinValue(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
ParameterDescription
aMinValueMinimum value to be set.

SetPropertyId ( TSensrvPropertyId )

IMPORT_C voidSetPropertyId(TSensrvPropertyIdaPropertyId)

Set the property Id for the property.

Since
S60 5.0
ParameterDescription
aPropertyIdProperty Id to be set.

SetReadOnly ( TBool )

IMPORT_C voidSetReadOnly(TBoolaReadOnly)

Set the readonly information for the property.

Since
S60 5.0
ParameterDescription
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

Since
S60 5.0
ParameterDescription
aSecurityInfoSecurity info to be set

SetValue ( const TInt )

IMPORT_C voidSetValue(const TIntaValue)

Set integer property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type
ParameterDescription
aValueValue to be set.

SetValue ( const TReal )

IMPORT_C voidSetValue(const TRealaValue)

Set real property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type
ParameterDescription
aValueValue to be set.

SetValue ( const TDesC8 & )

IMPORT_C voidSetValue(const TDesC8 &aValue)

Set buffer property value

Since
S60 5.0
panic
KSensrvPanicCategory ESensrvPanicInvalidPropertyType Panic if the property object is not a correct type
ParameterDescription
aValueValue to be set.