1 /* |
|
2 * Copyright (c) 2006 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: IETF SIMPLE Protocol implementation for XIMP Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPRESENCEPLUGINSESSION_H |
|
20 #define CPRESENCEPLUGINSESSION_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <msimpleconnectionobserver.h> |
|
25 #include "mpresencepluginconnectionobs.h" |
|
26 #include "presencelogger.h" |
|
27 |
|
28 //FORWARD |
|
29 class MXIMPServiceInfo; |
|
30 class MPresencePluginConnectionObs; |
|
31 |
|
32 /** |
|
33 * CPrecensePluginSession |
|
34 * |
|
35 * presence Engine Connection |
|
36 * |
|
37 * @lib presenceplugin.dll |
|
38 * @since S60 v3.2 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CPresencePluginSession ): public CActive, |
|
41 public MSimpleConnectionObserver |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 * Current operation |
|
47 */ |
|
48 enum TPluginSessionOperation |
|
49 { |
|
50 ENoOperation, |
|
51 EInitializeXdm, |
|
52 }; |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * |
|
57 * @param aService, XIMP Service info |
|
58 * @param aObs, Connection observer |
|
59 */ |
|
60 static CPresencePluginSession* NewL( |
|
61 const MXIMPServiceInfo& aService, |
|
62 MPresencePluginConnectionObs& aObs ); |
|
63 |
|
64 /** |
|
65 * Standard C++ destructor |
|
66 */ |
|
67 virtual ~CPresencePluginSession(); |
|
68 |
|
69 public: //New function |
|
70 |
|
71 TInt32 GetPresenceSetId( ) const; |
|
72 |
|
73 /** |
|
74 * MSimpleConnection accessor |
|
75 * |
|
76 * @since S60 3.2 |
|
77 * @return MSImpleConnection instance |
|
78 */ |
|
79 MSimpleConnection* SimpleConnection(); |
|
80 |
|
81 /** |
|
82 * OpenSessionL |
|
83 * |
|
84 * @since S60 3.2 |
|
85 * Opens the SIP connection (registers when needed) |
|
86 * @param none |
|
87 * @return none |
|
88 */ |
|
89 void OpenSessionL(); |
|
90 |
|
91 /** |
|
92 * XDMSettings accessor |
|
93 * |
|
94 * @since S60 3.2 |
|
95 * @param none |
|
96 * @return XDM Settings ID |
|
97 */ |
|
98 TInt XdmSettingsId(); |
|
99 |
|
100 /** |
|
101 * Current registered SIP entity |
|
102 * |
|
103 * @since S60 3.2 |
|
104 * @param none |
|
105 * @return TPrtC8, current sip presentity |
|
106 */ |
|
107 TPtrC8 CurrentSipPresentity(); |
|
108 |
|
109 /** |
|
110 * Domain syntax for current settings |
|
111 * |
|
112 * @since S60 3.2 |
|
113 * @param none |
|
114 * @return TPrtC16, current domain |
|
115 */ |
|
116 TPtrC16 CurrentDomain(); |
|
117 |
|
118 /** |
|
119 * Close Connection |
|
120 * |
|
121 * @since S60 3.2 |
|
122 * @param none |
|
123 * @return none |
|
124 */ |
|
125 void CloseConnection(); |
|
126 |
|
127 /** |
|
128 * Connection status |
|
129 * |
|
130 * @since S60 3.2 |
|
131 * @param none |
|
132 * @return TBool, connection TRUE/FALSE |
|
133 */ |
|
134 TBool ConnectionStatus(); |
|
135 |
|
136 /** |
|
137 * Connection status |
|
138 * |
|
139 * @since S60 3.2 |
|
140 * @param none |
|
141 * @return TBool, connection TRUE/FALSE |
|
142 */ |
|
143 TBool IsXdmLocalmode(); |
|
144 |
|
145 /** |
|
146 * Check XDM settings valid |
|
147 * |
|
148 * @since S60 5.0 |
|
149 * @param aServiceId, service if owning this session |
|
150 * @return none |
|
151 */ |
|
152 void CheckXDMSettingsL( TUint aServiceId ); |
|
153 |
|
154 /** |
|
155 * Accessor to valid XdmUtils |
|
156 * |
|
157 * @since S60 3.2 |
|
158 * @param none |
|
159 * @return XdmUtils instance |
|
160 */ |
|
161 CPresencePluginXdmUtils* XdmUtilsL(); |
|
162 |
|
163 /** |
|
164 * Returns service id owning this session. |
|
165 * |
|
166 * @since S60 5.0 |
|
167 * @param none |
|
168 * @return TInt, service id |
|
169 */ |
|
170 TInt& ServiceId(); |
|
171 |
|
172 private: |
|
173 |
|
174 /** |
|
175 * Standard C++ constructor |
|
176 * @param aObs, connection observer. |
|
177 */ |
|
178 CPresencePluginSession( |
|
179 MPresencePluginConnectionObs& aObs ); |
|
180 |
|
181 /** |
|
182 * Performs the 2nd phase of construction. |
|
183 * |
|
184 * @param aService, XIMP service info |
|
185 */ |
|
186 void ConstructL( const MXIMPServiceInfo& aService ); |
|
187 |
|
188 public:// from base class MSimpleConnectionObserver |
|
189 |
|
190 /** |
|
191 * Defined in a base class |
|
192 */ |
|
193 void ConnectionStatusL( |
|
194 MSimpleConnection::TSimpleState aState ); |
|
195 |
|
196 /** |
|
197 * Defined in a base class |
|
198 */ |
|
199 void RequestCompleteL( TInt aOpId, TInt aStatus ); |
|
200 |
|
201 protected: // from base class CActive |
|
202 |
|
203 /** |
|
204 * Defined in a base class |
|
205 */ |
|
206 void RunL(); |
|
207 |
|
208 /** |
|
209 * Defined in a base class |
|
210 */ |
|
211 TInt RunError( TInt aError ); |
|
212 |
|
213 /** |
|
214 * Defined in a base class |
|
215 */ |
|
216 void DoCancel(); |
|
217 |
|
218 private: // Data |
|
219 |
|
220 /** |
|
221 * XIMP Plugin connection observer |
|
222 * Own. |
|
223 */ |
|
224 MPresencePluginConnectionObs& iObs; |
|
225 |
|
226 /** |
|
227 * Simple Engine connection. |
|
228 * Own. |
|
229 */ |
|
230 MSimpleConnection* iConnection; |
|
231 |
|
232 /** |
|
233 * Current Simple Engine operation id |
|
234 * Own. |
|
235 */ |
|
236 TInt iOpId; |
|
237 |
|
238 /** |
|
239 * Request type |
|
240 * Own. |
|
241 */ |
|
242 MPresencePluginConnectionObs::TReqType iType; |
|
243 |
|
244 /** |
|
245 * presence settings Id |
|
246 * Own. |
|
247 */ |
|
248 TInt iPresSettingId; |
|
249 |
|
250 /** |
|
251 * XDM Settings id |
|
252 * Own. |
|
253 */ |
|
254 TInt iXdmSetting; |
|
255 |
|
256 /** |
|
257 * Domain syntax for current settings |
|
258 * Own, |
|
259 */ |
|
260 HBufC16* iDomain; |
|
261 |
|
262 /** |
|
263 * Current User ID, User's SIP identity |
|
264 * Own. |
|
265 */ |
|
266 HBufC8* iUserId8; |
|
267 |
|
268 /** |
|
269 * Whether conncted to network |
|
270 * Own. |
|
271 */ |
|
272 TBool iSipConnected; |
|
273 |
|
274 /** |
|
275 * Whether conncted to network |
|
276 * Own. |
|
277 */ |
|
278 TBool iXdmConnected; |
|
279 |
|
280 /** |
|
281 * Xdm local mode |
|
282 * Own. |
|
283 */ |
|
284 TBool iXdmLocalMode; |
|
285 |
|
286 /** |
|
287 * XDM utils |
|
288 * Own. |
|
289 */ |
|
290 CPresencePluginXdmUtils* iXdmUtils; |
|
291 |
|
292 /** |
|
293 * Session operation. |
|
294 */ |
|
295 TPluginSessionOperation iOperation; |
|
296 |
|
297 /** |
|
298 * Service id owning this session. |
|
299 */ |
|
300 TInt iServiceId; |
|
301 |
|
302 SIMPLE_UNIT_TEST( T_CPresencePluginSession ) |
|
303 SIMPLE_UNIT_TEST( T_CPresencePluginConnection ) |
|
304 }; |
|
305 |
|
306 #endif // CPRESENCEPLUGINSESSION_H |
|