mmshplugins/mmshaoplugin/src/muscalleventmonitor.cpp
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Monitor the events of CS call
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "mussesseioninformationapi.h"
       
    20 #include "muscalleventmonitor.h"
       
    21 #include "muslogger.h"
       
    22 
       
    23 #include <etelmm.h>
       
    24 #include <e32svr.h>
       
    25 #include <mmtsy_names.h>
       
    26 #include <e32property.h>
       
    27 
       
    28 
       
    29 // ------------------------------------------------------------------------------
       
    30 // Symbian two-phase constructor.
       
    31 // ------------------------------------------------------------------------------
       
    32 //
       
    33 CMusCallEventMonitor* CMusCallEventMonitor::NewL( const RMobileCall& aCall, 
       
    34                                                     MMusTsyPropertyObserver& aObserver,
       
    35                                                     MMusCallStateObserver& aCallStateObserver )
       
    36     {
       
    37     MUS_LOG( "mus: [MUSAO]  -> CMusCallEventMonitor::NewL" )
       
    38     CMusCallEventMonitor* self = new (ELeave) CMusCallEventMonitor(aCall, aObserver, aCallStateObserver );
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     CleanupStack::Pop( self );
       
    42     MUS_LOG( "mus: [MUSAO]  <- CMusCallEventMonitor::NewL" )
       
    43     return self;
       
    44     }
       
    45 
       
    46 
       
    47 // ------------------------------------------------------------------------------
       
    48 // C++ destructor.
       
    49 // ------------------------------------------------------------------------------
       
    50 //
       
    51 CMusCallEventMonitor::~CMusCallEventMonitor()
       
    52     {
       
    53     MUS_LOG( "mus: [MUSAO]  -> CMusCallEventMonitor::~CMusCallEventMonitor" )        
       
    54     Cancel();        
       
    55     MUS_LOG( "mus: [MUSAO]  <- CMusCallEventMonitor::~CMusCallEventMonitor" )
       
    56     }
       
    57 
       
    58 // ------------------------------------------------------------------------------
       
    59 // Symbian second-phase constructor.
       
    60 // ------------------------------------------------------------------------------
       
    61 //
       
    62 void CMusCallEventMonitor::ConstructL( )
       
    63     {
       
    64     MUS_LOG( "mus: [MUSAO]  -> CMusCallEventMonitor::ConstructL" )   
       
    65     CActiveScheduler::Add( this );         
       
    66     iCall.NotifyCallEvent( iStatus, iCallEvent );
       
    67     SetActive();        
       
    68     MUS_LOG( "mus: [MUSAO]  <- CMusCallEventMonitor::ConstructL" )
       
    69     }
       
    70 
       
    71 
       
    72 // ------------------------------------------------------------------------------
       
    73 // C++ constructor.
       
    74 // ------------------------------------------------------------------------------
       
    75 //
       
    76 CMusCallEventMonitor::CMusCallEventMonitor( const RMobileCall& aCall, 
       
    77                                             MMusTsyPropertyObserver& aObserver,
       
    78                                             MMusCallStateObserver& aCallStateObserver ) 
       
    79         : CMusCallMonitorBase(aCall, aObserver, aCallStateObserver)     
       
    80         
       
    81     { 
       
    82     
       
    83     }
       
    84 
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CMusCallEventMonitor::RunL()
       
    88 // From CActive.It will be called any NotifyMobileLineStatusChange
       
    89 // Event happens.
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void CMusCallEventMonitor::RunL()
       
    93     {
       
    94     MUS_LOG( "mus: [MUSAO]  -> CMusCallEventMonitor::RunL" )    
       
    95     iCall.NotifyCallEvent( iStatus, iCallEvent );
       
    96     SetActive();
       
    97     MUS_LOG1( "mus: [MUSAO]  iCallEvent =  %d", iCallEvent )    
       
    98     switch(iCallEvent)    
       
    99         {              	
       
   100             case RMobileCall::ELocalHold:
       
   101                  iLocalCallEvent = RMobileCall::ELocalHold;
       
   102                  SetStateL( NMusSessionInformationApi::ECallHold );
       
   103                  break;
       
   104 		    case RMobileCall::ELocalResume:	
       
   105                  iLocalCallEvent = RMobileCall::ELocalResume;
       
   106                  // when local resume happens , check the remote call state. 
       
   107                  // without knowing remote call state we can not set the state
       
   108                  // to call connected.        
       
   109                  if( iRemoteCallEvent == RMobileCall::ERemoteResume) 
       
   110                     {
       
   111                     SetStateL( NMusSessionInformationApi::ECallConnected );
       
   112                     }
       
   113                  else
       
   114                     {
       
   115                     SetStateL( NMusSessionInformationApi::ECallHold );
       
   116                     }                 
       
   117                  break;
       
   118 		    case RMobileCall::ELocalDeflectCall:	
       
   119                  //SetStateL( NMusSessionInformationApi::ECallHold );
       
   120                  break;
       
   121 		    case RMobileCall::ELocalTransfer:
       
   122                  SetStateL( NMusSessionInformationApi::ENoCall );
       
   123                  break;	
       
   124 		    case RMobileCall::ERemoteHold:	
       
   125                  iRemoteCallEvent = RMobileCall::ERemoteHold;	
       
   126                  SetStateL( NMusSessionInformationApi::ECallHold );
       
   127                  break;
       
   128 		    case RMobileCall::ERemoteResume:	
       
   129                  iRemoteCallEvent = RMobileCall::ERemoteResume;
       
   130                  // when remote resume happens , check the local call state.         
       
   131                  // without knowing local call state we can not set the state
       
   132                  // to call connected. 
       
   133                  if( iLocalCallEvent == RMobileCall::ELocalResume) 
       
   134                     {
       
   135                     SetStateL( NMusSessionInformationApi::ECallConnected );   
       
   136                     }
       
   137                  else
       
   138                     {
       
   139                     SetStateL( NMusSessionInformationApi::ECallHold );
       
   140                     }       	                 
       
   141                  break;
       
   142 		    case RMobileCall::ERemoteTerminated:	
       
   143                  SetStateL( NMusSessionInformationApi::ENoCall );
       
   144                  NotifyCallStateChanged( NMusSessionInformationApi::ENoCall );
       
   145                  break;
       
   146 		    case RMobileCall::ERemoteConferenceCreate:
       
   147                  SetStateL( NMusSessionInformationApi::EConferenceCall );
       
   148                  break;
       
   149 		    case RMobileCall::ERemoteTransferring:
       
   150                  //SetStateL( NMusSessionInformationApi::ECallHold );
       
   151                  break;
       
   152 		    case RMobileCall::ERemoteTransferAlerting:	
       
   153                  //SetStateL( NMusSessionInformationApi::ECallHold );
       
   154                  break;
       
   155 		    case RMobileCall::ERemoteBarred:	
       
   156                  //SetStateL( NMusSessionInformationApi::ECallHold );
       
   157                  break;
       
   158 		    case RMobileCall::ERemoteForwarding:	
       
   159                  //SetStateL( NMusSessionInformationApi::ECallHold );
       
   160                  break;
       
   161 		    case RMobileCall::ERemoteWaiting:	
       
   162                  //SetStateL( NMusSessionInformationApi::ECallHold );
       
   163                  break;
       
   164 		    case RMobileCall::ELocalBarred:
       
   165                  //SetStateL( NMusSessionInformationApi::ECallHold );
       
   166                  break;
       
   167             default:
       
   168                  break;
       
   169         }    
       
   170     MUS_LOG( "mus: [MUSAO]  <- CMusCallEventMonitor::RunL" )
       
   171     }
       
   172 
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CMusCallEventMonitor::DoCancel()
       
   176 // Implemented for CActive.
       
   177 // Will be called when Cancel() method is called.
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 void CMusCallEventMonitor::DoCancel()
       
   181     {
       
   182     MUS_LOG( "mus: [MUSAO]  -> CMusCallEventMonitor::DoCancel" )
       
   183     iCall.CancelAsyncRequest( EMobileCallNotifyCallEvent );
       
   184     MUS_LOG( "mus: [MUSAO]  <- CMusCallEventMonitor::DoCancel" )
       
   185     }
       
   186 
       
   187 // End of file