|
1 /* |
|
2 * Copyright (c) 2008-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 * Scr Accessor - entry point |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @test |
|
23 @internalComponent |
|
24 */ |
|
25 |
|
26 #include <e32std.h> |
|
27 #include <e32base.h> |
|
28 |
|
29 #include "tscraccessor_server_session.h" |
|
30 #include "tscraccessor_common.h" |
|
31 |
|
32 // |
|
33 // Perform server initialisation, in particular creation of the scheduler and |
|
34 // server and then run the scheduler |
|
35 // |
|
36 static void RunServerL() |
|
37 { |
|
38 // naming the server thread after the server helps to debug panics |
|
39 User::LeaveIfError(RThread().RenameMe(KScrAccessServerName)); |
|
40 // |
|
41 // create and install the active scheduler we need |
|
42 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
43 CleanupStack::PushL(sched); |
|
44 CActiveScheduler::Install(sched); |
|
45 // |
|
46 // create the server (leave it on the cleanup stack) |
|
47 CScrAccessServer::NewLC(); |
|
48 |
|
49 // |
|
50 // Initialisation complete, now signal the client |
|
51 RProcess::Rendezvous(KErrNone); |
|
52 |
|
53 // |
|
54 // Ready to run |
|
55 CActiveScheduler::Start(); |
|
56 // |
|
57 // Cleanup the server and scheduler |
|
58 CleanupStack::PopAndDestroy(2, sched); |
|
59 } |
|
60 |
|
61 // |
|
62 // Server process entry-point |
|
63 // |
|
64 TInt E32Main() |
|
65 { |
|
66 __UHEAP_MARK; |
|
67 |
|
68 // |
|
69 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
70 TInt r = KErrNoMemory; |
|
71 if (cleanup) |
|
72 { |
|
73 TRAP(r, RunServerL()); |
|
74 delete cleanup; |
|
75 } |
|
76 // |
|
77 |
|
78 __UHEAP_MARKEND; |
|
79 return r; |
|
80 } |
|
81 |
|
82 void PanicClient(const RMessagePtr2& aMessage, TScrAccessPanic aPanic) |
|
83 { |
|
84 _LIT(KPanic,"ScrAccessServer"); |
|
85 aMessage.Panic(KPanic,aPanic); // Also completes the message |
|
86 } |