epoc32/include/sensordatacompensator.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * 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
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Sensor data compensator class definition.
    15 *
    16 */
    17 
    18 
    19 #ifndef C_SENSORDATACOMPENSATOR_H
    20 #define C_SENSORDATACOMPENSATOR_H
    21 
    22 #include <sensrvtypes.h>
    23 #include <sensordatacompensationtypes.h>
    24 
    25 /**
    26  * Class provides operations to compensate sensor data.
    27  *
    28  * Usage:
    29  *
    30  * @code
    31  * #include <sensordatacompensator.h>
    32  * #include <sensrvaccelerometersensor.h>
    33  *
    34  * // Client creates the compensator instance as a member.
    35  * // This compensates the axis data received from accelerometer.
    36  * // The data is compensated according to both device and UI rotation.
    37  * // See sensrvtypes.h and sensordatacompensationtypes.h for more information.
    38  * iDataCompensator = CSensorDataCompensator::NewL(
    39  *                        KSensrvChannelTypeIdAccelerometerXYZAxisData,
    40  *                        ESensorCompensateDeviceAndUIOrientation );
    41  *
    42  * // Data compensation is done in client's MSensrvDataListener::DataReceived() implementation 
    43  * // where 'iSensorChannel' contains the accelerometer channel instance.
    44  * TPckgBuf<TSensrvAccelerometerAxisData> dataPckgBuf;
    45  * // Get data from accelerometer ( iSensorChannel->GetData( dataPckgBuf ) )
    46  * TInt err( iDataCompensator->Compensate( dataPckgBuf ) );
    47  *
    48  * // Client deletes the compensator instance in destructor.
    49  * delete iDataCompensator;
    50  *
    51  * @endcode
    52  *
    53  * @lib sensordatacompensator.lib
    54  * @since S60 5.1
    55  */
    56 
    57 NONSHARABLE_CLASS( CSensorDataCompensator ): public CBase
    58     {
    59     public:
    60 
    61     /**
    62     * Two-phase constructor
    63     *
    64     * @since S60 5.1
    65     * @param aDataType Specifies the data type to be compensated.
    66     * @param aType Specifies the type of compensation. See TSensorCompensationType.
    67     * @return CSensorDataCompensator* Pointer to created object
    68     */
    69     IMPORT_C static CSensorDataCompensator* NewL( TSensrvChannelDataTypeId aDataType,
    70         TSensorCompensationType aType );
    71 
    72     public:
    73 
    74     /**
    75     * Compensates sensor data.
    76     *
    77     * @since S60 5.1
    78     * @param aData Reference to descriptor where sensor data locates.
    79     *              On return contains compensated data if compensation successful.
    80     *              The following packages can be used in compensating;
    81     *              TSensrvAccelerometerAxisData
    82     *              TSensrvMagnetometerAxisData
    83     *              TSensrvMagneticNorthData
    84     *              TSensrvTappingData               
    85     * @return TInt KErrNone - Compensation successful.
    86     *              KErrArgument - Input aData does not match data type.
    87     *              KErrNotSupported - Compensation not supported for data type.
    88     *              KErrNotReady - Not ready for compensation.
    89     *              KErrCorrupt - Configured compensation values are invalid.
    90     */
    91     virtual TInt Compensate( TDes8& aData ) = 0;
    92 
    93     /**
    94     * Used to get the compensated channel data type.
    95     *
    96     * @since S60 5.1
    97     * @return TSensrvChannelDataTypeId
    98     *              The compensated data type.
    99     */
   100     virtual TSensrvChannelDataTypeId GetChannelDataType( ) const = 0;
   101 
   102     /**
   103     * Used to get the compensation type.
   104     *
   105     * @since S60 5.1
   106     * @return TSensorCompensationType
   107     *              The used compensation type.
   108     */
   109     virtual TSensorCompensationType GetCompensationType( ) const = 0;
   110 
   111     };
   112 
   113 
   114 #endif // C_SENSORDATACOMPENSATOR_H