53 // |
58 // |
54 CMMCMonitor::CMMCMonitor( CFilePlugin& aFilePlugin ) |
59 CMMCMonitor::CMMCMonitor( CFilePlugin& aFilePlugin ) |
55 : CActive( CActive::EPriorityStandard ), |
60 : CActive( CActive::EPriorityStandard ), |
56 iFilePlugin( aFilePlugin ) |
61 iFilePlugin( aFilePlugin ) |
57 { |
62 { |
|
63 OstTraceFunctionEntry0( CMMCMONITOR_CMMCMONITOR_ENTRY ); |
58 CPIXLOGSTRING("ENTER CMMCMonitor::CMMCMonitor"); |
64 CPIXLOGSTRING("ENTER CMMCMonitor::CMMCMonitor"); |
59 CActiveScheduler::Add( this ); |
65 CActiveScheduler::Add( this ); |
60 CPIXLOGSTRING("END CMMCMonitor::CMMCMonitor"); |
66 CPIXLOGSTRING("END CMMCMonitor::CMMCMonitor"); |
|
67 OstTraceFunctionExit0( CMMCMONITOR_CMMCMONITOR_EXIT ); |
61 } |
68 } |
62 |
69 |
63 |
70 |
64 // ----------------------------------------------------------------------------- |
71 // ----------------------------------------------------------------------------- |
65 // CMMCMonitor::~CMMCMonitor |
72 // CMMCMonitor::~CMMCMonitor |
79 // CMMCMonitor::ConstructL |
86 // CMMCMonitor::ConstructL |
80 // ----------------------------------------------------------------------------- |
87 // ----------------------------------------------------------------------------- |
81 // |
88 // |
82 void CMMCMonitor::ConstructL( RFs* aFsSession ) |
89 void CMMCMonitor::ConstructL( RFs* aFsSession ) |
83 { |
90 { |
|
91 OstTraceFunctionEntry0( CMMCMONITOR_CONSTRUCTL_ENTRY ); |
84 CPIXLOGSTRING("ENTER CMMCMonitor::ConstructL Foobar"); |
92 CPIXLOGSTRING("ENTER CMMCMonitor::ConstructL Foobar"); |
85 iFsSession = aFsSession; |
93 iFsSession = aFsSession; |
86 |
94 |
87 TInt error = iProperty.Attach( KPSUidUikon, KUikMMCInserted ); |
95 TInt error = iProperty.Attach( KPSUidUikon, KUikMMCInserted ); |
88 if ( error != KErrNone ) CPIXLOGSTRING("END CMMCMonitor::Attach to MMCInserted failed"); |
96 if ( error != KErrNone ) |
|
97 { |
|
98 OstTrace0( TRACE_NORMAL, CMMCMONITOR_CONSTRUCTL, "END CMMCMonitor::Attach to MMCInserted failed" ); |
|
99 CPIXLOGSTRING("END CMMCMonitor::Attach to MMCInserted failed"); |
|
100 } |
89 |
101 |
90 error = iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus ); |
102 error = iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus ); |
91 if ( error != KErrNone ) |
103 if ( error != KErrNone ) |
92 { |
104 { |
|
105 OstTrace0( TRACE_NORMAL, DUP1_CMMCMONITOR_CONSTRUCTL, "CMMCMonitor::Get MMCInserted failed" ); |
93 CPIXLOGSTRING("CMMCMonitor::Get MMCInserted failed"); |
106 CPIXLOGSTRING("CMMCMonitor::Get MMCInserted failed"); |
94 } |
107 } |
95 else if ( iMmcStatus ) |
108 else if ( iMmcStatus ) |
96 { |
109 { |
|
110 OstTrace0( TRACE_NORMAL, DUP2_CMMCMONITOR_CONSTRUCTL, "CMMCMonitor::MMC card is in" ); |
97 CPIXLOGSTRING("CMMCMonitor::MMC card is in"); |
111 CPIXLOGSTRING("CMMCMonitor::MMC card is in"); |
98 } |
112 } |
99 else |
113 else |
100 { |
114 { |
|
115 OstTrace0( TRACE_NORMAL, DUP3_CMMCMONITOR_CONSTRUCTL, "CMMCMonitor::no MMC card" ); |
101 CPIXLOGSTRING("CMMCMonitor::no MMC card"); |
116 CPIXLOGSTRING("CMMCMonitor::no MMC card"); |
102 } |
117 } |
103 |
118 |
104 // The CFilePlugin::StartMonitoring() will call |
119 // The CFilePlugin::StartMonitoring() will call |
105 // CMMCMonitor::StartMonitoring() which will call |
120 // CMMCMonitor::StartMonitoring() which will call |
106 // CMMCMonitor::RunL(). |
121 // CMMCMonitor::RunL(). |
107 // |
122 // |
108 CPIXLOGSTRING("END CMMCMonitor::ConstructL"); |
123 CPIXLOGSTRING("END CMMCMonitor::ConstructL"); |
|
124 OstTraceFunctionExit0( CMMCMONITOR_CONSTRUCTL_EXIT ); |
109 } |
125 } |
110 |
126 |
111 |
127 |
112 // ----------------------------------------------------------------------------- |
128 // ----------------------------------------------------------------------------- |
113 // CMMCMonitor::StartMonitoring |
129 // CMMCMonitor::StartMonitoring |
114 // ----------------------------------------------------------------------------- |
130 // ----------------------------------------------------------------------------- |
115 // |
131 // |
116 TBool CMMCMonitor::StartMonitoring() |
132 TBool CMMCMonitor::StartMonitoring() |
117 { |
133 { |
|
134 OstTraceFunctionEntry0( CMMCMONITOR_STARTMONITORING_ENTRY ); |
118 CPIXLOGSTRING("ENTER CMMCMonitor::StartMonitoring"); |
135 CPIXLOGSTRING("ENTER CMMCMonitor::StartMonitoring"); |
119 TRAP_IGNORE( RunL() ); // Need to TRAP this rather than use RunError |
136 TRAP_IGNORE( RunL() ); // Need to TRAP this rather than use RunError |
120 CPIXLOGSTRING("END CMMCMonitor::StartMonitoring"); |
137 CPIXLOGSTRING("END CMMCMonitor::StartMonitoring"); |
|
138 OstTraceFunctionExit0( CMMCMONITOR_STARTMONITORING_EXIT ); |
121 return ETrue; |
139 return ETrue; |
122 } |
140 } |
123 |
141 |
124 |
142 |
125 // ----------------------------------------------------------------------------- |
143 // ----------------------------------------------------------------------------- |
165 // CMMCMonitor::DoCancel |
185 // CMMCMonitor::DoCancel |
166 // ----------------------------------------------------------------------------- |
186 // ----------------------------------------------------------------------------- |
167 // |
187 // |
168 void CMMCMonitor::DoCancel() |
188 void CMMCMonitor::DoCancel() |
169 { |
189 { |
|
190 OstTraceFunctionEntry0( CMMCMONITOR_DOCANCEL_ENTRY ); |
170 CPIXLOGSTRING("ENTER CMMCMonitor::DoCancel"); |
191 CPIXLOGSTRING("ENTER CMMCMonitor::DoCancel"); |
171 iProperty.Cancel(); |
192 iProperty.Cancel(); |
172 CPIXLOGSTRING("END CMMCMonitor::DoCancel"); |
193 CPIXLOGSTRING("END CMMCMonitor::DoCancel"); |
|
194 OstTraceFunctionExit0( CMMCMONITOR_DOCANCEL_EXIT ); |
173 } |
195 } |
174 |
196 |
175 |
197 |
176 // ----------------------------------------------------------------------------- |
198 // ----------------------------------------------------------------------------- |
177 // CMMCMonitor::RunL |
199 // CMMCMonitor::RunL |
178 // ----------------------------------------------------------------------------- |
200 // ----------------------------------------------------------------------------- |
179 // |
201 // |
180 void CMMCMonitor::RunL() |
202 void CMMCMonitor::RunL() |
181 { |
203 { |
|
204 OstTraceFunctionEntry0( CMMCMONITOR_RUNL_ENTRY ); |
182 CPIXLOGSTRING("ENTER CMMCMonitor::RunL"); |
205 CPIXLOGSTRING("ENTER CMMCMonitor::RunL"); |
183 iProperty.Subscribe( iStatus ); |
206 iProperty.Subscribe( iStatus ); |
184 SetActive(); |
207 SetActive(); |
185 User::LeaveIfError( iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus ) ); |
208 User::LeaveIfError( iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus ) ); |
186 |
209 |
187 if ( iMmcStatus ) |
210 if ( iMmcStatus ) |
188 { |
211 { |
|
212 OstTrace0( TRACE_NORMAL, CMMCMONITOR_RUNL, "CMMCMonitor::MMC card is in" ); |
189 CPIXLOGSTRING("CMMCMonitor::MMC card is in"); |
213 CPIXLOGSTRING("CMMCMonitor::MMC card is in"); |
190 } |
214 } |
191 else |
215 else |
192 { |
216 { |
|
217 OstTrace0( TRACE_NORMAL, DUP1_CMMCMONITOR_RUNL, "CMMCMonitor::no MMC card" ); |
193 CPIXLOGSTRING("CMMCMonitor::no MMC card"); |
218 CPIXLOGSTRING("CMMCMonitor::no MMC card"); |
194 } |
219 } |
195 |
220 |
196 for ( TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++ ) |
221 for ( TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++ ) |
197 { |
222 { |
212 continue; // should not happen |
237 continue; // should not happen |
213 } |
238 } |
214 |
239 |
215 if ( drvStatus & DriveInfo::EDrivePresent ) |
240 if ( drvStatus & DriveInfo::EDrivePresent ) |
216 { |
241 { |
|
242 OstTrace0( TRACE_NORMAL, DUP2_CMMCMONITOR_RUNL, "CMMCMonitor::RunL insert event" ); |
217 CPIXLOGSTRING("CMMCMonitor::RunL insert event"); |
243 CPIXLOGSTRING("CMMCMonitor::RunL insert event"); |
218 // Mount MMC and force reharvest |
244 // Mount MMC and force reharvest |
219 iFilePlugin.MountL(drv, ETrue); |
245 iFilePlugin.MountL(drv, ETrue); |
220 } |
246 } |
221 else |
247 else |
222 { |
248 { |
|
249 OstTrace0( TRACE_NORMAL, DUP3_CMMCMONITOR_RUNL, "CMMCMonitor::RunL eject event" ); |
223 CPIXLOGSTRING("CMMCMonitor::RunL eject event"); |
250 CPIXLOGSTRING("CMMCMonitor::RunL eject event"); |
224 // If the MMC has been ejected, then need to dismount |
251 // If the MMC has been ejected, then need to dismount |
225 // and undefine the volume |
252 // and undefine the volume |
226 iFilePlugin.UnMount(drv, ETrue); |
253 iFilePlugin.UnMount(drv, ETrue); |
227 } |
254 } |
228 } |
255 } |
229 CPIXLOGSTRING("END CMMCMonitor::RunL"); |
256 CPIXLOGSTRING("END CMMCMonitor::RunL"); |
|
257 OstTraceFunctionExit0( CMMCMONITOR_RUNL_EXIT ); |
230 } |
258 } |
231 |
259 |
232 // End Of File |
260 // End Of File |