omadrm/drmengine/utils/inc/dirwatcher.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Declaration of the CDirWatcher class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIRWATCHER_H
       
    20 #define DIRWATCHER_H
       
    21 
       
    22 #include "watcherobserver.h"
       
    23 
       
    24 /**  Prefix used when signaling the observer which directory has changed */
       
    25 _LIT( KDirIdentifier, "RDB: " );
       
    26 
       
    27 /**
       
    28  *  Watches a single directory
       
    29  *
       
    30  *  Uses change notifications on the RDB directories, restarts the device if
       
    31  *  unauthorized modifications have been detected
       
    32  *
       
    33  *  @since S60 3.0
       
    34  */
       
    35 NONSHARABLE_CLASS( CDirWatcher ): public CActive
       
    36     {
       
    37 public:
       
    38 
       
    39     static CDirWatcher* NewL( MWatcherObserver& aObserver, RFs& aFs, const TDesC& aDir );
       
    40 
       
    41     virtual ~CDirWatcher();
       
    42 
       
    43     /**
       
    44      * Start watching the database
       
    45      *
       
    46      * @since S60 3.0
       
    47      */
       
    48     void StartWatching();
       
    49 
       
    50 protected:
       
    51 
       
    52 // from base class CActive
       
    53 
       
    54     /**
       
    55      * From CActive.
       
    56      * Cancel outstanding requests
       
    57      *
       
    58      * @since S60 3.0
       
    59      */
       
    60     void DoCancel();
       
    61     
       
    62     /**
       
    63      * From CActive.
       
    64      * Handle events
       
    65      *
       
    66      * @since S60 3.0
       
    67      */
       
    68     void RunL();
       
    69     
       
    70 private:
       
    71 
       
    72     CDirWatcher( MWatcherObserver& aObserver, RFs& aFs );
       
    73 
       
    74     void ConstructL( const TDesC& aDir );
       
    75 
       
    76 private: // data
       
    77 
       
    78     RFs& iFs;
       
    79     TFileName iDir;
       
    80     MWatcherObserver& iObserver;
       
    81     };
       
    82 
       
    83 #endif // DIRWATCHER_H