convergedcallengine/csplugin/src/cspetelcallcapsmonitor.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:  Implementation of class CSPEtelCallCapsMonitor which
       
    15 *                monitors call status changes from ETel and notifies observer
       
    16 *                according to call status change.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #include "cspetelcallcapsmonitor.h"
       
    22 
       
    23 #include <mccpcallobserver.h>
       
    24 
       
    25 #include "mcspcallobserver.h"
       
    26 #include "csplogger.h"
       
    27 
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // Constructs the monitor in two phase.
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CSPEtelCallCapsMonitor* CSPEtelCallCapsMonitor::NewL( 
       
    34                                                     MCSPCallObserver& aObserver,
       
    35                                                     RMobileCall& aCall ) 
       
    36     {
       
    37     CSPLOGSTRING(CSPOBJECT, 
       
    38         "CSPEtelCallCapsMonitor::NewL()" );
       
    39     CSPEtelCallCapsMonitor* self = 
       
    40                         new ( ELeave ) CSPEtelCallCapsMonitor( 
       
    41                                                             aObserver, aCall );
       
    42     return self;    
       
    43     }
       
    44 
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // Destructs the object by canceling first ongoing monitoring.
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CSPEtelCallCapsMonitor::~CSPEtelCallCapsMonitor( )
       
    51     {
       
    52     CSPLOGSTRING(CSPOBJECT, 
       
    53         "CSPEtelCallCapsMonitor::~CSPEtelCallCapsMonitor()" );
       
    54     Cancel();
       
    55     CSPLOGSTRING(CSPOBJECT, 
       
    56         "CSPEtelCallCapsMonitor::~CSPEtelCallCapsMonitor() ok" );
       
    57 
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // Starts the monitoring.
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 void CSPEtelCallCapsMonitor::StartMonitoring()
       
    66     {
       
    67     CSPLOGSTRING(CSPOBJECT, 
       
    68           "CSPEtelCallCapsMonitor::StartMonitoring()" );
       
    69 
       
    70     
       
    71     if ( !IsActive() )
       
    72         {
       
    73         CSPLOGSTRING( CSPREQOUT, 
       
    74             "CSPEtelCallCapsMonitor::StartMonitoring: Request \
       
    75                     RMobilePhone::NotifyCapsChange" );
       
    76         iCall.NotifyMobileCallCapsChange( iStatus, iCapsPckg );
       
    77         SetActive();
       
    78         }
       
    79     else
       
    80         {
       
    81         CSPLOGSTRING( CSPERROR, 
       
    82             "CSPEtelCallCapsMonitor::StartMonitoring: Already active" );
       
    83         }
       
    84     }
       
    85     
       
    86 // ---------------------------------------------------------------------------
       
    87 // From CActive
       
    88 // Handles call status notifying.
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CSPEtelCallCapsMonitor::RunL()
       
    92     {
       
    93     CSPLOGSTRING2( CSPREQEND, 
       
    94         "CSPEtelCallCapsMonitor::RunL: status: %d", iStatus.Int() );
       
    95     
       
    96     if ( iStatus == KErrNone )
       
    97         {
       
    98         TUint32 capsFlags = iCaps.iCallControlCaps;
       
    99         
       
   100         iObserver.CallCapsChanged( capsFlags );
       
   101         StartMonitoring();
       
   102         }
       
   103     
       
   104     }
       
   105 
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // From CActive
       
   109 // Canceling functionality.
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 void CSPEtelCallCapsMonitor::DoCancel()
       
   113     {
       
   114     iCall.CancelAsyncRequest( EMobileCallNotifyMobileCallCapsChange );
       
   115     }
       
   116 
       
   117 
       
   118 
       
   119     
       
   120 // ---------------------------------------------------------------------------
       
   121 // Constructs the monitor..
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 CSPEtelCallCapsMonitor::CSPEtelCallCapsMonitor( MCSPCallObserver& aObserver,
       
   125                                                     RMobileCall& aCall ) : 
       
   126                                    CActive( EPriorityStandard ),
       
   127                                    iObserver( aObserver ),
       
   128                                    iCall ( aCall ),
       
   129                                    iCapsPckg( iCaps )
       
   130     {
       
   131     CSPLOGSTRING(CSPOBJECT, 
       
   132         "CSPEtelCallCapsMonitor::CSPEtelCallCapsMonitor()" );
       
   133     CActiveScheduler::Add( this );
       
   134     }
       
   135     
       
   136 
       
   137 TUint32 CSPEtelCallCapsMonitor::FetchCallControlCapsL()
       
   138     {
       
   139     TInt err = iCall.GetMobileCallCaps( iCapsPckg );
       
   140     User::LeaveIfError( err );
       
   141     return iCaps.iCallControlCaps;
       
   142     }
       
   143 
       
   144 
       
   145 // End of file