qtinternetradio/irqsystemeventhandler/inc/irdiskspaceobserver.h
changeset 3 ee64f059b8e1
child 5 0930554dc389
equal deleted inserted replaced
2:2e1adbfc62af 3:ee64f059b8e1
       
     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 CIRDISKSPACEOBSERVER_H
       
    19 #define CIRDISKSPACEOBSERVER_H
       
    20 
       
    21 #include <e32base.h>  // CActive
       
    22 #include <f32file.h>  // RFs
       
    23 
       
    24 class MIRDiskSpaceObserverInterface;
       
    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 CIRDiskSpaceObserver : 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 CIRDiskSpaceObserver* NewL(MIRDiskSpaceObserverInterface* aObserver);
       
    44 
       
    45     /**
       
    46      * Destructor
       
    47      */
       
    48     ~CIRDiskSpaceObserver();
       
    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     TBool 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     CIRDiskSpaceObserver(MIRDiskSpaceObserverInterface* 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     MIRDiskSpaceObserverInterface* 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 #endif // CIRDISKSPACEOBSERVER_H