|
1 /* |
|
2 * Copyright (c) 2008 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: Orientation class of Orientation SSY |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include "OrientationCRListener.h" |
|
21 #include "OrientationConfiguration.h" |
|
22 #include "SsyTrace.h" |
|
23 |
|
24 // ---------------------------------------------------------------------------------- |
|
25 // CSsyOrientationCRListener::CSsyOrientationCRListener |
|
26 // ---------------------------------------------------------------------------------- |
|
27 // |
|
28 CSsyOrientationCRListener::CSsyOrientationCRListener( MCenRepCallBack& |
|
29 aPrtToCallback ) : |
|
30 CActive( CActive::EPriorityStandard ), |
|
31 iCallBack( aPrtToCallback ) |
|
32 { |
|
33 SSY_TRACE_IN(); |
|
34 CActiveScheduler::Add( this ); |
|
35 SSY_TRACE_OUT(); |
|
36 } |
|
37 |
|
38 // ---------------------------------------------------------------------------------- |
|
39 // CSsyOrientationCRListener::~CSsyOrientationCRListener |
|
40 // ---------------------------------------------------------------------------------- |
|
41 // |
|
42 CSsyOrientationCRListener::~CSsyOrientationCRListener() |
|
43 { |
|
44 SSY_TRACE_IN(); |
|
45 |
|
46 if( IsActive() ) |
|
47 { |
|
48 Cancel(); |
|
49 } |
|
50 iRepository = NULL; |
|
51 SSY_TRACE_OUT(); |
|
52 } |
|
53 |
|
54 // ---------------------------------------------------------------------------------- |
|
55 // CSsyOrientationCRListener::NewL |
|
56 // ---------------------------------------------------------------------------------- |
|
57 // |
|
58 CSsyOrientationCRListener* CSsyOrientationCRListener::NewL( |
|
59 MCenRepCallBack& aPrtToCallback, |
|
60 CRepository* aRepository ) |
|
61 { |
|
62 SSY_TRACE_IN(); |
|
63 CSsyOrientationCRListener* self = new ( ELeave ) |
|
64 CSsyOrientationCRListener( aPrtToCallback ); |
|
65 CleanupStack::PushL( self ); |
|
66 self->ConstructL( aRepository ); |
|
67 CleanupStack::Pop( self ); |
|
68 SSY_TRACE_OUT(); |
|
69 return self; |
|
70 } |
|
71 |
|
72 // ---------------------------------------------------------------------------------- |
|
73 // CSsyOrientationCRListener::ConstructL |
|
74 // ---------------------------------------------------------------------------------- |
|
75 // |
|
76 void CSsyOrientationCRListener::ConstructL( CRepository* aRepository ) |
|
77 { |
|
78 SSY_TRACE_IN(); |
|
79 iRepository = aRepository; |
|
80 SetCenRepListener(); |
|
81 SSY_TRACE_OUT(); |
|
82 } |
|
83 |
|
84 // ---------------------------------------------------------------------------------- |
|
85 // CSsyOrientationCRListener::RunL |
|
86 // ---------------------------------------------------------------------------------- |
|
87 // |
|
88 void CSsyOrientationCRListener::RunL() |
|
89 { |
|
90 SSY_TRACE_IN(); |
|
91 SSY_TRACE( EExtended, "ORIENTATIONSSY:RunL::Key %d changed", iStatus.Int() ); |
|
92 iRepository->NotifyRequest( iStatus.Int(), iStatus ); |
|
93 |
|
94 iCallBack.CreateConfigurations(); |
|
95 |
|
96 if( !IsActive() ) |
|
97 { |
|
98 SetActive(); |
|
99 } |
|
100 SSY_TRACE_OUT(); |
|
101 } |
|
102 |
|
103 // ---------------------------------------------------------------------------------- |
|
104 // CSsyOrientationCRListener::DoCancel |
|
105 // ---------------------------------------------------------------------------------- |
|
106 // |
|
107 void CSsyOrientationCRListener::DoCancel() |
|
108 { |
|
109 SSY_TRACE_IN(); |
|
110 iRepository->NotifyCancelAll(); |
|
111 SSY_TRACE_OUT(); |
|
112 } |
|
113 |
|
114 |
|
115 // ---------------------------------------------------------------------------------- |
|
116 // CSsyOrientationCRListener::RunError |
|
117 // ---------------------------------------------------------------------------------- |
|
118 // |
|
119 TInt CSsyOrientationCRListener::RunError( TInt aError ) |
|
120 { |
|
121 SSY_TRACE_IN(); |
|
122 if( aError != KErrNone ) |
|
123 { |
|
124 SSY_TRACE( EExtended, "CSsyOrientationCRListener::RunError aError = %d", aError ); |
|
125 } |
|
126 |
|
127 SSY_TRACE_OUT(); |
|
128 return KErrNone; |
|
129 } |
|
130 |
|
131 // ---------------------------------------------------------------------------------- |
|
132 // CSsyOrientationCRListener::SetCenRepListener |
|
133 // ---------------------------------------------------------------------------------- |
|
134 // |
|
135 void CSsyOrientationCRListener::SetCenRepListener() |
|
136 { |
|
137 SSY_TRACE_IN(); |
|
138 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayRightUpKey, iStatus ); |
|
139 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayRightUpTimerKey, iStatus ); |
|
140 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayLeftUpKey, iStatus ); |
|
141 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayLeftUpTimerKey, iStatus ); |
|
142 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayUpwardsKey, iStatus ); |
|
143 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayUpwardsTimerKey, iStatus ); |
|
144 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayDownwardsKey, iStatus ); |
|
145 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayDownwardsTimerKey, iStatus ); |
|
146 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayDownKey, iStatus ); |
|
147 iRepository->NotifyRequest( KOriStateDisplayUpToDisplayDownTimerKey, iStatus ); |
|
148 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayRightUpKey, iStatus ); |
|
149 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayRightUpTimerKey, iStatus ); |
|
150 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayLeftUpKey, iStatus ); |
|
151 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayLeftUpTimerKey, iStatus ); |
|
152 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayUpwardsKey, iStatus ); |
|
153 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayUpwardsTimerKey, iStatus ); |
|
154 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayDownwardsKey, iStatus ); |
|
155 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayDownwardsTimerKey, iStatus ); |
|
156 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayUpKey, iStatus ); |
|
157 iRepository->NotifyRequest( KOriStateDisplayDownToDisplayUpTimerKey, iStatus ); |
|
158 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayRightUpKey, iStatus ); |
|
159 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayRightUpTimerKey, iStatus ); |
|
160 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayLeftUpKey, iStatus ); |
|
161 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayLeftUpTimerKey, iStatus ); |
|
162 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayUpKey, iStatus ); |
|
163 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayUpTimerKey, iStatus ); |
|
164 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayDownwardsKey, iStatus ); |
|
165 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayDownwardsTimerKey, iStatus ); |
|
166 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayDownKey, iStatus ); |
|
167 iRepository->NotifyRequest( KOriStateDisplayUpwardsToDisplayDownTimerKey, iStatus ); |
|
168 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayRightUpKey, iStatus ); |
|
169 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayRightUpTimerKey, iStatus ); |
|
170 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayLeftUpKey, iStatus ); |
|
171 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayLeftUpTimerKey, iStatus ); |
|
172 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayUpwardsKey, iStatus ); |
|
173 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayUpwardsTimerKey, iStatus ); |
|
174 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayUpKey, iStatus ); |
|
175 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayUpTimerKey, iStatus ); |
|
176 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayDownKey, iStatus ); |
|
177 iRepository->NotifyRequest( KOriStateDisplayDownwardsToDisplayDownTimerKey, iStatus ); |
|
178 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayRightUpKey, iStatus ); |
|
179 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayRightUpTimerKey, iStatus ); |
|
180 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayUpKey, iStatus ); |
|
181 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayUpTimerKey, iStatus ); |
|
182 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayUpwardsKey, iStatus ); |
|
183 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayUpwardsTimerKey, iStatus ); |
|
184 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayDownwardsKey, iStatus ); |
|
185 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayDownwardsTimerKey, iStatus ); |
|
186 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayDownKey, iStatus ); |
|
187 iRepository->NotifyRequest( KOriStateDisplayLeftUpToDisplayDownTimerKey, iStatus ); |
|
188 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayUpKey, iStatus ); |
|
189 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayUpTimerKey, iStatus ); |
|
190 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayLeftUpKey, iStatus ); |
|
191 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayLeftUpTimerKey, iStatus ); |
|
192 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayUpwardsKey, iStatus ); |
|
193 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayUpwardsTimerKey, iStatus ); |
|
194 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayDownwardsKey, iStatus ); |
|
195 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayDownwardsTimerKey, iStatus ); |
|
196 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayDownKey, iStatus ); |
|
197 iRepository->NotifyRequest( KOriStateDisplayRightUpToDisplayDownTimerKey, iStatus ); |
|
198 if( !IsActive() ) |
|
199 { |
|
200 SetActive(); |
|
201 } |
|
202 SSY_TRACE_OUT(); |
|
203 } |
|
204 |
|
205 // End of file |