|
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: Sub session of the Presence server |
|
15 * It is used to maintain one session slot. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __RPENGSESSIONHOLDER_H__ |
|
21 #define __RPENGSESSIONHOLDER_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32def.h> |
|
25 #include "RPEngManagerClient.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class RPEngManagerClient; |
|
29 class TPEngWVCspServicesTree2; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * Sub-session of the Presence Server |
|
34 * It is used to maintain one session slot. |
|
35 * |
|
36 * @lib PEngClient2 |
|
37 * @since 3.0 |
|
38 */ |
|
39 class RPEngSessionHolder : public RSubSessionBase |
|
40 { |
|
41 |
|
42 public: // Constructors and destructors |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 IMPORT_C ~RPEngSessionHolder( void ); |
|
48 |
|
49 /** |
|
50 * C++ default constructor. |
|
51 */ |
|
52 IMPORT_C RPEngSessionHolder( void ); |
|
53 |
|
54 public: // Connect close operations |
|
55 |
|
56 /** |
|
57 * Connect this sub-session to the Presence Server |
|
58 * |
|
59 * Client is connected to the server with defined session Id |
|
60 * and application Id |
|
61 * |
|
62 * @since 3.0 |
|
63 * @param aSessionId packed session slot Id |
|
64 * @param aAppId application Id |
|
65 * @param aManagerClient main session client |
|
66 * @return KErrNone if connected or system wide error code |
|
67 */ |
|
68 IMPORT_C TInt Connect( const TDesC8& aSessSlotId, |
|
69 const TDesC16& aAppId, |
|
70 RPEngManagerClient& aManagerClient ); |
|
71 /** |
|
72 * Closes sub session to the Presence server |
|
73 * |
|
74 * This can be used also for CleanUpStack support |
|
75 * By default this will cause detach of the sub-session holder |
|
76 * on the server side |
|
77 * |
|
78 * @since 3.0 |
|
79 */ |
|
80 IMPORT_C void Close(); |
|
81 |
|
82 public: // New Opening methods |
|
83 |
|
84 /** |
|
85 * Asynchronous request to open new network session |
|
86 * |
|
87 * |
|
88 * LogIn fails if there already such a session active on |
|
89 * the server side. |
|
90 * Session is specified by the information passed at holder |
|
91 * construction. |
|
92 * If client still wants to get shared owner ship of the existing |
|
93 * active session, Attach method has to be used instead |
|
94 * Once LogIn is completed successfully this session holder |
|
95 * becomes reference to the such a session and its |
|
96 * lifetime is bound with it. How closing of this session |
|
97 * holder affects session itself depends on the function which is |
|
98 * used for closing of this handler. See: |
|
99 * ForceLogOut(), Detach(), LeaveAlive() |
|
100 * |
|
101 * |
|
102 * @since 3.0 |
|
103 * @param aLogInData buffer with the logIn data information |
|
104 * @param aStatus - TRequestStatus, where server will |
|
105 * signal completing of the LogIn request |
|
106 * @return KErrNone if request went fine to server, otherwise |
|
107 * system wide error code |
|
108 */ |
|
109 IMPORT_C TInt LogIn( const TDesC8& aLogInData, |
|
110 TRequestStatus& aStatus ); |
|
111 |
|
112 /** |
|
113 * Cancel LogIn request |
|
114 * @since 3.0 |
|
115 */ |
|
116 IMPORT_C void CancelLogIn(); |
|
117 |
|
118 |
|
119 /** |
|
120 * Synchronous request to attach holder to existion session |
|
121 * |
|
122 * Session holder is attached to the existing active session |
|
123 * on the server. |
|
124 * Session is specified by the information passed at holder |
|
125 * construction. |
|
126 * |
|
127 * @since 3.0 |
|
128 * @return KErrNone if request went fine to server, otherwise |
|
129 * system wide error code |
|
130 */ |
|
131 IMPORT_C TInt Attach(); |
|
132 |
|
133 /** |
|
134 * Synchronous request to attach holder to existion session |
|
135 * |
|
136 * This will attach holder to the session which is active and |
|
137 * was left to be active with specified process name. |
|
138 * Once Holder is attached with the process name, process name |
|
139 * is removed on the server side from the list of reserved |
|
140 * process names which are reserving session to be opened |
|
141 * even those processes are not alive. |
|
142 * Session is specified by the information passed at holder |
|
143 * construction. |
|
144 * |
|
145 * @since 3.0 |
|
146 * @param aProcessName process name |
|
147 * @return KErrNone if request went fine to server, otherwise |
|
148 * system wide error code |
|
149 */ |
|
150 IMPORT_C TInt Attach( const TDesC& aProcessName ); |
|
151 |
|
152 public: // New closing functions |
|
153 |
|
154 /** |
|
155 * Asynchronous request to force network session close |
|
156 * |
|
157 * Network session is closed on the server side for all |
|
158 * application Ids |
|
159 * |
|
160 * @since 3.0 |
|
161 * @param aStatus - TRequestStatus, where server will |
|
162 * signal completing of the request |
|
163 * @return KErrNone if request went fine to server, otherwise |
|
164 * system wide error code |
|
165 */ |
|
166 IMPORT_C TInt ForceLogOut( TRequestStatus& aStatus ); |
|
167 |
|
168 /** |
|
169 * Cancel LogOut request |
|
170 * |
|
171 * @since 3.0 |
|
172 */ |
|
173 IMPORT_C void CancelLogOut(); |
|
174 |
|
175 /** |
|
176 * Detach Session holder |
|
177 * |
|
178 * This function detaches session holder from active session |
|
179 * on the server, it can result in closing of the session if |
|
180 * this holder was last one using the session, therefore |
|
181 * This function is asynchronous, though in most cases it |
|
182 * will be completed immediately. |
|
183 * |
|
184 * @since 3.0 |
|
185 * @param aStatus - TRequestStatus, where server will |
|
186 * signal completing of the request |
|
187 * @return KErrNone if request went fine to server, otherwise |
|
188 * system wide error code |
|
189 */ |
|
190 IMPORT_C TInt Detach( TRequestStatus& aStatus ); |
|
191 |
|
192 /** |
|
193 * Cancel Detach request |
|
194 * |
|
195 * @since 3.0 |
|
196 */ |
|
197 IMPORT_C void CancelDetach(); |
|
198 |
|
199 /** |
|
200 * Leave session alive closing call |
|
201 * |
|
202 * This call will leave session opened with reserved session |
|
203 * for passed Process Name, untill this process name is not |
|
204 * attached again some holder, session will stay active |
|
205 * It should be used with caution, since it can leave to |
|
206 * opened session without any client. |
|
207 * How ever id client wants to disconnect from the session |
|
208 * but keep session alive for next connection, this it the |
|
209 * way to get job done. |
|
210 * |
|
211 * @since 3.0 |
|
212 * @param aProcessName Process name to reserve session for |
|
213 * @return KErrNone if request went fine to server, otherwise |
|
214 * system wide error code |
|
215 */ |
|
216 IMPORT_C TInt LeaveAlive( const TDesC& aProcessName ); |
|
217 |
|
218 |
|
219 /** |
|
220 * Session slot capabilities tree |
|
221 * |
|
222 * retrieves Session slot's capability tree |
|
223 * Function |
|
224 * |
|
225 * @since 3.0 |
|
226 * @param aService tree to be filled with values of the session |
|
227 * slot. |
|
228 * @return KErrNone if session is opened and request to |
|
229 * server was successful, otherwise system wide error code |
|
230 */ |
|
231 IMPORT_C TInt GetServiceTree( |
|
232 TPEngWVCspServicesTree2& aServiceTree ); |
|
233 |
|
234 /** |
|
235 * Session slot Log-In data |
|
236 * |
|
237 * Returns log in data which were used for session slot opening |
|
238 * |
|
239 * @since 3.0 |
|
240 * @param aLogInData buffer which will be on the return filled |
|
241 * with log in data. |
|
242 * @return KErrNone if session is opened and request to |
|
243 * server was successful, otherwise system wide error code |
|
244 */ |
|
245 IMPORT_C TInt LogInData( HBufC8*& aLogInData ); |
|
246 |
|
247 private: // Data |
|
248 |
|
249 /// OWN: Flag is client is connected or not |
|
250 TBool iConnected; |
|
251 |
|
252 /// OWN: Size of the Log in data buffer |
|
253 TInt iLogInData; |
|
254 }; |
|
255 |
|
256 #endif // __RPENGSESSIONHOLDER_H__ |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |