phonebookengines/VirtualPhonebook/VPbkSimStoreImpl/inc/CSatRefreshNotifier.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-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:  A notifier that gets refresh events from the SAT server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VPBKSIMSTOREIMPL_CSATREFRESHNOTIFIER_H
       
    21 #define VPBKSIMSTOREIMPL_CSATREFRESHNOTIFIER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <msatrefreshobserver.h>
       
    26 #include "MSimRefreshObject.h"
       
    27 
       
    28 namespace VPbkSimStoreImpl {
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  A notifier that gets refresh events from the SAT server
       
    36 *
       
    37 */
       
    38 NONSHARABLE_CLASS(CSatRefreshNotifier) : public CBase,
       
    39                             private MSatRefreshObserver,
       
    40                             private MSimRefreshCompletion
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43         
       
    44         /**
       
    45         * Two-phased constructor.
       
    46         */
       
    47         static CSatRefreshNotifier* NewL();
       
    48         
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CSatRefreshNotifier();
       
    53 
       
    54     public: // New functions
       
    55         
       
    56         /**
       
    57         * Opens session to SAT server and activates notification
       
    58         * if refresh object has files that are not already listened to.
       
    59         *
       
    60         * @param aSimRefreshObject the object that needs to listen to refresh.
       
    61         */
       
    62         void ActivateL( MSimRefreshObject& aSimRefreshObject );
       
    63         
       
    64         /**
       
    65         * Deactivates listening refresh.
       
    66         *
       
    67         * @param aSimRefreshObject the object that doesn't need 
       
    68         *                          notification anymore.
       
    69         */
       
    70         void DeActivate( MSimRefreshObject& aSimRefreshObject );
       
    71         
       
    72         /**
       
    73         * Returns ETrue if notifier has been activated
       
    74         * @return ETrue if notifier has been activated
       
    75         */
       
    76         TBool IsActive();
       
    77         
       
    78     private:  // From MSatRefreshObserver
       
    79         
       
    80         TBool AllowRefresh( TSatRefreshType aType, 
       
    81             const TSatRefreshFiles& aFiles );
       
    82         void Refresh( TSatRefreshType aType, const TSatRefreshFiles& aFiles );
       
    83     
       
    84     private:    // From MSimRefreshCompletion
       
    85         void SatRefreshCompleted( MSimRefreshObject& aSimRefreshObject,
       
    86             TBool aReadAdditionalFiles );
       
    87             
       
    88     private:
       
    89 
       
    90         /**
       
    91         * C++ default constructor.
       
    92         */
       
    93         CSatRefreshNotifier();
       
    94 
       
    95         /**
       
    96         * By default Symbian 2nd phase constructor is private.
       
    97         */
       
    98         void ConstructL();
       
    99 
       
   100     private:    // Data
       
   101         /// Own: a C-class that owns SAT session
       
   102         class CSatSession;
       
   103         CSatSession* iSatSession;
       
   104         /// An array of observers. Instances are not owned.
       
   105         RPointerArray<MSimRefreshObject> iObjects;
       
   106         /// The number of object that have completed refresh
       
   107         TInt iRefreshedObjects;
       
   108         /// ETrue if some object has read other than SAT-defined EFs.
       
   109         TBool iAdditionalEFsRead;        
       
   110     };
       
   111 } // namespace VPbkSimStoreImpl
       
   112 #endif      // VPBKSIMSTOREIMPL_CSATREFRESHNOTIFIER_H
       
   113             
       
   114 // End of File