plugin/poi/landmarks/overlay/inc/Accelerometer.h
changeset 0 c316ab048e9d
equal deleted inserted replaced
-1:000000000000 0:c316ab048e9d
       
     1 /*
       
     2  * Name        : Accelerometer.h
       
     3  * Description : Accelerometer helper class
       
     4  * Project     : This file is part of OpenMAR, an Open Mobile Augmented Reality browser
       
     5  * Website     : http://OpenMAR.org
       
     6  *
       
     7  * Copyright (c) 2010 David Caabeiro
       
     8  *
       
     9  * All rights reserved. This program and the accompanying materials are made available 
       
    10  * under the terms of the Eclipse Public License v1.0 which accompanies this 
       
    11  * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
       
    12  *
       
    13  */
       
    14 
       
    15 #ifndef ACCELEROMETER_H_
       
    16 #define ACCELEROMETER_H_
       
    17 
       
    18 #include "Vector3d.h"
       
    19 
       
    20 #include <SensrvDataListener.h>
       
    21 
       
    22 class CSensrvChannel;
       
    23 
       
    24 /**
       
    25  * @brief Wrapper class over sensor channel to retrieve data from 3-axis accelerometer
       
    26  * 
       
    27  * This class also implements a simple bandpass filter
       
    28  */
       
    29 class CAccelerometer : public CBase, 
       
    30             public MSensrvDataListener
       
    31 {
       
    32 public:
       
    33     static CAccelerometer* NewL();
       
    34     ~CAccelerometer();
       
    35 
       
    36 protected:
       
    37     CAccelerometer();
       
    38     void ConstructL();
       
    39 
       
    40 public:
       
    41     void StartL();
       
    42     void Stop();
       
    43 
       
    44     const Vector3d GetValue() const { return Vector3d(iX1, iY1, iZ1); }
       
    45 
       
    46 protected:
       
    47     // From MSensrvDataListener
       
    48     void DataReceived(CSensrvChannel& aChannel, TInt aCount, TInt aDataLost);
       
    49     void DataError(CSensrvChannel& aChannel, TSensrvErrorSeverity aError);
       
    50     void GetDataListenerInterfaceL(TUid aInterfaceUid, TAny*& aInterface);
       
    51 
       
    52 private:
       
    53     CSensrvChannel* iSensorChannel;
       
    54 
       
    55     TReal iX1;
       
    56     TReal iY1;
       
    57     TReal iZ0;
       
    58     TReal iZ1;
       
    59     TReal iZ2;
       
    60 };
       
    61 
       
    62 #endif