vtengines/videoteleng/Src/Base/CVtEngSATClient.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2005 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:  SAT listener.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CVtEngStateManager.h"
       
    22 #include    "CVtEngSATClient.h"
       
    23 #include    "VtEngUtils.h"
       
    24 #include    <cvtlogger.h>
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CVtEngSATClient::CVtEngSATClient
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CVtEngSATClient::CVtEngSATClient() : 
       
    35     iSatSession(),
       
    36     iSatRefresh( *this )
       
    37     {
       
    38     __VTPRINT( DEBUG_GEN | DEBUG_CONSTRUCT, "CSATClient.C++" )
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CVtEngSATClient::NewL
       
    43 // Two-phased constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CVtEngSATClient* CVtEngSATClient::NewL( )
       
    47     {
       
    48     __VTPRINTENTER( "CSATClient.NewL" )
       
    49     CVtEngSATClient* self = new( ELeave ) CVtEngSATClient;
       
    50     CleanupStack::PushL( self );
       
    51     self->ConstructL();
       
    52     CleanupStack::Pop( self );
       
    53     __VTPRINTEXIT( "CSATClient.NewL" )
       
    54     return self;
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CVtEngSATClient::~CVtEngSATClient
       
    59 // Destructor.
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 CVtEngSATClient::~CVtEngSATClient()
       
    63     {
       
    64     __VTPRINTENTER( "CSATClient.~" )
       
    65     iSatRefresh.Close();
       
    66     iSatSession.Close();
       
    67     __VTPRINTEXIT( "CSATClient.~" )
       
    68     }
       
    69     
       
    70 // -----------------------------------------------------------------------------
       
    71 // CVtEngSATClient::ConstructL
       
    72 // 2nd phase constructor.
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 void CVtEngSATClient::ConstructL()
       
    76     {
       
    77     iSatSession.ConnectL();
       
    78     iSatRefresh.OpenL( iSatSession );
       
    79     iSatRefresh.NotifyFileChangeL();
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CVtEngSATClient::AllowRefresh
       
    84 // Callback from SAT.
       
    85 // -----------------------------------------------------------------------------
       
    86 //    
       
    87 TBool CVtEngSATClient::AllowRefresh( 
       
    88     TSatRefreshType  aType, 
       
    89     const TSatRefreshFiles& /*aFiles*/ )
       
    90     {
       
    91     __VTPRINTENTER( "CSATClient.AllowRefresh" )    
       
    92     TBool ret( EFalse );
       
    93     const MVtEngSessionInfo::TSessionState state( 
       
    94         CVtEngUtility::StateManager()->SessionState() );
       
    95     if ( state == MVtEngSessionInfo::EIdle || aType == EFileChangeNotification )
       
    96         {
       
    97         __VTPRINT2( DEBUG_GEN, " TSatRefreshType aType=%d", aType )
       
    98         ret = ETrue;
       
    99         }
       
   100     __VTPRINTEXITR( "CSATClient.AllowRefresh ret=%d", ret )            
       
   101     return ret;
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CVtEngSATClient::Refresh
       
   106 // Callback from SAT.
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 void CVtEngSATClient::Refresh( 
       
   110     TSatRefreshType /* aType */,
       
   111     const TSatRefreshFiles& /* aFiles */ )
       
   112     {
       
   113     // Not needed.
       
   114     __VTPRINT( DEBUG_GEN | DEBUG_DETAIL, "CSATClient.Refresh" )
       
   115     iSatRefresh.RefreshEFRead( EFalse );
       
   116     }
       
   117 
       
   118 // end of file