satengine/SatServer/Commands/CallControlCmd/src/ccallcontrolrequesthandler.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 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 request that need SAT perform
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <etelmm.h>
       
    20 
       
    21 #include "ccallcontrolrequesthandler.h"
       
    22 #include "CCallControlHandler.h"
       
    23 #include "SatLog.h"
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CCallControlRequestHandler::CCallControlRequestHandler
       
    29 // The class constructor.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CCallControlRequestHandler::CCallControlRequestHandler(
       
    33                 MSatMultiModeApi& aPhone, CCallControlHandler* aDispatcher )
       
    34     : CActive( EPriorityStandard ), iPhone( aPhone ), 
       
    35       iDispatcher( aDispatcher )
       
    36     {
       
    37     LOG( SIMPLE,
       
    38         "CALLCONTROL: CCallControlRequestHandler::CCallControlRequestHandler \
       
    39         calling" )
       
    40 
       
    41     CActiveScheduler::Add( this );
       
    42 
       
    43     LOG( SIMPLE,
       
    44         "CALLCONTROL: CCallControlRequestHandler::CCallControlRequestHandler \
       
    45         exiting" )
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CCallControlRequestHandler::NewL
       
    50 // Two-phased constructor.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CCallControlRequestHandler* CCallControlRequestHandler::NewL(
       
    54     MSatMultiModeApi& aPhone, CCallControlHandler* aDispatcher )
       
    55     {
       
    56     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::NewL calling" )
       
    57 
       
    58     CCallControlRequestHandler* self =
       
    59         new ( ELeave ) CCallControlRequestHandler( aPhone, aDispatcher );
       
    60             
       
    61     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::NewL exiting" )
       
    62     return self;
       
    63     }
       
    64 
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CCallControlRequestHandler::~CCallControlRequestHandler
       
    68 // Destructor
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 CCallControlRequestHandler::~CCallControlRequestHandler()
       
    72     {
       
    73     LOG( SIMPLE, "CALLCONTROL: \
       
    74             CCallControlRequestHandler::~CCallControlRequestHandler calling" )
       
    75 
       
    76     Cancel();
       
    77     iDispatcher = NULL;
       
    78 
       
    79     LOG( SIMPLE, "CALLCONTROL: \
       
    80             CCallControlRequestHandler::~CCallControlRequestHandler exiting" )
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CCallControlRequestHandler::DialNumber
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 void CCallControlRequestHandler::DialNumber( const TDesC8& aCallParams,
       
    88                                              const TDesC& aTelNumber )
       
    89     {
       
    90     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::DialNumber calling" )
       
    91 
       
    92     if ( !IsActive() )
       
    93         {
       
    94         iPhone.DialNoFdnCheck( iStatus, aCallParams, aTelNumber );
       
    95         SetActive();
       
    96         }
       
    97     else
       
    98         {
       
    99         iDispatcher->DispatchCcRequestComplete( KErrInUse );
       
   100         }
       
   101 
       
   102     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::DialNumber exiting" )
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CCallControlRequestHandler::SendSs
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 void CCallControlRequestHandler::SendSs( const TDesC& aServiceString )
       
   110     {
       
   111     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::SendSs calling" )
       
   112 
       
   113     if ( !IsActive() )
       
   114         {        
       
   115         iPhone.SendNetworkServiceRequestNoFdnCheck( iStatus, aServiceString );
       
   116         SetActive();
       
   117         }
       
   118     else
       
   119         {
       
   120         iDispatcher->DispatchCcRequestComplete( KErrInUse );
       
   121         }
       
   122 
       
   123     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::SendSs exiting" )
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CCallControlRequestHandler::SendUssd
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 void CCallControlRequestHandler::SendUssd( const TDesC8& aMsgData,
       
   131 		const TDesC8& aMsgAttributes )
       
   132     {
       
   133     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::SendUssd calling" )
       
   134 
       
   135     if ( !IsActive() )
       
   136         {
       
   137         iPhone.SendMessageNoFdnCheck( iStatus, aMsgData, aMsgAttributes );
       
   138         SetActive();
       
   139         }
       
   140     else
       
   141         {
       
   142         iDispatcher->DispatchCcRequestComplete( KErrInUse );
       
   143         }
       
   144 
       
   145     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::SendUssd exiting" )
       
   146     }
       
   147 
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CCallControlRequestHandler::RunL
       
   151 // Handles the command.
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 void CCallControlRequestHandler::RunL()
       
   155     {
       
   156     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::RunL calling" )
       
   157     
       
   158     if ( iStatus == KErrNone )
       
   159         {
       
   160         LOG( NORMAL, "CALLCONTROL: CCallControlRequestHandler::RunL\
       
   161              iStatus == KErrNone" )
       
   162         iDispatcher->DispatchCcRequestComplete( iCcStatus );
       
   163         }
       
   164     else
       
   165         {
       
   166         LOG2( NORMAL, "CALLCONTROL: CCallControlRequestHandler::RunL\
       
   167               iStatus == %i", iStatus.Int() )
       
   168         iDispatcher->DispatchCcRequestComplete( KErrGeneral );
       
   169         }
       
   170     
       
   171     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::RunL exiting" )
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CCallControlRequestHandler::CancelOperation
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 void CCallControlRequestHandler::CancelOperation( TInt aOperationType )
       
   179     {
       
   180     LOG( SIMPLE, "CALLCONTROL: \
       
   181                   CCallControlRequestHandler::CancelOperation calling" )
       
   182 
       
   183     LOG2( NORMAL, "CALLCONTROL: \
       
   184         CCallControlRequestHandler::CancelOperation callingOperation Type %d",
       
   185         aOperationType )
       
   186 
       
   187     switch( aOperationType )
       
   188         {
       
   189         case CCallControlHandler::ECcDialWaiting:
       
   190             {
       
   191             iPhone.DialCancel();
       
   192             break;
       
   193             }
       
   194         case CCallControlHandler::ECcSendSsWaiting:
       
   195             {
       
   196             iPhone.CancelAsyncRequest( 
       
   197                 EMobilePhoneSendNetworkServiceRequestNoFdnCheck );
       
   198             break;
       
   199             }
       
   200         case CCallControlHandler::ECcSendUssdWaiting:
       
   201             {
       
   202             iPhone.CancelAsyncRequest( 
       
   203                 EMobileUssdMessagingSendMessageNoFdnCheck );
       
   204             break;
       
   205             }
       
   206         }
       
   207     LOG( SIMPLE, 
       
   208         "CALLCONTROL: CCallControlRequestHandler::CancelOperation exiting" )
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // From class CActive.
       
   213 // Cancels the sat request.
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 void CCallControlRequestHandler::DoCancel()
       
   217     {
       
   218     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::DoCancel calling" )
       
   219 
       
   220     LOG( SIMPLE, "CALLCONTROL: CCallControlRequestHandler::DoCancel exiting" )
       
   221     }
       
   222 
       
   223 
       
   224 //  End of File