|
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: IMPS Protocol Publishing implementation for Presence Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <badesca.h> |
|
20 |
|
21 #include <ximpbase.h> |
|
22 #include <ximpidentity.h> |
|
23 #include <ximpprotocolconnectionhost.h> |
|
24 |
|
25 #include "cimpsprotocolpresencepublishing.h" |
|
26 #include "ImpsDebugPrint.h" |
|
27 #include "cimpspluginconnectionmanager.h" |
|
28 #include "csubscribeownpresencerequest.h" |
|
29 #include "cpresencenotificationhandler.h" |
|
30 #include "cunsubscribeownpresencerequest.h" |
|
31 #include "cpublishownpresencerequest.h" |
|
32 #include "csubscribepresencewatcherlistrequest.h" |
|
33 #include "cupdateownpresencesubscriptionpifrequest.h" |
|
34 #include "impspluginpanics.h" |
|
35 |
|
36 |
|
37 |
|
38 // ======== MEMBER FUNCTIONS ======== |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CImpsProtocolPresencePublishing::GetInterface() |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 TAny* CImpsProtocolPresencePublishing::GetInterface( |
|
45 TInt32 aInterfaceId, |
|
46 TIfGetOps aOptions ) |
|
47 { |
|
48 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::GetInterface() Start" ) ); |
|
49 |
|
50 |
|
51 if ( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) |
|
52 { |
|
53 MProtocolPresencePublishing* self = this; |
|
54 return self; |
|
55 } |
|
56 |
|
57 if ( aOptions == MXIMPBase::EPanicIfUnknown ) |
|
58 { |
|
59 User::Panic( KImpsProtocolPresencePublishing, KErrExtensionNotSupported ); |
|
60 } |
|
61 |
|
62 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresencePublishing::GetInterface() End" ) ); |
|
63 return NULL; |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CImpsProtocolPresencePublishing::GetInterface() |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 const TAny* CImpsProtocolPresencePublishing::GetInterface( |
|
72 TInt32 aInterfaceId, |
|
73 TIfGetOps aOptions ) const |
|
74 { |
|
75 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresentityGroups::GetInterface() Start" ) ); |
|
76 |
|
77 if ( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) |
|
78 { |
|
79 const MProtocolPresencePublishing* self = this; |
|
80 return self; |
|
81 } |
|
82 |
|
83 if ( aOptions == MXIMPBase::EPanicIfUnknown ) |
|
84 { |
|
85 User::Panic( KImpsProtocolPresencePublishing, KErrExtensionNotSupported ); |
|
86 } |
|
87 |
|
88 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresencePublishing::GetInterface() End" ) ); |
|
89 return NULL; |
|
90 } |
|
91 |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CImpsProtocolPresencePublishing::NewInstanceLC() |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 TInt32 CImpsProtocolPresencePublishing::GetInterfaceId() const |
|
98 { |
|
99 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresencePublishing::GetInterfaceId() Start-End" ) ); |
|
100 return MProtocolPresencePublishing::KInterfaceId; |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // CImpsProtocolPresencePublishing::CImpsProtocolPresencePublishing() |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 CImpsProtocolPresencePublishing::CImpsProtocolPresencePublishing( |
|
108 MImpsPrtPluginConnectionManager& aConnMan ) |
|
109 : iConnMan( aConnMan ) |
|
110 { |
|
111 IMPS_DP( D_IMPS_LIT( "Publishing::CImpsProtocolPresencePublishing() Start" ) ); |
|
112 IMPS_DP( D_IMPS_LIT( "Publishing::CImpsProtocolPresencePublishing() End" ) ); |
|
113 } |
|
114 |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // CImpsProtocolPresencePublishing::ConstructL() |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 void CImpsProtocolPresencePublishing::ConstructL() |
|
121 { |
|
122 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresencePublishing::ConstructL() Start" ) ); |
|
123 |
|
124 //iNotificationHandler = CPresenceNotificationHandler::NewL( iConnMan ); |
|
125 |
|
126 |
|
127 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresencePublishing::ConstructL() End" ) ); |
|
128 } |
|
129 |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CImpsProtocolPresencePublishing::NewL() |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 CImpsProtocolPresencePublishing* CImpsProtocolPresencePublishing::NewL( |
|
136 MImpsPrtPluginConnectionManager& aConnMan ) |
|
137 |
|
138 { |
|
139 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresencePublishing::NewL() Start" ) ); |
|
140 |
|
141 CImpsProtocolPresencePublishing* self = |
|
142 new( ELeave ) CImpsProtocolPresencePublishing( aConnMan ); |
|
143 CleanupStack::PushL( self ); |
|
144 self->ConstructL( ); |
|
145 CleanupStack::Pop( self ); |
|
146 |
|
147 IMPS_DP( D_IMPS_LIT( "CImpsProtocolPresencePublishing::NewL() End" ) ); |
|
148 return self; |
|
149 } |
|
150 |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // CImpsProtocolPresencePublishing::~CImpsProtocolPresencePublishing() |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 CImpsProtocolPresencePublishing::~CImpsProtocolPresencePublishing() |
|
157 { |
|
158 IMPS_DP( D_IMPS_LIT( "Publishing::~CImpsProtocolPresencePublishing() Start" ) ); |
|
159 |
|
160 //delete iNotificationHandler; |
|
161 |
|
162 IMPS_DP( D_IMPS_LIT( "Publishing::~CImpsProtocolPresencePublishing() End" ) ); |
|
163 } |
|
164 |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CImpsProtocolPresencePublishing::DoSubscribeOwnPresenceL() |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 void CImpsProtocolPresencePublishing::DoSubscribeOwnPresenceL( |
|
171 const MPresenceInfoFilter& aPif, |
|
172 TXIMPRequestId aReqId ) |
|
173 { |
|
174 IMPS_DP( D_IMPS_LIT( "Publishing::DoSubscribeOwnPresenceL() Start" ) ); |
|
175 |
|
176 CreateDataHandlerL(); |
|
177 |
|
178 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
179 |
|
180 CSubscribeOwnPresenceRequest* req = |
|
181 CSubscribeOwnPresenceRequest::NewLC( iConnMan, aReqId ); |
|
182 |
|
183 CleanupStack::Check( req ); |
|
184 |
|
185 req->SubscribeOwnPresenceL( aPif ); |
|
186 |
|
187 iConnMan.AddRequest( req ); |
|
188 |
|
189 CleanupStack::Pop( req ); |
|
190 |
|
191 |
|
192 |
|
193 IMPS_DP( D_IMPS_LIT( "Publishing::DoSubscribeOwnPresenceL() End" ) ); |
|
194 } |
|
195 |
|
196 |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // CImpsProtocolPresencePublishing::DoUnsubscribeOwnPresenceL() |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 void CImpsProtocolPresencePublishing::DoUnsubscribeOwnPresenceL( |
|
203 TXIMPRequestId aReqId ) |
|
204 { |
|
205 IMPS_DP( D_IMPS_LIT( "Publishing::DoUnsubscribeOwnPresenceL() Start" ) ); |
|
206 |
|
207 CreateDataHandlerL(); |
|
208 |
|
209 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
210 |
|
211 CUnSubscribeOwnPresenceRequest* req = |
|
212 CUnSubscribeOwnPresenceRequest::NewLC( iConnMan, aReqId ); |
|
213 |
|
214 CleanupStack::Check( req ); |
|
215 |
|
216 req->UnSubscribeOwnPresenceL(); |
|
217 |
|
218 iConnMan.AddRequest( req ); |
|
219 CleanupStack::Pop( req ); |
|
220 |
|
221 |
|
222 IMPS_DP( D_IMPS_LIT( "Publishing::DoUnsubscribeOwnPresenceL() End" ) ); |
|
223 } |
|
224 |
|
225 |
|
226 |
|
227 // --------------------------------------------------------------------------- |
|
228 // CImpsProtocolPresencePublishing::DoUpdateOwnPresenceSubscriptionL() |
|
229 // --------------------------------------------------------------------------- |
|
230 // |
|
231 void CImpsProtocolPresencePublishing::DoUpdateOwnPresenceSubscriptionPifL( |
|
232 const MPresenceInfoFilter& aPif, |
|
233 TXIMPRequestId aReqId ) |
|
234 { |
|
235 IMPS_DP( D_IMPS_LIT( "Publishing::DoUpdateOwnPresenceSubscriptionPifL() Start" ) ); |
|
236 |
|
237 CreateDataHandlerL(); |
|
238 |
|
239 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
240 |
|
241 CUpdateOwnPresenceSubscriptionPifRequest* req = |
|
242 CUpdateOwnPresenceSubscriptionPifRequest::NewLC( iConnMan, aReqId ); |
|
243 |
|
244 CleanupStack::Check( req ); |
|
245 |
|
246 req->UpdateOwnPresenceSubscriptionPifL( aPif ); |
|
247 |
|
248 iConnMan.AddRequest( req ); |
|
249 CleanupStack::Pop( req ); |
|
250 |
|
251 IMPS_DP( D_IMPS_LIT( "Publishing::DoUpdateOwnPresenceSubscriptionPifL() End" ) ); |
|
252 } |
|
253 |
|
254 |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // CImpsProtocolPresencePublishing::DoPublishOwnPresenceL() |
|
258 // --------------------------------------------------------------------------- |
|
259 // |
|
260 void CImpsProtocolPresencePublishing::DoPublishOwnPresenceL( |
|
261 const MPresenceInfo& aPresence, |
|
262 TXIMPRequestId aReqId ) |
|
263 { |
|
264 IMPS_DP( D_IMPS_LIT( "Publishing::DoPublishOwnPresenceL() Start" ) ); |
|
265 |
|
266 CreateDataHandlerL(); |
|
267 |
|
268 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
269 |
|
270 CPublishOwnPresencerequest* req = |
|
271 CPublishOwnPresencerequest::NewLC( iConnMan, aReqId ); |
|
272 |
|
273 CleanupStack::Check( req ); |
|
274 |
|
275 req->PublishOwnPresenceL( aPresence ); |
|
276 |
|
277 iConnMan.AddRequest( req ); |
|
278 CleanupStack::Pop( req ); |
|
279 |
|
280 IMPS_DP( D_IMPS_LIT( "Publishing::DoPublishOwnPresenceL() End" ) ); |
|
281 } |
|
282 |
|
283 // --------------------------------------------------------------------------- |
|
284 // CImpsProtocolPresencePublishing::DoSubscribePresenceWatcherListL() |
|
285 // --------------------------------------------------------------------------- |
|
286 // |
|
287 void CImpsProtocolPresencePublishing::DoSubscribePresenceWatcherListL( |
|
288 TXIMPRequestId aReqId ) |
|
289 { |
|
290 IMPS_DP( D_IMPS_LIT( "Publishing::DoSubscribePresenceWatcherListL() Start" ) ); |
|
291 |
|
292 |
|
293 CreateDataHandlerL(); |
|
294 |
|
295 iConnMan.ReserveSpaceForOneMoreRequestL(); |
|
296 |
|
297 CSubscribePresenceWatcherListRequest* req = |
|
298 CSubscribePresenceWatcherListRequest::NewLC( iConnMan, aReqId ); |
|
299 |
|
300 CleanupStack::Check( req ); |
|
301 |
|
302 req->SubscribePresenceWatcherListL(); |
|
303 |
|
304 iConnMan.AddRequest( req ); |
|
305 CleanupStack::Pop( req ); |
|
306 |
|
307 IMPS_DP( D_IMPS_LIT( "Publishing::DoSubscribePresenceWatcherListL() End" ) ); |
|
308 } |
|
309 |
|
310 |
|
311 // --------------------------------------------------------------------------- |
|
312 // CImpsProtocolPresencePublishing::DoUnsubscribePresenceWatcherListL() |
|
313 // --------------------------------------------------------------------------- |
|
314 // |
|
315 void CImpsProtocolPresencePublishing::DoUnsubscribePresenceWatcherListL( |
|
316 TXIMPRequestId aReqId ) |
|
317 { |
|
318 IMPS_DP( D_IMPS_LIT( "Publishing::DoUnsubscribePresenceWatcherListL() Start" ) ); |
|
319 |
|
320 iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone ); |
|
321 |
|
322 IMPS_DP( D_IMPS_LIT( "Publishing::DoUnsubscribePresenceWatcherListL() End" ) ); |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // CImpsProtocolPresencePublishing::CreateDataHandlerL() |
|
327 // --------------------------------------------------------------------------- |
|
328 // |
|
329 void CImpsProtocolPresencePublishing::CreateDataHandlerL() |
|
330 { |
|
331 IMPS_DP_TXT( "Publishing::CreateDataHandler() Start" ); |
|
332 if ( !( iConnMan.IsDataHandlerCreatedL() ) ) |
|
333 { |
|
334 iConnMan.ManufactureDataHandlerL(); |
|
335 |
|
336 IMPS_DP_TXT( "Publishing::Start Incoming Event Listener() " ); |
|
337 |
|
338 } |
|
339 |
|
340 IMPS_DP_TXT( "Publishing::CreateDataHandler() End" ); |
|
341 } |
|
342 |
|
343 |
|
344 |
|
345 // End of file |
|
346 |