Array Properties

A property that defines multiple discrete values inside one property ID is called an array property.

Array properties can be identified with array index, which can be queried using the TSensrvProperty::GetArrayIndex() function.

The following example shows how to retrieve the current data rate of the channel, for which the data rate is declared as an array property.

Read the KSensrvPropIdDataRate property using the CSensrvChannel::GetPropertyL() function.

If the retrieved property is an array property the result of the CSensrvChannel::GetPropertyL() call is a property with array index ESensrvArrayPropertyInfo, otherwise the array information index is ESensrvSingleProperty.

In case of an array property, the value of the current data rate is in the KSensrvPropIdDataRate property, for which the array index is the same as the array property's value.

TSensrvProperty property;
    TInt err( KErrNone );
    TInt datarate( 0 );

    iSensorChannel->GetPropertyL( KSensrvPropIdDataRate,
                                  KSensrvItemIndexNone,
                                  property );

    if( ESensrvArrayPropertyInfo == property.GetArrayIndex() )
        {
        //Current data rate in use is in the KSensrvPropIdDataRate property
        //for which the array index is declared in the array property's value.
        TInt arrayIndex( 0 );
        property.GetValue( arrayIndex );

        iSensorChannel->GetPropertyL( KSensrvPropIdDataRate,
                                      KSensrvItemIndexNone,
                                      arrayIndex,
                                      property );
                                      
        property.GetValue( datarate );
        }
    else
        {
        //KSensrvPropIdDataRate is a single property and current data rate can be read diretly from it.
        property.GetValue( datarate );
        }