|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Main class |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "AlwaysOnlineManagerServerSession.h" |
|
21 #include "AlwaysOnlineManagerServer.h" |
|
22 |
|
23 _LIT( KTxtServer, "AlwaysOnlineManagerServerSession" ); |
|
24 |
|
25 //---------------------------------- |
|
26 // CAlwaysOnlineManagerServerSession() |
|
27 //---------------------------------- |
|
28 CAlwaysOnlineManagerServerSession::CAlwaysOnlineManagerServerSession() |
|
29 : CSession2() |
|
30 { |
|
31 } |
|
32 |
|
33 //---------------------------------- |
|
34 // NewL() |
|
35 //---------------------------------- |
|
36 CAlwaysOnlineManagerServerSession* CAlwaysOnlineManagerServerSession::NewL( |
|
37 CAlwaysOnlineManagerServer * aServer ) |
|
38 { |
|
39 CAlwaysOnlineManagerServerSession* self = |
|
40 new(ELeave) CAlwaysOnlineManagerServerSession(); |
|
41 CleanupStack::PushL( self ); |
|
42 self->ConstructL( aServer ); |
|
43 CleanupStack::Pop( self ); |
|
44 return self; |
|
45 } |
|
46 |
|
47 //---------------------------------- |
|
48 // ConstructL() |
|
49 //---------------------------------- |
|
50 void CAlwaysOnlineManagerServerSession::ConstructL( CAlwaysOnlineManagerServer* aServer ) |
|
51 { |
|
52 iAOMServer = aServer; |
|
53 } |
|
54 |
|
55 //---------------------------------- |
|
56 // ~CAlwaysOnlineManagerServerSession() |
|
57 //---------------------------------- |
|
58 CAlwaysOnlineManagerServerSession::~CAlwaysOnlineManagerServerSession() |
|
59 { |
|
60 } |
|
61 |
|
62 //---------------------------------- |
|
63 // ServiceL() |
|
64 //---------------------------------- |
|
65 void CAlwaysOnlineManagerServerSession::ServiceL(const RMessage2& aMessage) |
|
66 { |
|
67 TRAPD(err,DispatchMessageL(aMessage)); |
|
68 aMessage.Complete(err); |
|
69 |
|
70 } |
|
71 |
|
72 //---------------------------------- |
|
73 // DispatchMessageL() |
|
74 //---------------------------------- |
|
75 void CAlwaysOnlineManagerServerSession::DispatchMessageL( |
|
76 const RMessage2& aMessage ) |
|
77 { |
|
78 //read the used command |
|
79 TAlwaysOnlineServerAPICommands command = |
|
80 static_cast<TAlwaysOnlineServerAPICommands>( aMessage.Function() ); |
|
81 |
|
82 switch ( command ) |
|
83 { |
|
84 case EServerAPIEmailEMNReceived: |
|
85 { |
|
86 TPckgBuf<TEMNElement> buf; |
|
87 aMessage.ReadL( 0, buf ); |
|
88 // Forward command to client |
|
89 iAOMServer->HandleClientCommandL( command, buf ); |
|
90 } |
|
91 break; |
|
92 case EServerAPIEmailQueryState: |
|
93 case EServerAPIEmailSessionClosed: |
|
94 { |
|
95 TPckgBuf<RMessage2> buf(aMessage); |
|
96 iAOMServer->HandleClientCommandL( command, buf ); |
|
97 } |
|
98 break; |
|
99 case EServerAPIBaseCommandStart: |
|
100 case EServerAPIBaseCommandStop: |
|
101 { |
|
102 TPckgBuf<TUid> buf; |
|
103 aMessage.ReadL( 0, buf ); |
|
104 // Forward command to client |
|
105 iAOMServer->HandleClientCommandL( command, buf ); |
|
106 } |
|
107 break; |
|
108 |
|
109 default:// All other commands handles only TMsvId |
|
110 { |
|
111 TPckgBuf<TMsvId> buf; |
|
112 aMessage.ReadL( 0, buf ); |
|
113 // Forward command to client |
|
114 iAOMServer->HandleClientCommandL( command, buf ); |
|
115 } |
|
116 break; |
|
117 } |
|
118 } |
|
119 |
|
120 //---------------------------------- |
|
121 // PanicClient() |
|
122 //---------------------------------- |
|
123 void CAlwaysOnlineManagerServerSession::PanicClient( const RMessage2& aMessage, TInt aPanic ) const |
|
124 { |
|
125 aMessage.Panic( KTxtServer, aPanic ); |
|
126 } |