qtinternetradio/irqdiskspacewatcher/inc/irqdiskspaceobserver.h
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     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:  Contains logic for watching certain disk's space
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef IRQDISKSPACEOBSERVER_H_
       
    19 #define IRQDISKSPACEOBSERVER_H_
       
    20 
       
    21 #include <e32base.h>  // CActive
       
    22 #include <f32file.h>  // RFs
       
    23 
       
    24 class MIRQDiskSpaceObserver;
       
    25 
       
    26 /**
       
    27  * Defines disk space observer. 
       
    28  *
       
    29  * Observers defined disk and notifies observer if disk space drops below
       
    30  * certain level.
       
    31  */
       
    32 class  IRQDiskSpaceObserver  : public CActive
       
    33     {
       
    34 
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Static constructor 
       
    39      *
       
    40      * @param aObserver Observer who is interested if disk 
       
    41      * space drops below certain level.
       
    42      */
       
    43     static IRQDiskSpaceObserver* NewL(MIRQDiskSpaceObserver* aObserver);
       
    44 
       
    45     /**
       
    46      * Destructor
       
    47      */
       
    48     ~IRQDiskSpaceObserver();
       
    49     
       
    50     /**
       
    51      * Start Monitoring 
       
    52      */
       
    53     void start(const TInt64 aCriticalLevel);
       
    54 
       
    55     /**
       
    56      * Tells observed critical level.
       
    57      *
       
    58      * @return critical level which is been observed by this session.
       
    59      */
       
    60     TInt64 criticalLevel() const;
       
    61     
       
    62     /**
       
    63      * Returns whether or disk defined by parameter 
       
    64      * contains less than the critical level free disk space.
       
    65      */
       
    66     bool isBelowCriticalLevel(const TInt64 aCriticalLevel) const;
       
    67        
       
    68 protected:
       
    69     /**
       
    70      * From CActive 
       
    71      */
       
    72     void DoCancel();
       
    73     void RunL();
       
    74 
       
    75 private:
       
    76 
       
    77     /**
       
    78      * C++ constructor.  
       
    79      */
       
    80     IRQDiskSpaceObserver(MIRQDiskSpaceObserver* aObserver);
       
    81 
       
    82     /**
       
    83      * Second phase constructor
       
    84      */
       
    85     void ConstructL();
       
    86     
       
    87     void run();
       
    88     
       
    89 private: 
       
    90 
       
    91     /** 
       
    92      * The observer to be notified when critical disk space limit is reached. 
       
    93      */
       
    94     MIRQDiskSpaceObserver* iObserver;
       
    95 
       
    96     /** 
       
    97      * Critical disk space level. 
       
    98      */
       
    99     TInt64 iCriticalLevel;
       
   100 
       
   101     /** 
       
   102      * Handle to the file system. 
       
   103      */
       
   104     RFs iFs;
       
   105 };
       
   106 
       
   107 
       
   108 #endif // IRQDISKSPACEOBSERVER_H_