satengine/satserver/Commands/CallControlCmd/src/CCallControlHandler.cpp
changeset 33 8d5d7fcf9b59
child 48 78df25012fda
equal deleted inserted replaced
32:1f002146abb4 33:8d5d7fcf9b59
       
     1 /*
       
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Handles CallControl command
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //Include Files
       
    20 #include    <utf.h>
       
    21 #include    "MSatApi.h"
       
    22 #include    "MSatUtils.h"
       
    23 #include    "MSatUiSession.h"
       
    24 #include    "MSatSUiClientHandler.h"
       
    25 #include    "CCallControlHandler.h"
       
    26 #include    "ccallcontrolrequesthandler.h"
       
    27 #include    "msatmultimodeapi.h"
       
    28 #include    "SatLog.h"
       
    29 
       
    30 // USSD DCS coding.
       
    31 const TUint8 KSatDcs7Bit( 0x40 );
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CCallControlHandler::CCallControlHandler
       
    37 // C++ default constructor can NOT contain any code, that
       
    38 // might leave.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 //lint -e{1403, 1769} Can not be initialized, harmless.
       
    42 CCallControlHandler::CCallControlHandler() :
       
    43     CSatCommandHandler(),
       
    44     iCallControlData(),
       
    45     iCallControlPckg( iCallControlData ),
       
    46     iCallControlSendData(),
       
    47     iCallControlSendDataPckg( iCallControlSendData ),
       
    48     iCallControlUiRespData(),
       
    49     iCallControlUiRespDataPckg( iCallControlUiRespData ),
       
    50     iCcStatus( ECcIdle )
       
    51     {
       
    52     LOG( SIMPLE, "CALLCONTROL: \
       
    53         CCallControlHandler::CCallControlHandler calling - exiting" )
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CCallControlHandler::ConstructL
       
    58 // Symbian 2nd phase constructor can leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 void CCallControlHandler::ConstructL()
       
    62     {
       
    63     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::ConstructL calling" )
       
    64 
       
    65     iUtils->RegisterServiceRequestL(
       
    66         ESatSProactiveNotification,
       
    67         ESatSProactiveNotificationResponse,
       
    68         this );
       
    69 
       
    70     iRequestHandler = 
       
    71         CCallControlRequestHandler::NewL( iUtils->MultiModeApi(), this ); 
       
    72 
       
    73     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::ConstructL exiting" )
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CCallControlHandler::NewL
       
    78 // Two-phased constructor.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 CCallControlHandler* CCallControlHandler::NewL( MSatUtils* aUtils )
       
    82     {
       
    83     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::NewL calling" )
       
    84 
       
    85     CCallControlHandler* self = new( ELeave ) CCallControlHandler;
       
    86 
       
    87     CleanupStack::PushL( self );
       
    88     self->BaseConstructL( aUtils );
       
    89     self->ConstructL();
       
    90     CleanupStack::Pop( self );
       
    91 
       
    92     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::NewL exiting" )
       
    93     return self;
       
    94     }
       
    95 
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CCallControlHandler::~CCallControlHandler
       
    99 // Destructor
       
   100 // -----------------------------------------------------------------------------
       
   101 CCallControlHandler::~CCallControlHandler()
       
   102     {
       
   103     LOG( SIMPLE,
       
   104         "CALLCONTROL: CCallControlHandler::~CCallControlHandler calling" )
       
   105 
       
   106     Cancel();
       
   107 
       
   108     LOG( SIMPLE,
       
   109         "CALLCONTROL: CCallControlHandler::~CCallControlHandler exiting" )
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CCallControlHandler::ClientResponse
       
   114 // (other items were commented in a header).
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CCallControlHandler::ClientResponse()
       
   118     {
       
   119     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::ClientResponse calling" )
       
   120 
       
   121     CallControlClientOperation();    
       
   122 
       
   123     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::ClientResponse exiting" )
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CCallControlHandler::DoCancel
       
   128 // Cancels the sat request.
       
   129 // (other items were commented in a header).
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 void CCallControlHandler::DoCancel()
       
   133     {
       
   134     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::DoCancel calling" )
       
   135 
       
   136     iUtils->USatAPI().NotifyCallControlCancel();
       
   137     iRequestHandler->CancelOperation( iCcStatus ); 
       
   138 
       
   139     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::DoCancel exiting" )
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CCallControlHandler::IssueUSATRequest
       
   144 // (other items were commented in a header).
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 void CCallControlHandler::IssueUSATRequest( TRequestStatus& aStatus )
       
   148     {
       
   149     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::IssueUSATRequest calling" )
       
   150 
       
   151     // Clear the IPC package.
       
   152     new (&iCallControlData) RSat::TCallControlV6();
       
   153     iNeedUiSession = EFalse;
       
   154     iUtils->USatAPI().NotifyCallControl( aStatus, iCallControlPckg );
       
   155 
       
   156     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::IssueUSATRequest exiting" )
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CCallControlHandler::CommandAllowed
       
   161 // (other items were commented in a header).
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 TBool CCallControlHandler::CommandAllowed()
       
   165     {
       
   166     LOG( SIMPLE,
       
   167         "CALLCONTROL: CCallControlHandler::CommandAllowed calling - exiting" )
       
   168     return ETrue;
       
   169     }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CCallControlHandler::NeedUiSession
       
   173 // (other items were commented in a header).
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 TBool CCallControlHandler::NeedUiSession()
       
   177     {
       
   178     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::NeedUiSession calling" )
       
   179     // UI is not needed, if control is AllowedWithMod and AlphaId is NULL or
       
   180     // control is Allowed and AlphaId is not provided
       
   181 
       
   182     //  Get values
       
   183     RSat::TAlphaId alphaId;
       
   184     RSat::TAlphaIdValidity validity;
       
   185     RSat::TControlResult controlResult;
       
   186 
       
   187     // Get Alpha Id and Control result by SIM.
       
   188     iCallControlPckg().GetAlphaId( validity, alphaId );
       
   189     iCallControlPckg().GetCcGeneralResult( controlResult );
       
   190 
       
   191     const TBool alphaIdNull( RSat::EAlphaIdNull == alphaId.iStatus ||
       
   192                              RSat::EAlphaIdNotSet == alphaId.iStatus );
       
   193 
       
   194     const TBool controlAllowed( 
       
   195                 RSat::EAllowedNoModification == controlResult ||
       
   196                 RSat::EControlResultNotSet == controlResult );
       
   197     LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::NeedUiSession \
       
   198             controlResult: %d", controlResult )
       
   199     LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::NeedUiSession \
       
   200             alphaId.iStatus: %d", alphaId.iStatus )    
       
   201 
       
   202     if ( RSat::EAllowedWithModifications == controlResult && 
       
   203          alphaIdNull )
       
   204         {
       
   205         LOG( NORMAL, "CALLCONTROL: CCallControlHandler::NeedUiSession \
       
   206              EAllowedWithModifications" )
       
   207         iNeedUiSession = EFalse;
       
   208         }
       
   209     else if ( controlAllowed && ( RSat::EAlphaIdProvided != alphaId.iStatus ) )
       
   210         {
       
   211         LOG( NORMAL, "CALLCONTROL: CCallControlHandler::NeedUiSession \
       
   212              RSat::EAlphaIdProvided != alphaId.iStatus" )
       
   213         iNeedUiSession = EFalse;
       
   214         }
       
   215     else
       
   216         {
       
   217         iNeedUiSession = ETrue;
       
   218         }
       
   219 
       
   220     // Notify other commands that we are executing.
       
   221     iUtils->NotifyEvent( MSatUtils::ECallControlExecuting );
       
   222 
       
   223     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::NeedUiSession exiting" )
       
   224     return iNeedUiSession;
       
   225     }
       
   226 
       
   227 // -----------------------------------------------------------------------------
       
   228 // CCallControlHandler::HandleCommand
       
   229 // (other items were commented in a header).
       
   230 // -----------------------------------------------------------------------------
       
   231 //
       
   232 void CCallControlHandler::HandleCommand()
       
   233     {
       
   234     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::HandleCommand calling" )
       
   235 
       
   236     // Check do we need UI
       
   237     if ( iNeedUiSession )
       
   238         {
       
   239         // Clear send data.
       
   240         TSatNotificationV1 clear;
       
   241         iCallControlSendData = clear;
       
   242 
       
   243         //  Build the IPC package.
       
   244         RSat::TAlphaId alphaId;
       
   245         RSat::TAlphaIdValidity validity;
       
   246         RSat::TControlResult controlResult;
       
   247 
       
   248         // Get Alpha Id and Control result by SIM.
       
   249         iCallControlPckg().GetAlphaId( validity, alphaId );
       
   250         iCallControlPckg().GetCcGeneralResult( controlResult );
       
   251         
       
   252         // Enums to UI related parameters
       
   253         TSatAlphaIdStatus satAlphaIdStatus;
       
   254         TSatControlResult satControlResult;
       
   255 
       
   256         LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::HandleCommand\
       
   257                 alphaId.iStatus: %d", alphaId.iStatus ) 
       
   258         LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::HandleCommand\
       
   259                 controlResult: %d", controlResult )
       
   260         // Map RSat value
       
   261         switch ( alphaId.iStatus )
       
   262             {
       
   263             case RSat::EAlphaIdProvided :
       
   264                 {
       
   265                 satAlphaIdStatus = ESatAlphaIdNotNull;
       
   266                 break;
       
   267                 }
       
   268 
       
   269             case RSat::EAlphaIdNotPresent :
       
   270                 {
       
   271                 satAlphaIdStatus = ESatAlphaIdNotProvided;
       
   272                 break;
       
   273                 }
       
   274 
       
   275             // Use this also as a default value
       
   276             case RSat::EAlphaIdNull :
       
   277             case RSat::EAlphaIdNotSet :
       
   278             default :
       
   279                 {
       
   280                 satAlphaIdStatus = ESatAlphaIdNull;
       
   281                 break;
       
   282                 }
       
   283             }
       
   284 
       
   285         // Map RSat value
       
   286         switch ( controlResult )
       
   287             {
       
   288             case RSat::ENotAllowed :
       
   289                 {
       
   290                 satControlResult = ESatNotAllowed;
       
   291                 break;
       
   292                 }
       
   293 
       
   294             case RSat::EAllowedWithModifications :
       
   295                 {
       
   296                 satControlResult = ESatAllowedWithModifications;
       
   297                 break;
       
   298                 }
       
   299 
       
   300             // Use this also as a default value
       
   301             case RSat::EAllowedNoModification :
       
   302             case RSat::EControlResultNotSet :
       
   303             default :
       
   304                 {
       
   305                 satControlResult = ESatAllowedNoModification;
       
   306                 break;
       
   307                 }
       
   308             }
       
   309 
       
   310         // Get information needed.
       
   311         iCallControlSendData.iCommand = ESatSCallControlNotify;
       
   312         iCallControlSendData.iText = alphaId.iAlphaId;
       
   313         iCallControlSendData.iAlphaIdStatus = satAlphaIdStatus;
       
   314         iCallControlSendData.iControlResult = satControlResult;
       
   315 
       
   316         // Register notification observer
       
   317         TRAPD( regErr, iUtils->RegisterServiceRequestL(
       
   318             ESatSProactiveNotification,
       
   319             ESatSProactiveNotificationResponse,
       
   320             this )
       
   321             ); // TRAPD
       
   322         LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::HandleCommand \
       
   323                 regErr: %d",regErr )
       
   324         // No need to check error value, since we cannot send terminal
       
   325         // response for this command
       
   326         if ( KErrNone == regErr )
       
   327             {
       
   328             // Get UISession.
       
   329             MSatUiSession* uiSession = iUtils->SatUiHandler().UiSession();
       
   330 
       
   331             // Send command to SatClient.
       
   332             uiSession->SendCommand( &iCallControlSendDataPckg,
       
   333                 &iCallControlUiRespDataPckg, ESatSProactiveNotification );
       
   334             }
       
   335         }
       
   336     else
       
   337         {
       
   338         LOG( NORMAL, "CCallControlHandler::HandleCommand UI isn't needed" )
       
   339         CallControlClientOperation();
       
   340         }
       
   341     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::HandleCommand exiting" )
       
   342     }
       
   343 
       
   344 // -----------------------------------------------------------------------------
       
   345 // CCallControlHandler::UiLaunchFailed
       
   346 // (other items were commented in a header).
       
   347 // -----------------------------------------------------------------------------
       
   348 //
       
   349 void CCallControlHandler::UiLaunchFailed()
       
   350     {
       
   351     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::UiLaunchFailed calling" )
       
   352 
       
   353     // We cannot send terminal response to SIM since it doesn't
       
   354     // expect terminal response from MoSmControl command...
       
   355 
       
   356     // Inform the session that we are done here
       
   357     iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
       
   358 
       
   359     // Start to receive more commands.
       
   360     Start();
       
   361 
       
   362     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::UiLaunchFailed exiting" )
       
   363     }
       
   364 
       
   365 // -----------------------------------------------------------------------------
       
   366 // CCallControlHandler::CallControlClientOperation
       
   367 // (other items were commented in a header).
       
   368 // -----------------------------------------------------------------------------
       
   369 //
       
   370 void CCallControlHandler::CallControlClientOperation()
       
   371     {
       
   372     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::CallControlClientOperation\
       
   373      calling" )
       
   374     RSat::TCallParamOrigin controlOrigin;
       
   375     iCallControlData.GetCallParamOrigin( controlOrigin );
       
   376     LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::\
       
   377         CallControlClientOperation GetCallParamOrigin = %d", controlOrigin )
       
   378     iCcStatus = ECcIdle;
       
   379    
       
   380     RSat::TActionOriginator actionOrigin;
       
   381     iCallControlData.GetActionOriginator( actionOrigin );
       
   382     LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::\
       
   383           CallControlClientOperation GetActionOriginator: %d", actionOrigin )
       
   384 
       
   385     if ( RSat::EClientOriginator == actionOrigin )
       
   386         {
       
   387         RSat::TCallControlType controlType;
       
   388         iCallControlData.GetCallControlType( controlType );
       
   389         
       
   390         switch ( controlType )
       
   391             {
       
   392             case RSat::ECcAddress:
       
   393                 {
       
   394                 LOG( NORMAL, "CALLCONTROL: CCallControlHandler::\
       
   395                  CallControlClientOperation ControlType ECcArddress" )
       
   396                 if ( KErrNone == DialNumber() )
       
   397                     {
       
   398                     iCcStatus = ECcDialWaiting;
       
   399                     }
       
   400                 break;
       
   401                 }
       
   402             case RSat::ECcSsString:
       
   403                 {
       
   404                 LOG( NORMAL, "CALLCONTROL: CCallControlHandler::\
       
   405                  CallControlClientOperation ControlType ECcSsString" )
       
   406                 if ( KErrNone == SendSs() )
       
   407                     {
       
   408                     iCcStatus = ECcSendSsWaiting;
       
   409                     }
       
   410                 break;
       
   411                 }
       
   412             case RSat::ECcUssdString:
       
   413                 {
       
   414                 LOG( NORMAL, "CALLCONTROL: CCallControlHandler::\
       
   415                  CallControlClientOperation ControlType ECcUssdString" )
       
   416                 if ( KErrNone == SendUssd() )
       
   417                     {
       
   418                     iCcStatus = ECcSendUssdWaiting;
       
   419                     }
       
   420                 break;
       
   421                 }
       
   422             default:
       
   423                 {
       
   424                 LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::\
       
   425                  CallControlClientOperation ControlType %d", controlType )
       
   426                 break;
       
   427                 }
       
   428             }
       
   429         }
       
   430             
       
   431     if ( ECcIdle == iCcStatus )
       
   432         {
       
   433         CompleteCallControlCmd( KErrNone );
       
   434         }
       
   435     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::CallControlClientOperation\
       
   436          exiting" )
       
   437     }
       
   438 
       
   439 // -----------------------------------------------------------------------------
       
   440 // CCallControlHandler::DialNumber
       
   441 // (other items were commented in a header).
       
   442 // -----------------------------------------------------------------------------
       
   443 //
       
   444 TInt CCallControlHandler::DialNumber()
       
   445     {
       
   446     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::DialNumber calling" )
       
   447     TInt err( KErrNone );
       
   448     iCcStatus = ECcDialWaiting;
       
   449     RSat::TCallSetUpParams callParams;
       
   450     err = iCallControlData.GetCallSetUpDetails ( callParams );
       
   451         
       
   452     if ( !err )
       
   453         {
       
   454         RMobileCall::TMobileCallParamsV7 dialParams;
       
   455         dialParams.iAutoRedial = ETrue;
       
   456         dialParams.iBearerMode = RMobileCall::EMulticallNewBearer;
       
   457         dialParams.iCallParamOrigin = RMobileCall::EOriginatorEtelClient;
       
   458         dialParams.iSubAddress = callParams.iSubAddress;
       
   459         dialParams.iBearerCap1 = callParams.iCcp1;
       
   460         dialParams.iBearerCap2 = callParams.iCcp2;        
       
   461         iCallControlData.GetBCRepeatIndicator( 
       
   462             reinterpret_cast< RSat::TBCRepeatIndicator& > 
       
   463             ( dialParams.iBCRepeatIndicator ) );
       
   464         dialParams.iIconId.iQualifier = RMobileCall::EIconQualifierNotSet;
       
   465         dialParams.iIconId.iIdentifier = 0;
       
   466         
       
   467         RSat::TAlphaId alphaid;
       
   468         RSat::TAlphaIdValidity validity;
       
   469         iCallControlData.GetAlphaId( validity, alphaid );
       
   470         
       
   471         if ( (RSat::EValidAlpaId == validity)
       
   472             && ( RSat::EAlphaIdProvided == alphaid.iStatus ) )
       
   473             {                   
       
   474             LOG2( NORMAL, 
       
   475                 "CALLCONTROL: CCallControlHandler::DialNumber id:%S",
       
   476                 &alphaid.iAlphaId )
       
   477             dialParams.iAlphaId = alphaid.iAlphaId;
       
   478             }        
       
   479 
       
   480         LOG2( NORMAL, 
       
   481             "CALLCONTROL: CCallControlHandler::DialNumber string %S",
       
   482             &callParams.iAddress.iTelNumber )
       
   483 
       
   484         
       
   485         RMobileCall::TMobileCallParamsV7Pckg package( dialParams );
       
   486         iRequestHandler->DialNumber( package, callParams.iAddress.iTelNumber );
       
   487         }
       
   488     LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::DialNumber exiting %d",
       
   489           err)
       
   490     return err;
       
   491     }
       
   492 
       
   493 // -----------------------------------------------------------------------------
       
   494 // CCallControlHandler::SendSS
       
   495 // (other items were commented in a header).
       
   496 // -----------------------------------------------------------------------------
       
   497 //
       
   498 TInt CCallControlHandler::SendSs()
       
   499     {
       
   500     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::SendSs calling" )
       
   501     TInt err( KErrNone );
       
   502     
       
   503     RSat::TSsString ssString;
       
   504     err = iCallControlData.GetSendSsDetails( ssString );
       
   505     if ( !err )
       
   506         {
       
   507         LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendSs type %d",
       
   508           ssString.iTypeOfNumber )
       
   509         LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendSs plan %d",
       
   510           ssString.iNumberPlan )
       
   511 
       
   512         HBufC16* ss16 =  HBufC16::New( ssString.iSsString.Length() );
       
   513         if ( ss16 )
       
   514             {
       
   515             TPtr16 ssPtr( ss16->Des() );
       
   516             CnvUtfConverter::ConvertToUnicodeFromUtf8( ssPtr,
       
   517                 ssString.iSsString );  
       
   518     
       
   519             LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendSs string %S",
       
   520               ss16 )
       
   521             iRequestHandler->SendSs( *ss16 );        
       
   522             delete ss16;
       
   523             }
       
   524         else
       
   525             {
       
   526             err = KErrNoMemory;
       
   527             }    
       
   528         }
       
   529     LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendSs exiting %d", err)
       
   530     return err;
       
   531     }
       
   532 
       
   533 // -----------------------------------------------------------------------------
       
   534 // CCallControlHandler::SendUssd
       
   535 // (other items were commented in a header).
       
   536 // -----------------------------------------------------------------------------
       
   537 //
       
   538 TInt CCallControlHandler::SendUssd()
       
   539     {
       
   540     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::SendUssd calling" )
       
   541     TInt err( KErrNone );
       
   542     RSat::TUssdString ussdString;
       
   543     err = iCallControlData.GetSendUssdDetails ( ussdString );
       
   544     if ( !err )
       
   545         {
       
   546         LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd string %S",
       
   547             &ussdString.iUssdString )
       
   548          
       
   549         LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd schema %d",
       
   550             ussdString.iDcs )
       
   551 
       
   552         RMobileUssdMessaging::TMobileUssdAttributesV1 ussdAttr;
       
   553         
       
   554         
       
   555         if ( KSatDcs7Bit == ussdString.iDcs )
       
   556             {
       
   557             ussdAttr.iFormat= RMobileUssdMessaging::EFormatPackedString;
       
   558             }
       
   559         else
       
   560             {
       
   561             ussdAttr.iFormat= RMobileUssdMessaging::EFormatUnspecified;                        
       
   562             }
       
   563         
       
   564         HBufC8* ussd8 =  HBufC8::New( ussdString.iUssdString.Length() );
       
   565         if ( ussd8 )
       
   566             {
       
   567             ussd8->Des().Copy( ussdString.iUssdString );
       
   568     
       
   569             ussdAttr.iFlags = RMobileUssdMessaging::KUssdDataFormat
       
   570                | RMobileUssdMessaging::KUssdMessageType
       
   571                | RMobileUssdMessaging::KUssdMessageDcs;
       
   572                 
       
   573             ussdAttr.iDcs = ussdString.iDcs;
       
   574             ussdAttr.iType = RMobileUssdMessaging::EUssdMORequest;
       
   575             RMobileUssdMessaging::TMobileUssdAttributesV1Pckg 
       
   576                 ussdPckg( ussdAttr );
       
   577     
       
   578             iRequestHandler->SendUssd ( *ussd8, ussdPckg );
       
   579             delete ussd8;
       
   580             }
       
   581         else
       
   582             {
       
   583             err = KErrNoMemory;
       
   584             }    
       
   585         }
       
   586 
       
   587     LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd exiting %d",
       
   588           err)
       
   589     return err;
       
   590     }
       
   591 
       
   592 
       
   593 // -----------------------------------------------------------------------------
       
   594 // CCallControlHandler::DispatchCcRequestComplete
       
   595 // (other items were commented in a header).
       
   596 // -----------------------------------------------------------------------------
       
   597 //
       
   598 void CCallControlHandler::DispatchCcRequestComplete( TInt aErrCode )
       
   599     {
       
   600     LOG( SIMPLE, 
       
   601     "CALLCONTROL: CCallControlHandler::DispatchCcRequestComplete calling" )
       
   602     
       
   603     LOG2( NORMAL, 
       
   604     "CALLCONTROL: CCallControlHandler::DispatchCcRequestComplete aErrCode %d",
       
   605     aErrCode )
       
   606 
       
   607     iCcStatus = ECcIdle;
       
   608     CompleteCallControlCmd( aErrCode );
       
   609     
       
   610     LOG2( NORMAL, 
       
   611         "CALLCONTROL: CCallControlHandler::SendUssd exiting %d", aErrCode )
       
   612     }
       
   613 
       
   614 
       
   615 // -----------------------------------------------------------------------------
       
   616 // CCallControlHandler::CompleteCallControlCmd
       
   617 // (other items were commented in a header).
       
   618 // -----------------------------------------------------------------------------
       
   619 //
       
   620 void CCallControlHandler::CompleteCallControlCmd( TInt /*aErrCode*/ )
       
   621     {
       
   622     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::CompleteCallControlCmd\
       
   623          calling" )
       
   624 
       
   625     // Start to receive more commands. We have to start again here because
       
   626     // we don't send terminal response, wich does this automatically.
       
   627     Start();
       
   628 
       
   629     // Inform the system that we are finished executing. If there is 
       
   630     // proactive SendSm command pending, it is notified and it continues
       
   631     // from here.
       
   632     iUtils->NotifyEvent( MSatUtils::ECallControlDone );
       
   633 
       
   634     // If we launched UI, close it.
       
   635     if ( !iUtils->SatUiHandler().UiLaunchedByUser() )
       
   636         {
       
   637         iUtils->NotifyEvent( MSatUtils::ESimSessionEndCallBack );
       
   638         }
       
   639     else
       
   640         {
       
   641         // Inform the session that we are done here.
       
   642         iUtils->NotifyEvent( MSatUtils::EDelaySimSessionEnd );
       
   643         }
       
   644         
       
   645     // We do not send TerminalResponse to SIM.
       
   646     LOG( SIMPLE, "CALLCONTROL: CCallControlHandler::CompleteCallControlCmd\
       
   647           exiting" )
       
   648     }
       
   649     
       
   650 //  End of File