author | Leon Anavi <leon.anavi@opencode.com> |
Sat, 06 Nov 2010 18:38:12 +0200 | |
branch | opencode |
changeset 87 | 434681fe53c8 |
parent 85 | 96b4f933d69a |
child 88 | 5e27cc612ac7 |
permissions | -rw-r--r-- |
24 | 1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// |
|
15 |
||
16 |
||
17 |
||
18 |
// INCLUDE FILES |
|
19 |
#include <etelmm.h> |
|
20 |
#include <mmlist.h> |
|
21 |
#include "cmmussdtsy.h" |
|
22 |
#include <ctsy/serviceapi/cmmsmsutility.h> |
|
23 |
#include "MmTsy_timeoutdefs.h" |
|
24 |
#include "MmTsy_numberOfSlots.h" |
|
25 |
#include "cmmtsyreqhandlestore.h" |
|
26 |
#include "CMmCommonStaticUtility.h" |
|
27 |
#include "cmmmessagemanagerbase.h" |
|
28 |
#include <ctsy/pluginapi/cmmdatapackage.h> |
|
29 |
#include <ctsy/serviceapi/gsmerror.h> |
|
30 |
||
31 |
// ======== MEMBER FUNCTIONS ======== |
|
32 |
||
33 |
CMmUssdTsy::CMmUssdTsy() |
|
34 |
{ |
|
35 |
} |
|
36 |
||
37 |
void CMmUssdTsy::ConstructL( |
|
38 |
CMmPhoneTsy* aMmPhoneTsy ) |
|
39 |
{ |
|
40 |
TFLOGSTRING("TSY: CMmUssdTsy::ConstructL\n" ); |
|
41 |
iMmPhone = aMmPhoneTsy; |
|
42 |
||
43 |
// register . |
|
44 |
iMmPhone->MessageManager()->RegisterTsyObject( |
|
45 |
CMmMessageManagerBase::EUssdMessagingTsy, this ); |
|
46 |
||
47 |
#ifdef REQHANDLE_TIMER |
|
48 |
// create req handle store |
|
49 |
iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this, iMmPhone, |
|
50 |
EMultimodeUssdMaxNumOfRequests, iUssdReqHandles); |
|
51 |
#else |
|
52 |
// create req handle store |
|
53 |
iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( |
|
54 |
EMultimodeUssdMaxNumOfRequests, iUssdReqHandles); |
|
55 |
||
56 |
#endif // REQHANDLE_TIMER |
|
57 |
||
58 |
// Reset all CMmUssdTsy variables |
|
59 |
ResetVariables(); |
|
60 |
||
61 |
// Initialize boolean flag |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
62 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown; |
24 | 63 |
} |
64 |
||
65 |
CMmUssdTsy* CMmUssdTsy::NewL( |
|
66 |
CMmPhoneTsy* aMmPhone ) |
|
67 |
{ |
|
68 |
CMmUssdTsy* aMmUssdTsy = new( ELeave ) CMmUssdTsy(); |
|
69 |
CleanupClosePushL( *aMmUssdTsy ); |
|
70 |
aMmUssdTsy->ConstructL( aMmPhone ); |
|
71 |
aMmUssdTsy->iMmPhone = aMmPhone; |
|
72 |
CleanupStack::Pop(); |
|
73 |
||
74 |
return aMmUssdTsy; |
|
75 |
} |
|
76 |
||
77 |
CMmUssdTsy::~CMmUssdTsy() |
|
78 |
{ |
|
79 |
TFLOGSTRING("TSY: CMmUssdTsy::~CMmUssdTsy" ); |
|
80 |
// unregister. |
|
81 |
if ( iMmPhone ) |
|
82 |
{ |
|
83 |
// deregister tsy object from message manager |
|
84 |
iMmPhone->MessageManager()->DeregisterTsyObject(this); |
|
85 |
} |
|
86 |
||
87 |
// delete req handle store |
|
88 |
delete iTsyReqHandleStore; |
|
89 |
iTsyReqHandleStore = NULL; |
|
90 |
||
91 |
// Null other pointers |
|
92 |
iReturnResultPtr = NULL; |
|
93 |
iReceiveUssdMessagePtr = NULL; |
|
94 |
iReceiveUssdMessageAttributesPtr = NULL; |
|
95 |
iMmPhone = NULL; |
|
96 |
} |
|
97 |
||
98 |
// --------------------------------------------------------------------------- |
|
99 |
// CMmUssdTsy::Init |
|
100 |
// Initialisation method that is called from ETel Server. |
|
101 |
// (other items were commented in a header). |
|
102 |
// --------------------------------------------------------------------------- |
|
103 |
// |
|
104 |
void CMmUssdTsy::Init() |
|
105 |
{ |
|
106 |
} |
|
107 |
||
108 |
// --------------------------------------------------------------------------- |
|
109 |
// CMmUssdTsy::ExtFunc |
|
110 |
// ExtFunc is called by the server when it has an "extended",i.e. |
|
111 |
// non-core ETel request for the TSY. To process a request handle, request type |
|
112 |
// and request data are passed to the TSY. |
|
113 |
// (other items were commented in a header). |
|
114 |
// --------------------------------------------------------------------------- |
|
115 |
// |
|
116 |
TInt CMmUssdTsy::ExtFunc( |
|
117 |
const TTsyReqHandle aTsyReqHandle, |
|
118 |
const TInt aIpc, |
|
119 |
const TDataPackage& aPackage ) |
|
120 |
{ |
|
121 |
TInt ret = KErrNone; |
|
122 |
TInt trapError = KErrNone; |
|
123 |
||
124 |
// before processing further the request, check if offline mode status |
|
125 |
// is enabled and if the given request can be perfomed in that case. |
|
126 |
if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() && |
|
127 |
( !IsRequestPossibleInOffline( aIpc ) ) ) |
|
128 |
{ |
|
129 |
TFLOGSTRING2 ("TSY: Offline mode ON, request is not allowed: %d", aIpc ); |
|
130 |
ret = CMmCommonStaticUtility::EpocErrorCode( KErrGeneral, |
|
131 |
KErrGsmOfflineOpNotAllowed ); |
|
132 |
||
133 |
// Complete the request with appropiate error |
|
134 |
ReqCompleted ( aTsyReqHandle, ret ); |
|
135 |
} |
|
136 |
else |
|
137 |
{ |
|
138 |
// Original code continues here. |
|
139 |
TRAP( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ); ); |
|
140 |
TInt reqMode = 0; |
|
141 |
TRAP_IGNORE( reqMode = ReqModeL(aIpc) ); |
|
142 |
if ( trapError != KErrNone ) |
|
143 |
{ |
|
144 |
// Object cannot be created. |
|
145 |
ReqCompleted( aTsyReqHandle, trapError ); |
|
146 |
} |
|
147 |
else if ( ret != KErrNone && reqMode&KReqModeMultipleCompletionWithInterestLevel ) |
|
148 |
{ |
|
149 |
// As the error has occured in the synchronous part of the client call |
|
150 |
// we want the error to go directly back to the client which made the |
|
151 |
// call. We don't want to be offering the error to all clients as part |
|
152 |
// of our deliver mechanism. |
|
153 |
return ret; |
|
154 |
} |
|
155 |
else if ( ret != KErrNone ) |
|
156 |
{ |
|
157 |
ReqCompleted( aTsyReqHandle, ret ); |
|
158 |
} |
|
159 |
} |
|
160 |
||
161 |
return KErrNone; |
|
162 |
} |
|
163 |
||
164 |
// --------------------------------------------------------------------------- |
|
165 |
// CMmUssdTsy::DoExtFuncL |
|
166 |
// ExtFunc is called by the server when it has an "extended",i.e. |
|
167 |
// non-core ETel request for the TSY. To process a request handle,request type |
|
168 |
// and request data are passed to the TSY. |
|
169 |
// (other items were commented in a header). |
|
170 |
// --------------------------------------------------------------------------- |
|
171 |
// |
|
172 |
TInt CMmUssdTsy::DoExtFuncL( |
|
173 |
const TTsyReqHandle aTsyReqHandle, |
|
174 |
const TInt aIpc, |
|
175 |
const TDataPackage& aPackage ) |
|
176 |
{ |
|
177 |
TInt ret(KErrNone); |
|
178 |
||
179 |
switch ( aIpc ) |
|
180 |
{ |
|
181 |
// Ussd Messaging requests |
|
182 |
case EMobileUssdMessagingGetCaps: |
|
183 |
ret = GetCaps( aTsyReqHandle, aPackage.Des1n() ); |
|
184 |
break; |
|
185 |
case EMobileUssdMessagingReceiveMessage: |
|
186 |
ret = ReceiveMessage( aTsyReqHandle, aPackage.Des1n(), |
|
187 |
aPackage.Des2n() ); |
|
188 |
break; |
|
189 |
case EMobileUssdMessagingSendMessage: |
|
190 |
{ |
|
191 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckNotUsed; |
|
77 | 192 |
iSendToDefaultHandler = EFalse; |
24 | 193 |
ret = SendMessageL( |
194 |
aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n() ); |
|
195 |
} |
|
196 |
break; |
|
77 | 197 |
case EMobileUssdMessagingSendMessageDefaultHandler: |
85 | 198 |
{ |
77 | 199 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckNotUsed; |
200 |
iSendToDefaultHandler = ETrue; |
|
201 |
ret = SendMessageL( |
|
202 |
aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n() ); |
|
203 |
} |
|
204 |
break; |
|
24 | 205 |
case EMobileUssdMessagingSendMessageNoFdnCheck: |
206 |
{ |
|
207 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUsed; |
|
77 | 208 |
iSendToDefaultHandler = EFalse; |
24 | 209 |
ret = SendMessageL( |
210 |
aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n() ); |
|
211 |
} |
|
212 |
break; |
|
213 |
case EMobileUssdMessagingSendRelease: |
|
214 |
ret = SendReleaseL( aTsyReqHandle, aPackage.Des1n() ); |
|
215 |
break; |
|
216 |
case EMobileUssdMessagingNotifyNetworkRelease: |
|
217 |
switch( aPackage.Type() ) |
|
218 |
{ |
|
219 |
// Switch between alternative implementations of NotifyNetworkRelease |
|
220 |
case TDataPackage::EPackage1n: |
|
221 |
ret = NotifyNetworkRelease( aTsyReqHandle, aPackage.Des1n(), NULL ); |
|
222 |
break; |
|
223 |
case TDataPackage::EPackage1n2n: |
|
224 |
ret = NotifyNetworkRelease( aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n() ); |
|
225 |
break; |
|
226 |
default: |
|
227 |
ret = KErrNotSupported; |
|
228 |
break; |
|
229 |
} |
|
230 |
||
231 |
break; |
|
232 |
default: |
|
233 |
ret = KErrNotSupported; |
|
234 |
break; |
|
235 |
} |
|
236 |
||
237 |
return ret; |
|
238 |
} |
|
239 |
||
240 |
// --------------------------------------------------------------------------- |
|
241 |
// CMmUssdTsy::CancelService |
|
242 |
// CancelService is called by the server when it is "cleaning-up" |
|
243 |
// any still outstanding asynchronous requests before closing a client's |
|
244 |
// sub-session. This will happen if a client closes its R-class handle without |
|
245 |
// cancelling outstanding asynchronous requests |
|
246 |
// (other items were commented in a header). |
|
247 |
// --------------------------------------------------------------------------- |
|
248 |
// |
|
249 |
TInt CMmUssdTsy::CancelService( |
|
250 |
const TInt aIpc, |
|
251 |
const TTsyReqHandle aTsyReqHandle ) |
|
252 |
{ |
|
253 |
TInt ret( KErrNone ); |
|
254 |
||
255 |
switch ( aIpc ) |
|
256 |
{ |
|
257 |
case EMobileUssdMessagingReceiveMessage: |
|
258 |
ReceiveMessageCancel( aTsyReqHandle ); |
|
259 |
ret = KErrNone; |
|
260 |
break; |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
261 |
case EMobileUssdMessagingSendMessageDefaultHandler: |
24 | 262 |
case EMobileUssdMessagingSendMessage: |
263 |
SendMessageCancel( aTsyReqHandle ); |
|
264 |
ret = KErrNone; |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
265 |
break; |
24 | 266 |
case EMobileUssdMessagingSendMessageNoFdnCheck: |
267 |
SendMessageNoFdnCheckCancel( aTsyReqHandle ); |
|
268 |
ret = KErrNone; |
|
269 |
break; |
|
270 |
case EMobileUssdMessagingSendRelease: |
|
271 |
SendReleaseCancel(); |
|
272 |
ret = KErrNone; |
|
273 |
break; |
|
274 |
case EMobileUssdMessagingNotifyNetworkRelease: |
|
275 |
NotifyNetworkReleaseCancel(); |
|
276 |
ret = KErrNone; |
|
277 |
break; |
|
278 |
default: |
|
279 |
ret = KErrNotSupported; |
|
280 |
break; |
|
281 |
} |
|
282 |
||
283 |
return ret; |
|
284 |
} |
|
285 |
||
286 |
// --------------------------------------------------------------------------- |
|
287 |
// CMmUssdTsy::ReqModeL |
|
288 |
// When the ETel server receives an "extension" client request, |
|
289 |
// it will pass the IPC request number down to the TSY in order to find out |
|
290 |
// what type of request it is. The virtual method that gets called is ReqModeL |
|
291 |
// (other items were commented in a header). |
|
292 |
// --------------------------------------------------------------------------- |
|
293 |
// |
|
294 |
CTelObject::TReqMode CMmUssdTsy::ReqModeL( |
|
295 |
const TInt aIpc ) |
|
296 |
{ |
|
297 |
CTelObject::TReqMode ret ( 0 ); |
|
298 |
||
299 |
switch ( aIpc ) |
|
300 |
{ |
|
301 |
// Non-Flow Controlled Services |
|
302 |
case EMobileUssdMessagingGetCaps: |
|
303 |
break; |
|
304 |
// Flow Controlled Services |
|
305 |
||
306 |
// Immediate Server Repost |
|
307 |
case EMobileUssdMessagingReceiveMessage: |
|
308 |
ret = KReqModeRePostImmediately | |
|
309 |
KReqModeMultipleCompletionWithInterestLevel; |
|
310 |
break; |
|
311 |
// Services handled by TSY |
|
77 | 312 |
case EMobileUssdMessagingSendMessageDefaultHandler: |
313 |
ret = KReqModeSessionBased | KReqModeTransferToDefaultHandler; |
|
314 |
break; |
|
315 |
case EMobileUssdMessagingSendMessage: |
|
24 | 316 |
case EMobileUssdMessagingSendMessageNoFdnCheck: |
317 |
case EMobileUssdMessagingSendRelease: |
|
77 | 318 |
ret = KReqModeSessionBased; |
24 | 319 |
break; |
320 |
case EMobileUssdMessagingNotifyNetworkRelease: |
|
321 |
// Multiple completion because the clients don't have to own the |
|
322 |
// session in order to be notified that the session has been |
|
323 |
// released. |
|
77 | 324 |
ret = KReqModeRePostImmediately | KReqModeMultipleCompletionEnabled; |
24 | 325 |
break; |
326 |
default: |
|
327 |
User::Leave( KErrNotSupported ); |
|
328 |
break; |
|
329 |
} |
|
330 |
||
331 |
return ret; |
|
332 |
} |
|
333 |
||
334 |
// --------------------------------------------------------------------------- |
|
335 |
// CMmUssdTsy::OpenNewObjectL |
|
336 |
// Opens new object and names it. Not supported. |
|
337 |
// (other items were commented in a header). |
|
338 |
// --------------------------------------------------------------------------- |
|
339 |
// |
|
340 |
CTelObject* CMmUssdTsy::OpenNewObjectL( |
|
341 |
TDes& /*aName*/ ) |
|
342 |
{ |
|
343 |
User::Leave( KErrNotSupported ); |
|
344 |
//lint -e{527} "unreachable code" |
|
345 |
||
346 |
return NULL; |
|
347 |
} |
|
348 |
||
349 |
// --------------------------------------------------------------------------- |
|
350 |
// CMmUssdTsy::OpenNewObjectByNameL |
|
351 |
// Open extendible sub-sessions. Not Supported |
|
352 |
// (other items were commented in a header). |
|
353 |
// --------------------------------------------------------------------------- |
|
354 |
// |
|
355 |
CTelObject* CMmUssdTsy::OpenNewObjectByNameL( |
|
356 |
const TDesC& /*aName*/ ) |
|
357 |
{ |
|
358 |
User::Leave( KErrNotSupported ); |
|
359 |
//lint -e{527} "unreachable code" |
|
360 |
||
361 |
return NULL; |
|
362 |
} |
|
363 |
||
364 |
// --------------------------------------------------------------------------- |
|
365 |
// CMmUssdTsy::RegisterNotification |
|
366 |
// RegisterNotification is called when the server recognises that |
|
367 |
// this notification is being posted for the first time on this sub-session |
|
368 |
// object. It enables the TSY to "turn on" any regular notification messages |
|
369 |
// that it may receive from DOS. |
|
370 |
// (other items were commented in a header). |
|
371 |
// --------------------------------------------------------------------------- |
|
372 |
// |
|
373 |
TInt CMmUssdTsy::RegisterNotification( |
|
374 |
const TInt aIpc ) // Notification IPC number |
|
375 |
{ |
|
376 |
TFLOGSTRING2( "TSY: CMmUssdTsy::RegisterNotification. IPC: %d", aIpc ); |
|
377 |
||
378 |
TInt ret( KErrNone ); |
|
379 |
||
380 |
switch ( aIpc ) |
|
381 |
{ |
|
382 |
case EMobileUssdMessagingNotifyNetworkRelease: |
|
383 |
case EMobileUssdMessagingReceiveMessage: |
|
384 |
break; |
|
385 |
default: |
|
386 |
// Not supported |
|
387 |
ret = KErrNotSupported; |
|
388 |
break; |
|
389 |
} |
|
390 |
||
391 |
return ret; |
|
392 |
} |
|
393 |
||
394 |
// --------------------------------------------------------------------------- |
|
395 |
// CMmUssdTsy::DeregisterNotification |
|
396 |
// DeregisterNotification is called when the server recognises |
|
397 |
// that this notification will not be posted again because the last client |
|
398 |
// to have a handle on this sub-session object has just closed the handle. |
|
399 |
// It enables the TSY to "turn off" any regular notification messages that it |
|
400 |
// may receive from DOS. |
|
401 |
// (other items were commented in a header). |
|
402 |
// --------------------------------------------------------------------------- |
|
403 |
// |
|
404 |
TInt CMmUssdTsy::DeregisterNotification( |
|
405 |
const TInt aIpc ) // Notification IPC number |
|
406 |
{ |
|
407 |
TFLOGSTRING2( "TSY: CMmUssdTsy::DeregisterNotification. IPC: %d", aIpc ); |
|
408 |
||
409 |
TInt ret( KErrNone ); |
|
410 |
||
411 |
switch ( aIpc ) |
|
412 |
{ |
|
413 |
case EMobileUssdMessagingNotifyNetworkRelease: |
|
414 |
case EMobileUssdMessagingReceiveMessage: |
|
415 |
break; |
|
416 |
default: |
|
417 |
// Not supported |
|
418 |
ret = KErrNotSupported; |
|
419 |
break; |
|
420 |
} |
|
421 |
||
422 |
return ret; |
|
423 |
} |
|
424 |
||
425 |
// --------------------------------------------------------------------------- |
|
426 |
// CMmUssdTsy::NumberOfSlotsL |
|
427 |
// NumberOfSlotsL is called by the server when it is registering |
|
428 |
// a new NOTIFICATION. It enables the TSY to tell the server how many buffer |
|
429 |
// slots to allocate for "repost immediately" notifications that may trigger |
|
430 |
// before clients collect them. |
|
431 |
// (other items were commented in a header). |
|
432 |
// --------------------------------------------------------------------------- |
|
433 |
// |
|
434 |
TInt CMmUssdTsy::NumberOfSlotsL( |
|
435 |
const TInt aIpc ) |
|
436 |
{ |
|
437 |
TInt numberOfSlots = 1; |
|
438 |
switch ( aIpc ) |
|
439 |
{ |
|
440 |
case EMobileUssdMessagingReceiveMessage: |
|
441 |
numberOfSlots = KMmUssdMessagingReceiveMessageSlots; |
|
442 |
break; |
|
443 |
case EMobileUssdMessagingNotifyNetworkRelease: |
|
444 |
numberOfSlots = KMmUssdMessagingNotifyNetworkReleaseSlots; |
|
445 |
break; |
|
446 |
default: |
|
447 |
User::Leave( KErrNotSupported ); |
|
448 |
break; |
|
449 |
} |
|
450 |
||
451 |
return numberOfSlots; |
|
452 |
} |
|
453 |
||
454 |
// --------------------------------------------------------------------------- |
|
455 |
// CMmUssdTsy::GetCaps |
|
456 |
// This method returns a class that reflects the Ussd messaging |
|
457 |
// capabilities of the phone. This feature can be completed without sending |
|
458 |
// message, because TSY knows phones Ussd capabilities |
|
459 |
// (other items were commented in a header). |
|
460 |
// --------------------------------------------------------------------------- |
|
461 |
// |
|
462 |
TInt CMmUssdTsy::GetCaps( |
|
463 |
const TTsyReqHandle aTsyReqHandle, |
|
464 |
TDes8* aCaps ) |
|
465 |
{ |
|
466 |
TInt ret = KErrNone; |
|
467 |
if( aCaps->MaxLength() >= sizeof(RMobileUssdMessaging::TMobileUssdCapsV1Pckg) ) |
|
468 |
{ |
|
469 |
RMobileUssdMessaging::TMobileUssdCapsV1Pckg* ussdCapsPckg = |
|
470 |
reinterpret_cast<RMobileUssdMessaging::TMobileUssdCapsV1Pckg*> |
|
471 |
( aCaps ); |
|
472 |
||
473 |
RMobileUssdMessaging::TMobileUssdCapsV1& ussdCaps = ( *ussdCapsPckg )(); |
|
474 |
||
475 |
// TSY knows what capabilities it has. |
|
476 |
// Capabilities depend on the TSY implementation. |
|
477 |
ussdCaps.iUssdTypes = KUssdTypeCaps; |
|
478 |
||
479 |
ussdCaps.iUssdFormat = RMobileUssdMessaging::KCapsPackedString; |
|
480 |
} |
|
481 |
else |
|
482 |
{ |
|
483 |
ret = KErrArgument; |
|
484 |
} |
|
485 |
||
486 |
ReqCompleted( aTsyReqHandle, ret ); |
|
487 |
return KErrNone; |
|
488 |
} |
|
489 |
||
490 |
// --------------------------------------------------------------------------- |
|
491 |
// CMmUssdTsy::ReceiveMessage |
|
492 |
// This method activates receiving of Ussd messages. |
|
493 |
// (other items were commented in a header). |
|
494 |
// --------------------------------------------------------------------------- |
|
495 |
// |
|
496 |
TInt CMmUssdTsy::ReceiveMessage( |
|
497 |
const TTsyReqHandle aTsyReqHandle, |
|
498 |
TDes8* aData, |
|
499 |
TDes8* aAttributes ) |
|
500 |
{ |
|
501 |
if(sizeof(RMobileUssdMessaging::TMobileUssdAttributesV1) > aAttributes->MaxLength()) |
|
502 |
{ |
|
503 |
return KErrArgument; |
|
504 |
} |
|
505 |
||
506 |
if (RMobileUssdMessaging::TGsmUssdMessageData().MaxLength() > aData->MaxLength()) |
|
507 |
{ |
|
508 |
return KErrArgument; |
|
509 |
} |
|
510 |
||
511 |
TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1>* ussdAttributesPckg = |
|
512 |
reinterpret_cast<TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1>*> |
|
513 |
( aAttributes ); |
|
514 |
||
515 |
RMobileUssdMessaging::TMobileUssdAttributesV1& ussdAttributes = |
|
516 |
( *ussdAttributesPckg )(); |
|
517 |
||
518 |
// Save request handle |
|
519 |
iTsyReqHandleStore->SetTsyReqHandle( |
|
520 |
EMultimodeUssdReceiveMessage, aTsyReqHandle ); |
|
521 |
iReceiveUssdMessagePtr = aData; |
|
522 |
iReceiveUssdMessageAttributesPtr = &ussdAttributes; |
|
523 |
||
524 |
return KErrNone; |
|
525 |
} |
|
526 |
||
527 |
// --------------------------------------------------------------------------- |
|
528 |
// CMmUssdTsy::ReceiveMessageCancel |
|
529 |
// This method cancels reception of USSD messages |
|
530 |
// (other items were commented in a header). |
|
531 |
// --------------------------------------------------------------------------- |
|
532 |
// |
|
533 |
void CMmUssdTsy::ReceiveMessageCancel( |
|
534 |
const TTsyReqHandle aTsyReqHandle ) |
|
535 |
{ |
|
536 |
iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeUssdReceiveMessage ); |
|
537 |
||
538 |
ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
539 |
} |
|
540 |
||
541 |
// --------------------------------------------------------------------------- |
|
542 |
// CMmUssdTsy::CompleteReceiveMessage |
|
543 |
// This method completes reception of USSD messages request |
|
544 |
// (other items were commented in a header). |
|
545 |
// --------------------------------------------------------------------------- |
|
546 |
// |
|
547 |
void CMmUssdTsy::CompleteReceiveMessage( |
|
548 |
TInt aError, |
|
549 |
CMmDataPackage* aDataPackage ) |
|
550 |
{ |
|
551 |
TFLOGSTRING("TSY: CMmUssdTsy::CompleteReceiveMessage.\n" ); |
|
552 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( |
|
553 |
EMultimodeUssdReceiveMessage ); |
|
77 | 554 |
|
24 | 555 |
if ( ( EMultimodeUssdReqHandleUnknown != reqHandle ) ) |
556 |
{ |
|
557 |
// reset req handle. Returns the deleted req handle |
|
558 |
reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
559 |
EMultimodeUssdReceiveMessage ); |
|
560 |
||
561 |
if ( KErrNone == aError ) |
|
562 |
{ |
|
563 |
TDes8* unpackedReceiveUssdMessagePtr = NULL; |
|
564 |
RMobileUssdMessaging::TMobileUssdAttributesV1* unpackedReceiveUssdMessageAttributesPtr = NULL; |
|
77 | 565 |
aDataPackage->UnPackData (&unpackedReceiveUssdMessagePtr, &unpackedReceiveUssdMessageAttributesPtr); |
85 | 566 |
|
24 | 567 |
if(iReceiveUssdMessagePtr->MaxLength() >= unpackedReceiveUssdMessagePtr->Length()) |
568 |
{ |
|
569 |
*iReceiveUssdMessagePtr = *unpackedReceiveUssdMessagePtr; |
|
570 |
*iReceiveUssdMessageAttributesPtr = *unpackedReceiveUssdMessageAttributesPtr; |
|
571 |
} |
|
572 |
else |
|
573 |
{ |
|
574 |
aError = KErrArgument; |
|
85 | 575 |
} |
24 | 576 |
} |
577 |
ReqCompleted( reqHandle, aError ); |
|
578 |
} |
|
579 |
} |
|
580 |
||
581 |
// --------------------------------------------------------------------------- |
|
582 |
// CMmUssdTsy::SendMessageL |
|
583 |
// Routes send message to message handler. |
|
584 |
// (other items were commented in a header). |
|
585 |
// --------------------------------------------------------------------------- |
|
586 |
// |
|
587 |
TInt CMmUssdTsy::SendMessageL( |
|
588 |
const TTsyReqHandle aTsyReqHandle, |
|
589 |
TDes8* aData, |
|
590 |
TDes8* aAttributes ) |
|
591 |
{ |
|
592 |
TFLOGSTRING2("TSY: CMmUssdTsy::SendMessage - Data length: %d", aData->Length() ); |
|
593 |
TFLOGSTRING2("TSY: CMmUssdTsy::SendMessageL: iUssdNoFdnCheckFlag: %d", iUssdNoFdnCheckFlag); |
|
594 |
TInt ret = KErrNone; |
|
595 |
||
77 | 596 |
|
24 | 597 |
if ( iSsTransactionOngoing ) |
598 |
{ |
|
599 |
ret = KErrServerBusy; |
|
600 |
} |
|
601 |
else |
|
602 |
{ |
|
603 |
// Create package |
|
604 |
CMmDataPackage package; |
|
605 |
||
606 |
// Pack call parameters and mobile call info |
|
607 |
package.PackData( aData, &aAttributes ); |
|
608 |
||
609 |
// Check if NoFdnCheck is used or not |
|
610 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckUsed ) |
|
611 |
{ |
|
612 |
// Send request to the Domestic OS layer. |
|
613 |
ret = iMmPhone->MessageManager()->HandleRequestL( |
|
614 |
EMobileUssdMessagingSendMessageNoFdnCheck, &package ); |
|
615 |
} |
|
77 | 616 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckNotUsed ) |
24 | 617 |
{ |
618 |
// Send request to the Domestic OS layer. |
|
77 | 619 |
if(EFalse == iSendToDefaultHandler) |
620 |
{ |
|
621 |
ret = iMmPhone->MessageManager()->HandleRequestL( |
|
622 |
EMobileUssdMessagingSendMessage, &package ); |
|
623 |
} |
|
624 |
else //default handler |
|
625 |
{ |
|
85 | 626 |
ret = iMmPhone->MessageManager()->HandleRequestL( |
77 | 627 |
EMobileUssdMessagingSendMessageDefaultHandler, &package ); |
628 |
} |
|
24 | 629 |
} |
77 | 630 |
iSsTransactionOngoing = ETrue; |
24 | 631 |
} |
632 |
||
633 |
if ( KErrNone != ret ) |
|
634 |
{ |
|
635 |
ReqCompleted( aTsyReqHandle, ret ); |
|
636 |
iSsTransactionOngoing = EFalse; |
|
637 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown; |
|
638 |
} |
|
639 |
else |
|
640 |
{ |
|
641 |
if (!IsSessionInProgress()) |
|
642 |
{ |
|
643 |
// If a session isn't in progress then reserve the session to |
|
644 |
// prevent any other attempts at opening a dialogue. If the send |
|
645 |
// succeeds then the session is opened. If the send fails or the |
|
646 |
// user cancels the send then we cancel it. |
|
647 |
// If the session is already in progress then no reservation is |
|
648 |
// necessary and the success or failure of this send does not |
|
649 |
// affect the session or dialogue state. |
|
650 |
(void)ReserveSession(); |
|
651 |
} |
|
77 | 652 |
|
24 | 653 |
#ifdef REQHANDLE_TIMER |
654 |
// Check if NoFdnCheck is used or not |
|
655 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckUsed ) |
|
656 |
{ |
|
657 |
// Set timer for the request |
|
658 |
SetTypeOfResponse( EMultimodeUssdSendMessageNoFdnCheck, |
|
659 |
aTsyReqHandle ); |
|
660 |
} |
|
77 | 661 |
if ( (iUssdNoFdnCheckFlag == EUssdNoFdnCheckNotUsed) && |
662 |
(EFalse == iSendToDefaultHandler)) |
|
24 | 663 |
{ |
664 |
// Set timer for the request |
|
665 |
SetTypeOfResponse( EMultimodeUssdSendMessage, |
|
666 |
aTsyReqHandle ); |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
667 |
} |
77 | 668 |
if ( (iUssdNoFdnCheckFlag == EUssdNoFdnCheckNotUsed) && |
669 |
(EFalse != iSendToDefaultHandler)) //send to default hadnler |
|
670 |
{ |
|
671 |
// Set timer for the request |
|
672 |
SetTypeOfResponse( EMultimodeUssdSendMessageDefaultHandler, |
|
673 |
aTsyReqHandle ); |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
674 |
} |
24 | 675 |
#else |
676 |
// Check if NoFdnCheck is used or not |
|
677 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckUsed ) |
|
678 |
{ |
|
679 |
// Save SendMessageNoFdnCheck request handle, set timer |
|
680 |
iTsyReqHandleStore->SetTsyReqHandle( |
|
681 |
EMultimodeUssdSendMessageNoFdnCheck, aTsyReqHandle ); |
|
682 |
} |
|
683 |
||
684 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckNotUsed ) |
|
685 |
{ |
|
686 |
// Save SendMessage request handle, set timer |
|
687 |
iTsyReqHandleStore->SetTsyReqHandle( |
|
688 |
EMultimodeUssdSendMessage, aTsyReqHandle ); |
|
689 |
} |
|
690 |
#endif // REQHANDLE_TIMER |
|
691 |
} |
|
692 |
||
693 |
return KErrNone; |
|
694 |
} |
|
695 |
||
696 |
// --------------------------------------------------------------------------- |
|
697 |
// CmmUssdTsy::SendMessageCancel |
|
698 |
// Cancels cancelling of USSD session. |
|
699 |
// (other items were commented in a header). |
|
700 |
// --------------------------------------------------------------------------- |
|
701 |
// |
|
702 |
TInt CMmUssdTsy::SendMessageCancel( |
|
703 |
const TTsyReqHandle aTsyReqHandle ) |
|
704 |
{ |
|
705 |
// reset the req handle |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
706 |
if(EFalse == iSendToDefaultHandler) |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
707 |
{ |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
708 |
iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeUssdSendMessage ); |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
709 |
} |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
710 |
else // default handler |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
711 |
{ |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
712 |
iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeUssdSendMessageDefaultHandler ); |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
713 |
} |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
714 |
|
77 | 715 |
|
716 |
CancelReserveSession(); |
|
717 |
||
718 |
// complete with cancel |
|
719 |
ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
720 |
iSsTransactionOngoing = EFalse; |
|
721 |
||
722 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown; |
|
723 |
||
724 |
return KErrNone; |
|
725 |
} |
|
726 |
||
727 |
||
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
728 |
|
24 | 729 |
// --------------------------------------------------------------------------- |
730 |
// CMmUssdTsy::CompleteSendMessage |
|
731 |
// Complete SendMessage |
|
732 |
// (other items were commented in a header). |
|
733 |
// --------------------------------------------------------------------------- |
|
734 |
// |
|
735 |
void CMmUssdTsy::CompleteSendMessage( |
|
736 |
TInt aError ) |
|
737 |
{ |
|
738 |
TFLOGSTRING("TSY: CMmUssdTsy::CompleteSendMessage.\n" ); |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
739 |
TTsyReqHandle reqHandle; |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
740 |
|
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
741 |
if(EFalse == iSendToDefaultHandler) |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
742 |
{ |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
743 |
reqHandle = iTsyReqHandleStore->GetTsyReqHandle( |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
744 |
EMultimodeUssdSendMessage ); |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
745 |
} |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
746 |
else //default hanlder |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
747 |
{ |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
748 |
reqHandle = iTsyReqHandleStore->GetTsyReqHandle( |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
749 |
EMultimodeUssdSendMessageDefaultHandler ); |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
750 |
} |
24 | 751 |
|
752 |
if ( EMultimodeUssdReqHandleUnknown != reqHandle ) |
|
753 |
{ |
|
754 |
// reset req handle. Returns the deleted req handle |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
755 |
if(EFalse == iSendToDefaultHandler) |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
756 |
{ |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
757 |
reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
758 |
EMultimodeUssdSendMessage ); |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
759 |
} |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
760 |
else// default handler |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
761 |
{ |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
762 |
reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
85 | 763 |
EMultimodeUssdSendMessageDefaultHandler ); |
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
764 |
} |
24 | 765 |
// If the session is already in progress then no session management |
766 |
// action is required. Otherwise we either promote the reserved |
|
767 |
// session to an open session or cancel the reservation. |
|
768 |
if ( !IsSessionInProgress() && IsSessionReserved() ) |
|
769 |
{ |
|
770 |
if ( KErrNone == aError ) |
|
771 |
{ |
|
81
7f379d8ed02d
Implemented CTelObject::SetSessionOwnerByTsyHandleAndIpc() and CPhoneBase::FindByIpcAndSecureId()
ivan.fildichev@opencode.com
parents:
78
diff
changeset
|
772 |
if(EFalse == iSendToDefaultHandler) |
7f379d8ed02d
Implemented CTelObject::SetSessionOwnerByTsyHandleAndIpc() and CPhoneBase::FindByIpcAndSecureId()
ivan.fildichev@opencode.com
parents:
78
diff
changeset
|
773 |
{ |
7f379d8ed02d
Implemented CTelObject::SetSessionOwnerByTsyHandleAndIpc() and CPhoneBase::FindByIpcAndSecureId()
ivan.fildichev@opencode.com
parents:
78
diff
changeset
|
774 |
SetSessionOwnerByTsyHandle( reqHandle ); |
7f379d8ed02d
Implemented CTelObject::SetSessionOwnerByTsyHandleAndIpc() and CPhoneBase::FindByIpcAndSecureId()
ivan.fildichev@opencode.com
parents:
78
diff
changeset
|
775 |
} |
7f379d8ed02d
Implemented CTelObject::SetSessionOwnerByTsyHandleAndIpc() and CPhoneBase::FindByIpcAndSecureId()
ivan.fildichev@opencode.com
parents:
78
diff
changeset
|
776 |
else // default handler |
85 | 777 |
{ |
778 |
//this function call will transfer received message to the |
|
779 |
//default handler which already has EMobileUssdMessagingReceiveMessage request. |
|
780 |
SetSessionOwnerByTsyHandleAndIpc( reqHandle, EMobileUssdMessagingReceiveMessage ); |
|
81
7f379d8ed02d
Implemented CTelObject::SetSessionOwnerByTsyHandleAndIpc() and CPhoneBase::FindByIpcAndSecureId()
ivan.fildichev@opencode.com
parents:
78
diff
changeset
|
781 |
} |
24 | 782 |
} |
783 |
else |
|
784 |
{ |
|
785 |
CancelReserveSession(); |
|
786 |
} |
|
787 |
} |
|
77 | 788 |
|
24 | 789 |
ReqCompleted( reqHandle, aError ); |
790 |
iSsTransactionOngoing = EFalse; |
|
791 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown; |
|
792 |
} |
|
793 |
} |
|
794 |
||
795 |
// --------------------------------------------------------------------------- |
|
796 |
// CMmUssdTsy::SendReleaseL |
|
797 |
// This function cancels active ussd session asynchronously |
|
798 |
// (other items were commented in a header). |
|
799 |
// --------------------------------------------------------------------------- |
|
800 |
// |
|
801 |
TInt CMmUssdTsy::SendReleaseL( |
|
802 |
const TTsyReqHandle aTsyReqHandle, |
|
803 |
TDes8* aReturnResult ) |
|
804 |
{ |
|
77 | 805 |
|
806 |
//Check if there is a session in progress |
|
24 | 807 |
if ( !IsSessionInProgress() ) |
808 |
{ |
|
809 |
// You can't release a dialogue that isn't in progress. |
|
810 |
return KErrDisconnected; |
|
811 |
} |
|
77 | 812 |
|
24 | 813 |
TTsyReqHandle sendReleaseHandle = |
814 |
iTsyReqHandleStore->GetTsyReqHandle( EMultimodeUssdSendRelease ); |
|
77 | 815 |
|
24 | 816 |
if ( 0 < sendReleaseHandle ) |
817 |
{ |
|
818 |
// The request is already in processing because of previous request |
|
819 |
// Complete request with status value informing the client about |
|
820 |
// the situation. |
|
77 | 821 |
TFLOGSTRING("LTSY: CMmUssdTsy::SendRelease - KErrAccessDenied"); |
822 |
ReqCompleted( aTsyReqHandle, KErrAccessDenied ); |
|
24 | 823 |
} |
824 |
else |
|
825 |
{ |
|
826 |
TFLOGSTRING("TSY: CMmUssdTsy::SendRelease called"); |
|
827 |
TInt ret = KErrGeneral; |
|
828 |
||
829 |
TPckg<RMobilePhone::TMobilePhoneSendSSRequestV3>* ussdSendSSRequestPckg = |
|
830 |
reinterpret_cast< TPckg<RMobilePhone::TMobilePhoneSendSSRequestV3>* > |
|
831 |
( aReturnResult ); |
|
77 | 832 |
|
24 | 833 |
if ( sizeof(RMobilePhone::TMobilePhoneSendSSRequestV3) > |
834 |
ussdSendSSRequestPckg->MaxLength() ) |
|
835 |
{ |
|
836 |
ret = KErrArgument; |
|
837 |
} |
|
838 |
else |
|
839 |
{ |
|
840 |
RMobilePhone::TMobilePhoneSendSSRequestV3& returnResult = |
|
841 |
( *ussdSendSSRequestPckg )(); |
|
842 |
||
843 |
iReturnResultPtr = &returnResult; |
|
844 |
||
845 |
// Send request to the Domestic OS layer. |
|
846 |
ret = iMmPhone->MessageManager()->HandleRequestL( |
|
847 |
EMobileUssdMessagingSendRelease ); |
|
848 |
} |
|
77 | 849 |
|
24 | 850 |
// If ret is not KErrNone |
851 |
if ( KErrNone != ret ) |
|
852 |
{ |
|
853 |
ReqCompleted( aTsyReqHandle, ret ); |
|
854 |
} |
|
855 |
else |
|
856 |
{ |
|
857 |
#ifdef REQHANDLE_TIMER |
|
858 |
// Set timer for the request |
|
77 | 859 |
//If there is no session in progress this line lead to crash |
24 | 860 |
SetTypeOfResponse( EMultimodeUssdSendRelease, aTsyReqHandle ); |
861 |
#else |
|
862 |
// Save SendMessage request handle, set timer |
|
863 |
iTsyReqHandleStore->SetTsyReqHandle( |
|
864 |
EMultimodeUssdSendRelease, aTsyReqHandle ); |
|
865 |
#endif // REQHANDLE_TIMER |
|
866 |
} |
|
867 |
} |
|
868 |
return KErrNone; |
|
869 |
} |
|
870 |
||
871 |
// --------------------------------------------------------------------------- |
|
872 |
// CMmUssdTsy::CompleteSendRelease |
|
873 |
// This method completes an outstanding SendRelease request. |
|
874 |
// (other items were commented in a header). |
|
875 |
// --------------------------------------------------------------------------- |
|
876 |
// |
|
877 |
void CMmUssdTsy::CompleteSendRelease( |
|
878 |
TInt aErrorCode, |
|
879 |
CMmDataPackage* aDataPackage ) |
|
880 |
{ |
|
881 |
TFLOGSTRING("TSY: CMmUssdTsy::CompleteSendRelease" ); |
|
882 |
// reset req handle. Returns the deleted req handle |
|
883 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
884 |
EMultimodeUssdSendRelease ); |
|
885 |
||
886 |
if( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
887 |
{ |
|
888 |
if ( KErrNone == aErrorCode ) |
|
889 |
{ |
|
890 |
aDataPackage->UnPackData ( *iReturnResultPtr ); |
|
891 |
} |
|
77 | 892 |
EndSession(); |
24 | 893 |
ReqCompleted( reqHandle, aErrorCode ); |
894 |
} |
|
895 |
} |
|
896 |
||
897 |
// --------------------------------------------------------------------------- |
|
898 |
// CmmUssdTsy::SendReleaseCancel |
|
899 |
// Cancels cancelling of USSD session. |
|
900 |
// (other items were commented in a header). |
|
901 |
// --------------------------------------------------------------------------- |
|
902 |
// |
|
903 |
TInt CMmUssdTsy::SendReleaseCancel() |
|
904 |
{ |
|
905 |
// reset the req handle |
|
906 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
907 |
EMultimodeUssdSendRelease ); |
|
908 |
||
909 |
if ( EMultimodeUssdReqHandleUnknown != reqHandle ) |
|
910 |
{ |
|
911 |
// complete with cancel |
|
912 |
ReqCompleted( reqHandle, KErrCancel ); |
|
913 |
} |
|
914 |
||
915 |
return KErrNone; |
|
916 |
} |
|
917 |
||
918 |
// --------------------------------------------------------------------------- |
|
919 |
// CMmUssdTsy::NotifyNetworkRelease |
|
920 |
// This method activates notifying of network release |
|
921 |
// (other items were commented in a header). |
|
922 |
// --------------------------------------------------------------------------- |
|
923 |
// |
|
924 |
TInt CMmUssdTsy::NotifyNetworkRelease( |
|
925 |
const TTsyReqHandle aTsyReqHandle, |
|
926 |
TDes8* aMsgData, |
|
927 |
TDes8* aMsgAttributes) // aMsgAttributes may be NULL |
|
928 |
{ |
|
929 |
TFLOGSTRING("TSY: CMmUssdTsy::NotifyNetworkRelease" ); |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
930 |
|
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
931 |
//TODO if we do not remove the following if block emulator would not start in GUI mode |
77 | 932 |
//Check if there is a session in progress |
933 |
if ( !IsSessionInProgress() ) |
|
934 |
{ |
|
935 |
// You can't release a dialogue that isn't in progress. |
|
936 |
return KErrDisconnected; |
|
937 |
} |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
938 |
|
24 | 939 |
|
940 |
if (aMsgData->MaxLength() < sizeof(RMobilePhone::TMobilePhoneSendSSRequestV3Pckg)) |
|
941 |
{ |
|
942 |
TFLOGSTRING ("TSY: CMmNetTsy::NotifyNetworkRelease Bad size argument (arg1)"); |
|
943 |
// Complete the request with appropiate error |
|
944 |
return KErrArgument; |
|
945 |
} |
|
77 | 946 |
|
24 | 947 |
if (aMsgAttributes && |
948 |
aMsgAttributes->MaxLength() < sizeof(RMobileUssdMessaging::TMobileUssdAttributesV1Pckg)) |
|
949 |
{ |
|
950 |
TFLOGSTRING ("TSY: CMmNetTsy::NotifyNetworkRelease Bad size argument (arg2)"); |
|
951 |
// Complete the request with appropiate error |
|
952 |
return KErrArgument; |
|
953 |
} |
|
77 | 954 |
|
24 | 955 |
TPckg<RMobilePhone::TMobilePhoneSendSSRequestV3>* ussdSendSSRequestPckg = |
956 |
reinterpret_cast< TPckg<RMobilePhone::TMobilePhoneSendSSRequestV3>* > |
|
957 |
( aMsgData ); |
|
958 |
||
959 |
RMobilePhone::TMobilePhoneSendSSRequestV3& msgData = |
|
960 |
( *ussdSendSSRequestPckg )(); |
|
961 |
||
962 |
iReturnNotifyPtr = &msgData; |
|
963 |
if (aMsgAttributes != NULL) |
|
964 |
{ |
|
965 |
RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* ussdAttributesPckg = |
|
966 |
reinterpret_cast< RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* > (aMsgAttributes); |
|
967 |
||
968 |
RMobileUssdMessaging::TMobileUssdAttributesV1& msgAttributes = (*ussdAttributesPckg)(); |
|
969 |
||
970 |
iReturnNotifyUssdMessageAttributesPtr = &msgAttributes; |
|
971 |
} |
|
972 |
else |
|
973 |
{ |
|
974 |
iReturnNotifyUssdMessageAttributesPtr = NULL; |
|
77 | 975 |
} |
24 | 976 |
#ifdef REQHANDLE_TIMER |
977 |
// Set timer for the request |
|
978 |
SetTypeOfResponse( EMultimodeUssdNotifyNetworkRelease, aTsyReqHandle ); |
|
979 |
#else |
|
980 |
// Save SendMessage request handle, set timer |
|
981 |
iTsyReqHandleStore->SetTsyReqHandle( |
|
982 |
EMultimodeUssdNotifyNetworkRelease, aTsyReqHandle ); |
|
983 |
#endif // REQHANDLE_TIMER |
|
984 |
||
985 |
return KErrNone; |
|
986 |
} |
|
987 |
||
988 |
// --------------------------------------------------------------------------- |
|
989 |
// CMmUssdTsy::CompleteNotifyNetworkRelease |
|
990 |
// This method completes notify network release request. |
|
991 |
// (other items were commented in a header). |
|
992 |
// --------------------------------------------------------------------------- |
|
993 |
// |
|
994 |
void CMmUssdTsy::CompleteNotifyNetworkRelease( |
|
995 |
TInt aErrorCode, |
|
996 |
CMmDataPackage* aDataPackage ) |
|
997 |
{ |
|
77 | 998 |
EndSession(); |
24 | 999 |
|
1000 |
TFLOGSTRING2("TSY: CMmUssdTsy::CompleteNotifyNetworkRelease. Error: %d", aErrorCode ); |
|
1001 |
// reset req handle. Returns the deleted req handle |
|
1002 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1003 |
EMultimodeUssdNotifyNetworkRelease ); |
|
1004 |
||
1005 |
if( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
1006 |
{ |
|
1007 |
if ( KErrNone == aErrorCode ) |
|
1008 |
{ |
|
1009 |
RMobilePhone::TMobilePhoneSendSSRequestV3* tempReturnNotifyPtr; |
|
1010 |
if (iReturnNotifyUssdMessageAttributesPtr != NULL) |
|
1011 |
{ |
|
1012 |
RMobileUssdMessaging::TMobileUssdAttributesV1* tempReturnNotifyUssdMessageAttributesPtr; |
|
1013 |
aDataPackage->UnPackData ( &tempReturnNotifyPtr, &tempReturnNotifyUssdMessageAttributesPtr ); |
|
1014 |
if (tempReturnNotifyPtr != NULL) |
|
1015 |
{ |
|
1016 |
*iReturnNotifyPtr = *tempReturnNotifyPtr; |
|
1017 |
} |
|
1018 |
else |
|
1019 |
{ |
|
1020 |
iReturnNotifyPtr->iOpCode = KErrNone; |
|
1021 |
iReturnNotifyPtr->iAdditionalInfo.Append( KErrNone ); |
|
1022 |
} |
|
1023 |
if (tempReturnNotifyUssdMessageAttributesPtr != NULL) |
|
1024 |
{ |
|
1025 |
*iReturnNotifyUssdMessageAttributesPtr = *tempReturnNotifyUssdMessageAttributesPtr; |
|
1026 |
} |
|
1027 |
else |
|
1028 |
{ |
|
1029 |
iReturnNotifyUssdMessageAttributesPtr->iFormat = RMobileUssdMessaging::EFormatUnspecified; |
|
1030 |
iReturnNotifyUssdMessageAttributesPtr->iType = RMobileUssdMessaging::EUssdUnknown; |
|
1031 |
} |
|
1032 |
} |
|
1033 |
else |
|
1034 |
{ |
|
1035 |
aDataPackage->UnPackData ( &tempReturnNotifyPtr ); |
|
1036 |
if(tempReturnNotifyPtr != NULL) |
|
1037 |
{ |
|
1038 |
*iReturnNotifyPtr = *tempReturnNotifyPtr; |
|
1039 |
} |
|
1040 |
else |
|
1041 |
{ |
|
1042 |
iReturnNotifyPtr->iOpCode = KErrNone; |
|
1043 |
iReturnNotifyPtr->iAdditionalInfo.Append( KErrNone ); |
|
1044 |
} |
|
1045 |
} |
|
1046 |
} |
|
1047 |
// Null ret pointers |
|
1048 |
iReturnNotifyPtr = NULL; |
|
1049 |
iReturnNotifyUssdMessageAttributesPtr = NULL; |
|
1050 |
||
1051 |
// Complete the client request |
|
1052 |
ReqCompleted( reqHandle, aErrorCode ); |
|
1053 |
} |
|
1054 |
} |
|
1055 |
||
1056 |
// --------------------------------------------------------------------------- |
|
1057 |
// CmmUssdTsy::NotifyNetworkReleaseCancel |
|
1058 |
// Cancels notify network release request. |
|
1059 |
// (other items were commented in a header). |
|
1060 |
// --------------------------------------------------------------------------- |
|
1061 |
// |
|
1062 |
TInt CMmUssdTsy::NotifyNetworkReleaseCancel() |
|
1063 |
{ |
|
1064 |
// reset the req handle |
|
1065 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1066 |
EMultimodeUssdNotifyNetworkRelease ); |
|
1067 |
||
1068 |
// This will always be true if the etel is handling the request correctly. |
|
1069 |
// In case etel fails to block the request this will prevent crashing. |
|
1070 |
if ( EMultimodeUssdReqHandleUnknown != reqHandle ) |
|
1071 |
{ |
|
1072 |
// Null ret pointers |
|
1073 |
iReturnNotifyPtr = NULL; |
|
1074 |
iReturnNotifyUssdMessageAttributesPtr = NULL; |
|
1075 |
||
1076 |
// complete with cancel |
|
1077 |
ReqCompleted( reqHandle, KErrCancel ); |
|
1078 |
} |
|
1079 |
||
1080 |
return KErrNone; |
|
1081 |
} |
|
1082 |
||
1083 |
// --------------------------------------------------------------------------- |
|
1084 |
// CMmUssdTsy::ResetVariables |
|
1085 |
// Reset used member variables. |
|
1086 |
// (other items were commented in a header). |
|
1087 |
// --------------------------------------------------------------------------- |
|
1088 |
// |
|
1089 |
void CMmUssdTsy::ResetVariables() |
|
1090 |
{ |
|
1091 |
iReceiveUssdMessagePtr = NULL; |
|
1092 |
iReceiveUssdMessageAttributesPtr = NULL; |
|
1093 |
iReturnResultPtr = NULL; |
|
1094 |
iReturnNotifyPtr = NULL; |
|
1095 |
iReturnNotifyUssdMessageAttributesPtr = NULL; |
|
77 | 1096 |
iSendToDefaultHandler = EFalse; |
24 | 1097 |
} |
1098 |
||
1099 |
#ifdef REQHANDLE_TIMER |
|
1100 |
// --------------------------------------------------------------------------- |
|
1101 |
// CMmUssdTsy::SetTypeOfResponse |
|
1102 |
// Sets the type of response for a given Handle. Automatic |
|
1103 |
// mode includes an automatic response in case of non response |
|
1104 |
// from the DOS in a specified time |
|
1105 |
// (other items were commented in a header). |
|
1106 |
// --------------------------------------------------------------------------- |
|
1107 |
// |
|
1108 |
void CMmUssdTsy::SetTypeOfResponse( |
|
1109 |
const TInt aReqHandleType, |
|
1110 |
const TTsyReqHandle aTsyReqHandle ) |
|
1111 |
{ |
|
1112 |
TInt timeOut( 0 ); |
|
1113 |
||
1114 |
switch ( aReqHandleType ) |
|
1115 |
{ |
|
1116 |
case EMultimodeUssdSendMessage: |
|
77 | 1117 |
case EMultimodeUssdSendMessageDefaultHandler: |
24 | 1118 |
timeOut = KMmUssdSendMessageTimeOut; |
1119 |
break; |
|
1120 |
case EMultimodeUssdSendMessageNoFdnCheck: |
|
1121 |
timeOut = KMmUssdSendMessageNoFdnCheckTimeOut; |
|
1122 |
break; |
|
1123 |
case EMultimodeUssdSendRelease: |
|
1124 |
timeOut = KMmUssdSendReleaseTimeOut; |
|
1125 |
break; |
|
1126 |
default: |
|
1127 |
// Does not use timer |
|
1128 |
iTsyReqHandleStore->SetTsyReqHandle( |
|
1129 |
aReqHandleType, aTsyReqHandle ); |
|
1130 |
break; |
|
1131 |
} |
|
1132 |
||
1133 |
if ( timeOut > 0 ) |
|
1134 |
{ |
|
1135 |
// The timeout parameter is given in seconds. |
|
1136 |
iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType, |
|
1137 |
aTsyReqHandle, timeOut ); |
|
1138 |
} |
|
1139 |
} |
|
1140 |
||
1141 |
// --------------------------------------------------------------------------- |
|
1142 |
// CMmUssdTsy::Complete |
|
1143 |
// Completes the request due timer expiration |
|
1144 |
// (other items were commented in a header). |
|
1145 |
// --------------------------------------------------------------------------- |
|
1146 |
// |
|
1147 |
void CMmUssdTsy::Complete( |
|
1148 |
TInt aReqHandleType, |
|
1149 |
TInt aError ) |
|
1150 |
{ |
|
1151 |
// All possible TSY req handle types are listed in the |
|
1152 |
// switch case below. |
|
1153 |
||
1154 |
RMobilePhone::TMobilePhoneSendSSRequestV3 returnResult; |
|
1155 |
// create package. |
|
1156 |
CMmDataPackage package; |
|
1157 |
||
1158 |
switch( aReqHandleType ) |
|
1159 |
{ |
|
1160 |
// Cases handled with automatic completion |
|
78
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
1161 |
case EMultimodeUssdSendMessageDefaultHandler: |
d4cfc65049ba
Fixed Send Message Default Handler routines according to Dejana's request.
ivan.fildichev@opencode.com
parents:
77
diff
changeset
|
1162 |
case EMultimodeUssdSendMessage: |
24 | 1163 |
CompleteSendMessage( aError ); |
77 | 1164 |
break; |
24 | 1165 |
case EMultimodeUssdSendMessageNoFdnCheck: |
1166 |
CompleteSendMessageNoFdnCheck( aError ); |
|
1167 |
break; |
|
1168 |
case EMultimodeUssdSendRelease: |
|
1169 |
returnResult.iOpCode = static_cast< TUint8 >( KErrTimedOut ); |
|
1170 |
returnResult.iAdditionalInfo.Append ( KErrNone ); |
|
1171 |
||
1172 |
// pack the data |
|
1173 |
package.PackData( &returnResult ); |
|
1174 |
CompleteSendRelease( aError, &package ); |
|
1175 |
break; |
|
1176 |
default: |
|
1177 |
ReqCompleted( iTsyReqHandleStore->ResetTsyReqHandle( |
|
1178 |
aReqHandleType ), aError ); |
|
1179 |
break; |
|
1180 |
} |
|
1181 |
} |
|
1182 |
#endif // REQHANDLE_TIMER |
|
1183 |
||
1184 |
#ifdef TF_LOGGING_ENABLED |
|
1185 |
// --------------------------------------------------------------------------- |
|
1186 |
// CMmUssdTsy::ReqCompleted |
|
1187 |
// Overloads CTelObject::ReqCompleted for logging purposes. It |
|
1188 |
// prints the aTsyReqHandle and aError variable in the log file and then |
|
1189 |
// calls CTelObject::ReqCompleted. |
|
1190 |
// (other items were commented in a header). |
|
1191 |
// --------------------------------------------------------------------------- |
|
1192 |
// |
|
1193 |
void CMmUssdTsy::ReqCompleted( |
|
1194 |
const TTsyReqHandle aTsyReqHandle, |
|
1195 |
const TInt aError ) |
|
1196 |
{ |
|
1197 |
TFLOGSTRING3("TSY: CMmUssdTsy::ReqCompleted. Handle: %d Error: %d", aTsyReqHandle, aError); |
|
1198 |
CTelObject::ReqCompleted( aTsyReqHandle, aError ); |
|
1199 |
} |
|
1200 |
#endif // TF_LOGGING_ENABLED |
|
1201 |
||
1202 |
// --------------------------------------------------------------------------- |
|
1203 |
// CMmUssdTsy::Phone |
|
1204 |
// This method returns pointer to the Phone object. |
|
1205 |
// (other items were commented in a header). |
|
1206 |
// --------------------------------------------------------------------------- |
|
1207 |
// |
|
1208 |
CMmPhoneTsy* CMmUssdTsy::Phone() |
|
1209 |
{ |
|
1210 |
return iMmPhone; |
|
1211 |
} |
|
1212 |
||
1213 |
// --------------------------------------------------------------------------- |
|
1214 |
// CMmUssdTsy::IsRequestPossibleInOffLine |
|
1215 |
// Checks whether a ETel request can be performed or not while offline mode is |
|
1216 |
// enabled |
|
1217 |
// (other items were commented in a header). |
|
1218 |
// --------------------------------------------------------------------------- |
|
1219 |
// |
|
1220 |
TBool CMmUssdTsy::IsRequestPossibleInOffline( TInt aIpc ) const |
|
1221 |
{ |
|
1222 |
TBool isRequestPossible ( ETrue ); |
|
1223 |
||
1224 |
switch ( aIpc ) |
|
1225 |
{ |
|
77 | 1226 |
case EMobileUssdMessagingSendMessage: |
1227 |
case EMobileUssdMessagingSendMessageDefaultHandler: |
|
24 | 1228 |
case EMobileUssdMessagingSendMessageNoFdnCheck: |
1229 |
case EMobileUssdMessagingSendRelease: |
|
1230 |
isRequestPossible = EFalse; |
|
1231 |
break; |
|
1232 |
case EMobileUssdMessagingReceiveMessage: |
|
1233 |
default: |
|
1234 |
break; |
|
1235 |
} |
|
1236 |
||
1237 |
return isRequestPossible; |
|
1238 |
} |
|
1239 |
||
1240 |
// --------------------------------------------------------------------------- |
|
1241 |
// CMmUssdTsy::SendMessageNoFDNCheckCancel |
|
1242 |
// Cancels SendMessageNoFDNCheck request. |
|
1243 |
// (other items were commented in a header). |
|
1244 |
// --------------------------------------------------------------------------- |
|
1245 |
// |
|
1246 |
TInt CMmUssdTsy::SendMessageNoFdnCheckCancel( |
|
1247 |
const TTsyReqHandle aTsyReqHandle ) |
|
1248 |
{ |
|
1249 |
TFLOGSTRING("TSY: CMmUssdTsy::SendMessageNoFdnCheckCancel" ); |
|
1250 |
||
1251 |
// reset the req handle |
|
1252 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1253 |
EMultimodeUssdSendMessageNoFdnCheck ); |
|
1254 |
||
1255 |
if ( EMultimodeUssdReqHandleUnknown < reqHandle ) |
|
1256 |
{ |
|
1257 |
// complete with cancel |
|
1258 |
ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
1259 |
iSsTransactionOngoing = EFalse; |
|
1260 |
} |
|
1261 |
||
1262 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown; |
|
1263 |
return KErrNone; |
|
1264 |
} |
|
1265 |
||
1266 |
// --------------------------------------------------------------------------- |
|
1267 |
// CMmUssdTsy::CompleteSendMessageNoFdnCheck |
|
1268 |
// Complete SendMessage |
|
1269 |
// (other items were commented in a header). |
|
1270 |
// --------------------------------------------------------------------------- |
|
1271 |
// |
|
1272 |
void CMmUssdTsy::CompleteSendMessageNoFdnCheck( |
|
1273 |
TInt aError ) |
|
1274 |
{ |
|
1275 |
TFLOGSTRING("TSY: CMmUssdTsy::CompleteSendMessageNoFdnCheck.\n" ); |
|
1276 |
// get reg handle |
|
1277 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( |
|
1278 |
EMultimodeUssdSendMessageNoFdnCheck ); |
|
1279 |
||
1280 |
if ( EMultimodeUssdReqHandleUnknown != reqHandle ) |
|
1281 |
{ |
|
1282 |
// reset req handle. Returns the deleted req handle |
|
1283 |
reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1284 |
EMultimodeUssdSendMessageNoFdnCheck ); |
|
1285 |
||
1286 |
ReqCompleted( reqHandle, aError ); |
|
1287 |
iSsTransactionOngoing = EFalse; |
|
1288 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown; |
|
1289 |
} |
|
1290 |
} |
|
1291 |
||
1292 |
||
1293 |
// End of file |
|
1294 |
||
1295 |