|
1 /* |
|
2 * Copyright (c) 2004 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 * @file |
|
20 * |
|
21 * @internalComponent |
|
22 * @prototype |
|
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 /// an M-Class specifying the behaviour of the daemon |
|
69 MDaemonBehaviour& iBehaviour; |
|
70 |
|
71 /// An array of watchers, which watch removable drives |
|
72 RPointerArray<CDriveWatcher> iWatchers; |
|
73 |
|
74 RFs iFs; |
|
75 |
|
76 // Used for preventing exclusing locks on the SWI policy file |
|
77 RFile iPolicyLockFile; |
|
78 |
|
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__ |