convergedcallengine/csplugin/src/cspetelvideocallcapsmonitor.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 CSPEtelVideoCallCapsMonitor which
       
    15 *                monitors call status changes from ETel and notifies observer
       
    16 *                according to call status change.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #include <mccpcallobserver.h>
       
    22 
       
    23 #include "cspetelvideocallcapsmonitor.h"
       
    24 #include "cspvideocall.h"
       
    25 #include "csplogger.h"
       
    26 
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CSPEtelCallEventMonitor::NewL.
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CSPEtelVideoCallCapsMonitor* CSPEtelVideoCallCapsMonitor::NewL( 
       
    33                                                     CSPVideoCall& aOwner,
       
    34                                                     RMobileCall& aCall ) 
       
    35     {
       
    36     CSPLOGSTRING(CSPOBJECT, 
       
    37         "CSPEtelCallEventMonitor::NewL()" );
       
    38     CSPEtelVideoCallCapsMonitor* self = 
       
    39                         new ( ELeave ) CSPEtelVideoCallCapsMonitor( 
       
    40                                                             aOwner, aCall );
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( );
       
    43     CleanupStack::Pop( self );
       
    44     return self;    
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Destructs the object by canceling first ongoing monitoring.
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CSPEtelVideoCallCapsMonitor::~CSPEtelVideoCallCapsMonitor( )
       
    52     {
       
    53     CSPLOGSTRING(CSPOBJECT, 
       
    54         "CSPEtelVideoCallCapsMonitor::CSPEtelVideoCallCapsMonitor()" );
       
    55     Cancel();
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // Starts the monitoring.
       
    60 // NOTE: This function reads the initial value of data call caps in the 
       
    61 // beginning so that client can use GetMobileDataCallCaps to get up to date
       
    62 // caps information.
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 void CSPEtelVideoCallCapsMonitor::StartMonitoring()
       
    66     {
       
    67     CSPLOGSTRING(CSPOBJECT, 
       
    68           "CSPEtelVideoCallCapsMonitor::StartMonitoring()" );
       
    69 
       
    70     iCall.GetMobileDataCallCaps( iDataCallCapsPckg );
       
    71     
       
    72     if ( !IsActive() )
       
    73         {
       
    74         CSPLOGSTRING( CSPREQOUT, 
       
    75             "CSP: CSPEtelVideoCallCapsMonitor::StartMonitoring: Request \
       
    76                     RMobilePhone::NotifyCapsChange" );
       
    77         iCall.NotifyMobileDataCallCapsChange( iStatus, iDataCallCapsPckg );
       
    78         SetActive();
       
    79         }
       
    80     else
       
    81         {
       
    82         CSPLOGSTRING( CSPERROR, 
       
    83          "CSP: CSPEtelVideoCallCapsMonitor::StartMonitoring: Already active" );
       
    84         }
       
    85     }
       
    86     
       
    87 // ---------------------------------------------------------------------------
       
    88 // CSPEtelVideoCallCapsMonitor::GetMobileDataCallCaps
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 TInt CSPEtelVideoCallCapsMonitor::GetMobileDataCallCaps( TDes8& aCaps ) const
       
    92     {
       
    93     CSPLOGSTRING( CSPREQIN, "CSPEtelVideoCallCapsMonitor::GetMobileDataCallCaps" );
       
    94     // get data call caps from Etel
       
    95     aCaps = iDataCallCapsPckg;
       
    96     return KErrNone;
       
    97     }
       
    98 
       
    99 // ---------------------------------------------------------------------------
       
   100 // CSPEtelVideoCallCapsMonitor::GetProtocolCaps
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 TUint CSPEtelVideoCallCapsMonitor::GetProtocolCaps()
       
   104     {
       
   105     iDataCallCaps = iDataCallCapsPckg();
       
   106     return iDataCallCaps.iProtocolCaps;
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // From CActive
       
   111 // Handles call status notifying.
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 void CSPEtelVideoCallCapsMonitor::RunL()
       
   115     {
       
   116     CSPLOGSTRING2( CSPREQEND, 
       
   117         "CSPEtelVideoCallCapsMonitor::RunL: status: %d", iStatus.Int() );
       
   118     
       
   119     if ( iStatus == KErrNone )
       
   120         {
       
   121         iDataCallCaps = iDataCallCapsPckg();
       
   122         
       
   123         iOwner.DataCallCapsChanged( iDataCallCaps );
       
   124         
       
   125         iCall.NotifyMobileDataCallCapsChange( iStatus, iDataCallCapsPckg );
       
   126         SetActive();
       
   127         }
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // From CActive
       
   132 // Canceling functionality.
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 void CSPEtelVideoCallCapsMonitor::DoCancel()
       
   136     {
       
   137     iCall.CancelAsyncRequest( EMobileCallNotifyMobileDataCallCapsChange );
       
   138     }
       
   139     
       
   140 // ---------------------------------------------------------------------------
       
   141 // Constructs the monitor..
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 CSPEtelVideoCallCapsMonitor::CSPEtelVideoCallCapsMonitor( CSPVideoCall& aOwner,
       
   145                                                     RMobileCall& aCall ) : 
       
   146                                    CActive( EPriorityStandard ),
       
   147                                    iOwner( aOwner ),
       
   148                                    iCall ( aCall ),
       
   149                                    iDataCallCapsPckg( iDataCallCaps )
       
   150     {
       
   151     CSPLOGSTRING(CSPOBJECT, 
       
   152         "CSPEtelVideoCallCapsMonitor::CSPEtelCallCapsMonitor()" );
       
   153     CActiveScheduler::Add( this );
       
   154     }
       
   155     
       
   156 // ---------------------------------------------------------------------------
       
   157 // Second phase construction.
       
   158 // ---------------------------------------------------------------------------
       
   159 //
       
   160 void CSPEtelVideoCallCapsMonitor::ConstructL()
       
   161     {
       
   162     // Implementation not required.    
       
   163     }
       
   164 
       
   165 // ---------------------------------------------------------------------------
       
   166 // CSPEtelVideoCallCapsMonitor::UpdateProtocolCaps
       
   167 // ---------------------------------------------------------------------------
       
   168 //
       
   169 void CSPEtelVideoCallCapsMonitor::UpdateProtocolCaps()
       
   170     {
       
   171     CSPLOGSTRING(CSPOBJECT, 
       
   172         "CSPEtelVideoCallCapsMonitor::UpdateProtocolCaps()" );
       
   173 
       
   174     iCall.GetMobileDataCallCaps( iDataCallCapsPckg );            
       
   175     }
       
   176 
       
   177 // End of File