|
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 MMC insertions and removals.* |
|
15 */ |
|
16 |
|
17 #ifndef __MMCMONITORPLUGIN_H__ |
|
18 #define __MMCMONITORPLUGIN_H__ |
|
19 |
|
20 #include <e32base.h> |
|
21 |
|
22 #include "mdeharvestersession.h" |
|
23 #include "mdeobject.h" |
|
24 #include "monitorplugin.h" |
|
25 #include "mmcmounttaskao.h" |
|
26 #include "mmcusbao.h" |
|
27 #include "mmcscannerao.h" |
|
28 |
|
29 class CMMCMonitorPlugin : public CMonitorPlugin, public MMMCMonitorObserver |
|
30 { |
|
31 public: |
|
32 /** |
|
33 * Creates and constructs a new instance of CMMCMonitorPlugin. |
|
34 * |
|
35 * @return A pointer to the new instance of CMMCMonitorPlugin. |
|
36 */ |
|
37 static CMMCMonitorPlugin* NewL(); |
|
38 |
|
39 /** |
|
40 * Destructor |
|
41 */ |
|
42 virtual ~CMMCMonitorPlugin(); |
|
43 |
|
44 /** |
|
45 * |
|
46 * |
|
47 * @param aObserver All events are notified via the aObserver. |
|
48 * @param aMdEClient A pointer to MdE client. |
|
49 * @param aCtxEngine A pointer to context engine. |
|
50 * @param aPluginFactory A pointer to harvester plugin factory. |
|
51 * @return ETrue if success, EFalse if not. |
|
52 */ |
|
53 TBool StartMonitoring( MMonitorPluginObserver& aObserver, |
|
54 CMdESession* aMdEClient, CContextEngine* aCtxEngine, |
|
55 CHarvesterPluginFactory* aHarvesterPluginFactory ); |
|
56 |
|
57 /** |
|
58 * Stops the monitoring. |
|
59 * |
|
60 * @return ETrue if success, EFalse if not. |
|
61 */ |
|
62 TBool StopMonitoring(); |
|
63 |
|
64 /** |
|
65 * Resumes paused monitoring. |
|
66 * |
|
67 * @param aObserver All events are notified via the aObserver. |
|
68 * @param aMdEClient A pointer to MdE client. |
|
69 * @param aCtxEngine A pointer to context engine. |
|
70 * @param aPluginFactory A pointer to harvester plugin factory. |
|
71 * @return ETrue if success, EFalse if not. |
|
72 */ |
|
73 TBool ResumeMonitoring( MMonitorPluginObserver& aObserver, |
|
74 CMdESession* aMdEClient, CContextEngine* aCtxEngine, |
|
75 CHarvesterPluginFactory* aHarvesterPluginFactory ); |
|
76 |
|
77 /** |
|
78 * Pauses the monitoring. |
|
79 * |
|
80 * @return ETrue if success, EFalse if not. |
|
81 */ |
|
82 TBool PauseMonitoring(); |
|
83 |
|
84 /** |
|
85 * Inherited from MMMCMonitorObserver. Will be called by CMMCMonitorAO when any MMC is inserted |
|
86 * or removed. |
|
87 * |
|
88 * @param aDriveChar The drive which is inserted or removed. |
|
89 * @param aEventType EMounted if media is inserted, EDismounted if media is removed. |
|
90 */ |
|
91 void MountEvent( TChar aDriveChar, TUint32 aMediaID, TMMCEventType aEventType ); |
|
92 |
|
93 private: |
|
94 |
|
95 /** |
|
96 * C++ constructor - not exported; |
|
97 * implicitly called from NewL() |
|
98 */ |
|
99 CMMCMonitorPlugin(); |
|
100 |
|
101 /** |
|
102 * 2nd phase construction, called by NewL(). |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 /** |
|
107 * Creates and adds a file monitor for a specified drive. |
|
108 * |
|
109 * @param aDrive A drive for file monitor. |
|
110 */ |
|
111 void AddNotificationPathL( TChar aDrive ); |
|
112 |
|
113 /** |
|
114 * Starts monitor all MMCs in the device. |
|
115 */ |
|
116 void StartMonitoringAllMMCsL( RArray<TMdEMediaInfo>& aMedias ); |
|
117 |
|
118 private: // data |
|
119 /** |
|
120 * An observer class to notify about file creations, modifications and deletions in any MMCs. |
|
121 */ |
|
122 MMonitorPluginObserver* iObserver; |
|
123 |
|
124 /** |
|
125 * A pointer to MMC monitor which observes any MMCs insertions and removals. |
|
126 */ |
|
127 CMMCMonitorAO* iMMCMonitor; |
|
128 |
|
129 /** |
|
130 * A pointer to MdE client. |
|
131 */ |
|
132 CMdEHarvesterSession* iMdEClient; |
|
133 |
|
134 CMMCMountTaskAO* iMountTask; |
|
135 |
|
136 CMMCUsbAO* iUsbMonitor; |
|
137 |
|
138 CMmcScannerAO* iMmcScanner; |
|
139 |
|
140 CMmcScannerAO* iHddScanner; |
|
141 |
|
142 }; |
|
143 |
|
144 #endif // __MMCMONITORPLUGIN_H__ |