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
|
|
62 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown;
|
|
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;
|
|
192 |
ret = SendMessageL(
|
|
193 |
aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n() );
|
|
194 |
}
|
|
195 |
break;
|
|
196 |
case EMobileUssdMessagingSendMessageNoFdnCheck:
|
|
197 |
{
|
|
198 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUsed;
|
|
199 |
ret = SendMessageL(
|
|
200 |
aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n() );
|
|
201 |
}
|
|
202 |
break;
|
|
203 |
case EMobileUssdMessagingSendRelease:
|
|
204 |
ret = SendReleaseL( aTsyReqHandle, aPackage.Des1n() );
|
|
205 |
break;
|
|
206 |
case EMobileUssdMessagingNotifyNetworkRelease:
|
|
207 |
switch( aPackage.Type() )
|
|
208 |
{
|
|
209 |
// Switch between alternative implementations of NotifyNetworkRelease
|
|
210 |
case TDataPackage::EPackage1n:
|
|
211 |
ret = NotifyNetworkRelease( aTsyReqHandle, aPackage.Des1n(), NULL );
|
|
212 |
break;
|
|
213 |
case TDataPackage::EPackage1n2n:
|
|
214 |
ret = NotifyNetworkRelease( aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n() );
|
|
215 |
break;
|
|
216 |
default:
|
|
217 |
ret = KErrNotSupported;
|
|
218 |
break;
|
|
219 |
}
|
|
220 |
|
|
221 |
break;
|
|
222 |
default:
|
|
223 |
ret = KErrNotSupported;
|
|
224 |
break;
|
|
225 |
}
|
|
226 |
|
|
227 |
return ret;
|
|
228 |
}
|
|
229 |
|
|
230 |
// ---------------------------------------------------------------------------
|
|
231 |
// CMmUssdTsy::CancelService
|
|
232 |
// CancelService is called by the server when it is "cleaning-up"
|
|
233 |
// any still outstanding asynchronous requests before closing a client's
|
|
234 |
// sub-session. This will happen if a client closes its R-class handle without
|
|
235 |
// cancelling outstanding asynchronous requests
|
|
236 |
// (other items were commented in a header).
|
|
237 |
// ---------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
TInt CMmUssdTsy::CancelService(
|
|
240 |
const TInt aIpc,
|
|
241 |
const TTsyReqHandle aTsyReqHandle )
|
|
242 |
{
|
|
243 |
TInt ret( KErrNone );
|
|
244 |
|
|
245 |
switch ( aIpc )
|
|
246 |
{
|
|
247 |
case EMobileUssdMessagingReceiveMessage:
|
|
248 |
ReceiveMessageCancel( aTsyReqHandle );
|
|
249 |
ret = KErrNone;
|
|
250 |
break;
|
|
251 |
case EMobileUssdMessagingSendMessage:
|
|
252 |
SendMessageCancel( aTsyReqHandle );
|
|
253 |
ret = KErrNone;
|
|
254 |
break;
|
|
255 |
case EMobileUssdMessagingSendMessageNoFdnCheck:
|
|
256 |
SendMessageNoFdnCheckCancel( aTsyReqHandle );
|
|
257 |
ret = KErrNone;
|
|
258 |
break;
|
|
259 |
case EMobileUssdMessagingSendRelease:
|
|
260 |
SendReleaseCancel();
|
|
261 |
ret = KErrNone;
|
|
262 |
break;
|
|
263 |
case EMobileUssdMessagingNotifyNetworkRelease:
|
|
264 |
NotifyNetworkReleaseCancel();
|
|
265 |
ret = KErrNone;
|
|
266 |
break;
|
|
267 |
default:
|
|
268 |
ret = KErrNotSupported;
|
|
269 |
break;
|
|
270 |
}
|
|
271 |
|
|
272 |
return ret;
|
|
273 |
}
|
|
274 |
|
|
275 |
// ---------------------------------------------------------------------------
|
|
276 |
// CMmUssdTsy::ReqModeL
|
|
277 |
// When the ETel server receives an "extension" client request,
|
|
278 |
// it will pass the IPC request number down to the TSY in order to find out
|
|
279 |
// what type of request it is. The virtual method that gets called is ReqModeL
|
|
280 |
// (other items were commented in a header).
|
|
281 |
// ---------------------------------------------------------------------------
|
|
282 |
//
|
|
283 |
CTelObject::TReqMode CMmUssdTsy::ReqModeL(
|
|
284 |
const TInt aIpc )
|
|
285 |
{
|
|
286 |
CTelObject::TReqMode ret ( 0 );
|
|
287 |
|
|
288 |
switch ( aIpc )
|
|
289 |
{
|
|
290 |
// Non-Flow Controlled Services
|
|
291 |
case EMobileUssdMessagingGetCaps:
|
|
292 |
break;
|
|
293 |
// Flow Controlled Services
|
|
294 |
|
|
295 |
// Immediate Server Repost
|
|
296 |
case EMobileUssdMessagingReceiveMessage:
|
|
297 |
ret = KReqModeRePostImmediately |
|
|
298 |
KReqModeMultipleCompletionWithInterestLevel;
|
|
299 |
break;
|
|
300 |
// Services handled by TSY
|
|
301 |
case EMobileUssdMessagingSendMessage:
|
|
302 |
case EMobileUssdMessagingSendMessageNoFdnCheck:
|
|
303 |
case EMobileUssdMessagingSendRelease:
|
|
304 |
//ret = KReqModeSessionBased;
|
|
305 |
ret = 0;
|
|
306 |
break;
|
|
307 |
case EMobileUssdMessagingNotifyNetworkRelease:
|
|
308 |
// Multiple completion because the clients don't have to own the
|
|
309 |
// session in order to be notified that the session has been
|
|
310 |
// released.
|
|
311 |
ret = KReqModeMultipleCompletionEnabled;
|
|
312 |
break;
|
|
313 |
default:
|
|
314 |
User::Leave( KErrNotSupported );
|
|
315 |
break;
|
|
316 |
}
|
|
317 |
|
|
318 |
return ret;
|
|
319 |
}
|
|
320 |
|
|
321 |
// ---------------------------------------------------------------------------
|
|
322 |
// CMmUssdTsy::OpenNewObjectL
|
|
323 |
// Opens new object and names it. Not supported.
|
|
324 |
// (other items were commented in a header).
|
|
325 |
// ---------------------------------------------------------------------------
|
|
326 |
//
|
|
327 |
CTelObject* CMmUssdTsy::OpenNewObjectL(
|
|
328 |
TDes& /*aName*/ )
|
|
329 |
{
|
|
330 |
User::Leave( KErrNotSupported );
|
|
331 |
//lint -e{527} "unreachable code"
|
|
332 |
|
|
333 |
return NULL;
|
|
334 |
}
|
|
335 |
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
// CMmUssdTsy::OpenNewObjectByNameL
|
|
338 |
// Open extendible sub-sessions. Not Supported
|
|
339 |
// (other items were commented in a header).
|
|
340 |
// ---------------------------------------------------------------------------
|
|
341 |
//
|
|
342 |
CTelObject* CMmUssdTsy::OpenNewObjectByNameL(
|
|
343 |
const TDesC& /*aName*/ )
|
|
344 |
{
|
|
345 |
User::Leave( KErrNotSupported );
|
|
346 |
//lint -e{527} "unreachable code"
|
|
347 |
|
|
348 |
return NULL;
|
|
349 |
}
|
|
350 |
|
|
351 |
// ---------------------------------------------------------------------------
|
|
352 |
// CMmUssdTsy::RegisterNotification
|
|
353 |
// RegisterNotification is called when the server recognises that
|
|
354 |
// this notification is being posted for the first time on this sub-session
|
|
355 |
// object. It enables the TSY to "turn on" any regular notification messages
|
|
356 |
// that it may receive from DOS.
|
|
357 |
// (other items were commented in a header).
|
|
358 |
// ---------------------------------------------------------------------------
|
|
359 |
//
|
|
360 |
TInt CMmUssdTsy::RegisterNotification(
|
|
361 |
const TInt aIpc ) // Notification IPC number
|
|
362 |
{
|
|
363 |
TFLOGSTRING2( "TSY: CMmUssdTsy::RegisterNotification. IPC: %d", aIpc );
|
|
364 |
|
|
365 |
TInt ret( KErrNone );
|
|
366 |
|
|
367 |
switch ( aIpc )
|
|
368 |
{
|
|
369 |
case EMobileUssdMessagingNotifyNetworkRelease:
|
|
370 |
case EMobileUssdMessagingReceiveMessage:
|
|
371 |
break;
|
|
372 |
default:
|
|
373 |
// Not supported
|
|
374 |
ret = KErrNotSupported;
|
|
375 |
break;
|
|
376 |
}
|
|
377 |
|
|
378 |
return ret;
|
|
379 |
}
|
|
380 |
|
|
381 |
// ---------------------------------------------------------------------------
|
|
382 |
// CMmUssdTsy::DeregisterNotification
|
|
383 |
// DeregisterNotification is called when the server recognises
|
|
384 |
// that this notification will not be posted again because the last client
|
|
385 |
// to have a handle on this sub-session object has just closed the handle.
|
|
386 |
// It enables the TSY to "turn off" any regular notification messages that it
|
|
387 |
// may receive from DOS.
|
|
388 |
// (other items were commented in a header).
|
|
389 |
// ---------------------------------------------------------------------------
|
|
390 |
//
|
|
391 |
TInt CMmUssdTsy::DeregisterNotification(
|
|
392 |
const TInt aIpc ) // Notification IPC number
|
|
393 |
{
|
|
394 |
TFLOGSTRING2( "TSY: CMmUssdTsy::DeregisterNotification. IPC: %d", aIpc );
|
|
395 |
|
|
396 |
TInt ret( KErrNone );
|
|
397 |
|
|
398 |
switch ( aIpc )
|
|
399 |
{
|
|
400 |
case EMobileUssdMessagingNotifyNetworkRelease:
|
|
401 |
case EMobileUssdMessagingReceiveMessage:
|
|
402 |
break;
|
|
403 |
default:
|
|
404 |
// Not supported
|
|
405 |
ret = KErrNotSupported;
|
|
406 |
break;
|
|
407 |
}
|
|
408 |
|
|
409 |
return ret;
|
|
410 |
}
|
|
411 |
|
|
412 |
// ---------------------------------------------------------------------------
|
|
413 |
// CMmUssdTsy::NumberOfSlotsL
|
|
414 |
// NumberOfSlotsL is called by the server when it is registering
|
|
415 |
// a new NOTIFICATION. It enables the TSY to tell the server how many buffer
|
|
416 |
// slots to allocate for "repost immediately" notifications that may trigger
|
|
417 |
// before clients collect them.
|
|
418 |
// (other items were commented in a header).
|
|
419 |
// ---------------------------------------------------------------------------
|
|
420 |
//
|
|
421 |
TInt CMmUssdTsy::NumberOfSlotsL(
|
|
422 |
const TInt aIpc )
|
|
423 |
{
|
|
424 |
TInt numberOfSlots = 1;
|
|
425 |
switch ( aIpc )
|
|
426 |
{
|
|
427 |
case EMobileUssdMessagingReceiveMessage:
|
|
428 |
numberOfSlots = KMmUssdMessagingReceiveMessageSlots;
|
|
429 |
break;
|
|
430 |
case EMobileUssdMessagingNotifyNetworkRelease:
|
|
431 |
numberOfSlots = KMmUssdMessagingNotifyNetworkReleaseSlots;
|
|
432 |
break;
|
|
433 |
default:
|
|
434 |
User::Leave( KErrNotSupported );
|
|
435 |
break;
|
|
436 |
}
|
|
437 |
|
|
438 |
return numberOfSlots;
|
|
439 |
}
|
|
440 |
|
|
441 |
// ---------------------------------------------------------------------------
|
|
442 |
// CMmUssdTsy::GetCaps
|
|
443 |
// This method returns a class that reflects the Ussd messaging
|
|
444 |
// capabilities of the phone. This feature can be completed without sending
|
|
445 |
// message, because TSY knows phones Ussd capabilities
|
|
446 |
// (other items were commented in a header).
|
|
447 |
// ---------------------------------------------------------------------------
|
|
448 |
//
|
|
449 |
TInt CMmUssdTsy::GetCaps(
|
|
450 |
const TTsyReqHandle aTsyReqHandle,
|
|
451 |
TDes8* aCaps )
|
|
452 |
{
|
|
453 |
TInt ret = KErrNone;
|
|
454 |
if( aCaps->MaxLength() >= sizeof(RMobileUssdMessaging::TMobileUssdCapsV1Pckg) )
|
|
455 |
{
|
|
456 |
RMobileUssdMessaging::TMobileUssdCapsV1Pckg* ussdCapsPckg =
|
|
457 |
reinterpret_cast<RMobileUssdMessaging::TMobileUssdCapsV1Pckg*>
|
|
458 |
( aCaps );
|
|
459 |
|
|
460 |
RMobileUssdMessaging::TMobileUssdCapsV1& ussdCaps = ( *ussdCapsPckg )();
|
|
461 |
|
|
462 |
// TSY knows what capabilities it has.
|
|
463 |
// Capabilities depend on the TSY implementation.
|
|
464 |
ussdCaps.iUssdTypes = KUssdTypeCaps;
|
|
465 |
|
|
466 |
ussdCaps.iUssdFormat = RMobileUssdMessaging::KCapsPackedString;
|
|
467 |
}
|
|
468 |
else
|
|
469 |
{
|
|
470 |
ret = KErrArgument;
|
|
471 |
}
|
|
472 |
|
|
473 |
ReqCompleted( aTsyReqHandle, ret );
|
|
474 |
|
|
475 |
return KErrNone;
|
|
476 |
}
|
|
477 |
|
|
478 |
// ---------------------------------------------------------------------------
|
|
479 |
// CMmUssdTsy::ReceiveMessage
|
|
480 |
// This method activates receiving of Ussd messages.
|
|
481 |
// (other items were commented in a header).
|
|
482 |
// ---------------------------------------------------------------------------
|
|
483 |
//
|
|
484 |
TInt CMmUssdTsy::ReceiveMessage(
|
|
485 |
const TTsyReqHandle aTsyReqHandle,
|
|
486 |
TDes8* aData,
|
|
487 |
TDes8* aAttributes )
|
|
488 |
{
|
|
489 |
if(sizeof(RMobileUssdMessaging::TMobileUssdAttributesV1) > aAttributes->MaxLength())
|
|
490 |
{
|
|
491 |
return KErrArgument;
|
|
492 |
}
|
|
493 |
|
|
494 |
if (RMobileUssdMessaging::TGsmUssdMessageData().MaxLength() > aData->MaxLength())
|
|
495 |
{
|
|
496 |
return KErrArgument;
|
|
497 |
}
|
|
498 |
|
|
499 |
TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1>* ussdAttributesPckg =
|
|
500 |
reinterpret_cast<TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1>*>
|
|
501 |
( aAttributes );
|
|
502 |
|
|
503 |
RMobileUssdMessaging::TMobileUssdAttributesV1& ussdAttributes =
|
|
504 |
( *ussdAttributesPckg )();
|
|
505 |
|
|
506 |
// Save request handle
|
|
507 |
iTsyReqHandleStore->SetTsyReqHandle(
|
|
508 |
EMultimodeUssdReceiveMessage, aTsyReqHandle );
|
|
509 |
iReceiveUssdMessagePtr = aData;
|
|
510 |
iReceiveUssdMessageAttributesPtr = &ussdAttributes;
|
|
511 |
|
|
512 |
return KErrNone;
|
|
513 |
}
|
|
514 |
|
|
515 |
// ---------------------------------------------------------------------------
|
|
516 |
// CMmUssdTsy::ReceiveMessageCancel
|
|
517 |
// This method cancels reception of USSD messages
|
|
518 |
// (other items were commented in a header).
|
|
519 |
// ---------------------------------------------------------------------------
|
|
520 |
//
|
|
521 |
void CMmUssdTsy::ReceiveMessageCancel(
|
|
522 |
const TTsyReqHandle aTsyReqHandle )
|
|
523 |
{
|
|
524 |
iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeUssdReceiveMessage );
|
|
525 |
|
|
526 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
527 |
}
|
|
528 |
|
|
529 |
// ---------------------------------------------------------------------------
|
|
530 |
// CMmUssdTsy::CompleteReceiveMessage
|
|
531 |
// This method completes reception of USSD messages request
|
|
532 |
// (other items were commented in a header).
|
|
533 |
// ---------------------------------------------------------------------------
|
|
534 |
//
|
|
535 |
void CMmUssdTsy::CompleteReceiveMessage(
|
|
536 |
TInt aError,
|
|
537 |
CMmDataPackage* aDataPackage )
|
|
538 |
{
|
|
539 |
// TODO if a session is in progress and this is a notification then we need to send back
|
|
540 |
// a USSD busy code.
|
|
541 |
|
|
542 |
TFLOGSTRING("TSY: CMmUssdTsy::CompleteReceiveMessage.\n" );
|
|
543 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
|
|
544 |
EMultimodeUssdReceiveMessage );
|
|
545 |
|
|
546 |
if ( ( EMultimodeUssdReqHandleUnknown != reqHandle ) )
|
|
547 |
{
|
|
548 |
// reset req handle. Returns the deleted req handle
|
|
549 |
reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
550 |
EMultimodeUssdReceiveMessage );
|
|
551 |
|
|
552 |
if ( KErrNone == aError )
|
|
553 |
{
|
|
554 |
TDes8* unpackedReceiveUssdMessagePtr = NULL;
|
|
555 |
RMobileUssdMessaging::TMobileUssdAttributesV1* unpackedReceiveUssdMessageAttributesPtr = NULL;
|
|
556 |
aDataPackage->UnPackData (&unpackedReceiveUssdMessagePtr, &unpackedReceiveUssdMessageAttributesPtr);
|
|
557 |
|
|
558 |
if(iReceiveUssdMessagePtr->MaxLength() >= unpackedReceiveUssdMessagePtr->Length())
|
|
559 |
{
|
|
560 |
*iReceiveUssdMessagePtr = *unpackedReceiveUssdMessagePtr;
|
|
561 |
*iReceiveUssdMessageAttributesPtr = *unpackedReceiveUssdMessageAttributesPtr;
|
|
562 |
}
|
|
563 |
else
|
|
564 |
{
|
|
565 |
aError = KErrArgument;
|
|
566 |
}
|
|
567 |
}
|
|
568 |
ReqCompleted( reqHandle, aError );
|
|
569 |
}
|
|
570 |
}
|
|
571 |
|
|
572 |
// ---------------------------------------------------------------------------
|
|
573 |
// CMmUssdTsy::SendMessageL
|
|
574 |
// Routes send message to message handler.
|
|
575 |
// (other items were commented in a header).
|
|
576 |
// ---------------------------------------------------------------------------
|
|
577 |
//
|
|
578 |
TInt CMmUssdTsy::SendMessageL(
|
|
579 |
const TTsyReqHandle aTsyReqHandle,
|
|
580 |
TDes8* aData,
|
|
581 |
TDes8* aAttributes )
|
|
582 |
{
|
|
583 |
TFLOGSTRING2("TSY: CMmUssdTsy::SendMessage - Data length: %d", aData->Length() );
|
|
584 |
TFLOGSTRING2("TSY: CMmUssdTsy::SendMessageL: iUssdNoFdnCheckFlag: %d", iUssdNoFdnCheckFlag);
|
|
585 |
TInt ret = KErrNone;
|
|
586 |
|
|
587 |
if ( iSsTransactionOngoing )
|
|
588 |
{
|
|
589 |
ret = KErrServerBusy;
|
|
590 |
}
|
|
591 |
else
|
|
592 |
{
|
|
593 |
// Create package
|
|
594 |
CMmDataPackage package;
|
|
595 |
|
|
596 |
// Pack call parameters and mobile call info
|
|
597 |
package.PackData( aData, &aAttributes );
|
|
598 |
|
|
599 |
// Check if NoFdnCheck is used or not
|
|
600 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckUsed )
|
|
601 |
{
|
|
602 |
// Send request to the Domestic OS layer.
|
|
603 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
604 |
EMobileUssdMessagingSendMessageNoFdnCheck, &package );
|
|
605 |
}
|
|
606 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckNotUsed )
|
|
607 |
{
|
|
608 |
// Send request to the Domestic OS layer.
|
|
609 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
610 |
EMobileUssdMessagingSendMessage, &package );
|
|
611 |
}
|
|
612 |
|
|
613 |
iSsTransactionOngoing = ETrue;
|
|
614 |
}
|
|
615 |
|
|
616 |
if ( KErrNone != ret )
|
|
617 |
{
|
|
618 |
ReqCompleted( aTsyReqHandle, ret );
|
|
619 |
iSsTransactionOngoing = EFalse;
|
|
620 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown;
|
|
621 |
}
|
|
622 |
else
|
|
623 |
{
|
|
624 |
/* TODO
|
|
625 |
if (!IsSessionInProgress())
|
|
626 |
{
|
|
627 |
// If a session isn't in progress then reserve the session to
|
|
628 |
// prevent any other attempts at opening a dialogue. If the send
|
|
629 |
// succeeds then the session is opened. If the send fails or the
|
|
630 |
// user cancels the send then we cancel it.
|
|
631 |
// If the session is already in progress then no reservation is
|
|
632 |
// necessary and the success or failure of this send does not
|
|
633 |
// affect the session or dialogue state.
|
|
634 |
(void)ReserveSession();
|
|
635 |
}
|
|
636 |
*/
|
|
637 |
#ifdef REQHANDLE_TIMER
|
|
638 |
// Check if NoFdnCheck is used or not
|
|
639 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckUsed )
|
|
640 |
{
|
|
641 |
// Set timer for the request
|
|
642 |
SetTypeOfResponse( EMultimodeUssdSendMessageNoFdnCheck,
|
|
643 |
aTsyReqHandle );
|
|
644 |
}
|
|
645 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckNotUsed )
|
|
646 |
{
|
|
647 |
// Set timer for the request
|
|
648 |
SetTypeOfResponse( EMultimodeUssdSendMessage,
|
|
649 |
aTsyReqHandle );
|
|
650 |
}
|
|
651 |
#else
|
|
652 |
// Check if NoFdnCheck is used or not
|
|
653 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckUsed )
|
|
654 |
{
|
|
655 |
// Save SendMessageNoFdnCheck request handle, set timer
|
|
656 |
iTsyReqHandleStore->SetTsyReqHandle(
|
|
657 |
EMultimodeUssdSendMessageNoFdnCheck, aTsyReqHandle );
|
|
658 |
}
|
|
659 |
|
|
660 |
if ( iUssdNoFdnCheckFlag == EUssdNoFdnCheckNotUsed )
|
|
661 |
{
|
|
662 |
// Save SendMessage request handle, set timer
|
|
663 |
iTsyReqHandleStore->SetTsyReqHandle(
|
|
664 |
EMultimodeUssdSendMessage, aTsyReqHandle );
|
|
665 |
}
|
|
666 |
#endif // REQHANDLE_TIMER
|
|
667 |
}
|
|
668 |
|
|
669 |
return KErrNone;
|
|
670 |
}
|
|
671 |
|
|
672 |
// ---------------------------------------------------------------------------
|
|
673 |
// CmmUssdTsy::SendMessageCancel
|
|
674 |
// Cancels cancelling of USSD session.
|
|
675 |
// (other items were commented in a header).
|
|
676 |
// ---------------------------------------------------------------------------
|
|
677 |
//
|
|
678 |
TInt CMmUssdTsy::SendMessageCancel(
|
|
679 |
const TTsyReqHandle aTsyReqHandle )
|
|
680 |
{
|
|
681 |
// reset the req handle
|
|
682 |
iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeUssdSendMessage );
|
|
683 |
|
|
684 |
// CancelReserveSession(); TODO
|
|
685 |
|
|
686 |
// complete with cancel
|
|
687 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
688 |
iSsTransactionOngoing = EFalse;
|
|
689 |
|
|
690 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown;
|
|
691 |
|
|
692 |
return KErrNone;
|
|
693 |
}
|
|
694 |
|
|
695 |
// ---------------------------------------------------------------------------
|
|
696 |
// CMmUssdTsy::CompleteSendMessage
|
|
697 |
// Complete SendMessage
|
|
698 |
// (other items were commented in a header).
|
|
699 |
// ---------------------------------------------------------------------------
|
|
700 |
//
|
|
701 |
void CMmUssdTsy::CompleteSendMessage(
|
|
702 |
TInt aError )
|
|
703 |
{
|
|
704 |
TFLOGSTRING("TSY: CMmUssdTsy::CompleteSendMessage.\n" );
|
|
705 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
|
|
706 |
EMultimodeUssdSendMessage );
|
|
707 |
|
|
708 |
if ( EMultimodeUssdReqHandleUnknown != reqHandle )
|
|
709 |
{
|
|
710 |
// reset req handle. Returns the deleted req handle
|
|
711 |
reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
712 |
EMultimodeUssdSendMessage );
|
|
713 |
/* TODO
|
|
714 |
// If the session is already in progress then no session management
|
|
715 |
// action is required. Otherwise we either promote the reserved
|
|
716 |
// session to an open session or cancel the reservation.
|
|
717 |
if ( !IsSessionInProgress() && IsSessionReserved() )
|
|
718 |
{
|
|
719 |
if ( KErrNone == aError )
|
|
720 |
{
|
|
721 |
SetSessionOwnerByTsyHandle( reqHandle );
|
|
722 |
}
|
|
723 |
else
|
|
724 |
{
|
|
725 |
CancelReserveSession();
|
|
726 |
}
|
|
727 |
}
|
|
728 |
*/
|
|
729 |
ReqCompleted( reqHandle, aError );
|
|
730 |
iSsTransactionOngoing = EFalse;
|
|
731 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown;
|
|
732 |
}
|
|
733 |
}
|
|
734 |
|
|
735 |
// ---------------------------------------------------------------------------
|
|
736 |
// CMmUssdTsy::SendReleaseL
|
|
737 |
// This function cancels active ussd session asynchronously
|
|
738 |
// (other items were commented in a header).
|
|
739 |
// ---------------------------------------------------------------------------
|
|
740 |
//
|
|
741 |
TInt CMmUssdTsy::SendReleaseL(
|
|
742 |
const TTsyReqHandle aTsyReqHandle,
|
|
743 |
TDes8* aReturnResult )
|
|
744 |
{
|
|
745 |
/* TODO
|
|
746 |
if ( !IsSessionInProgress() )
|
|
747 |
{
|
|
748 |
// You can't release a dialogue that isn't in progress.
|
|
749 |
return KErrDisconnected;
|
|
750 |
}
|
|
751 |
*/
|
|
752 |
TTsyReqHandle sendReleaseHandle =
|
|
753 |
iTsyReqHandleStore->GetTsyReqHandle( EMultimodeUssdSendRelease );
|
|
754 |
|
|
755 |
if ( 0 < sendReleaseHandle )
|
|
756 |
{
|
|
757 |
// The request is already in processing because of previous request
|
|
758 |
// Complete request with status value informing the client about
|
|
759 |
// the situation.
|
|
760 |
TFLOGSTRING("LTSY: CMmUssdTsy::SendRelease - KErrServerBusy");
|
|
761 |
ReqCompleted( aTsyReqHandle, KErrServerBusy );
|
|
762 |
}
|
|
763 |
else
|
|
764 |
{
|
|
765 |
TFLOGSTRING("TSY: CMmUssdTsy::SendRelease called");
|
|
766 |
|
|
767 |
TInt ret = KErrGeneral;
|
|
768 |
|
|
769 |
TPckg<RMobilePhone::TMobilePhoneSendSSRequestV3>* ussdSendSSRequestPckg =
|
|
770 |
reinterpret_cast< TPckg<RMobilePhone::TMobilePhoneSendSSRequestV3>* >
|
|
771 |
( aReturnResult );
|
|
772 |
|
|
773 |
if ( sizeof(RMobilePhone::TMobilePhoneSendSSRequestV3) >
|
|
774 |
ussdSendSSRequestPckg->MaxLength() )
|
|
775 |
{
|
|
776 |
ret = KErrArgument;
|
|
777 |
}
|
|
778 |
else
|
|
779 |
{
|
|
780 |
RMobilePhone::TMobilePhoneSendSSRequestV3& returnResult =
|
|
781 |
( *ussdSendSSRequestPckg )();
|
|
782 |
|
|
783 |
iReturnResultPtr = &returnResult;
|
|
784 |
|
|
785 |
// Send request to the Domestic OS layer.
|
|
786 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
787 |
EMobileUssdMessagingSendRelease );
|
|
788 |
}
|
|
789 |
|
|
790 |
// If ret is not KErrNone
|
|
791 |
if ( KErrNone != ret )
|
|
792 |
{
|
|
793 |
ReqCompleted( aTsyReqHandle, ret );
|
|
794 |
}
|
|
795 |
else
|
|
796 |
{
|
|
797 |
#ifdef REQHANDLE_TIMER
|
|
798 |
// Set timer for the request
|
|
799 |
SetTypeOfResponse( EMultimodeUssdSendRelease, aTsyReqHandle );
|
|
800 |
#else
|
|
801 |
// Save SendMessage request handle, set timer
|
|
802 |
iTsyReqHandleStore->SetTsyReqHandle(
|
|
803 |
EMultimodeUssdSendRelease, aTsyReqHandle );
|
|
804 |
#endif // REQHANDLE_TIMER
|
|
805 |
}
|
|
806 |
}
|
|
807 |
|
|
808 |
return KErrNone;
|
|
809 |
}
|
|
810 |
|
|
811 |
// ---------------------------------------------------------------------------
|
|
812 |
// CMmUssdTsy::CompleteSendRelease
|
|
813 |
// This method completes an outstanding SendRelease request.
|
|
814 |
// (other items were commented in a header).
|
|
815 |
// ---------------------------------------------------------------------------
|
|
816 |
//
|
|
817 |
void CMmUssdTsy::CompleteSendRelease(
|
|
818 |
TInt aErrorCode,
|
|
819 |
CMmDataPackage* aDataPackage )
|
|
820 |
{
|
|
821 |
TFLOGSTRING("TSY: CMmUssdTsy::CompleteSendRelease" );
|
|
822 |
// reset req handle. Returns the deleted req handle
|
|
823 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
824 |
EMultimodeUssdSendRelease );
|
|
825 |
|
|
826 |
if( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
|
|
827 |
{
|
|
828 |
if ( KErrNone == aErrorCode )
|
|
829 |
{
|
|
830 |
aDataPackage->UnPackData ( *iReturnResultPtr );
|
|
831 |
}
|
|
832 |
// EndSession(); TODO
|
|
833 |
ReqCompleted( reqHandle, aErrorCode );
|
|
834 |
}
|
|
835 |
}
|
|
836 |
|
|
837 |
// ---------------------------------------------------------------------------
|
|
838 |
// CmmUssdTsy::SendReleaseCancel
|
|
839 |
// Cancels cancelling of USSD session.
|
|
840 |
// (other items were commented in a header).
|
|
841 |
// ---------------------------------------------------------------------------
|
|
842 |
//
|
|
843 |
TInt CMmUssdTsy::SendReleaseCancel()
|
|
844 |
{
|
|
845 |
// reset the req handle
|
|
846 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
847 |
EMultimodeUssdSendRelease );
|
|
848 |
|
|
849 |
if ( EMultimodeUssdReqHandleUnknown != reqHandle )
|
|
850 |
{
|
|
851 |
// complete with cancel
|
|
852 |
ReqCompleted( reqHandle, KErrCancel );
|
|
853 |
}
|
|
854 |
|
|
855 |
return KErrNone;
|
|
856 |
}
|
|
857 |
|
|
858 |
// ---------------------------------------------------------------------------
|
|
859 |
// CMmUssdTsy::NotifyNetworkRelease
|
|
860 |
// This method activates notifying of network release
|
|
861 |
// (other items were commented in a header).
|
|
862 |
// ---------------------------------------------------------------------------
|
|
863 |
//
|
|
864 |
TInt CMmUssdTsy::NotifyNetworkRelease(
|
|
865 |
const TTsyReqHandle aTsyReqHandle,
|
|
866 |
TDes8* aMsgData,
|
|
867 |
TDes8* aMsgAttributes) // aMsgAttributes may be NULL
|
|
868 |
{
|
|
869 |
TFLOGSTRING("TSY: CMmUssdTsy::NotifyNetworkRelease" );
|
|
870 |
|
|
871 |
if (aMsgData->MaxLength() < sizeof(RMobilePhone::TMobilePhoneSendSSRequestV3Pckg))
|
|
872 |
{
|
|
873 |
TFLOGSTRING ("TSY: CMmNetTsy::NotifyNetworkRelease Bad size argument (arg1)");
|
|
874 |
// Complete the request with appropiate error
|
|
875 |
return KErrArgument;
|
|
876 |
}
|
|
877 |
if (aMsgAttributes &&
|
|
878 |
aMsgAttributes->MaxLength() < sizeof(RMobileUssdMessaging::TMobileUssdAttributesV1Pckg))
|
|
879 |
{
|
|
880 |
TFLOGSTRING ("TSY: CMmNetTsy::NotifyNetworkRelease Bad size argument (arg2)");
|
|
881 |
// Complete the request with appropiate error
|
|
882 |
return KErrArgument;
|
|
883 |
}
|
|
884 |
|
|
885 |
TPckg<RMobilePhone::TMobilePhoneSendSSRequestV3>* ussdSendSSRequestPckg =
|
|
886 |
reinterpret_cast< TPckg<RMobilePhone::TMobilePhoneSendSSRequestV3>* >
|
|
887 |
( aMsgData );
|
|
888 |
|
|
889 |
RMobilePhone::TMobilePhoneSendSSRequestV3& msgData =
|
|
890 |
( *ussdSendSSRequestPckg )();
|
|
891 |
|
|
892 |
iReturnNotifyPtr = &msgData;
|
|
893 |
|
|
894 |
if (aMsgAttributes != NULL)
|
|
895 |
{
|
|
896 |
RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* ussdAttributesPckg =
|
|
897 |
reinterpret_cast< RMobileUssdMessaging::TMobileUssdAttributesV1Pckg* > (aMsgAttributes);
|
|
898 |
|
|
899 |
RMobileUssdMessaging::TMobileUssdAttributesV1& msgAttributes = (*ussdAttributesPckg)();
|
|
900 |
|
|
901 |
iReturnNotifyUssdMessageAttributesPtr = &msgAttributes;
|
|
902 |
}
|
|
903 |
else
|
|
904 |
{
|
|
905 |
iReturnNotifyUssdMessageAttributesPtr = NULL;
|
|
906 |
}
|
|
907 |
#ifdef REQHANDLE_TIMER
|
|
908 |
// Set timer for the request
|
|
909 |
SetTypeOfResponse( EMultimodeUssdNotifyNetworkRelease, aTsyReqHandle );
|
|
910 |
#else
|
|
911 |
// Save SendMessage request handle, set timer
|
|
912 |
iTsyReqHandleStore->SetTsyReqHandle(
|
|
913 |
EMultimodeUssdNotifyNetworkRelease, aTsyReqHandle );
|
|
914 |
#endif // REQHANDLE_TIMER
|
|
915 |
|
|
916 |
return KErrNone;
|
|
917 |
}
|
|
918 |
|
|
919 |
// ---------------------------------------------------------------------------
|
|
920 |
// CMmUssdTsy::CompleteNotifyNetworkRelease
|
|
921 |
// This method completes notify network release request.
|
|
922 |
// (other items were commented in a header).
|
|
923 |
// ---------------------------------------------------------------------------
|
|
924 |
//
|
|
925 |
void CMmUssdTsy::CompleteNotifyNetworkRelease(
|
|
926 |
TInt aErrorCode,
|
|
927 |
CMmDataPackage* aDataPackage )
|
|
928 |
{
|
|
929 |
// EndSession(); TODO
|
|
930 |
|
|
931 |
TFLOGSTRING2("TSY: CMmUssdTsy::CompleteNotifyNetworkRelease. Error: %d", aErrorCode );
|
|
932 |
// reset req handle. Returns the deleted req handle
|
|
933 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
934 |
EMultimodeUssdNotifyNetworkRelease );
|
|
935 |
|
|
936 |
if( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
|
|
937 |
{
|
|
938 |
if ( KErrNone == aErrorCode )
|
|
939 |
{
|
|
940 |
RMobilePhone::TMobilePhoneSendSSRequestV3* tempReturnNotifyPtr;
|
|
941 |
if (iReturnNotifyUssdMessageAttributesPtr != NULL)
|
|
942 |
{
|
|
943 |
RMobileUssdMessaging::TMobileUssdAttributesV1* tempReturnNotifyUssdMessageAttributesPtr;
|
|
944 |
aDataPackage->UnPackData ( &tempReturnNotifyPtr, &tempReturnNotifyUssdMessageAttributesPtr );
|
|
945 |
if (tempReturnNotifyPtr != NULL)
|
|
946 |
{
|
|
947 |
*iReturnNotifyPtr = *tempReturnNotifyPtr;
|
|
948 |
}
|
|
949 |
else
|
|
950 |
{
|
|
951 |
iReturnNotifyPtr->iOpCode = KErrNone;
|
|
952 |
iReturnNotifyPtr->iAdditionalInfo.Append( KErrNone );
|
|
953 |
}
|
|
954 |
if (tempReturnNotifyUssdMessageAttributesPtr != NULL)
|
|
955 |
{
|
|
956 |
*iReturnNotifyUssdMessageAttributesPtr = *tempReturnNotifyUssdMessageAttributesPtr;
|
|
957 |
}
|
|
958 |
else
|
|
959 |
{
|
|
960 |
iReturnNotifyUssdMessageAttributesPtr->iFormat = RMobileUssdMessaging::EFormatUnspecified;
|
|
961 |
iReturnNotifyUssdMessageAttributesPtr->iType = RMobileUssdMessaging::EUssdUnknown;
|
|
962 |
}
|
|
963 |
}
|
|
964 |
else
|
|
965 |
{
|
|
966 |
aDataPackage->UnPackData ( &tempReturnNotifyPtr );
|
|
967 |
if(tempReturnNotifyPtr != NULL)
|
|
968 |
{
|
|
969 |
*iReturnNotifyPtr = *tempReturnNotifyPtr;
|
|
970 |
}
|
|
971 |
else
|
|
972 |
{
|
|
973 |
iReturnNotifyPtr->iOpCode = KErrNone;
|
|
974 |
iReturnNotifyPtr->iAdditionalInfo.Append( KErrNone );
|
|
975 |
}
|
|
976 |
}
|
|
977 |
}
|
|
978 |
// Null ret pointers
|
|
979 |
iReturnNotifyPtr = NULL;
|
|
980 |
iReturnNotifyUssdMessageAttributesPtr = NULL;
|
|
981 |
|
|
982 |
// Complete the client request
|
|
983 |
ReqCompleted( reqHandle, aErrorCode );
|
|
984 |
}
|
|
985 |
}
|
|
986 |
|
|
987 |
// ---------------------------------------------------------------------------
|
|
988 |
// CmmUssdTsy::NotifyNetworkReleaseCancel
|
|
989 |
// Cancels notify network release request.
|
|
990 |
// (other items were commented in a header).
|
|
991 |
// ---------------------------------------------------------------------------
|
|
992 |
//
|
|
993 |
TInt CMmUssdTsy::NotifyNetworkReleaseCancel()
|
|
994 |
{
|
|
995 |
// reset the req handle
|
|
996 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
997 |
EMultimodeUssdNotifyNetworkRelease );
|
|
998 |
|
|
999 |
// This will always be true if the etel is handling the request correctly.
|
|
1000 |
// In case etel fails to block the request this will prevent crashing.
|
|
1001 |
if ( EMultimodeUssdReqHandleUnknown != reqHandle )
|
|
1002 |
{
|
|
1003 |
// Null ret pointers
|
|
1004 |
iReturnNotifyPtr = NULL;
|
|
1005 |
iReturnNotifyUssdMessageAttributesPtr = NULL;
|
|
1006 |
|
|
1007 |
// complete with cancel
|
|
1008 |
ReqCompleted( reqHandle, KErrCancel );
|
|
1009 |
}
|
|
1010 |
|
|
1011 |
return KErrNone;
|
|
1012 |
}
|
|
1013 |
|
|
1014 |
// ---------------------------------------------------------------------------
|
|
1015 |
// CMmUssdTsy::ResetVariables
|
|
1016 |
// Reset used member variables.
|
|
1017 |
// (other items were commented in a header).
|
|
1018 |
// ---------------------------------------------------------------------------
|
|
1019 |
//
|
|
1020 |
void CMmUssdTsy::ResetVariables()
|
|
1021 |
{
|
|
1022 |
iReceiveUssdMessagePtr = NULL;
|
|
1023 |
iReceiveUssdMessageAttributesPtr = NULL;
|
|
1024 |
iReturnResultPtr = NULL;
|
|
1025 |
iReturnNotifyPtr = NULL;
|
|
1026 |
iReturnNotifyUssdMessageAttributesPtr = NULL;
|
|
1027 |
}
|
|
1028 |
|
|
1029 |
#ifdef REQHANDLE_TIMER
|
|
1030 |
// ---------------------------------------------------------------------------
|
|
1031 |
// CMmUssdTsy::SetTypeOfResponse
|
|
1032 |
// Sets the type of response for a given Handle. Automatic
|
|
1033 |
// mode includes an automatic response in case of non response
|
|
1034 |
// from the DOS in a specified time
|
|
1035 |
// (other items were commented in a header).
|
|
1036 |
// ---------------------------------------------------------------------------
|
|
1037 |
//
|
|
1038 |
void CMmUssdTsy::SetTypeOfResponse(
|
|
1039 |
const TInt aReqHandleType,
|
|
1040 |
const TTsyReqHandle aTsyReqHandle )
|
|
1041 |
{
|
|
1042 |
TInt timeOut( 0 );
|
|
1043 |
|
|
1044 |
switch ( aReqHandleType )
|
|
1045 |
{
|
|
1046 |
case EMultimodeUssdSendMessage:
|
|
1047 |
timeOut = KMmUssdSendMessageTimeOut;
|
|
1048 |
break;
|
|
1049 |
case EMultimodeUssdSendMessageNoFdnCheck:
|
|
1050 |
timeOut = KMmUssdSendMessageNoFdnCheckTimeOut;
|
|
1051 |
break;
|
|
1052 |
case EMultimodeUssdSendRelease:
|
|
1053 |
timeOut = KMmUssdSendReleaseTimeOut;
|
|
1054 |
break;
|
|
1055 |
default:
|
|
1056 |
// Does not use timer
|
|
1057 |
iTsyReqHandleStore->SetTsyReqHandle(
|
|
1058 |
aReqHandleType, aTsyReqHandle );
|
|
1059 |
break;
|
|
1060 |
}
|
|
1061 |
|
|
1062 |
if ( timeOut > 0 )
|
|
1063 |
{
|
|
1064 |
// The timeout parameter is given in seconds.
|
|
1065 |
iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType,
|
|
1066 |
aTsyReqHandle, timeOut );
|
|
1067 |
}
|
|
1068 |
}
|
|
1069 |
|
|
1070 |
// ---------------------------------------------------------------------------
|
|
1071 |
// CMmUssdTsy::Complete
|
|
1072 |
// Completes the request due timer expiration
|
|
1073 |
// (other items were commented in a header).
|
|
1074 |
// ---------------------------------------------------------------------------
|
|
1075 |
//
|
|
1076 |
void CMmUssdTsy::Complete(
|
|
1077 |
TInt aReqHandleType,
|
|
1078 |
TInt aError )
|
|
1079 |
{
|
|
1080 |
// All possible TSY req handle types are listed in the
|
|
1081 |
// switch case below.
|
|
1082 |
|
|
1083 |
RMobilePhone::TMobilePhoneSendSSRequestV3 returnResult;
|
|
1084 |
// create package.
|
|
1085 |
CMmDataPackage package;
|
|
1086 |
|
|
1087 |
switch( aReqHandleType )
|
|
1088 |
{
|
|
1089 |
// Cases handled with automatic completion
|
|
1090 |
case EMultimodeUssdSendMessage:
|
|
1091 |
CompleteSendMessage( aError );
|
|
1092 |
break;
|
|
1093 |
case EMultimodeUssdSendMessageNoFdnCheck:
|
|
1094 |
CompleteSendMessageNoFdnCheck( aError );
|
|
1095 |
break;
|
|
1096 |
case EMultimodeUssdSendRelease:
|
|
1097 |
returnResult.iOpCode = static_cast< TUint8 >( KErrTimedOut );
|
|
1098 |
returnResult.iAdditionalInfo.Append ( KErrNone );
|
|
1099 |
|
|
1100 |
// pack the data
|
|
1101 |
package.PackData( &returnResult );
|
|
1102 |
CompleteSendRelease( aError, &package );
|
|
1103 |
break;
|
|
1104 |
default:
|
|
1105 |
ReqCompleted( iTsyReqHandleStore->ResetTsyReqHandle(
|
|
1106 |
aReqHandleType ), aError );
|
|
1107 |
break;
|
|
1108 |
}
|
|
1109 |
}
|
|
1110 |
#endif // REQHANDLE_TIMER
|
|
1111 |
|
|
1112 |
#ifdef TF_LOGGING_ENABLED
|
|
1113 |
// ---------------------------------------------------------------------------
|
|
1114 |
// CMmUssdTsy::ReqCompleted
|
|
1115 |
// Overloads CTelObject::ReqCompleted for logging purposes. It
|
|
1116 |
// prints the aTsyReqHandle and aError variable in the log file and then
|
|
1117 |
// calls CTelObject::ReqCompleted.
|
|
1118 |
// (other items were commented in a header).
|
|
1119 |
// ---------------------------------------------------------------------------
|
|
1120 |
//
|
|
1121 |
void CMmUssdTsy::ReqCompleted(
|
|
1122 |
const TTsyReqHandle aTsyReqHandle,
|
|
1123 |
const TInt aError )
|
|
1124 |
{
|
|
1125 |
TFLOGSTRING3("TSY: CMmUssdTsy::ReqCompleted. Handle: %d Error: %d", aTsyReqHandle, aError);
|
|
1126 |
CTelObject::ReqCompleted( aTsyReqHandle, aError );
|
|
1127 |
}
|
|
1128 |
#endif // TF_LOGGING_ENABLED
|
|
1129 |
|
|
1130 |
// ---------------------------------------------------------------------------
|
|
1131 |
// CMmUssdTsy::Phone
|
|
1132 |
// This method returns pointer to the Phone object.
|
|
1133 |
// (other items were commented in a header).
|
|
1134 |
// ---------------------------------------------------------------------------
|
|
1135 |
//
|
|
1136 |
CMmPhoneTsy* CMmUssdTsy::Phone()
|
|
1137 |
{
|
|
1138 |
return iMmPhone;
|
|
1139 |
}
|
|
1140 |
|
|
1141 |
// ---------------------------------------------------------------------------
|
|
1142 |
// CMmUssdTsy::IsRequestPossibleInOffLine
|
|
1143 |
// Checks whether a ETel request can be performed or not while offline mode is
|
|
1144 |
// enabled
|
|
1145 |
// (other items were commented in a header).
|
|
1146 |
// ---------------------------------------------------------------------------
|
|
1147 |
//
|
|
1148 |
TBool CMmUssdTsy::IsRequestPossibleInOffline( TInt aIpc ) const
|
|
1149 |
{
|
|
1150 |
TBool isRequestPossible ( ETrue );
|
|
1151 |
|
|
1152 |
switch ( aIpc )
|
|
1153 |
{
|
|
1154 |
case EMobileUssdMessagingSendMessage:
|
|
1155 |
case EMobileUssdMessagingSendMessageNoFdnCheck:
|
|
1156 |
case EMobileUssdMessagingSendRelease:
|
|
1157 |
isRequestPossible = EFalse;
|
|
1158 |
break;
|
|
1159 |
case EMobileUssdMessagingReceiveMessage:
|
|
1160 |
default:
|
|
1161 |
break;
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
return isRequestPossible;
|
|
1165 |
}
|
|
1166 |
|
|
1167 |
// ---------------------------------------------------------------------------
|
|
1168 |
// CMmUssdTsy::SendMessageNoFDNCheckCancel
|
|
1169 |
// Cancels SendMessageNoFDNCheck request.
|
|
1170 |
// (other items were commented in a header).
|
|
1171 |
// ---------------------------------------------------------------------------
|
|
1172 |
//
|
|
1173 |
TInt CMmUssdTsy::SendMessageNoFdnCheckCancel(
|
|
1174 |
const TTsyReqHandle aTsyReqHandle )
|
|
1175 |
{
|
|
1176 |
TFLOGSTRING("TSY: CMmUssdTsy::SendMessageNoFdnCheckCancel" );
|
|
1177 |
|
|
1178 |
// reset the req handle
|
|
1179 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
1180 |
EMultimodeUssdSendMessageNoFdnCheck );
|
|
1181 |
|
|
1182 |
if ( EMultimodeUssdReqHandleUnknown < reqHandle )
|
|
1183 |
{
|
|
1184 |
// complete with cancel
|
|
1185 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
1186 |
iSsTransactionOngoing = EFalse;
|
|
1187 |
}
|
|
1188 |
|
|
1189 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown;
|
|
1190 |
return KErrNone;
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
// ---------------------------------------------------------------------------
|
|
1194 |
// CMmUssdTsy::CompleteSendMessageNoFdnCheck
|
|
1195 |
// Complete SendMessage
|
|
1196 |
// (other items were commented in a header).
|
|
1197 |
// ---------------------------------------------------------------------------
|
|
1198 |
//
|
|
1199 |
void CMmUssdTsy::CompleteSendMessageNoFdnCheck(
|
|
1200 |
TInt aError )
|
|
1201 |
{
|
|
1202 |
TFLOGSTRING("TSY: CMmUssdTsy::CompleteSendMessageNoFdnCheck.\n" );
|
|
1203 |
// get reg handle
|
|
1204 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
|
|
1205 |
EMultimodeUssdSendMessageNoFdnCheck );
|
|
1206 |
|
|
1207 |
if ( EMultimodeUssdReqHandleUnknown != reqHandle )
|
|
1208 |
{
|
|
1209 |
// reset req handle. Returns the deleted req handle
|
|
1210 |
reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
1211 |
EMultimodeUssdSendMessageNoFdnCheck );
|
|
1212 |
|
|
1213 |
ReqCompleted( reqHandle, aError );
|
|
1214 |
iSsTransactionOngoing = EFalse;
|
|
1215 |
iUssdNoFdnCheckFlag = EUssdNoFdnCheckUnknown;
|
|
1216 |
}
|
|
1217 |
}
|
|
1218 |
|
|
1219 |
|
|
1220 |
// End of file
|
|
1221 |
|
|
1222 |
|