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