|
1 /* |
|
2 * Copyright (c) 2002-2007 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 "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: Implementation of obexservicemanager core. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "obexserviceman.h" |
|
24 #include "debug.h" |
|
25 #include "obexsm.h" |
|
26 |
|
27 |
|
28 // --------------------------------------------------------- |
|
29 // PanicClient |
|
30 // |
|
31 // RMessage2::Panic() also completes the message. |
|
32 // |
|
33 // --------------------------------------------------------- |
|
34 void PanicClient(const RMessage2& aMessage,TInt aPanic ) |
|
35 { |
|
36 FTRACE(FPrint(_L("[SRCS]\tserver\tPanicClient: Reason = %d"), aPanic)); |
|
37 aMessage.Panic(KSrcsPanic,aPanic); |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------- |
|
41 // PanicServer |
|
42 // |
|
43 // Panic our own thread |
|
44 // |
|
45 // --------------------------------------------------------- |
|
46 void PanicServer(TInt aPanic) |
|
47 { |
|
48 FTRACE(FPrint(_L("[SRCS]\tserver\tPanicServer: Reason = %d"), aPanic)); |
|
49 User::Panic(KSrcsPanic, aPanic); |
|
50 } |
|
51 |
|
52 |
|
53 |
|
54 // ================= OTHER EXPORTED FUNCTIONS ============== |
|
55 |
|
56 |
|
57 // --------------------------------------------------------- |
|
58 // RunServerL |
|
59 // |
|
60 // Perform all server initialisation, in particular creation |
|
61 // of the scheduler and server and then run the scheduler. |
|
62 // This is called from Srcs.exe (RunServer -method). |
|
63 // |
|
64 // --------------------------------------------------------- |
|
65 EXPORT_C void RunServerL() |
|
66 { |
|
67 FLOG(_L("[SRCS]\tclient\tSrcs RunServerL")); |
|
68 |
|
69 // create and install the active scheduler we need |
|
70 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
71 CleanupStack::PushL(scheduler); |
|
72 CActiveScheduler::Install(scheduler); |
|
73 |
|
74 // create the server (leave it on the cleanup stack) |
|
75 CleanupStack::PushL( CObexSM::NewL() ); |
|
76 |
|
77 |
|
78 // naming the server thread after the server helps to debug panics |
|
79 // ignore error - we tried the best we could |
|
80 |
|
81 User::RenameThread(KSrcsName); |
|
82 |
|
83 |
|
84 RProcess::Rendezvous(KErrNone); |
|
85 |
|
86 |
|
87 FLOG(_L("[SRCS]\tclient\tSrcs RunServerL: Starting active scheduler...")); |
|
88 CActiveScheduler::Start(); |
|
89 |
|
90 FLOG(_L("[SRCS]\tclient\tSrcs RunServerL: Done")); |
|
91 // |
|
92 // Cleanup the server and scheduler |
|
93 CleanupStack::PopAndDestroy(2); |
|
94 } |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 TInt E32Main() //used in all case( WINS and TARGET) |
|
101 { |
|
102 __UHEAP_MARK; |
|
103 |
|
104 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
105 TInt retVal = KErrNoMemory; |
|
106 if ( cleanup ) |
|
107 { |
|
108 TRAP( retVal,RunServerL() ); |
|
109 delete cleanup; |
|
110 } |
|
111 |
|
112 __UHEAP_MARKEND; |
|
113 return retVal; |
|
114 } |
|
115 |
|
116 |
|
117 // End of file |