47 CSuplSessionRequest::CSuplSessionRequest(CSuplSessionManager& aSessnMgr, CSuplSessionBase* aSuplSessn, MSuplSessionObserver* aObserver): |
47 CSuplSessionRequest::CSuplSessionRequest(CSuplSessionManager& aSessnMgr, CSuplSessionBase* aSuplSessn, MSuplSessionObserver* aObserver): |
48 CActive(EPriorityStandard), |
48 CActive(EPriorityStandard), |
49 iRequestPhase(ESuplReqInactive), |
49 iRequestPhase(ESuplReqInactive), |
50 iObserver(aObserver), |
50 iObserver(aObserver), |
51 iSessnMgr(aSessnMgr), |
51 iSessnMgr(aSessnMgr), |
52 iSuplSessn(aSuplSessn) |
52 iSuplSessn(aSuplSessn), |
|
53 iParamExtendedFallback(NULL) |
53 { |
54 { |
54 DEBUG_TRACE("CSuplSessionRequest::CSuplSessionRequest", __LINE__) |
55 DEBUG_TRACE("CSuplSessionRequest::CSuplSessionRequest", __LINE__) |
55 CActiveScheduler::Add(this); |
56 CActiveScheduler::Add(this); |
56 |
57 |
57 } |
58 } |
58 CSuplSessionRequest::CSuplSessionRequest(CSuplSessionManager& aSessnMgr, CSuplSessionBase* aSuplSessn, MNetInitiatedObserver* aObserver): |
59 CSuplSessionRequest::CSuplSessionRequest(CSuplSessionManager& aSessnMgr, CSuplSessionBase* aSuplSessn, MNetInitiatedObserver* aObserver): |
59 CActive(EPriorityStandard), |
60 CActive(EPriorityStandard), |
60 iRequestPhase(ESuplReqInactive), |
61 iRequestPhase(ESuplReqInactive), |
61 iNetObserver(aObserver), |
62 iNetObserver(aObserver), |
62 iSessnMgr(aSessnMgr), |
63 iSessnMgr(aSessnMgr), |
63 iSuplSessn(aSuplSessn) |
64 iSuplSessn(aSuplSessn), |
|
65 iParamExtendedFallback(NULL) |
64 { |
66 { |
65 DEBUG_TRACE("CSuplSessionRequest::CSuplSessionRequest", __LINE__) |
67 DEBUG_TRACE("CSuplSessionRequest::CSuplSessionRequest", __LINE__) |
66 CActiveScheduler::Add(this); |
68 CActiveScheduler::Add(this); |
67 |
69 |
68 } |
70 } |
113 TBool fallBack = ETrue; |
120 TBool fallBack = ETrue; |
114 TBuf<KMaxHslpAddressLength> aHslpAddress (KNullDesC); |
121 TBuf<KMaxHslpAddressLength> aHslpAddress (KNullDesC); |
115 |
122 |
116 iSessnMgr.RunSuplSessionL(aSuplSessn, iStatus, aHslpAddress, fallBack, aSetCaps, aReqId, aFirstReq); |
123 iSessnMgr.RunSuplSessionL(aSuplSessn, iStatus, aHslpAddress, fallBack, aSetCaps, aReqId, aFirstReq); |
117 SetActive(); |
124 SetActive(); |
|
125 iSessionStarted = ETrue; |
|
126 iParamFallback = ETrue; |
|
127 iParamSuplSessn = aSuplSessn; |
|
128 iParamSetCaps = aSetCaps; |
|
129 iParamReqId = aReqId; |
|
130 iParamFirstReq = aFirstReq; |
|
131 iParamExtendedQopUsed = EFalse; |
118 } |
132 } |
119 // --------------------------------------------------------- |
133 // --------------------------------------------------------- |
120 // CSuplSessionRequest::MakeSuplSessionRequestL |
134 // CSuplSessionRequest::MakeSuplSessionRequestL |
121 // |
135 // |
122 // (other items were commented in a header). |
136 // (other items were commented in a header). |
130 TBool fallBack = ETrue; |
144 TBool fallBack = ETrue; |
131 TBuf<KMaxHslpAddressLength> aHslpAddress ( KNullDesC); |
145 TBuf<KMaxHslpAddressLength> aHslpAddress ( KNullDesC); |
132 |
146 |
133 iSessnMgr.RunSuplSessionL(aSuplSessn, iStatus, aHslpAddress, fallBack, aSetCaps, aReqId, aQop, aFirstReq); |
147 iSessnMgr.RunSuplSessionL(aSuplSessn, iStatus, aHslpAddress, fallBack, aSetCaps, aReqId, aQop, aFirstReq); |
134 SetActive(); |
148 SetActive(); |
|
149 |
|
150 iSessionStarted = ETrue; |
|
151 iParamFallback = ETrue; |
|
152 iParamSuplSessn = aSuplSessn; |
|
153 iParamSetCaps = aSetCaps; |
|
154 iParamReqId = aReqId; |
|
155 iParamFirstReq = aFirstReq; |
|
156 iParamQop = aQop; |
|
157 iParamExtendedQopUsed = ETrue; |
135 } |
158 } |
136 |
159 |
137 void CSuplSessionRequest::MakeSuplSessionRequestL(CSuplSessionBase* aSuplSessn,const TDesC& aHslpAddress, TBool aFallBack, TInt aSetCaps, TInt aReqId, TBool aFirstReq) |
160 void CSuplSessionRequest::MakeSuplSessionRequestL(CSuplSessionBase* aSuplSessn,const TDesC& aHslpAddress, TBool aFallBack, TInt aSetCaps, TInt aReqId, TBool aFirstReq) |
138 { |
161 { |
139 DEBUG_TRACE("CSuplSessionRequest::MakeSuplSessionRequestL", __LINE__) |
162 DEBUG_TRACE("CSuplSessionRequest::MakeSuplSessionRequestL", __LINE__) |
140 iRequestPhase = ESuplSessionRequest; |
163 iRequestPhase = ESuplSessionRequest; |
141 iStatus = KRequestPending; |
164 iStatus = KRequestPending; |
142 iSessnMgr.RunSuplSessionL(aSuplSessn, iStatus, aHslpAddress, aFallBack, aSetCaps, aReqId, aFirstReq); |
165 iSessnMgr.RunSuplSessionL(aSuplSessn, iStatus, aHslpAddress, aFallBack, aSetCaps, aReqId, aFirstReq); |
143 SetActive(); |
166 SetActive(); |
|
167 |
|
168 iSessionStarted = ETrue; |
|
169 iParamFallback = aFallBack; |
|
170 iParamSuplSessn = aSuplSessn; |
|
171 iParamSetCaps = aSetCaps; |
|
172 iParamReqId = aReqId; |
|
173 iParamFirstReq = aFirstReq; |
|
174 if (iParamExtendedFallback) |
|
175 { |
|
176 delete iParamExtendedFallback; |
|
177 iParamExtendedFallback = NULL; |
|
178 } |
|
179 iParamExtendedFallback = HBufC::NewL(aHslpAddress.Length()); |
|
180 *iParamExtendedFallback = aHslpAddress; |
|
181 iParamExtendedQopUsed = EFalse; |
144 } |
182 } |
145 |
183 |
146 void CSuplSessionRequest::MakeSuplSessionRequestL(CSuplSessionBase* aSuplSessn,const TDesC& aHslpAddress, TBool aFallBack, TInt aSetCaps, TInt aReqId, TSuplTerminalQop& aQop, TBool aFirstReq) |
184 void CSuplSessionRequest::MakeSuplSessionRequestL(CSuplSessionBase* aSuplSessn,const TDesC& aHslpAddress, TBool aFallBack, TInt aSetCaps, TInt aReqId, TSuplTerminalQop& aQop, TBool aFirstReq) |
147 { |
185 { |
148 DEBUG_TRACE("CSuplSessionRequest::MakeSuplSessionRequestL", __LINE__) |
186 DEBUG_TRACE("CSuplSessionRequest::MakeSuplSessionRequestL", __LINE__) |
149 iRequestPhase = ESuplSessionRequest; |
187 iRequestPhase = ESuplSessionRequest; |
150 iStatus = KRequestPending; |
188 iStatus = KRequestPending; |
151 iSessnMgr.RunSuplSessionL(aSuplSessn, iStatus, aHslpAddress, aFallBack, aSetCaps, aReqId, aQop, aFirstReq); |
189 iSessnMgr.RunSuplSessionL(aSuplSessn, iStatus, aHslpAddress, aFallBack, aSetCaps, aReqId, aQop, aFirstReq); |
152 SetActive(); |
190 SetActive(); |
|
191 |
|
192 iSessionStarted = ETrue; |
|
193 iParamFallback = aFallBack; |
|
194 iParamSuplSessn = aSuplSessn; |
|
195 iParamSetCaps = aSetCaps; |
|
196 iParamReqId = aReqId; |
|
197 iParamFirstReq = aFirstReq; |
|
198 iParamQop = aQop; |
|
199 iParamExtendedQopUsed = ETrue; |
|
200 if (iParamExtendedFallback) |
|
201 { |
|
202 delete iParamExtendedFallback; |
|
203 iParamExtendedFallback = NULL; |
|
204 } |
|
205 iParamExtendedFallback = HBufC::NewL(aHslpAddress.Length()); |
|
206 *iParamExtendedFallback = aHslpAddress; |
153 } |
207 } |
154 |
208 |
155 // --------------------------------------------------------- |
209 // --------------------------------------------------------- |
156 // CSuplSessionRequest::ForwardMessageRequestL |
210 // CSuplSessionRequest::ForwardMessageRequestL |
157 // |
211 // |
210 // |
265 // |
211 void CSuplSessionRequest::RunL() |
266 void CSuplSessionRequest::RunL() |
212 { |
267 { |
213 DEBUG_TRACE("CSuplSessionRequest::RunL", __LINE__) |
268 DEBUG_TRACE("CSuplSessionRequest::RunL", __LINE__) |
214 TInt err = iStatus.Int(); |
269 TInt err = iStatus.Int(); |
215 switch (iRequestPhase) |
270 |
216 { |
271 iSessionStarted = EFalse; |
217 case ESuplStartTriggerRequest: |
272 if(err != KErrNone && iRequestPhase == ESuplSessionRequest) |
218 case ESuplStopTriggerRequest: |
273 { |
219 { |
274 DEBUG_TRACE("Retrying session", __LINE__) |
220 iRequestPhase = ESuplReqInactive; |
275 iRequestPhase = ESuplWaitingToRetrySession; |
221 iObserver->CompleteTriggerRunSession(err); |
276 iSessnMgr.QueueForReIssueRequestL(*this); |
222 break; |
277 } |
223 } |
278 else |
224 case ESuplTriggerFiredNotifyRequest: |
279 { |
225 { |
280 switch (iRequestPhase) |
226 iRequestPhase = ESuplReqInactive; |
281 { |
227 iObserver->CompleteTriggerFiredNotifyRequest(err); |
282 case ESuplStartTriggerRequest: |
228 break; |
283 case ESuplStopTriggerRequest: |
229 } |
284 { |
230 case ESuplSessionRequest: |
285 iRequestPhase = ESuplReqInactive; |
|
286 iObserver->CompleteTriggerRunSession(err); |
|
287 break; |
|
288 } |
|
289 case ESuplTriggerFiredNotifyRequest: |
|
290 { |
|
291 iRequestPhase = ESuplReqInactive; |
|
292 iObserver->CompleteTriggerFiredNotifyRequest(err); |
|
293 break; |
|
294 } |
|
295 case ESuplSessionRequest: |
|
296 case ESuplRetryingSession: |
|
297 { |
|
298 iRequestPhase = ESuplReqInactive; |
|
299 iObserver->CompleteRunSession(err); |
|
300 break; |
|
301 } |
|
302 case ESuplCancelRunSessionRequest: |
|
303 { |
|
304 iRequestPhase = ESuplReqInactive; |
|
305 iObserver->CompleteRunSession(err); |
|
306 break; |
|
307 } |
|
308 case ESuplForwardMessage: |
|
309 { |
|
310 iRequestPhase = ESuplReqInactive; |
|
311 iNetObserver->CompleteForwardMessageL(iHandle); |
|
312 break; |
|
313 } |
|
314 |
|
315 default : |
|
316 DebugPanic(EPosSuplServerPanicRequestInconsistency); |
|
317 } |
|
318 } |
|
319 } |
|
320 |
|
321 void CSuplSessionRequest::ReIssueRequestL() |
|
322 { |
|
323 DEBUG_TRACE("CSuplSessionRequest::ReIssueRequestL", __LINE__) |
|
324 if(!iParamExtendedQopUsed) |
|
325 { |
|
326 if (!iParamExtendedFallback) |
231 { |
327 { |
232 iRequestPhase = ESuplReqInactive; |
328 MakeSuplSessionRequestL(iParamSuplSessn, iParamSetCaps, iParamReqId, iParamFirstReq); |
233 iObserver->CompleteRunSession(err); |
|
234 break; |
|
235 } |
329 } |
236 case ESuplCancelRunSessionRequest: |
330 else |
237 { |
331 { |
238 iRequestPhase = ESuplReqInactive; |
332 MakeSuplSessionRequestL(iParamSuplSessn, *iParamExtendedFallback, iParamFallback, iParamSetCaps, iParamReqId, iParamFirstReq); |
239 iObserver->CompleteRunSession(err); |
|
240 break; |
|
241 } |
333 } |
242 case ESuplForwardMessage: |
334 } |
243 { |
335 else |
244 iRequestPhase = ESuplReqInactive; |
336 { |
245 iNetObserver->CompleteForwardMessageL(iHandle); |
337 if (!iParamExtendedFallback) |
246 break; |
338 { |
247 } |
339 MakeSuplSessionRequestL(iParamSuplSessn, iParamSetCaps, iParamReqId, iParamQop, iParamFirstReq); |
248 |
340 } |
249 default : |
341 else |
250 DebugPanic(EPosSuplServerPanicRequestInconsistency); |
342 { |
251 } |
343 MakeSuplSessionRequestL(iParamSuplSessn, *iParamExtendedFallback, iParamFallback, iParamSetCaps, iParamReqId, iParamQop, iParamFirstReq); |
252 } |
344 } |
|
345 } |
|
346 DEBUG_TRACE("Retry request succesfull", __LINE__) |
|
347 iRequestPhase = ESuplRetryingSession; |
|
348 } |
253 |
349 |
254 // --------------------------------------------------------- |
350 // --------------------------------------------------------- |
255 // CSuplSessionRequest::RunError |
351 // CSuplSessionRequest::RunError |
256 // |
352 // |
257 // (other items were commented in a header). |
353 // (other items were commented in a header). |