|
1 /* |
|
2 * Copyright (c) 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: Class for started dismount watcher |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_STARTED_DISMOUNT_WATCHER_H |
|
21 #define C_STARTED_DISMOUNT_WATCHER_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include "diskwatcherbase.h" |
|
27 |
|
28 // CLASS DECLARATION |
|
29 /** |
|
30 * Class provides functionality of dismount watcher. |
|
31 * |
|
32 * @since S60 5.2 |
|
33 */ |
|
34 NONSHARABLE_CLASS(CStartedDismountWatcher) : public CDiskWatcherBase |
|
35 { |
|
36 public: |
|
37 /** |
|
38 * This is a two-phase constructor method to create a new watcher instance. |
|
39 * |
|
40 * @since S60 5.2 |
|
41 * @param aCallback Reference to callback |
|
42 * @param aFs Reference to open file server session |
|
43 * @param aWatcherList Reference to watcher list |
|
44 * @param aDrive A drive identifier to be watched |
|
45 * @param aForcedTimeout A timeout to forced dismount |
|
46 * @return A pointer to a new watcher instance |
|
47 */ |
|
48 static CStartedDismountWatcher* NewL( |
|
49 MDiskNotifyHandlerCallback& aCallback, |
|
50 RFs& aFs, |
|
51 RPointerArray< CStartedDismountWatcher >& aWatcherList, |
|
52 TInt aDrive, |
|
53 TTimeIntervalMicroSeconds32 aForcedTimeout ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CStartedDismountWatcher(); |
|
59 |
|
60 /** |
|
61 * Compare function for find functionality |
|
62 * |
|
63 * @since S60 5.2 |
|
64 * @param aDrive Pointer to drive identifier |
|
65 * @param aWatcher Watcher to be compared |
|
66 * @return Comparison result |
|
67 */ |
|
68 static TInt CompareFind( |
|
69 const TInt* aDrive, |
|
70 const CStartedDismountWatcher& aWatcher ); |
|
71 |
|
72 /** |
|
73 * Compare function for find functionality |
|
74 * |
|
75 * @since S60 5.2 |
|
76 * @param aWatcher1 Watcher to be compared |
|
77 * @param aWatcher2 Watcher to be compared |
|
78 * @return Comparison result |
|
79 */ |
|
80 static TInt CompareFindObject( |
|
81 const CStartedDismountWatcher& aWatcher1, |
|
82 const CStartedDismountWatcher& aWatcher2 ); |
|
83 |
|
84 /** |
|
85 * Activates watcher manually |
|
86 * |
|
87 * @since S60 5.2 |
|
88 * @param aForcedTimeout A timeout to forced dismount |
|
89 */ |
|
90 void Activate( TTimeIntervalMicroSeconds32 aForcedTimeout ); |
|
91 |
|
92 private: // From CDiskWatcherBase |
|
93 void WatcherError( TInt aError, const TBool& aKilled ); |
|
94 void ReactivateWatcher(); |
|
95 void RunWatcher( const TBool& aKilled ); |
|
96 void CancelWatcher(); |
|
97 |
|
98 private: |
|
99 CStartedDismountWatcher(); |
|
100 CStartedDismountWatcher( |
|
101 MDiskNotifyHandlerCallback& aCallback, |
|
102 RFs& aFs, |
|
103 RPointerArray< CStartedDismountWatcher >& aWatcherList, |
|
104 TInt aDrive, |
|
105 TTimeIntervalMicroSeconds32 aForcedTimeout ); |
|
106 void ConstructL(); |
|
107 void RemoveFromListAndDestroy(); |
|
108 static TInt ForcedDismountCB( TAny* aPtr ); |
|
109 void RequestForcedDismount(); |
|
110 void NotifyDismount( TInt aError, const TBool& aKilled ); |
|
111 |
|
112 private: |
|
113 // Reference to array owning the watchers |
|
114 RPointerArray< CStartedDismountWatcher >& iWatcherList; |
|
115 // Drive to dismount |
|
116 TInt iDrive; |
|
117 // Timeout for forced dismount |
|
118 TTimeIntervalMicroSeconds32 iForcedTimeout; |
|
119 // Timer for forced dismount. Owned. |
|
120 CPeriodic* iForcedDismountTimer; |
|
121 // Indicates if the dismount in progress is forced |
|
122 TBool iForcedDismount; |
|
123 }; |
|
124 |
|
125 |
|
126 #endif // C_DISMOUNT_WATCHER_H |
|
127 |
|
128 // End of File |