diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-0CA7F22E-59D7-4D65-9D6C-735E4E0F0454.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-0CA7F22E-59D7-4D65-9D6C-735E4E0F0454.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,64 @@ + + + + + +Setting +Channel PropertiesThe channel properties can be configured using the CSensrvChannel::SetProperty() function. +

Before setting +channel properties, you must open +the sensor channel.

+ +Create a TSensrvProperty property +object for setting the KSensrvPropIdDataRate property +using the TSensrvProperty(const TSensrvPropertyId,const TInt,const +TInt) constructor. +... +TInt val=2; +TSensrvProperty sensrvProperty(KSensrvPropIdDataRate,KSensrvItemIndexNone,val); +... + +Set the KSensrvPropIdDataRate property +value by passing the property object that you created to CSensrvChannel::SetProperty(). +... +CSensrvChannel* channel; +... +TInt ret; +ret=channel->SetProperty(sensrvProperty); +... + + +

The following example explains how to set the x-axis of accelerometer +channel status from activated to deactivated.

The axis active property KSensrvPropIdAxisActive is +first retrieved using the CSensrvChannel::GetPropertyL() function. +If the axis is active, the new deactivated value is set in the retrieved +property object. Then the channel is updated with this updated property object +by using the CSensrvChannel::SetProperty() function.

TSensrvProperty property; + TInt err( KErrNone ); + TInt axisActive( 0 ); + iSensorChannel->GetPropertyL( KSensrvPropIdAxisActive, + TSensrvAccelerometerAxisData::Index::iAxisX, + property ); + property.GetValue( axisActive ); + if( 1 == axisActive ) + { + property.SetValue( 0 ); // A value other than 1 means that sensor axis is deactivated. + err = iSensorChannel->SetProperty( property ); + if( KErrNone == err ) + { + //Accelerometer x-axis was successfully deactivated + } + } + else + { + //Accelerometer x-axis is already inactive + }
+

End the session +with the sensor channel using the CSensrvChannel::CloseChannel() function.

+
\ No newline at end of file