18 |
18 |
19 #ifndef CMPXMEDIAREMOVALMONITOR_H |
19 #ifndef CMPXMEDIAREMOVALMONITOR_H |
20 #define CMPXMEDIAREMOVALMONITOR_H |
20 #define CMPXMEDIAREMOVALMONITOR_H |
21 |
21 |
22 #include <e32base.h> |
22 #include <e32base.h> |
|
23 #include <disknotifyhandler.h> |
23 #include "mpxsystemeventobserver.h" |
24 #include "mpxsystemeventobserver.h" |
24 |
25 |
25 /** |
26 /** |
26 * Class to monitors for File System dismount events |
27 * Class to monitors for File System dismount events |
|
28 * |
|
29 * The monitor emits events to MMPXSystemEventObserver |
|
30 * |
|
31 * EDiskDismountEvent whenever a drive is about to be dismounted (see RFs::NotifyDismount). |
|
32 * EDiskRemovedEvent whenever a specified drive has been dismounted or removed |
|
33 * EDiskInsertedEvent whenever a specified drive has been inserted |
|
34 * |
|
35 * The observer is expected to prepare the drive for dismounting during the EDiskDismountEvent. |
|
36 * |
|
37 * Dismount monitoring is automatically subscribed for all non-remote drives. |
|
38 * Inserted/Removed monitor is subscribed only for the drive given in the constructor. |
|
39 * |
27 * @lib Harvester |
40 * @lib Harvester |
28 * @since S60 3.0 |
41 * @since S60 3.0 |
29 */ |
42 */ |
30 class CMPXMediaRemovalMonitor : public CActive |
43 class CMPXMediaRemovalMonitor : public CBase, |
|
44 public MDiskNotifyHandlerCallback |
31 { |
45 { |
32 |
46 |
33 public: |
47 public: |
34 |
48 |
35 /** |
49 /** |
36 * Two-phase constructor |
50 * Two-phase constructor |
37 * @param aDrive drive to monitor |
51 * @param aDrive drive to monitor for insertions and removals |
38 * @param aFs file server session |
52 * @param aFs file server session |
39 * @param aObserver observer to the event |
53 * @param aObserver observer to the event |
40 */ |
54 */ |
41 static CMPXMediaRemovalMonitor* NewL( TInt aDrive, |
55 static CMPXMediaRemovalMonitor* NewL( TInt aDrive, |
42 RFs& aFs, |
56 RFs& aFs, |
53 |
67 |
54 /** |
68 /** |
55 * Virtual destructor |
69 * Virtual destructor |
56 */ |
70 */ |
57 virtual ~CMPXMediaRemovalMonitor(); |
71 virtual ~CMPXMediaRemovalMonitor(); |
|
72 |
|
73 /** |
|
74 * Check the status of the monitored disks |
|
75 * |
|
76 * This check should be done whenever there is a risk that we got |
|
77 * a NotifyDismount even though the drives actually weren't dismounted. |
|
78 * |
|
79 */ |
|
80 void CheckDriveStatus(); |
58 |
81 |
59 protected: // From base class |
82 protected: // From Base Class |
60 |
|
61 /* |
|
62 * From CActive |
|
63 */ |
|
64 void RunL(); |
|
65 |
|
66 /* |
|
67 * From CActive |
|
68 */ |
|
69 void DoCancel(); |
|
70 |
83 |
71 /** |
84 /** |
72 * From CActive |
85 * From MDiskNotifyHandlerCallback |
73 */ |
86 */ |
74 TInt RunError(TInt aError); |
87 void HandleNotifyDismount( TInt aError, const TDismountEvent& aEvent ); |
75 |
88 void HandleNotifyDisk( TInt aError, const TDiskEvent& aEvent ); |
|
89 |
76 private: |
90 private: |
77 |
91 |
78 /** |
92 /** |
79 * C++ constructor |
93 * C++ constructor |
80 * @param aDrive drive to monitor |
94 * @param aDrive drive to monitor |