convergedcallengine/csplugin/src/cspcallinfomonitor.cpp
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Monitors changes in remote party info.
       
    15 *  Interface   : 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 //  INCLUDE FILES
       
    22 
       
    23 #include    "cspcallinfomonitor.h"       
       
    24 #include    "mcspcallobserver.h"
       
    25 #include    "csppanic.pan"
       
    26 #include    "csplogger.h" //Debug
       
    27 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS =============================
       
    30 
       
    31 //----------------------------------------------------------------------------
       
    32 //  CSPCallInfoMonitor::NewL()
       
    33 //
       
    34 //  1st phase constructor
       
    35 //----------------------------------------------------------------------------
       
    36 //
       
    37 CSPCallInfoMonitor* CSPCallInfoMonitor::NewL
       
    38     ( MCSPCallObserver& aObserver,
       
    39       RMobileCall& aCall  )   
       
    40     {
       
    41     CSPCallInfoMonitor* self = new (ELeave) CSPCallInfoMonitor( aObserver,
       
    42                                                                 aCall ); 
       
    43     return self;
       
    44     }
       
    45 
       
    46 //----------------------------------------------------------------------------
       
    47 //  CSPCallInfoMonitor::~CSPCallInfoMonitor()
       
    48 //
       
    49 //  d'tor.
       
    50 //----------------------------------------------------------------------------
       
    51 //
       
    52 CSPCallInfoMonitor::~CSPCallInfoMonitor()
       
    53     {    
       
    54     Cancel();
       
    55     CSPLOGSTRING( CSPINT, "CSP: CSPCallInfoMonitor::~CSPCallInfoMonitor" );
       
    56     }
       
    57 
       
    58 //----------------------------------------------------------------------------
       
    59 //  CSPCallInfoMonitor::StartMonitor()
       
    60 //
       
    61 //  Starts monitoring.
       
    62 //----------------------------------------------------------------------------
       
    63 //
       
    64 void CSPCallInfoMonitor::StartMonitoring()
       
    65     {    
       
    66     // error ignored (starting notification doesn't leave)
       
    67     if (!IsActive()) 
       
    68         {
       
    69         iCall.NotifyRemotePartyInfoChange( 
       
    70             iStatus,  
       
    71             iRemotePartyInfoPckg ); 
       
    72         SetActive();             
       
    73         }
       
    74     else
       
    75         {
       
    76         CSPLOGSTRING( CSPERROR, 
       
    77             "CSP: CSPCallInfoMonitor::StartMonitoring: Already active" );
       
    78         
       
    79         }
       
    80     }
       
    81 
       
    82 //----------------------------------------------------------------------------
       
    83 //  CSPCallInfoMonitor::RunL()
       
    84 //
       
    85 //  Handling of the status changes.
       
    86 //----------------------------------------------------------------------------
       
    87 //
       
    88 void CSPCallInfoMonitor::RunL()
       
    89     {
       
    90     CSPLOGSTRING2( CSPINT, 
       
    91         "CSP: CSPCallInfoMonitor::RunL iStatus: %d", iStatus.Int() );
       
    92 
       
    93     RMobileCall::TMobileCallRemoteIdentityStatus idStatus = 
       
    94         iRemotePartyInfo.iRemoteIdStatus;
       
    95     CSPLOGSTRING2( CSPINT, 
       
    96         "CSP: CSPCallInfoMonitor::RunL id status: %d", idStatus );
       
    97 
       
    98     switch ( iStatus.Int() )
       
    99         {
       
   100         case KErrNone:
       
   101             {                
       
   102             if ( idStatus == RMobileCall::ERemoteIdentityAvailable) 
       
   103                 {
       
   104                 iObserver.NotifyRemotePartyInfoChanged(
       
   105                     iRemotePartyInfo.iCallingName,
       
   106                     KNullDesC());
       
   107                 }
       
   108             else
       
   109                 {
       
   110                 CSPLOGSTRING2( CSPERROR, 
       
   111                 "CSP: CSPCallInfoMonitor::RunL DISCARD: %d", idStatus );
       
   112                 }            
       
   113             break;
       
   114             }
       
   115         default:
       
   116             CSPLOGSTRING( CSPERROR, 
       
   117                 "CSP: CSPCallInfoMonitor::RunL error" );
       
   118             break;
       
   119         }
       
   120         
       
   121     if ( KErrNotSupported != iStatus.Int() )
       
   122         {        
       
   123         StartMonitoring();
       
   124         }
       
   125     }
       
   126 
       
   127 //----------------------------------------------------------------------------
       
   128 //  CSPCallInfoMonitor::DoCancel()
       
   129 //
       
   130 //  Implementation of cancel.
       
   131 //----------------------------------------------------------------------------
       
   132 //
       
   133 void CSPCallInfoMonitor::DoCancel()
       
   134     {
       
   135     CSPLOGSTRING( CSPINT, "CSP: CSPCallInfoMonitor::DoCancel" );
       
   136     
       
   137     iCall.CancelAsyncRequest( EMobileCallNotifyRemotePartyInfoChange );
       
   138     }
       
   139 
       
   140 //----------------------------------------------------------------------------
       
   141 //  CSPCallInfoMonitor::CSPCallInfoMonitor()
       
   142 //
       
   143 //  constructor.
       
   144 //----------------------------------------------------------------------------
       
   145 //
       
   146 CSPCallInfoMonitor::CSPCallInfoMonitor( MCSPCallObserver &aObserver, 
       
   147                                         RMobileCall& aCall ) : 
       
   148         CActive( EPriorityStandard ),
       
   149         iObserver( aObserver ),
       
   150         iCall( aCall ),
       
   151         iRemotePartyInfoPckg( iRemotePartyInfo )
       
   152     {
       
   153     CActiveScheduler::Add( this );
       
   154     }
       
   155 
       
   156 // End of file