|
1 // Copyright (c) 1999-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 "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 // |
|
15 |
|
16 #include "ASSrvStartup.h" |
|
17 #include "ASSrvServer.h" |
|
18 #include "ASSrvStaticUtils.h" |
|
19 |
|
20 // |
|
21 // ----> ASSrvStartup (source) |
|
22 // |
|
23 |
|
24 //************************************************************************************* |
|
25 TInt ASSrvStartup::RunServer() |
|
26 { |
|
27 __UHEAP_MARK; |
|
28 // |
|
29 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
30 TInt ret = KErrNoMemory; |
|
31 if (cleanup) |
|
32 { |
|
33 TRAP(ret, ASSrvStartup::RunServerL()); |
|
34 delete cleanup; |
|
35 } |
|
36 // |
|
37 __UHEAP_MARKEND; |
|
38 return ret; |
|
39 } |
|
40 |
|
41 //************************************************************************************* |
|
42 void ASSrvStartup::RunServerL() |
|
43 { |
|
44 // Create and install the active scheduler we need |
|
45 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler(); |
|
46 CleanupStack::PushL(scheduler); |
|
47 CActiveScheduler::Install(scheduler); |
|
48 |
|
49 // Create server |
|
50 CASSrvServer::NewLC(); |
|
51 |
|
52 // Initialisation complete, now signal the client |
|
53 User::LeaveIfError(RThread().RenameMe(ASSrvStaticUtils::ASName())); |
|
54 RProcess::Rendezvous(KErrNone); |
|
55 |
|
56 // Ready to run |
|
57 CActiveScheduler::Start(); |
|
58 |
|
59 // Cleanup the server and scheduler |
|
60 CleanupStack::PopAndDestroy(2, scheduler); |
|
61 } |
|
62 |
|
63 //************************************************************************************* |
|
64 TInt E32Main() |
|
65 { |
|
66 return ASSrvStartup::RunServer(); |
|
67 } |