epoc32/include/sensordatacompensator.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/sensordatacompensator.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,114 @@
     1.4 +/*
     1.5 +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Sensor data compensator class definition.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef C_SENSORDATACOMPENSATOR_H
    1.23 +#define C_SENSORDATACOMPENSATOR_H
    1.24 +
    1.25 +#include <sensrvtypes.h>
    1.26 +#include <sensordatacompensationtypes.h>
    1.27 +
    1.28 +/**
    1.29 + * Class provides operations to compensate sensor data.
    1.30 + *
    1.31 + * Usage:
    1.32 + *
    1.33 + * @code
    1.34 + * #include <sensordatacompensator.h>
    1.35 + * #include <sensrvaccelerometersensor.h>
    1.36 + *
    1.37 + * // Client creates the compensator instance as a member.
    1.38 + * // This compensates the axis data received from accelerometer.
    1.39 + * // The data is compensated according to both device and UI rotation.
    1.40 + * // See sensrvtypes.h and sensordatacompensationtypes.h for more information.
    1.41 + * iDataCompensator = CSensorDataCompensator::NewL(
    1.42 + *                        KSensrvChannelTypeIdAccelerometerXYZAxisData,
    1.43 + *                        ESensorCompensateDeviceAndUIOrientation );
    1.44 + *
    1.45 + * // Data compensation is done in client's MSensrvDataListener::DataReceived() implementation 
    1.46 + * // where 'iSensorChannel' contains the accelerometer channel instance.
    1.47 + * TPckgBuf<TSensrvAccelerometerAxisData> dataPckgBuf;
    1.48 + * // Get data from accelerometer ( iSensorChannel->GetData( dataPckgBuf ) )
    1.49 + * TInt err( iDataCompensator->Compensate( dataPckgBuf ) );
    1.50 + *
    1.51 + * // Client deletes the compensator instance in destructor.
    1.52 + * delete iDataCompensator;
    1.53 + *
    1.54 + * @endcode
    1.55 + *
    1.56 + * @lib sensordatacompensator.lib
    1.57 + * @since S60 5.1
    1.58 + */
    1.59 +
    1.60 +NONSHARABLE_CLASS( CSensorDataCompensator ): public CBase
    1.61 +    {
    1.62 +    public:
    1.63 +
    1.64 +    /**
    1.65 +    * Two-phase constructor
    1.66 +    *
    1.67 +    * @since S60 5.1
    1.68 +    * @param aDataType Specifies the data type to be compensated.
    1.69 +    * @param aType Specifies the type of compensation. See TSensorCompensationType.
    1.70 +    * @return CSensorDataCompensator* Pointer to created object
    1.71 +    */
    1.72 +    IMPORT_C static CSensorDataCompensator* NewL( TSensrvChannelDataTypeId aDataType,
    1.73 +        TSensorCompensationType aType );
    1.74 +
    1.75 +    public:
    1.76 +
    1.77 +    /**
    1.78 +    * Compensates sensor data.
    1.79 +    *
    1.80 +    * @since S60 5.1
    1.81 +    * @param aData Reference to descriptor where sensor data locates.
    1.82 +    *              On return contains compensated data if compensation successful.
    1.83 +    *              The following packages can be used in compensating;
    1.84 +    *              TSensrvAccelerometerAxisData
    1.85 +    *              TSensrvMagnetometerAxisData
    1.86 +    *              TSensrvMagneticNorthData
    1.87 +    *              TSensrvTappingData               
    1.88 +    * @return TInt KErrNone - Compensation successful.
    1.89 +    *              KErrArgument - Input aData does not match data type.
    1.90 +    *              KErrNotSupported - Compensation not supported for data type.
    1.91 +    *              KErrNotReady - Not ready for compensation.
    1.92 +    *              KErrCorrupt - Configured compensation values are invalid.
    1.93 +    */
    1.94 +    virtual TInt Compensate( TDes8& aData ) = 0;
    1.95 +
    1.96 +    /**
    1.97 +    * Used to get the compensated channel data type.
    1.98 +    *
    1.99 +    * @since S60 5.1
   1.100 +    * @return TSensrvChannelDataTypeId
   1.101 +    *              The compensated data type.
   1.102 +    */
   1.103 +    virtual TSensrvChannelDataTypeId GetChannelDataType( ) const = 0;
   1.104 +
   1.105 +    /**
   1.106 +    * Used to get the compensation type.
   1.107 +    *
   1.108 +    * @since S60 5.1
   1.109 +    * @return TSensorCompensationType
   1.110 +    *              The used compensation type.
   1.111 +    */
   1.112 +    virtual TSensorCompensationType GetCompensationType( ) const = 0;
   1.113 +
   1.114 +    };
   1.115 +
   1.116 +
   1.117 +#endif // C_SENSORDATACOMPENSATOR_H