filemanager/schbkup/inc/filemanagerschsubscriber.h
changeset 0 6a9f87576119
equal deleted inserted replaced
-1:000000000000 0:6a9f87576119
       
     1 /*
       
     2 * Copyright (c) 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:  Handles P&S and CenRep notifications
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FILEMANAGERSCHSUBSCRIBER_H
       
    20 #define C_FILEMANAGERSCHSUBSCRIBER_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <e32property.h>
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MFileManagerSchObserver;
       
    30 class CRepository;
       
    31 
       
    32 
       
    33 // CLASS DECLARATION
       
    34 /**
       
    35  *  This class handles P&S and CenRep notifications
       
    36  *
       
    37  *  @since S60 3.1
       
    38  */
       
    39 class CFileManagerSchSubscriber : public CActive
       
    40     {
       
    41 
       
    42 public:
       
    43     /**  Type of subscribed notifications */
       
    44     enum TType
       
    45         {
       
    46         ESubscribePS = 0,
       
    47         ESubscribeCR
       
    48         };
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      */
       
    53     static CFileManagerSchSubscriber* NewL(
       
    54         MFileManagerSchObserver& aObserver,
       
    55         const TUid& aCategory,
       
    56         const TUint aKey,
       
    57         const TType aType,
       
    58         const TInt aTimeoutSecs );
       
    59 
       
    60     /**
       
    61      * Destructor
       
    62      */
       
    63     ~CFileManagerSchSubscriber();
       
    64 
       
    65 private:  // New methods
       
    66     /**
       
    67      * Constructors
       
    68      */
       
    69     CFileManagerSchSubscriber(
       
    70         MFileManagerSchObserver& aObserver,
       
    71         const TUid& aCategory,
       
    72         const TUint aKey,
       
    73         const TType aType,
       
    74         const TInt aTimeoutSecs );
       
    75 
       
    76     void ConstructL();
       
    77 
       
    78     /**
       
    79      * Subscribes notification
       
    80      */
       
    81     void SubscribeL();
       
    82 
       
    83     /**
       
    84      * Timeout callback
       
    85      * @param aPtr Pointer to subcriber
       
    86      * @return System wide error code
       
    87      */
       
    88     static TInt TimeoutCB( void* aPtr );
       
    89 
       
    90     /**
       
    91      * Handles timeout
       
    92      */
       
    93     void Timeout();
       
    94 
       
    95 private: // From CActive
       
    96     void RunL();
       
    97     
       
    98     TInt RunError( TInt aError );
       
    99 
       
   100     void DoCancel();
       
   101 
       
   102 private: // Data
       
   103     /**
       
   104      * Reference to observer interface
       
   105      * Not own.
       
   106      */
       
   107     MFileManagerSchObserver& iObserver;
       
   108 
       
   109     /**
       
   110      * Pointer to CenRep
       
   111      * Own.
       
   112      */
       
   113     CRepository* iCenRep;
       
   114 
       
   115     /**
       
   116      * Handle to PS
       
   117      */
       
   118     RProperty iProperty;
       
   119 
       
   120     /**
       
   121      * Category Uid
       
   122      */
       
   123     TUid iCategory;
       
   124 
       
   125     /**
       
   126      * Key id
       
   127      */
       
   128     TUint iKey;
       
   129 
       
   130     /**
       
   131      * Subscriber type
       
   132      */
       
   133     TType iType;
       
   134 
       
   135     /**
       
   136      * Timeout seconds
       
   137      */
       
   138     TInt iTimeoutSecs;
       
   139 
       
   140     /**
       
   141      * Timer for timeout
       
   142      * Own.
       
   143      */
       
   144     CPeriodic* iTimer;
       
   145 
       
   146     /**
       
   147      * Indicates timeout status
       
   148      */
       
   149     TBool iTimeout;
       
   150 
       
   151     };
       
   152 
       
   153 #endif // C_FILEMANAGERSCHSUBSCRIBER_H
       
   154 
       
   155 // End of File