2
|
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:
|
|
13 |
*
|
|
14 |
* Description: Implements common reset module for STIF
|
|
15 |
* TestFramework. According to this DLL template can be implemented
|
|
16 |
* licensee specific reset module.
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include "StifHWResetStub.h"
|
|
22 |
|
|
23 |
// EXTERNAL DATA STRUCTURES
|
|
24 |
// None
|
|
25 |
|
|
26 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
27 |
// None
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
// None
|
|
31 |
|
|
32 |
// MACROS
|
|
33 |
// None
|
|
34 |
|
|
35 |
// LOCAL CONSTANTS AND MACROS
|
|
36 |
// None
|
|
37 |
|
|
38 |
// MODULE DATA STRUCTURES
|
|
39 |
// None
|
|
40 |
|
|
41 |
// LOCAL FUNCTION PROTOTYPES
|
|
42 |
// None
|
|
43 |
|
|
44 |
// FORWARD DECLARATIONS
|
|
45 |
// None
|
|
46 |
|
|
47 |
// ==================== LOCAL FUNCTIONS =======================================
|
|
48 |
|
|
49 |
// ================= MEMBER FUNCTIONS =========================================
|
|
50 |
|
|
51 |
/*
|
|
52 |
-------------------------------------------------------------------------------
|
|
53 |
|
|
54 |
Class: CStifHWResetStub
|
|
55 |
|
|
56 |
Method: CStifHWResetStub
|
|
57 |
|
|
58 |
Description: Default constructor.
|
|
59 |
|
|
60 |
Parameters: None
|
|
61 |
|
|
62 |
Return Values: None
|
|
63 |
|
|
64 |
Errors/Exceptions: None
|
|
65 |
|
|
66 |
Status: Proposal
|
|
67 |
|
|
68 |
-------------------------------------------------------------------------------
|
|
69 |
*/
|
|
70 |
CStifHWResetStub::CStifHWResetStub()
|
|
71 |
{
|
|
72 |
// None
|
|
73 |
|
|
74 |
}
|
|
75 |
|
|
76 |
/*
|
|
77 |
-------------------------------------------------------------------------------
|
|
78 |
|
|
79 |
Class: CStifHWResetStub
|
|
80 |
|
|
81 |
Method: ConstructL
|
|
82 |
|
|
83 |
Description: Symbian OS second phase constructor. Nothing to do.
|
|
84 |
|
|
85 |
Parameters: None
|
|
86 |
|
|
87 |
Return Values: None
|
|
88 |
|
|
89 |
Errors/Exceptions: None
|
|
90 |
|
|
91 |
Status: Proposal
|
|
92 |
|
|
93 |
-------------------------------------------------------------------------------
|
|
94 |
*/
|
|
95 |
void CStifHWResetStub::ConstructL()
|
|
96 |
{
|
|
97 |
// Create Logger
|
|
98 |
iLogger = CStifLogger::NewL( _L( "C:\\logs\\testframework\\testengine\\"),
|
|
99 |
_L( "StifHWResetStub" ),
|
|
100 |
CStifLogger::ETxt,
|
|
101 |
CStifLogger::EFile,
|
|
102 |
EFalse, // Append
|
|
103 |
ETrue,
|
|
104 |
ETrue,
|
|
105 |
EFalse,
|
|
106 |
EFalse );
|
|
107 |
|
|
108 |
}
|
|
109 |
|
|
110 |
/*
|
|
111 |
-------------------------------------------------------------------------------
|
|
112 |
|
|
113 |
Class: CStifHWResetStub
|
|
114 |
|
|
115 |
Method: NewL
|
|
116 |
|
|
117 |
Description: Two-phased constructor. Constructs new CStifHWResetStub
|
|
118 |
instance and returns pointer to it.
|
|
119 |
|
|
120 |
Parameters: None
|
|
121 |
|
|
122 |
Return Values: CStifHWResetStub*: new object.
|
|
123 |
|
|
124 |
Errors/Exceptions: Leaves if memory allocation fails or ConstructL leaves.
|
|
125 |
|
|
126 |
Status: Proposal
|
|
127 |
|
|
128 |
-------------------------------------------------------------------------------
|
|
129 |
*/
|
|
130 |
EXPORT_C CStifHWResetStub* CStifHWResetStub::NewL()
|
|
131 |
{
|
|
132 |
// Construct new CStifHWResetStub instance.
|
|
133 |
CStifHWResetStub* self = new ( ELeave ) CStifHWResetStub();
|
|
134 |
CleanupStack::PushL( self );
|
|
135 |
self->ConstructL();
|
|
136 |
CleanupStack::Pop();
|
|
137 |
|
|
138 |
return self;
|
|
139 |
|
|
140 |
}
|
|
141 |
|
|
142 |
/*
|
|
143 |
-------------------------------------------------------------------------------
|
|
144 |
|
|
145 |
Class: CStifHWResetStub
|
|
146 |
|
|
147 |
Method: ~CStifHWResetStub
|
|
148 |
|
|
149 |
Description: Destructor.
|
|
150 |
|
|
151 |
Parameters: None
|
|
152 |
|
|
153 |
Return Values: None
|
|
154 |
|
|
155 |
Errors/Exceptions: None
|
|
156 |
|
|
157 |
Status: Proposal
|
|
158 |
|
|
159 |
-------------------------------------------------------------------------------
|
|
160 |
*/
|
|
161 |
CStifHWResetStub::~CStifHWResetStub()
|
|
162 |
{
|
|
163 |
delete iLogger;
|
|
164 |
iLogger = NULL;
|
|
165 |
|
|
166 |
}
|
|
167 |
|
|
168 |
/*
|
|
169 |
-------------------------------------------------------------------------------
|
|
170 |
|
|
171 |
Class: CStifHWResetStub
|
|
172 |
|
|
173 |
Method: DoReset
|
|
174 |
|
|
175 |
Description: Does reset according to reset type.
|
|
176 |
|
|
177 |
Parameters: CTestModuleIf::TRebootType aResetType: in: Reset type
|
|
178 |
|
|
179 |
Return Values: TInt: Symbian OS error
|
|
180 |
|
|
181 |
Errors/Exceptions: Error code returned if reset method returns an error.
|
|
182 |
|
|
183 |
Status: Proposal
|
|
184 |
|
|
185 |
-------------------------------------------------------------------------------
|
|
186 |
*/
|
|
187 |
TInt CStifHWResetStub::DoReset( CTestModuleIf::TRebootType aResetType )
|
|
188 |
{
|
|
189 |
iLogger->Log( _L( "CStifHWResetStub::DoReset(), reset type: %d" ), aResetType );
|
|
190 |
TInt ret( KErrNone );
|
|
191 |
|
|
192 |
switch( aResetType )
|
|
193 |
{
|
|
194 |
case CTestModuleIf::EDefaultReset:
|
|
195 |
{
|
|
196 |
ret = KillProcess(); // For an example
|
|
197 |
break;
|
|
198 |
}
|
|
199 |
case CTestModuleIf::EDeviceReset0:
|
|
200 |
{
|
|
201 |
ret = KillProcess(); // For an example
|
|
202 |
break;
|
|
203 |
}
|
|
204 |
case CTestModuleIf::EDeviceReset1:
|
|
205 |
{
|
|
206 |
ret = KillProcess(); // For an example
|
|
207 |
break;
|
|
208 |
}
|
|
209 |
case CTestModuleIf::EDeviceReset2:
|
|
210 |
{
|
|
211 |
ret = GeneralReset(); // Do nothing, for an example
|
|
212 |
break;
|
|
213 |
}
|
|
214 |
case CTestModuleIf::EDeviceReset3:
|
|
215 |
{
|
|
216 |
ret = GeneralReset(); // Do nothing, for an example
|
|
217 |
break;
|
|
218 |
}
|
|
219 |
case CTestModuleIf::EDeviceReset4:
|
|
220 |
{
|
|
221 |
ret = GeneralReset(); // Do nothing, for an example
|
|
222 |
break;
|
|
223 |
}
|
|
224 |
case CTestModuleIf::EDeviceReset5:
|
|
225 |
{
|
|
226 |
ret = GeneralReset(); // Do nothing, for an example
|
|
227 |
break;
|
|
228 |
}
|
|
229 |
default:
|
|
230 |
{
|
|
231 |
return KErrArgument;
|
|
232 |
}
|
|
233 |
}
|
|
234 |
|
|
235 |
return ret;
|
|
236 |
|
|
237 |
}
|
|
238 |
|
|
239 |
/*
|
|
240 |
-------------------------------------------------------------------------------
|
|
241 |
|
|
242 |
Class: CStifHWResetStub
|
|
243 |
|
|
244 |
Method: KillProcess
|
|
245 |
|
|
246 |
Description: Kills process
|
|
247 |
|
|
248 |
Parameters: None
|
|
249 |
|
|
250 |
Return Values: TInt: Symbian OS error
|
|
251 |
|
|
252 |
Errors/Exceptions: None
|
|
253 |
|
|
254 |
Status: Proposal
|
|
255 |
|
|
256 |
-------------------------------------------------------------------------------
|
|
257 |
*/
|
|
258 |
TInt CStifHWResetStub::KillProcess()
|
|
259 |
{
|
|
260 |
iLogger->Log( _L( "KillProcess()" ) );
|
|
261 |
// Do process kill if MTC messages not allowed
|
|
262 |
RProcess thisProcess;
|
|
263 |
thisProcess.Kill( KErrNone );
|
|
264 |
thisProcess.Close();
|
|
265 |
|
|
266 |
return KErrNone;
|
|
267 |
|
|
268 |
}
|
|
269 |
|
|
270 |
/*
|
|
271 |
-------------------------------------------------------------------------------
|
|
272 |
|
|
273 |
Class: CStifHWResetStub
|
|
274 |
|
|
275 |
Method: GeneralReset
|
|
276 |
|
|
277 |
Description: General reset for example.
|
|
278 |
|
|
279 |
Parameters: None
|
|
280 |
|
|
281 |
Return Values: TInt: Symbian OS error
|
|
282 |
|
|
283 |
Errors/Exceptions: None
|
|
284 |
|
|
285 |
Status: Proposal
|
|
286 |
|
|
287 |
-------------------------------------------------------------------------------
|
|
288 |
*/
|
|
289 |
TInt CStifHWResetStub::GeneralReset()
|
|
290 |
{
|
|
291 |
// Lisencee specific reset
|
|
292 |
iLogger->Log( _L( "GeneralReset()" ) );
|
|
293 |
return KErrNone;
|
|
294 |
|
|
295 |
}
|
|
296 |
|
|
297 |
// ================= OTHER EXPORTED FUNCTIONS =================================
|
|
298 |
|
|
299 |
/*
|
|
300 |
-------------------------------------------------------------------------------
|
|
301 |
|
|
302 |
Function: LibEntryL
|
|
303 |
|
|
304 |
Description: Polymorphic Dll Entry Point
|
|
305 |
|
|
306 |
Test framework calls this function to obtain new instance of test module
|
|
307 |
class.
|
|
308 |
|
|
309 |
Parameters: None
|
|
310 |
|
|
311 |
Return Values: CStifHWResetStub* Pointer to CStifHWResetStub instance
|
|
312 |
|
|
313 |
Errors/Exceptions: Leaves if CStifHWResetStub::NewL leaves
|
|
314 |
|
|
315 |
Status: Proposal
|
|
316 |
|
|
317 |
-------------------------------------------------------------------------------
|
|
318 |
*/
|
|
319 |
EXPORT_C CStifHWResetStub* LibEntryL()
|
|
320 |
{
|
|
321 |
return CStifHWResetStub::NewL();
|
|
322 |
|
|
323 |
}
|
|
324 |
|
|
325 |
|
|
326 |
// End of File
|