installationservices/swi/source/daemon/daemon.h
branchRCL_3
changeset 25 7333d7932ef7
parent 24 5cc91383ab1e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
       
     2 * Copyright (c) 2004-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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  @file 
       
    21  @internalComponent
       
    22  @released
       
    23 */
       
    24 
       
    25 #ifndef __DAEMON_H__
       
    26 #define __DAEMON_H__
       
    27 
       
    28 #include "drivewatcher.h"
       
    29 
       
    30 namespace Swi
       
    31 {
       
    32 class CDriveWatcher;
       
    33 
       
    34 class MDaemonBehaviour : public MDriveObserver
       
    35 	{
       
    36 public:
       
    37 	/**
       
    38 	 * Called by the daemon when it is first started
       
    39 	 *
       
    40 	 * @return ETrue to continue, or EFalse to stop the daemon
       
    41 	 */
       
    42 	virtual TBool StartupL()=0;
       
    43 	};
       
    44 
       
    45 /**
       
    46  * The main daemon class which sets up the watchers.
       
    47  */
       
    48 class CDaemon : public CBase
       
    49 	{
       
    50 public:
       
    51 	static CDaemon* NewL(MDaemonBehaviour& aBehaviour);
       
    52 	static CDaemon* NewLC(MDaemonBehaviour& aBehaviour);
       
    53 	
       
    54 	~CDaemon();
       
    55 	
       
    56 	const RPointerArray<CDriveWatcher>& Watchers() const; 
       
    57 private:
       
    58 	CDaemon(MDaemonBehaviour& aBehaviour);
       
    59 	void ConstructL();
       
    60 	
       
    61 	void StartWatchersL();
       
    62 	
       
    63 	// This function should not leave, it is not an inherent functionality of the daemon
       
    64 	void LockSensitiveFiles(); 
       
    65 	
       
    66 	void StartRecoveryL();
       
    67 
       
    68 private:
       
    69 	/// an M-Class specifying the behaviour of the daemon
       
    70 	MDaemonBehaviour& iBehaviour;
       
    71 	
       
    72 	/// An array of watchers, which watch removable drives
       
    73 	RPointerArray<CDriveWatcher> iWatchers;	
       
    74 	
       
    75 	RFs iFs;
       
    76 	
       
    77 	// Used for preventing exclusing locks on the SWI policy file	
       
    78 	RFile iPolicyLockFile; 
       
    79 	};
       
    80 
       
    81 
       
    82 // inline functions from CDaemon
       
    83 
       
    84 inline const RPointerArray<CDriveWatcher>& CDaemon::Watchers() const
       
    85 	{
       
    86 	return iWatchers;
       
    87 	}
       
    88 
       
    89 } // namespace Swi
       
    90 
       
    91 #endif // #ifndef __DAEMON_H__