omadrm/drmengine/utils/inc/dbwatcher.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 CDbWatcher class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DBWATCHER_H
       
    20 #define DBWATCHER_H
       
    21 
       
    22 #include "dirwatcher.h"
       
    23 #include "watcherobserver.h"
       
    24 
       
    25 /**
       
    26  *  Watches the rights database to detect adding or removing of files
       
    27  *
       
    28  *  Uses change notifications on the RDB directories, restarts the device if
       
    29  *  unauthorized modifications have been detected
       
    30  *
       
    31  *  @since S60 3.0
       
    32  */
       
    33 NONSHARABLE_CLASS( CDbWatcher ): public CBase
       
    34     {
       
    35 
       
    36 public:
       
    37 
       
    38     /**  Number of directories to watch */
       
    39     static const TInt KNumDirs = 17;
       
    40 
       
    41     static CDbWatcher* NewL( MWatcherObserver& aObserver );
       
    42 
       
    43     virtual ~CDbWatcher();
       
    44 
       
    45     /**
       
    46      * Start watching the database
       
    47      *
       
    48      * @since S60 3.0
       
    49      */
       
    50     void StartWatching();
       
    51 
       
    52 protected:
       
    53 
       
    54 // from base class CActive
       
    55 
       
    56     /**
       
    57      * From CActive.
       
    58      * Cancel outstanding requests
       
    59      *
       
    60      * @since S60 3.0
       
    61      */
       
    62     void DoCancel();
       
    63     
       
    64     /**
       
    65      * From CActive.
       
    66      * Handle events
       
    67      *
       
    68      * @since S60 3.0
       
    69      */
       
    70     void RunL();
       
    71     
       
    72 private:
       
    73 
       
    74     CDbWatcher();
       
    75 
       
    76     void ConstructL( MWatcherObserver& aObserver );
       
    77 
       
    78 private: // data
       
    79 
       
    80     /**
       
    81      * Actual watcher objects
       
    82      */
       
    83     CDirWatcher* iDirWatcher[KNumDirs]; 
       
    84     
       
    85     /**
       
    86      * Array of request status fields
       
    87      */
       
    88     TRequestStatus iRequestStatus[KNumDirs];
       
    89 
       
    90     /**
       
    91      * File server instance
       
    92      */
       
    93     RFs iFs;
       
    94     };
       
    95 
       
    96 #endif // DBWATCHER_H