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