|
1 /* |
|
2 * Copyright (c) 2004-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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "rtautilsserver.h" |
|
20 #include "rtautilsstep.h" |
|
21 #include "archivestep.h" |
|
22 #include "rightsDbStep.h" |
|
23 |
|
24 _LIT(KServerName,"aprrtautils"); |
|
25 |
|
26 CRTAUtilsServer* CRTAUtilsServer::NewL() |
|
27 { |
|
28 CRTAUtilsServer * server = new (ELeave) CRTAUtilsServer(); |
|
29 CleanupStack::PushL(server); |
|
30 User::LeaveIfError(server->iFs.Connect()); |
|
31 |
|
32 // Make the file session sharable |
|
33 User::LeaveIfError(server->iFs.ShareProtected()); |
|
34 |
|
35 // CServer base class call |
|
36 server->StartL(KServerName); |
|
37 CleanupStack::Pop(server); |
|
38 return server; |
|
39 } |
|
40 |
|
41 // EKA2 much simpler |
|
42 // Just an E32Main and a MainL() |
|
43 LOCAL_C void MainL() |
|
44 /* |
|
45 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
46 */ |
|
47 { |
|
48 // Leave the hooks in for platform security |
|
49 #if (defined __DATA_CAGING__) |
|
50 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
51 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
52 #endif |
|
53 CActiveScheduler* sched=NULL; |
|
54 sched=new(ELeave) CActiveScheduler; |
|
55 CActiveScheduler::Install(sched); |
|
56 // __EDIT_ME__ Your server name |
|
57 CRTAUtilsServer* server = NULL; |
|
58 // Create the CTestServer derived server |
|
59 // __EDIT_ME__ Your server name |
|
60 TRAPD(err,server = CRTAUtilsServer::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 GLDEF_C TInt E32Main() |
|
72 /* |
|
73 * return standard error code on exit |
|
74 */ |
|
75 { |
|
76 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
77 if(cleanup == NULL) |
|
78 { |
|
79 return KErrNoMemory; |
|
80 } |
|
81 TRAP_IGNORE(MainL()); |
|
82 delete cleanup; |
|
83 return KErrNone; |
|
84 } |
|
85 |
|
86 // Create a thread in the calling process |
|
87 // Emulator typhoon and earlier |
|
88 |
|
89 CTestStep* CRTAUtilsServer::CreateTestStep(const TDesC& aStepName) |
|
90 /* |
|
91 * return a CTestStep derived instance |
|
92 * Implementation of CTestServer pure virtual |
|
93 */ |
|
94 { |
|
95 CTestStep* testStep = NULL; |
|
96 // They are created "just in time" when the worker thread is created |
|
97 if(aStepName == KCreateDrmArchive) |
|
98 testStep = new CCreateDrmArchive(*this); |
|
99 else if(aStepName == KImportDrmArchive) |
|
100 testStep = new CImportDrmArchive(*this); |
|
101 else if(aStepName == KClearRightsDb) |
|
102 testStep = new CClearRightsDb(*this); |
|
103 |
|
104 return testStep; |
|
105 } |