You must first open the channel before setting its properties.
Use the CSensrvChannel::SetProperty()
method to set channel properties. In some cases you might want to get the channel properties
and check them before setting them.
In the following example, the x-axis of accelerometer channel status is changed from activated to deactivated.
The axis active property KSensrvPropIdAxisActive
is first
retrieved with the CSensrvChannel::GetPropertyL()
method. 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 SetProperty()
method.
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 succesfully deactivated } } else { //Accelerometer x-axis is already deactive }