|
1 /* |
|
2 * Copyright (c) 2007-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: Wrapper implementation for file server notification handling. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_DISK_NOTIFY_HANDLER_IMPL_H |
|
21 #define C_DISK_NOTIFY_HANDLER_IMPL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MDiskNotifyHandlerCallback; |
|
29 class CDiskWatcher; |
|
30 class CDismountWatcher; |
|
31 class CDiskSpaceWatcher; |
|
32 class CEntryWatcher; |
|
33 class CStartedDismountWatcher; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 * Class provides actual implementation of disk notify handler. |
|
38 * |
|
39 * @since S60 5.0 |
|
40 */ |
|
41 NONSHARABLE_CLASS(CDiskNotifyHandlerImpl) : public CBase |
|
42 { |
|
43 |
|
44 public: |
|
45 |
|
46 /** |
|
47 * This is a two-phase constructor method that is used to |
|
48 * create a new instance for listening to the disk changes. |
|
49 * |
|
50 * @since S60 5.0 |
|
51 * @param aCallback Reference to a callback instance, MDiskNotifyHandlerCallback |
|
52 * @param aFs Reference to an open file server session |
|
53 * @return A pointer to a new instance of the CDiskNotifyHandlerImpl class. |
|
54 */ |
|
55 static CDiskNotifyHandlerImpl* NewL( |
|
56 MDiskNotifyHandlerCallback& aCallback, RFs& aFs ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 ~CDiskNotifyHandlerImpl(); |
|
62 |
|
63 /** |
|
64 * Starts listening for disk notifications. |
|
65 * |
|
66 * @since S60 5.0 |
|
67 * @return A system wide error code. |
|
68 */ |
|
69 TInt NotifyDisk(); |
|
70 |
|
71 /** |
|
72 * Cancels listening for disk notifications. |
|
73 * |
|
74 * @since S60 5.0 |
|
75 */ |
|
76 void CancelNotifyDisk(); |
|
77 |
|
78 /** |
|
79 * Starts listening for dismount notifications. |
|
80 * |
|
81 * @since S60 5.0 |
|
82 * @param aDrive A drive identifier specified by TDriveNumber |
|
83 */ |
|
84 TInt NotifyDismount( TInt aDrive ); |
|
85 |
|
86 /** |
|
87 * Cancels listening for dismount notifications. |
|
88 * |
|
89 * @since S60 5.0 |
|
90 * @param aDrive A drive identifier specified by TDriveNumber |
|
91 */ |
|
92 void CancelNotifyDismount( TInt aDrive ); |
|
93 |
|
94 /** |
|
95 * Cancels listening for all dismount notifications. |
|
96 * |
|
97 * @since S60 5.0 |
|
98 */ |
|
99 void CancelNotifyDismount(); |
|
100 |
|
101 /** |
|
102 * Allows the dismount of given drive. |
|
103 * |
|
104 * @since S60 5.0 |
|
105 * @param aDrive A drive identifier specified by TDriveNumber |
|
106 */ |
|
107 TInt AllowDismount( TInt aDrive ); |
|
108 |
|
109 /** |
|
110 * Starts listening for disk space notifications. |
|
111 * |
|
112 * @since S60 5.0 |
|
113 * @param aThreshold A threshold that causes notification when crossed. |
|
114 * @param aDrive A drive identifier specified by TDriveNumber |
|
115 * @return A system wide error code. |
|
116 */ |
|
117 TInt NotifyDiskSpace( const TInt64& aThreshold, TInt aDrive ); |
|
118 |
|
119 /** |
|
120 * Cancels listening for disk space notifications with given threshold. |
|
121 * |
|
122 * @since S60 5.0 |
|
123 * @param aThreshold A threshold that causes notification when crossed. |
|
124 * @param aDrive A drive identifier specified by TDriveNumber |
|
125 */ |
|
126 void CancelNotifyDiskSpace( const TInt64& aThreshold, TInt aDrive ); |
|
127 |
|
128 /** |
|
129 * Cancels listening for all disk space notifications with given drive. |
|
130 * |
|
131 * @since S60 5.0 |
|
132 * @param aDrive A drive identifier specified by TDriveNumber |
|
133 */ |
|
134 void CancelNotifyDiskSpace( TInt aDrive ); |
|
135 |
|
136 /** |
|
137 * Cancels listening for all disk space notifications. |
|
138 * |
|
139 * @since S60 5.0 |
|
140 */ |
|
141 void CancelNotifyDiskSpace(); |
|
142 |
|
143 /** |
|
144 * Starts listening for entry (i.e. file or folder) change notifications. |
|
145 * |
|
146 * @since S60 5.0 |
|
147 * @param aType A type of notification specified by TNotifyType. |
|
148 * @param aEntry A full path of the file or folder to be listened. |
|
149 * @return A system wide error code. |
|
150 */ |
|
151 TInt NotifyEntry( TNotifyType aType, const TDesC& aEntry ); |
|
152 |
|
153 /** |
|
154 * Cancels listening for entry (i.e. file or folder) change notifications with |
|
155 * given entry and notify type. |
|
156 * |
|
157 * @since S60 5.0 |
|
158 * @param aType A type of notification specified by TNotifyType. |
|
159 * @param aEntry A full path of the file or folder to be listened. |
|
160 */ |
|
161 void CancelNotifyEntry( TNotifyType aType, const TDesC& aEntry ); |
|
162 |
|
163 /** |
|
164 * Cancels listening for all entry (i.e. file or folder) change notifications with |
|
165 * given entry. |
|
166 * |
|
167 * @since S60 5.0 |
|
168 * @param aEntry A full path of the file or folder to be listened. |
|
169 */ |
|
170 void CancelNotifyEntry( const TDesC& aEntry ); |
|
171 |
|
172 /** |
|
173 * Cancels listening for all entry (i.e. file or folder) change notifications. |
|
174 * |
|
175 * @since S60 5.0 |
|
176 */ |
|
177 void CancelNotifyEntry(); |
|
178 |
|
179 /** |
|
180 * Starts dismount with sending notification to registered clients. If dismount is |
|
181 * pending after given timeout, forced dismount is done. |
|
182 * |
|
183 * @since S60 5.2 |
|
184 * @param aDrive A drive identifier specified by TDriveNumber |
|
185 * @param aForcedTimeout A timeout to forced dismount in micro seconds. |
|
186 * @return A system wide error code. |
|
187 */ |
|
188 TInt StartDismount( TInt aDrive, TTimeIntervalMicroSeconds32 aForcedTimeout ); |
|
189 |
|
190 /** |
|
191 * Cancels started dismount of given drive. |
|
192 * |
|
193 * @since S60 5.2 |
|
194 * @param aDrive A drive identifier specified by TDriveNumber |
|
195 */ |
|
196 void CancelStartedDismount( TInt aDrive ); |
|
197 |
|
198 /** |
|
199 * Cancels started dismount of all drives. |
|
200 * |
|
201 * @since S60 5.2 |
|
202 */ |
|
203 void CancelStartedDismount(); |
|
204 |
|
205 private: |
|
206 /** |
|
207 * C++ default constructor. |
|
208 */ |
|
209 CDiskNotifyHandlerImpl( MDiskNotifyHandlerCallback& aCallback, RFs& aFs ); |
|
210 |
|
211 private: |
|
212 MDiskNotifyHandlerCallback& iCallback; |
|
213 RFs& iFs; |
|
214 CDiskWatcher* iDiskWatcher; |
|
215 RPointerArray< CDismountWatcher > iDismountWatcherList; |
|
216 RPointerArray< CDiskSpaceWatcher > iDiskSpaceWatcherList; |
|
217 RPointerArray< CEntryWatcher > iEntryWatcherList; |
|
218 RPointerArray< CStartedDismountWatcher > iStartedDismountWatcherList; |
|
219 |
|
220 }; |
|
221 |
|
222 #endif // C_DISK_NOTIFY_HANDLER_IMPL_H |
|
223 |
|
224 // End of File |