brandingserver/bsserver/cbsbackupobserver.h
changeset 46 860cd8a5168c
parent 35 085f765766a0
equal deleted inserted replaced
35:085f765766a0 46:860cd8a5168c
     1 /*
       
     2 * Copyright (c) 2006-2006 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:  Gets and notifies backup and Restore events from system
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CBSBACKUPOBSERVER_H
       
    20 #define CBSBACKUPOBSERVER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32property.h>
       
    24 
       
    25 #include "mbsbackupobserver.h"
       
    26 
       
    27 /**
       
    28  *  Gets and notifies backup and Restore events from system
       
    29  *
       
    30  *  @lib bsserver.exe
       
    31  *  @since S60 v3.2
       
    32  */
       
    33 class CBSBackupObserver : public CActive
       
    34 {
       
    35 public:
       
    36 
       
    37     static CBSBackupObserver* NewL();
       
    38 
       
    39     static CBSBackupObserver* NewLC();
       
    40 
       
    41     ~CBSBackupObserver();
       
    42 
       
    43 
       
    44 private: // From CActive
       
    45 
       
    46     /**
       
    47      * @see CActive
       
    48      */
       
    49     void RunL();
       
    50     
       
    51     /**
       
    52      * @see CActive
       
    53      */
       
    54     void DoCancel();
       
    55     
       
    56     /**
       
    57      * @see CActive
       
    58      */
       
    59     TInt RunError( TInt aError );
       
    60 
       
    61 
       
    62 private: // Private constructors
       
    63 
       
    64     CBSBackupObserver();
       
    65 
       
    66     void ConstructL();
       
    67 
       
    68 
       
    69 public: // New Methods
       
    70 
       
    71     /**
       
    72      * Register observer to observe backup state changes
       
    73      * @param aObserver observer to register
       
    74      * @return KErrNone or some other system wide errorcode
       
    75      */
       
    76     TInt RegisterObserver( MBSBackupObserver* aObserver );
       
    77     
       
    78     /**
       
    79      * Unregister observer
       
    80      * @param aObserver observer to remove
       
    81      */
       
    82     void UnregisterObserver( MBSBackupObserver* aObserver );   
       
    83 
       
    84 
       
    85 private: // New methods
       
    86 
       
    87     /**
       
    88      * Subscribes to backup and restore P&S value.
       
    89      */
       
    90     void Subscribe();
       
    91     
       
    92     /**
       
    93      * Notify registered observers of new backup state
       
    94      */
       
    95     void NotifyObserversL( MBSBackupObserver::TBackupState aState );
       
    96     
       
    97     /**
       
    98      * Read current backup state
       
    99      * @return current backup state
       
   100      */
       
   101     MBSBackupObserver::TBackupState BackupStateL();
       
   102 
       
   103 
       
   104 private: // Data
       
   105 
       
   106     // backup state property
       
   107     RProperty iProperty;
       
   108     
       
   109     // Own (array only). Observers
       
   110     RPointerArray<MBSBackupObserver> iObservers;
       
   111     
       
   112     // latest state of backup and restore;
       
   113     MBSBackupObserver::TBackupState iLatestState;
       
   114 };
       
   115 
       
   116 #endif //CBSBACKUPOBSERVER_H