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 MpNowPlayingBackEnd |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32debug.h> |
|
20 |
|
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 |
|
81 void CRemConCoreApiTarget::VolumeUpResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
82 { |
|
83 RDebug::Print(_L(">>CRemConCoreApiTarget::VolumeUpResponse")); |
|
84 |
|
85 iClientStatus = &aStatus; |
|
86 gCRemConCoreApiTargetSendResponseCount++; |
|
87 |
|
88 // stub should not be async |
|
89 /*TRequestStatus* status = &iStatus; |
|
90 User::RequestComplete(status, KErrNone); |
|
91 SetActive();*/ |
|
92 |
|
93 RunL(); |
|
94 |
|
95 RDebug::Print(_L("<<CRemConCoreApiTarget::VolumeUpResponse")); |
|
96 } |
|
97 |
|
98 void CRemConCoreApiTarget::VolumeDownResponse(TRequestStatus& aStatus, TInt /*aError*/) |
|
99 { |
|
100 RDebug::Print(_L(">>CRemConCoreApiTarget::VolumeDownResponse")); |
|
101 |
|
102 iClientStatus = &aStatus; |
|
103 gCRemConCoreApiTargetSendResponseCount++; |
|
104 |
|
105 // stub should not be async |
|
106 /*TRequestStatus* status = &iStatus; |
|
107 User::RequestComplete(status, KErrNone); |
|
108 SetActive();*/ |
|
109 |
|
110 RunL(); |
|
111 |
|
112 RDebug::Print(_L("<<CRemConCoreApiTarget::VolumeDownResponse")); |
|
113 } |
|
114 |
|
115 void CRemConCoreApiTarget::SendResponse(TRequestStatus& aStatus, TRemConCoreApiOperationId /*aOperationId*/, TInt /*aError*/) |
|
116 { |
|
117 RDebug::Print(_L(">>CRemConCoreApiTarget::SendResponse")); |
|
118 |
|
119 iClientStatus = &aStatus; |
|
120 gCRemConCoreApiTargetSendResponseCount++; |
|
121 |
|
122 // stub should not be async |
|
123 /*TRequestStatus* status = &iStatus; |
|
124 User::RequestComplete(status, KErrNone); |
|
125 SetActive();*/ |
|
126 |
|
127 RunL(); |
|
128 |
|
129 RDebug::Print(_L("<<CRemConCoreApiTarget::SendResponse")); |
|
130 } |
|
131 |
|
132 void CRemConCoreApiTarget::DoCancel() |
|
133 { |
|
134 } |
|
135 |
|
136 void CRemConCoreApiTarget::RunL() |
|
137 { |
|
138 RDebug::Print(_L(">>CRemConCoreApiTarget::RunL")); |
|
139 User::RequestComplete(iClientStatus, KErrNone); |
|
140 RDebug::Print(_L("<<CRemConCoreApiTarget::RunL")); |
|
141 } |
|
142 |
|
143 //end of file |
|