|
1 /* |
|
2 * Copyright (c) 2006-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 "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: Monitors file creations, modifications and deletions.* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef __MDSFILESERVERPLUGIN_H__ |
|
19 #define __MDSFILESERVERPLUGIN_H__ |
|
20 |
|
21 #include <f32plugin.h> |
|
22 #include "mdsfileserverpluginclient.h" |
|
23 #include "mdsfspqueue.h" |
|
24 |
|
25 const TInt KDoubleMaxFileName = 2 * KMaxFileName; |
|
26 /** |
|
27 * File server plug-in. |
|
28 */ |
|
29 class CMdsFileServerPlugin : public CFsPlugin |
|
30 { |
|
31 public: |
|
32 |
|
33 /** |
|
34 * Standard NewL() |
|
35 * From CActive. |
|
36 */ |
|
37 static CMdsFileServerPlugin* NewL(); |
|
38 |
|
39 /** |
|
40 * Virtual destructor. |
|
41 */ |
|
42 virtual ~CMdsFileServerPlugin(); |
|
43 |
|
44 /** |
|
45 * Initialize plugin. |
|
46 */ |
|
47 virtual void InitialiseL(); |
|
48 |
|
49 virtual TInt DoRequestL( TFsPluginRequest& aRequest ); |
|
50 |
|
51 virtual CFsPluginConn* NewPluginConnL(); |
|
52 |
|
53 TInt RegisterNotification( CFsPluginConnRequest& aRequest ); |
|
54 |
|
55 /** |
|
56 * Add a new notification path. |
|
57 */ |
|
58 TInt AddNotificationPath( const CFsPluginConnRequest& aRequest ); |
|
59 |
|
60 /** |
|
61 * Remove notification path. |
|
62 */ |
|
63 TInt RemoveNotificationPath( const CFsPluginConnRequest& aRequest ); |
|
64 |
|
65 /** |
|
66 * Add a new path to ignore. |
|
67 */ |
|
68 TInt AddIgnorePath( const CFsPluginConnRequest& aRequest ); |
|
69 |
|
70 /** |
|
71 * Remove a path from the ignore list. |
|
72 */ |
|
73 TInt RemoveIgnorePath( const CFsPluginConnRequest& aRequest ); |
|
74 |
|
75 void EnableL(); |
|
76 |
|
77 void DisableL(); |
|
78 |
|
79 /** |
|
80 * Add CMdsFileServerPluginConn connection to this file server plugin. |
|
81 */ |
|
82 void AddConnection(); |
|
83 |
|
84 /** |
|
85 * Remove CMdsFileServerPluginConn connection from this file server |
|
86 * plugin. |
|
87 */ |
|
88 void RemoveConnection(); |
|
89 |
|
90 private: |
|
91 |
|
92 /** |
|
93 * Private constructor. |
|
94 */ |
|
95 CMdsFileServerPlugin(); |
|
96 |
|
97 /** |
|
98 * Check if a path is listed. |
|
99 * |
|
100 * @param aFilename Path to check. |
|
101 * |
|
102 * @return EFalse, if path is ignored. |
|
103 * ETrue, if the path is on the notification path list or |
|
104 * if there is no notification paths set. |
|
105 * Else EFalse. |
|
106 */ |
|
107 TBool CheckPath( const TDesC& aFilename ) const; |
|
108 |
|
109 /** |
|
110 * Check if path/file hass hidden or system attribute. |
|
111 * |
|
112 * @param aFilename Filename to check. |
|
113 * @param aIsDirectory ETrue if filename points to directory. |
|
114 * |
|
115 * @return EFalse, if path or file has a hidden or system attribute set. |
|
116 */ |
|
117 TBool CheckAttribs( const TDesC& aFilename, TBool& aIsDirectory ) const; |
|
118 |
|
119 /** |
|
120 * Check if directory is named correctly and ends with backslash. |
|
121 * |
|
122 * @param aDirName Directory name to check. |
|
123 */ |
|
124 void AddBackslashIfNeeded ( TDes& aDirName ) const; |
|
125 |
|
126 /** |
|
127 * Check if harvester (main observer) is alive |
|
128 */ |
|
129 TBool CheckHarvesterStatus(); |
|
130 |
|
131 #ifdef _DEBUG_EVENTS |
|
132 void RegisterDebugEventsL(); |
|
133 void UnregisterDebugEventsL(); |
|
134 void PrintDebugEvents( TInt aFunction ); |
|
135 #endif |
|
136 |
|
137 private: |
|
138 |
|
139 CFsPluginConnRequest* iNotification; |
|
140 |
|
141 /** |
|
142 * An array of notification paths. |
|
143 */ |
|
144 RPointerArray<TDesC> iPaths; |
|
145 |
|
146 /** |
|
147 * A queue of file server events. |
|
148 */ |
|
149 RPointerArray<CMdsFSPQueueItem> iQueue; |
|
150 |
|
151 RPointerArray<TDesC> iIgnorePaths; |
|
152 |
|
153 /** |
|
154 * File system client session. |
|
155 */ |
|
156 RFs iFsSession; |
|
157 |
|
158 RPointerArray<TDesC> iCreatedFiles; |
|
159 |
|
160 TUint32 iFormatOldMediaId; |
|
161 TInt iFormatDriveNumber; |
|
162 |
|
163 TInt iConnectionCount; |
|
164 |
|
165 TBuf<KDoubleMaxFileName> iFileName; |
|
166 TBuf<KDoubleMaxFileName> iNewFileName; |
|
167 |
|
168 TInt iPendingEvents; |
|
169 |
|
170 }; |
|
171 |
|
172 #endif // __MDSFILESERVERPLUGIN_H__ |