2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Sensor data compensator class definition.
19 #ifndef C_SENSORDATACOMPENSATOR_H
20 #define C_SENSORDATACOMPENSATOR_H
22 #include <sensrvtypes.h>
23 #include <sensordatacompensationtypes.h>
26 * Class provides operations to compensate sensor data.
31 * #include <sensordatacompensator.h>
32 * #include <sensrvaccelerometersensor.h>
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 );
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 ) );
48 * // Client deletes the compensator instance in destructor.
49 * delete iDataCompensator;
53 * @lib sensordatacompensator.lib
57 NONSHARABLE_CLASS( CSensorDataCompensator ): public CBase
62 * Two-phase constructor
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
69 IMPORT_C static CSensorDataCompensator* NewL( TSensrvChannelDataTypeId aDataType,
70 TSensorCompensationType aType );
75 * Compensates sensor data.
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
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.
91 virtual TInt Compensate( TDes8& aData ) = 0;
94 * Used to get the compensated channel data type.
97 * @return TSensrvChannelDataTypeId
98 * The compensated data type.
100 virtual TSensrvChannelDataTypeId GetChannelDataType( ) const = 0;
103 * Used to get the compensation type.
106 * @return TSensorCompensationType
107 * The used compensation type.
109 virtual TSensorCompensationType GetCompensationType( ) const = 0;
114 #endif // C_SENSORDATACOMPENSATOR_H