|
1 /* |
|
2 * Copyright (c) 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 "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: Juha Kauppinen, Mika Hokkanen |
|
13 * |
|
14 * Description: Photo Browser |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __IESensorMonitor_H__ |
|
19 #define __IESensorMonitor_H__ |
|
20 |
|
21 // INCLUDES |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32uid.h> |
|
25 #include "ImagicConsts.h" |
|
26 |
|
27 #ifdef _S60_3x_ACCELEROMETER_ |
|
28 #define SENSOR_API_LOAD_DYNAMICALLY |
|
29 |
|
30 #include "RRSensorApi.h" |
|
31 #include "IESensorDataFilter.h" |
|
32 #endif |
|
33 |
|
34 #ifdef _S60_5x_ACCELEROMETER_ |
|
35 #include <sensrvproperty.h> |
|
36 #include <sensrvtypes.h> |
|
37 #include <sensrvchannelfinder.h> |
|
38 #include <sensrvchannel.h> |
|
39 #include <sensrvgeneralproperties.h> |
|
40 //#include <sensrvmagnetometersensor.h> |
|
41 #include <sensrvaccelerometersensor.h> |
|
42 #include <sensrvorientationsensor.h> |
|
43 #include <sensrvdatalistener.h> |
|
44 //#include <sensrvtappingsensor.h> |
|
45 #endif |
|
46 |
|
47 //#ifdef _S60_3x_ACCELEROMETER_ |
|
48 #ifdef _ACCELEROMETER_SUPPORTED_ |
|
49 enum TImagicDeviceOrientation |
|
50 { |
|
51 EOrientationDisplayUp = 1,// Portrait Up |
|
52 EOrientationDisplayDown,// Portrait Down |
|
53 EOrientationDisplayLeftUp,// Landscape Down |
|
54 EOrientationDisplayRigthUp// Landscape Up |
|
55 }; |
|
56 #endif |
|
57 |
|
58 #ifdef _ACCELEROMETER_SUPPORTED_ |
|
59 |
|
60 class MIESensorMonitorObserver |
|
61 { |
|
62 public: |
|
63 virtual void SensorDataAvailable(TImagicDeviceOrientation aOrientation, TBool aValue) = 0; |
|
64 virtual void SetImageRotation(TInt aIndex) = 0; |
|
65 }; |
|
66 |
|
67 #ifdef _S60_3x_ACCELEROMETER_ |
|
68 class CIESensorMonitor : public MRRSensorDataListener |
|
69 #endif |
|
70 #ifdef _S60_5x_ACCELEROMETER_ |
|
71 class CIESensorMonitor : public MSensrvDataListener |
|
72 #endif |
|
73 { |
|
74 public: |
|
75 static CIESensorMonitor* NewL(MIESensorMonitorObserver& aSensorObserver); |
|
76 ~CIESensorMonitor(); |
|
77 |
|
78 private: |
|
79 void ConstructL(); |
|
80 CIESensorMonitor(MIESensorMonitorObserver& aSensorObserver); |
|
81 public: |
|
82 void StartMonitoring(); |
|
83 void StopMonitoring(); |
|
84 protected: |
|
85 |
|
86 #ifdef _S60_3x_ACCELEROMETER_ |
|
87 |
|
88 void HandleDataEventL(TRRSensorInfo aSensor, TRRSensorEvent aEvent); |
|
89 #endif |
|
90 #ifdef _S60_5x_ACCELEROMETER_ |
|
91 |
|
92 void DataReceived( CSensrvChannel& aChannel, TInt aCount, TInt aDataLost ); |
|
93 void DataError( CSensrvChannel& aChannel, TSensrvErrorSeverity aError ); |
|
94 void GetDataListenerInterfaceL( TUid /*aInterfaceUid*/, TAny*& /*aInterface*/ ){}; |
|
95 |
|
96 #endif |
|
97 |
|
98 private: |
|
99 |
|
100 MIESensorMonitorObserver& iSensorObserver; |
|
101 |
|
102 #ifdef _S60_3x_ACCELEROMETER_ |
|
103 |
|
104 // S60 3x Code |
|
105 RArray <TRRSensorInfo> iSensorList; |
|
106 |
|
107 #ifdef SENSOR_API_LOAD_DYNAMICALLY |
|
108 RLibrary iSensorApi; |
|
109 #endif //SENSOR_API_LOAD_DYNAMICALLY |
|
110 |
|
111 CRRSensorApi* iAccelerometerSensor; |
|
112 TInt iAccelerometerSensorIndex; |
|
113 |
|
114 TInt iAccSensorDataX; |
|
115 TInt iAccSensorDataY; |
|
116 TInt iAccSensorDataZ; |
|
117 |
|
118 CIESensorDataFilter* iSensorDataFilterX; |
|
119 CIESensorDataFilter* iSensorDataFilterY; |
|
120 CIESensorDataFilter* iSensorDataFilterZ; |
|
121 #endif |
|
122 |
|
123 |
|
124 #ifdef _S60_5x_ACCELEROMETER_ |
|
125 |
|
126 CSensrvChannelFinder* iSensrvChannelFinder; |
|
127 RSensrvChannelInfoList iChannelInfoList; |
|
128 CSensrvChannel* iSensrvSensorChannel; |
|
129 TInt iUpdateInterval; |
|
130 //TUint32 iDataCount,iDataLostCount; |
|
131 #endif |
|
132 }; |
|
133 #endif//_ACCELEROMETER_SUPPORTED_ |
|
134 |
|
135 #endif // __IESensorMonitor_H__ |
|
136 |