omadrm/drmengine/utils/inc/procwatcher.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 CProcWatcher class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef PROCWATCHER_H
       
    20 #define PROCWATCHER_H
       
    21 
       
    22 #include "watcherobserver.h"
       
    23 
       
    24 /**  Prefix used when signaling the observer which process was killed */
       
    25 _LIT( KProcIdentifier, "PROC: " );
       
    26 
       
    27 /**
       
    28  *  Watches a process
       
    29  *
       
    30  *  Logs onto a specified process and signals an observer when that process dies.
       
    31  *
       
    32  *  @since S60 3.0
       
    33  */
       
    34 NONSHARABLE_CLASS( CProcWatcher ): public CActive
       
    35     {
       
    36 public:
       
    37 
       
    38     static CProcWatcher* NewL( MWatcherObserver& aObserver, const TDesC& aProcess, const TDesC& aFile );
       
    39 
       
    40     virtual ~CProcWatcher();
       
    41 
       
    42     /**
       
    43      * Start watching the process
       
    44      *
       
    45      * @since S60 3.0
       
    46      * @return KErrNone if watching started correctly
       
    47      */
       
    48     TInt 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     CProcWatcher( MWatcherObserver& aObserver );
       
    73 
       
    74     void ConstructL( const TDesC& aProcess, const TDesC& aFile );
       
    75 
       
    76 private: // data
       
    77 
       
    78     TFullName iProcessName;
       
    79     TFileName iFileName;
       
    80     RProcess iProcess;
       
    81     MWatcherObserver& iObserver;
       
    82     };
       
    83 
       
    84 #endif // DIRWATCHER_H