vtengines/videoteleng/CallCtrl/Src/CVtCtlLineMonitor.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     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 new calls on data line
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #pragma CTC SKIP
       
    20 // INCLUDE FILES
       
    21 #include    "CVtCtlLineMonitor.h"
       
    22 #include    "MVtCtlLineEventObserver.h"
       
    23 #include    "VtCtlDefs.h"
       
    24 #include    <cvtlogger.h>
       
    25 #include    <etelmm.h>
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CVtCtlLineMonitor::CVtCtlLineMonitor
       
    32 // C++ constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 /*****************************************************
       
    37 *   Series 60 Customer / ETel
       
    38 *   Series 60  ETel API
       
    39 *****************************************************/
       
    40 CVtCtlLineMonitor::CVtCtlLineMonitor( 
       
    41     RMobileLine& aLine,
       
    42     MVtCtlLineEventObserver& aObserver) : 
       
    43     CActive( KVtCtlCallAdditionMonitorPriority ),
       
    44     iLine ( aLine ),
       
    45     iObserver( aObserver ),
       
    46     iLastLineStatus( RMobileCall::EStatusIdle ),
       
    47     iLineStatus( RMobileCall::EStatusIdle )
       
    48     {
       
    49     __VTPRINTENTER( "CVtCtlLineMonitor.CVtCtlLineMonitor" )
       
    50     CActiveScheduler::Add( this );
       
    51     __VTPRINTEXIT( "CVtCtlLineMonitor.CVtCtlLineMonitor" )
       
    52     }
       
    53     
       
    54 // Destructor
       
    55 CVtCtlLineMonitor::~CVtCtlLineMonitor()
       
    56     {
       
    57     __VTPRINTENTER( "CVtCtlLineMonitor.~" )
       
    58     Cancel();
       
    59     __VTPRINTEXIT( "CVtCtlLineMonitor.~" )
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CVtCtlLineMonitor::Start
       
    64 // Start monitoring
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void CVtCtlLineMonitor::Start()
       
    68     {
       
    69     __VTPRINTENTER( "CVtCtlLineMonitor.Start" )
       
    70     if ( !IsActive() )
       
    71         {      
       
    72         iLine.NotifyMobileLineStatusChange( iStatus, iLineStatus );
       
    73         SetActive();
       
    74         }
       
    75     __VTPRINTEXIT( "CVtCtlLineMonitor.Start" )
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CVtCtlLineMonitor::DoCancel
       
    80 // Stop monitoring
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CVtCtlLineMonitor::DoCancel()
       
    84     {
       
    85     __VTPRINTENTER( "CVtCtlLineMonitor.DoCancel" )
       
    86     iLine.CancelAsyncRequest( EMobileLineNotifyMobileLineStatusChange );
       
    87     __VTPRINTEXIT( "CVtCtlLineMonitor.DoCancel" )
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CVtCtlLineMonitor::RunL
       
    92 // Notifies observer on the event.
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CVtCtlLineMonitor::RunL()
       
    96     {
       
    97     __VTPRINTENTER( "CVtCtlLineMonitor.RunL" )
       
    98     __VTPRINT2( DEBUG_SESSION , "VtCtl:LineMon.RunL %d", iStatus.Int() )
       
    99     if ( iStatus == KErrNone )
       
   100         {
       
   101         if ( iLineStatus != iLastLineStatus )
       
   102             {
       
   103             iObserver.HandleLineEventL( 
       
   104                 MVtCtlLineEventObserver::ELineEventStatusChange, iLineStatus );
       
   105             iLastLineStatus = iLineStatus;
       
   106             }
       
   107         Start();
       
   108         }    
       
   109     __VTPRINTEXIT( "CVtCtlLineMonitor.RunL" )
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CVtCtlLineMonitor::RunError
       
   114 // Starts monitoring after error
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 TInt CVtCtlLineMonitor::RunError( 
       
   118 #ifdef VTDEBUG
       
   119     TInt aError )
       
   120 #else
       
   121     TInt )
       
   122 #endif
       
   123     {    
       
   124     __VTPRINTENTER( "CVtCtlLineMonitor.RunError" )
       
   125     Start();
       
   126     __VTPRINTEXITR( "CVtCtlLineMonitor.RunError err=%d", aError )
       
   127     return KErrNone;
       
   128     }
       
   129 #pragma CTC ENDSKIP
       
   130 //  End of File  
       
   131