|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Contains the implementation of TEF3.0 respective test server |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file te_tundrivertestserver.h |
|
21 @internalTechnology |
|
22 */ |
|
23 |
|
24 #include "te_tundrivertestserver.h" |
|
25 |
|
26 /** |
|
27 Function to instantiate TestServer. |
|
28 |
|
29 @return Returns the TestServer instance pointer. |
|
30 |
|
31 @internalTechnology |
|
32 */ |
|
33 CTunDriverTestServer* CTunDriverTestServer::NewL() |
|
34 { |
|
35 CTunDriverTestServer* server = new (ELeave) CTunDriverTestServer(); |
|
36 CleanupStack::PushL(server); |
|
37 server->ConstructL(); |
|
38 CleanupStack::Pop(server); |
|
39 return server; |
|
40 } |
|
41 |
|
42 /** |
|
43 Function to instantiate TestBlock. |
|
44 |
|
45 This function is invoked by the TestEngine while parsing START_TEST_BLOCK command in the |
|
46 script file. |
|
47 |
|
48 @return Returns the TestBlock instance pointer. |
|
49 |
|
50 @internalTechnology |
|
51 */ |
|
52 CTestBlockController* CTunDriverTestServer::CreateTestBlock() |
|
53 { |
|
54 CTestBlockController* testBlockController=NULL; |
|
55 TRAPD(err, testBlockController = CreateTestBlockL()); |
|
56 if(err == KErrNone) |
|
57 { |
|
58 return testBlockController; |
|
59 } |
|
60 else |
|
61 { |
|
62 return NULL; |
|
63 } |
|
64 } |
|
65 |
|
66 /** |
|
67 Function to instantiate TestBlock. |
|
68 |
|
69 @internalTechnology |
|
70 */ |
|
71 CTestBlockController* CTunDriverTestServer::CreateTestBlockL() |
|
72 { |
|
73 return new (ELeave) CTunDriverTestBlock(); |
|
74 } |
|
75 |
|
76 /** |
|
77 Function to kick start the TestServer. |
|
78 |
|
79 @internalTechnology |
|
80 */ |
|
81 LOCAL_C void MainL() |
|
82 { |
|
83 #if (defined __DATA_CAGING__) |
|
84 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
85 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
86 #endif |
|
87 CActiveScheduler* sched=NULL; |
|
88 sched=new(ELeave) CActiveScheduler; |
|
89 CActiveScheduler::Install(sched); |
|
90 CTunDriverTestServer* server = NULL; |
|
91 TRAPD(err, server = CTunDriverTestServer::NewL()); |
|
92 if(!err) |
|
93 { |
|
94 RProcess::Rendezvous(KErrNone); |
|
95 sched->Start(); |
|
96 } |
|
97 delete server; |
|
98 delete sched; |
|
99 } |
|
100 /** |
|
101 TestServer entry point. |
|
102 |
|
103 @return Returns KErrNone upon successfull completion, KErrNoMemory in low memory conditions. |
|
104 |
|
105 @internalTechnology |
|
106 */ |
|
107 GLDEF_C TInt E32Main() |
|
108 { |
|
109 __UHEAP_MARK; |
|
110 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
111 if(cleanup == NULL) |
|
112 { |
|
113 return KErrNoMemory; |
|
114 } |
|
115 TRAP_IGNORE(MainL()); |
|
116 delete cleanup; |
|
117 __UHEAP_MARKEND; |
|
118 return KErrNone; |
|
119 } |