|
1 /* |
|
2 * Copyright (c) 2006 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: remconcoreapitarget stub for testing MpMediaKeyHandler |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32debug.h> |
|
19 |
|
20 #include "stub/inc/remconcoreapitargetobserver.h" |
|
21 #include "stub/inc/remconcoreapitarget.h" |
|
22 |
|
23 |
|
24 int gCRemConCoreApiTargetCount = 0; |
|
25 bool gCRemConCoreApiTargetNewLLeave = false; |
|
26 int gCRemConCoreApiTargetSendResponseCount = 0; |
|
27 |
|
28 |
|
29 //static functions start |
|
30 |
|
31 int CRemConCoreApiTarget::getCount() |
|
32 { |
|
33 return gCRemConCoreApiTargetCount; |
|
34 } |
|
35 |
|
36 void CRemConCoreApiTarget::setNewLLeave() |
|
37 { |
|
38 gCRemConCoreApiTargetNewLLeave = true; |
|
39 } |
|
40 |
|
41 void CRemConCoreApiTarget::NewLLeaveIfDesiredL() |
|
42 { |
|
43 if (gCRemConCoreApiTargetNewLLeave) |
|
44 { |
|
45 RDebug::Print(_L("CRemConCoreApiTarget::NewLLeaveIfDesiredL Leave")); |
|
46 gCRemConCoreApiTargetNewLLeave = false; |
|
47 User::Leave(KErrGeneral); |
|
48 } |
|
49 } |
|
50 |
|
51 int CRemConCoreApiTarget::getSendResponseCount() |
|
52 { |
|
53 return gCRemConCoreApiTargetSendResponseCount; |
|
54 } |
|
55 |
|
56 //static functions end |
|
57 |
|
58 |
|
59 CRemConCoreApiTarget::CRemConCoreApiTarget() |
|
60 : CActive(EPriorityStandard), |
|
61 iClientStatus(NULL) |
|
62 { |
|
63 gCRemConCoreApiTargetCount++; |
|
64 } |
|
65 |
|
66 CRemConCoreApiTarget::~CRemConCoreApiTarget() |
|
67 { |
|
68 gCRemConCoreApiTargetCount--; |
|
69 gCRemConCoreApiTargetSendResponseCount = 0; |
|
70 } |
|
71 |
|
72 CRemConCoreApiTarget* CRemConCoreApiTarget::NewL(CRemConInterfaceSelector& /*aInterfaceSelector*/, MRemConCoreApiTargetObserver& /*aObserver*/) |
|
73 { |
|
74 RDebug::Print(_L("stub CRemConCoreApiTarget::NewL")); |
|
75 CRemConCoreApiTarget::NewLLeaveIfDesiredL(); |
|
76 CRemConCoreApiTarget* self = new(ELeave) CRemConCoreApiTarget(); |
|
77 return self; |
|
78 } |
|
79 |
|
80 void CRemConCoreApiTarget::PausePlayFunctionResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
81 { |
|
82 RDebug::Print(_L(">>CRemConCoreApiTarget::PausePlayFunctionResponse")); |
|
83 |
|
84 iClientStatus = &aStatus; |
|
85 gCRemConCoreApiTargetSendResponseCount++; |
|
86 |
|
87 // stub should not be async |
|
88 /*TRequestStatus* status = &iStatus; |
|
89 User::RequestComplete(status, KErrNone); |
|
90 SetActive();*/ |
|
91 |
|
92 RunL(); |
|
93 |
|
94 RDebug::Print(_L("<<CRemConCoreApiTarget::PausePlayFunctionResponse")); |
|
95 } |
|
96 |
|
97 void CRemConCoreApiTarget::PlayResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
98 { |
|
99 RDebug::Print(_L(">>CRemConCoreApiTarget::PlayResponse")); |
|
100 |
|
101 iClientStatus = &aStatus; |
|
102 gCRemConCoreApiTargetSendResponseCount++; |
|
103 |
|
104 // stub should not be async |
|
105 /*TRequestStatus* status = &iStatus; |
|
106 User::RequestComplete(status, KErrNone); |
|
107 SetActive();*/ |
|
108 |
|
109 RunL(); |
|
110 |
|
111 RDebug::Print(_L("<<CRemConCoreApiTarget::PlayResponse")); |
|
112 } |
|
113 |
|
114 void CRemConCoreApiTarget::StopResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
115 { |
|
116 RDebug::Print(_L(">>CRemConCoreApiTarget::StopResponse")); |
|
117 |
|
118 iClientStatus = &aStatus; |
|
119 gCRemConCoreApiTargetSendResponseCount++; |
|
120 |
|
121 // stub should not be async |
|
122 /*TRequestStatus* status = &iStatus; |
|
123 User::RequestComplete(status, KErrNone); |
|
124 SetActive();*/ |
|
125 |
|
126 RunL(); |
|
127 |
|
128 RDebug::Print(_L("<<CRemConCoreApiTarget::StopResponse")); |
|
129 } |
|
130 |
|
131 void CRemConCoreApiTarget::PauseResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
132 { |
|
133 RDebug::Print(_L(">>CRemConCoreApiTarget::PauseResponse")); |
|
134 |
|
135 iClientStatus = &aStatus; |
|
136 gCRemConCoreApiTargetSendResponseCount++; |
|
137 |
|
138 // stub should not be async |
|
139 /*TRequestStatus* status = &iStatus; |
|
140 User::RequestComplete(status, KErrNone); |
|
141 SetActive();*/ |
|
142 |
|
143 RunL(); |
|
144 |
|
145 RDebug::Print(_L("<<CRemConCoreApiTarget::PauseResponse")); |
|
146 } |
|
147 |
|
148 void CRemConCoreApiTarget::RewindResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
149 { |
|
150 RDebug::Print(_L(">>CRemConCoreApiTarget::RewindResponse")); |
|
151 |
|
152 iClientStatus = &aStatus; |
|
153 gCRemConCoreApiTargetSendResponseCount++; |
|
154 |
|
155 // stub should not be async |
|
156 /*TRequestStatus* status = &iStatus; |
|
157 User::RequestComplete(status, KErrNone); |
|
158 SetActive();*/ |
|
159 |
|
160 RunL(); |
|
161 |
|
162 RDebug::Print(_L("<<CRemConCoreApiTarget::RewindResponse")); |
|
163 } |
|
164 |
|
165 void CRemConCoreApiTarget::FastForwardResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
166 { |
|
167 RDebug::Print(_L(">>CRemConCoreApiTarget::FastForwardResponse")); |
|
168 |
|
169 iClientStatus = &aStatus; |
|
170 gCRemConCoreApiTargetSendResponseCount++; |
|
171 |
|
172 // stub should not be async |
|
173 /*TRequestStatus* status = &iStatus; |
|
174 User::RequestComplete(status, KErrNone); |
|
175 SetActive();*/ |
|
176 |
|
177 RunL(); |
|
178 |
|
179 RDebug::Print(_L("<<CRemConCoreApiTarget::FastForwardResponse")); |
|
180 } |
|
181 |
|
182 void CRemConCoreApiTarget::BackwardResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
183 { |
|
184 RDebug::Print(_L(">>CRemConCoreApiTarget::BackwardResponse")); |
|
185 |
|
186 iClientStatus = &aStatus; |
|
187 gCRemConCoreApiTargetSendResponseCount++; |
|
188 |
|
189 // stub should not be async |
|
190 /*TRequestStatus* status = &iStatus; |
|
191 User::RequestComplete(status, KErrNone); |
|
192 SetActive();*/ |
|
193 |
|
194 RunL(); |
|
195 |
|
196 RDebug::Print(_L("<<CRemConCoreApiTarget::BackwardResponse")); |
|
197 } |
|
198 |
|
199 void CRemConCoreApiTarget::ForwardResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
200 { |
|
201 RDebug::Print(_L(">>CRemConCoreApiTarget::ForwardResponse")); |
|
202 |
|
203 iClientStatus = &aStatus; |
|
204 gCRemConCoreApiTargetSendResponseCount++; |
|
205 |
|
206 // stub should not be async |
|
207 /*TRequestStatus* status = &iStatus; |
|
208 User::RequestComplete(status, KErrNone); |
|
209 SetActive();*/ |
|
210 |
|
211 RunL(); |
|
212 |
|
213 RDebug::Print(_L("<<CRemConCoreApiTarget::ForwardResponse")); |
|
214 } |
|
215 |
|
216 void CRemConCoreApiTarget::VolumeUpResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
217 { |
|
218 RDebug::Print(_L(">>CRemConCoreApiTarget::VolumeUpResponse")); |
|
219 |
|
220 iClientStatus = &aStatus; |
|
221 gCRemConCoreApiTargetSendResponseCount++; |
|
222 |
|
223 // stub should not be async |
|
224 /*TRequestStatus* status = &iStatus; |
|
225 User::RequestComplete(status, KErrNone); |
|
226 SetActive();*/ |
|
227 |
|
228 RunL(); |
|
229 |
|
230 RDebug::Print(_L("<<CRemConCoreApiTarget::VolumeUpResponse")); |
|
231 } |
|
232 |
|
233 void CRemConCoreApiTarget::VolumeDownResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
234 { |
|
235 RDebug::Print(_L(">>CRemConCoreApiTarget::VolumeDownResponse")); |
|
236 |
|
237 iClientStatus = &aStatus; |
|
238 gCRemConCoreApiTargetSendResponseCount++; |
|
239 |
|
240 // stub should not be async |
|
241 /*TRequestStatus* status = &iStatus; |
|
242 User::RequestComplete(status, KErrNone); |
|
243 SetActive();*/ |
|
244 |
|
245 RunL(); |
|
246 |
|
247 RDebug::Print(_L("<<CRemConCoreApiTarget::VolumeDownResponse")); |
|
248 } |
|
249 |
|
250 void CRemConCoreApiTarget::SendResponse(TRequestStatus& aStatus, TRemConCoreApiOperationId /*aOperationId*/, TInt /*aError*/) |
|
251 { |
|
252 RDebug::Print(_L(">>CRemConCoreApiTarget::SendResponse")); |
|
253 |
|
254 iClientStatus = &aStatus; |
|
255 gCRemConCoreApiTargetSendResponseCount++; |
|
256 |
|
257 // stub should not be async |
|
258 /*TRequestStatus* status = &iStatus; |
|
259 User::RequestComplete(status, KErrNone); |
|
260 SetActive();*/ |
|
261 |
|
262 RunL(); |
|
263 |
|
264 RDebug::Print(_L("<<CRemConCoreApiTarget::SendResponse")); |
|
265 } |
|
266 |
|
267 void CRemConCoreApiTarget::DoCancel() |
|
268 { |
|
269 } |
|
270 |
|
271 void CRemConCoreApiTarget::RunL() |
|
272 { |
|
273 RDebug::Print(_L(">>CRemConCoreApiTarget::RunL")); |
|
274 User::RequestComplete(iClientStatus, KErrNone); |
|
275 RDebug::Print(_L("<<CRemConCoreApiTarget::RunL")); |
|
276 } |
|
277 |
|
278 //end of file |