|
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: Presence Server sub-session handler implementation |
|
15 * All clients sub-session related request are handler here |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CPENGSUBSESSION_H__ |
|
22 #define __CPENGSUBSESSION_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <badesca.h> |
|
27 |
|
28 #include "MPEngSubSession.h" |
|
29 |
|
30 #include "TPEngServerMessages.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class MPEngServer; |
|
34 class RPEngMessage; |
|
35 class CPEngCSPSessManager; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 /** |
|
39 * Presence Server sub-session handler implementation |
|
40 * All clients sub-session related request are handler here, |
|
41 * |
|
42 * @lib PEngServer2 |
|
43 * @since 3.0 |
|
44 */ |
|
45 NONSHARABLE_CLASS( CPEngSubSession ) : |
|
46 public CObject, |
|
47 public MPEngSubSession |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 * @param aServer server instance |
|
54 * @param aMessage create sub-session message |
|
55 * @param aSessionId Id of the main session |
|
56 * @return sub-session instance |
|
57 */ |
|
58 static CPEngSubSession* NewL( MPEngServer& aServer, |
|
59 const RPEngMessage& aMessage, |
|
60 TInt32 aSessionId ); |
|
61 |
|
62 static CPEngSubSession* NewLC( MPEngServer& aServer, |
|
63 const RPEngMessage& aMessage, |
|
64 TInt32 aSessionId ); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~CPEngSubSession(); |
|
70 |
|
71 public: // New functions of the MPengSubSession |
|
72 /** |
|
73 * Store request response |
|
74 * @see <MPengSubSession.h> |
|
75 * @since 3.0 |
|
76 */ |
|
77 void StoreRequestResponse( HBufC8* aResponse ); |
|
78 |
|
79 /** |
|
80 * Application Id of the sub-session |
|
81 * @see <MPengSubSession.h> |
|
82 * @since 3.0 |
|
83 */ |
|
84 TDesC& AppId(); |
|
85 |
|
86 /** |
|
87 * Handler successful application Id login |
|
88 * @see <MPengSubSession.h> |
|
89 * @since 3.0 |
|
90 */ |
|
91 void HandleLogInL(); |
|
92 |
|
93 /** |
|
94 * Handler successful application Id logOut |
|
95 * @see <MPengSubSession.h> |
|
96 * @since 3.0 |
|
97 */ |
|
98 void HandleLogOut(); |
|
99 |
|
100 /** |
|
101 * Disconnect Application Id |
|
102 * @see <MPengSubSession.h> |
|
103 * @since 3.0 |
|
104 */ |
|
105 void DisconnectAppId( const TDesC& aAppId ); |
|
106 |
|
107 /** |
|
108 * Handle CSP closing |
|
109 * @see <MPengSubSession.h> |
|
110 * @since 3.0 |
|
111 */ |
|
112 void CSPSessionClosed(); |
|
113 |
|
114 public: // Function for handling of the clients requests |
|
115 |
|
116 /** |
|
117 * Dispatch message from the Sub Session |
|
118 * |
|
119 * @since 3.0 |
|
120 * @param aMessage message with the request details |
|
121 * @param aRequest request enumeration to handle |
|
122 * @return ETrue if message should be completed |
|
123 */ |
|
124 TBool DispatchMessageL( const RPEngMessage& aMessage, |
|
125 TInt aRequest ); |
|
126 |
|
127 /** |
|
128 * Set Sub-session handle Id for the Session |
|
129 * |
|
130 * @since 3.0 |
|
131 * @param aHandle Sub-session handle |
|
132 */ |
|
133 void SetSubSesionHandle( TInt aHandle ); |
|
134 |
|
135 |
|
136 private: // Functions from base classes |
|
137 |
|
138 /* |
|
139 * Panic client |
|
140 * |
|
141 * @since 3.0 |
|
142 * @param aMessage clients message |
|
143 * @param aPanic panic reason |
|
144 */ |
|
145 void PanicClient( const RPEngMessage& aMessage, |
|
146 const TInt aPanic ) const; |
|
147 |
|
148 /** |
|
149 * Fetch result of last asynchronous request |
|
150 * |
|
151 * @since 3.0 |
|
152 * @param aMessage with request details |
|
153 */ |
|
154 void FetchRequestresultL( const RPEngMessage& aMessage ); |
|
155 |
|
156 private: |
|
157 |
|
158 /** |
|
159 * C++ default constructor. |
|
160 */ |
|
161 CPEngSubSession( TInt32 aSessionId ); |
|
162 |
|
163 /** |
|
164 * Symbian 2nd phase constructor |
|
165 */ |
|
166 void ConstructL( MPEngServer& aServer, |
|
167 const RPEngMessage& aMessage ); |
|
168 |
|
169 private: // Data |
|
170 |
|
171 /// OWN: Sub-session type |
|
172 TInt iType; |
|
173 |
|
174 /// OWN: Sub Session Handle |
|
175 TInt iHandle; |
|
176 |
|
177 /// OWN: Session Id of this sub-session |
|
178 TInt32 iSessionId; |
|
179 |
|
180 /// REF: CSP Session holder |
|
181 CPEngCSPSessManager* iSessionManager; |
|
182 |
|
183 /// OWN: Application Id of the sub-session |
|
184 HBufC16* iAppId; |
|
185 |
|
186 /// OWN: Application Id was attached to Session Holder |
|
187 TBool iAppIdAttached; |
|
188 |
|
189 /// OWN: Sub-session last async request result |
|
190 HBufC8* iRequestResult; |
|
191 |
|
192 }; |
|
193 |
|
194 #endif // __CPENGSUBSESSION_H__ |
|
195 |
|
196 // End of File |