|
1 // Copyright (c) 2004-2009 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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This main DLL entry point for the Smoketest_Timew.dll |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 // EPOC includes |
|
20 #include <e32base.h> |
|
21 |
|
22 #include "TestTimewServer.h" |
|
23 #include "TestTimewSetAlarm.h" |
|
24 |
|
25 |
|
26 _LIT(KServerName,"Smoketest_Timew_Server"); |
|
27 |
|
28 CTestTimewServer* CTestTimewServer::NewL() |
|
29 /** |
|
30 * @return - Instance of the test server |
|
31 * Same code for Secure and non-secure variants |
|
32 * Called inside the MainL() function to create and start the |
|
33 * CTestServer derived server. |
|
34 */ |
|
35 { |
|
36 CTestTimewServer* server = new (ELeave) CTestTimewServer(); |
|
37 CleanupStack::PushL(server); |
|
38 // CServer base class call |
|
39 server->StartL(KServerName); |
|
40 CleanupStack::Pop(server); |
|
41 return server; |
|
42 } |
|
43 |
|
44 |
|
45 LOCAL_C void MainL() |
|
46 /** |
|
47 * Secure variant |
|
48 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
49 */ |
|
50 { |
|
51 #if (defined __DATA_CAGING__) |
|
52 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
53 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
54 #endif |
|
55 CActiveScheduler* sched=NULL; |
|
56 sched=new(ELeave) CActiveScheduler; |
|
57 CActiveScheduler::Install(sched); |
|
58 CTestTimewServer* server = NULL; |
|
59 // Create the CTestServer derived server |
|
60 TRAPD(err,server = CTestTimewServer::NewL()); |
|
61 if(!err) |
|
62 { |
|
63 // Sync with the client and enter the active scheduler |
|
64 RProcess::Rendezvous(KErrNone); |
|
65 sched->Start(); |
|
66 } |
|
67 delete server; |
|
68 delete sched; |
|
69 } |
|
70 |
|
71 |
|
72 GLDEF_C TInt E32Main() |
|
73 /** |
|
74 * @return - Standard Epoc error code on process exit |
|
75 * Secure variant only |
|
76 * Process entry point. Called by client using RProcess API |
|
77 */ |
|
78 { |
|
79 __UHEAP_MARK; |
|
80 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
81 if(cleanup == NULL) |
|
82 { |
|
83 return KErrNoMemory; |
|
84 } |
|
85 TRAPD(err,MainL()); |
|
86 if (!err) { } |
|
87 |
|
88 delete cleanup; |
|
89 __UHEAP_MARKEND; |
|
90 return KErrNone; |
|
91 } |
|
92 |
|
93 |
|
94 CTestStep* CTestTimewServer::CreateTestStep(const TDesC& aStepName) |
|
95 /** |
|
96 * @return - A CTestStep derived instance |
|
97 * Secure and non-secure variants |
|
98 * Implementation of CTestServer pure virtual |
|
99 */ |
|
100 { |
|
101 CTestStep* testStep = NULL; |
|
102 |
|
103 if(aStepName == _L("SetAlarm")) |
|
104 testStep = new CTestTimewSetAlarm(); |
|
105 return testStep; |
|
106 } |