convergedcallengine/csplugin/src/cspetelconferencecapsmonitor.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 CSPEtelConferenceCapsMonitor which
       
    15 *                monitors call status changes from ETel and notifies observer
       
    16 *                according to call status change.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #include "cspetelconferencecapsmonitor.h"
       
    22 
       
    23 #include "cspconferencecall.h"
       
    24 #include "csplogger.h"
       
    25 
       
    26 
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CSPEtelConferenceCapsMonitor::NewL.
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CSPEtelConferenceCapsMonitor* CSPEtelConferenceCapsMonitor::NewL( 
       
    33                                                     CSPConferenceCall& aOwner,
       
    34                                                     RMobileConferenceCall& aCall ) 
       
    35     {
       
    36     CSPLOGSTRING(CSPOBJECT, 
       
    37         "CSPEtelConferenceCapsMonitor::NewL()" );
       
    38     CSPEtelConferenceCapsMonitor* self = 
       
    39                         new ( ELeave ) CSPEtelConferenceCapsMonitor( 
       
    40                                                             aOwner, aCall );
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( );
       
    43     CleanupStack::Pop( self );
       
    44     return self;    
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // Destructs the object by canceling first ongoing monitoring.
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CSPEtelConferenceCapsMonitor::~CSPEtelConferenceCapsMonitor( )
       
    53     {
       
    54     CSPLOGSTRING(CSPOBJECT, 
       
    55         "CSPEtelConferenceCapsMonitor::~CSPEtelConferenceCapsMonitor()" );
       
    56         
       
    57     if ( iDestrPtr )
       
    58         {
       
    59         *iDestrPtr = ETrue;
       
    60         iDestrPtr = NULL;
       
    61         }
       
    62         
       
    63     Cancel();
       
    64     }
       
    65 
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // Starts the monitoring.
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 void CSPEtelConferenceCapsMonitor::StartMonitoring()
       
    72     {
       
    73     CSPLOGSTRING(CSPOBJECT, 
       
    74           "CSPEtelConferenceCapsMonitor::StartMonitoring()" );
       
    75 
       
    76     
       
    77     if ( !IsActive() )
       
    78         {
       
    79         CSPLOGSTRING( CSPREQOUT, 
       
    80             "CSP: CSPEtelConferenceCapsMonitor::StartMonitoring: Request \
       
    81                     RMobilePhone::NotifyCapsChange" );
       
    82         iCall.NotifyCapsChange( iStatus, iCaps );
       
    83         SetActive();
       
    84         }
       
    85     else
       
    86         {
       
    87         CSPLOGSTRING( CSPERROR, 
       
    88             "CSP: CSPEtelConferenceCapsMonitor::StartMonitoring: Already active" );
       
    89         }
       
    90     }
       
    91     
       
    92 // ---------------------------------------------------------------------------
       
    93 // From CActive
       
    94 // Handles call status notifying.
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CSPEtelConferenceCapsMonitor::RunL()
       
    98     {
       
    99     CSPLOGSTRING2( CSPREQEND, 
       
   100         "CSPEtelConferenceCapsMonitor::RunL: status: %d", iStatus.Int() );
       
   101     
       
   102     // Survive from monitor destruction during observing sequence
       
   103     TBool destroyed = EFalse;
       
   104     iDestrPtr = &destroyed;
       
   105 
       
   106     
       
   107     if ( iStatus == KErrNone )
       
   108         {
       
   109         // Test caps and notify about the iOwner 
       
   110         iOwner.ConferenceCapsChanged( iCaps );
       
   111 
       
   112         }
       
   113     
       
   114     if ( !destroyed )
       
   115         {
       
   116         // In case instance has not been deleted, it is important to clear
       
   117         // iPtr pointer.
       
   118         iDestrPtr = NULL;
       
   119         
       
   120         // ok to modify member variables.
       
   121         if ( iStatus == KErrNone )
       
   122             {
       
   123             StartMonitoring();
       
   124             }
       
   125         }
       
   126     else
       
   127         {
       
   128         // already destroyed, do not touch members.
       
   129         }
       
   130 
       
   131     }
       
   132 
       
   133 
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // From CActive
       
   137 // Canceling functionality.
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 void CSPEtelConferenceCapsMonitor::DoCancel()
       
   141     {
       
   142     iCall.CancelAsyncRequest( EMobileConferenceCallNotifyCapsChange );
       
   143     }
       
   144 
       
   145 
       
   146 
       
   147     
       
   148 // ---------------------------------------------------------------------------
       
   149 // Constructs the monitor..
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 CSPEtelConferenceCapsMonitor::CSPEtelConferenceCapsMonitor( CSPConferenceCall& aOwner,
       
   153                                                     RMobileConferenceCall& aCall ) : 
       
   154                                    CActive( EPriorityStandard ),
       
   155                                    iOwner( aOwner ),
       
   156                                    iCall ( aCall )
       
   157     {
       
   158     CSPLOGSTRING(CSPOBJECT, 
       
   159         "CSPEtelConferenceCapsMonitor::CSPEtelConferenceCapsMonitor()" );
       
   160     CActiveScheduler::Add( this );
       
   161     }
       
   162     
       
   163 // ---------------------------------------------------------------------------
       
   164 // Second phase construction.
       
   165 // ---------------------------------------------------------------------------
       
   166 //
       
   167 void CSPEtelConferenceCapsMonitor::ConstructL()
       
   168     {
       
   169     // Implementation not required.
       
   170     }
       
   171 
       
   172 
       
   173 // End of file