|
1 /* |
|
2 * Copyright (c) 2007 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: |
|
13 * |
|
14 * Description: CTCChannel class declaration. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef TCCHANNELTILT_H |
|
21 #define TCCHANNELTILT_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <sensrvdatalistener.h> |
|
25 #include <sensrvpropertylistener.h> |
|
26 |
|
27 #include "tcchannel.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CSensrvChannel; |
|
31 class CSensorDataCompensator; |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Tilt channel. |
|
36 * Tilt channel uses acclerometer data with magnetometer data |
|
37 * to calculate 2D data from 3D vectors. |
|
38 * |
|
39 * @lib None. |
|
40 * @since S60 5.0 |
|
41 */ |
|
42 NONSHARABLE_CLASS( CTCChannelTilt ): public CTCChannel, |
|
43 public MSensrvDataListener, public MSensrvPropertyListener |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two phased constructor. |
|
49 * |
|
50 * @param aCallback SSY callback. |
|
51 * @return CTCChannelTilt |
|
52 */ |
|
53 static CTCChannelTilt* NewL( MSsyCallback& aCallback ); |
|
54 static CTCChannelTilt* NewLC( MSsyCallback& aCallback ); |
|
55 |
|
56 // Default C++ destructor |
|
57 ~CTCChannelTilt(); |
|
58 |
|
59 public: // From base classes |
|
60 |
|
61 // @see CTCChannel |
|
62 void RegisterChannelL( RSensrvChannelInfoList& aChannels ); |
|
63 |
|
64 // @see CTCChannel |
|
65 void OpenChannelL(); |
|
66 |
|
67 // @see CTCChannel |
|
68 void CloseChannelL(); |
|
69 |
|
70 // @see CTCChannel |
|
71 void RegisterStateL( CTCState::TCStateId aStateId, |
|
72 RStateArray& aStateArray ); |
|
73 |
|
74 // @see CActive |
|
75 void RunL(); |
|
76 |
|
77 // @see MSsyPropertyProvider |
|
78 void CheckPropertyDependenciesL( const TSensrvChannelId aChannelId, |
|
79 const TSensrvProperty& aProperty, |
|
80 RSensrvChannelList& aAffectedChannels ); |
|
81 |
|
82 // @see MSsyPropertyProvider |
|
83 void SetPropertyL( const TSensrvChannelId aChannelId, |
|
84 const TSensrvProperty& aProperty ); |
|
85 |
|
86 // @see MSsyPropertyProvider |
|
87 void GetPropertyL( const TSensrvChannelId aChannelId, |
|
88 TSensrvProperty& aProperty ); |
|
89 |
|
90 // @see MSsyPropertyProvider |
|
91 void GetAllPropertiesL( const TSensrvChannelId aChannelId, |
|
92 RSensrvPropertyList& aChannelPropertyList ); |
|
93 |
|
94 // @see MSsyPropertyProvider |
|
95 void GetPropertyProviderInterfaceL( TUid aInterfaceUid, |
|
96 TAny*& aInterface ); |
|
97 |
|
98 // @see MSsyChannelDataProvider |
|
99 void StartChannelDataL( const TSensrvChannelId aChannelId, |
|
100 TUint8* aBuffer, TInt aCount ); |
|
101 |
|
102 // @see MSsyChannelDataProvider |
|
103 void StopChannelDataL( const TSensrvChannelId aChannelId ); |
|
104 |
|
105 // @see MSsyChannelDataProvider |
|
106 void ForceBufferFilledL( const TSensrvChannelId aChannelId ); |
|
107 |
|
108 // @see MSsyChannelDataProvider |
|
109 void GetChannelDataProviderInterfaceL( TUid aInterfaceUid, |
|
110 TAny*& aInterface ); |
|
111 |
|
112 // @see MTCTransactionHandler |
|
113 void ProcessTransactionL( TTCTransactionId aId, |
|
114 TTCTransaction* aTransaction = NULL ); |
|
115 |
|
116 // @see MTCTransactionHandler |
|
117 const RSensrvPropertyList& Properties() const; |
|
118 |
|
119 // @see MSensorDataListener |
|
120 void DataReceived( CSensrvChannel& aChannel, |
|
121 TInt aCount, |
|
122 TInt aDataLost ); |
|
123 |
|
124 // @see MSensorDataListener |
|
125 void DataError( CSensrvChannel& aChannel, |
|
126 TSensrvErrorSeverity aError ); |
|
127 |
|
128 // @see MSensorDataListener |
|
129 void GetDataListenerInterfaceL( TUid aInterfaceUid, |
|
130 TAny*& aInterface ); |
|
131 |
|
132 // @see MSensrvPropertyListener |
|
133 void PropertyChanged( CSensrvChannel& aChannel, |
|
134 const TSensrvProperty& aChangedProperty ); |
|
135 |
|
136 // @see MSensrvPropertyListener |
|
137 void PropertyError( CSensrvChannel& aChannel, |
|
138 TSensrvErrorSeverity aError ); |
|
139 |
|
140 // @see MSensrvPropertyListener |
|
141 void SetPropertySuccessIndicationChanged( |
|
142 TSetPropertySuccessIndicator aIndication ); |
|
143 |
|
144 // @see MSensrvPropertyListener |
|
145 void GetPropertyListenerInterfaceL( TUid aInterfaceUid, |
|
146 TAny*& aInterface ); |
|
147 |
|
148 private: // New methods |
|
149 |
|
150 // Opens channel |
|
151 void DoOpenChannelL(); |
|
152 |
|
153 // Closes channel |
|
154 void DoCloseChannel(); |
|
155 |
|
156 // Start channel data |
|
157 void DoStartChannelDataL(); |
|
158 |
|
159 // Close channel data |
|
160 void DoStopChannelData(); |
|
161 |
|
162 // Find and create accelerometer channel |
|
163 void FindAndCreateAccelerometerChannelL(); |
|
164 |
|
165 // Find and create magnetometer channel |
|
166 void FindAndCreateMagnetometerChannelL(); |
|
167 |
|
168 // Get property |
|
169 TSensrvProperty* Property( TSensrvPropertyId aId ); |
|
170 |
|
171 private: |
|
172 |
|
173 CTCChannelTilt( MSsyCallback& aCallback ); |
|
174 |
|
175 void ConstructL(); |
|
176 |
|
177 private: // Data |
|
178 |
|
179 TBool iIsSetFromListened; |
|
180 |
|
181 /** Accelerometer channel, owned */ |
|
182 CSensrvChannel* iAccelerometerChannel; |
|
183 |
|
184 /** Magnetometer channel, owned */ |
|
185 CSensrvChannel* iMagnetometerChannel; |
|
186 |
|
187 /** Tilt channel properties */ |
|
188 RSensrvPropertyList iProperties; |
|
189 |
|
190 /** Maximum value for data rate */ |
|
191 TInt iMaximumDataRate; |
|
192 |
|
193 /** Check which channel has the lower rate */ |
|
194 TBool iIsAccelometerLower; |
|
195 |
|
196 /** Sensor data accelerometer compensator instance, owned.*/ |
|
197 CSensorDataCompensator* iAccelerometerCompensator; |
|
198 |
|
199 /** Sensor data magnetometer compensator instance, owned.*/ |
|
200 CSensorDataCompensator* iMagnetometerCompensator; |
|
201 }; |
|
202 |
|
203 #endif // TCCHANNELTILT_H |
|
204 |
|
205 // End of File |