coreapplicationuis/SysAp/Src/SysApSatObserver.cpp
changeset 0 2e3d3ce01487
child 30 fc3225a0ab43
child 40 951aeeb3da43
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2009 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 CSysApSatObserver.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <RSatRefresh.h>
       
    22 #include <RSatSession.h>
       
    23 #include <e32debug.h>
       
    24 #include "SysApSatObserver.h"
       
    25 #include "SysAp.hrh"
       
    26 
       
    27 // Constants
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CSysApSatObserver::CSysApSatObserver
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CSysApSatObserver::CSysApSatObserver( MSysApSatObserver& aObserver ): 
       
    36     iObserver ( aObserver )
       
    37     {
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CSysApSatObserver::ConstructL
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 void CSysApSatObserver::ConstructL( TInt aFile )
       
    45     {
       
    46     TRACES( RDebug::Print( _L( "CSysApSatObserver::ConstructL" ) ) );
       
    47     
       
    48     iSatSession = new ( ELeave ) RSatSession;
       
    49     iSatSession->ConnectL();
       
    50     iSatRefresh = new ( ELeave ) RSatRefresh( *this );
       
    51     iSatRefresh->OpenL( *iSatSession );     
       
    52     
       
    53     TSatRefreshFiles file;
       
    54     file.Append( aFile );
       
    55     iSatRefresh->NotifyFileChangeL( file );
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CSysApSatObserver::NewL
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 CSysApSatObserver* CSysApSatObserver::NewL( MSysApSatObserver& aObserver, TInt aFile )
       
    63     {
       
    64     TRACES( RDebug::Print( _L( "CSysApSatObserver::NewL" ) ) );
       
    65     
       
    66     CSysApSatObserver* self = new (ELeave) CSysApSatObserver( aObserver );
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL( aFile );
       
    69     CleanupStack::Pop( self );
       
    70     return self;
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // Destructor
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CSysApSatObserver::~CSysApSatObserver()
       
    78     {
       
    79     TRACES( RDebug::Print( _L( "CSysApSatObserver::~CSysApSatObserver" ) ) );
       
    80     
       
    81     if ( iSatRefresh )
       
    82         {
       
    83         iSatRefresh->Cancel();  
       
    84         iSatRefresh->Close();
       
    85         }
       
    86     delete iSatRefresh;
       
    87     
       
    88     if ( iSatSession )
       
    89         {
       
    90         iSatSession->Close();
       
    91         }
       
    92     delete iSatSession;
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CSysApSatObserver::AllowRefresh
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 TBool CSysApSatObserver::AllowRefresh( TSatRefreshType /*aType*/, 
       
   100     const TSatRefreshFiles& /*aFiles*/ )
       
   101     {
       
   102     // Refresh is always allowed
       
   103     TRACES( RDebug::Print( _L( "CSysApSatObserver::AllowRefresh" ) ) );
       
   104 
       
   105     return ETrue;
       
   106     }
       
   107  
       
   108 // -----------------------------------------------------------------------------
       
   109 // CSysApSatObserver::Refresh
       
   110 // -----------------------------------------------------------------------------
       
   111 //     
       
   112 void CSysApSatObserver::Refresh( TSatRefreshType /*aType*/, const TSatRefreshFiles& /*aFiles*/ )
       
   113     {
       
   114     TRACES( RDebug::Print( _L( "CSysApSatObserver::Refresh" ) ) );
       
   115     
       
   116     TRAP_IGNORE( iObserver.SimFileChangedL() );
       
   117     
       
   118     // Notify SAT Server that refresh initiated file read is done
       
   119     iSatRefresh->RefreshEFRead( EFalse );
       
   120     }
       
   121 
       
   122 //  End of File