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