equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
23 #include <DriveInfo.h> |
23 #include <DriveInfo.h> |
24 |
24 |
25 // CONSTANTS |
25 // CONSTANTS |
26 |
26 |
27 |
27 |
28 static TInt TimerCallBack( TAny* ptr ) |
|
29 { |
|
30 CWrtUsbHandler* temp = static_cast<CWrtUsbHandler*>(ptr); |
|
31 if(temp) |
|
32 { |
|
33 temp->DeleteTimer(); |
|
34 temp->DoScanAndUpdate(); |
|
35 } |
|
36 return 0; |
|
37 } |
|
38 // ============================================================================ |
28 // ============================================================================ |
39 // CWrtUsbHandler::NewL() |
29 // CWrtUsbHandler::NewL() |
40 // two-phase constructor |
30 // two-phase constructor |
41 // |
31 // |
42 // @since 3.1 |
32 // @since 3.1 |
120 // ============================================================================ |
110 // ============================================================================ |
121 void CWrtUsbHandler::RunL() |
111 void CWrtUsbHandler::RunL() |
122 { |
112 { |
123 if ( iStatus == KErrNone ) |
113 if ( iStatus == KErrNone ) |
124 { |
114 { |
125 //Call back Timer |
115 DoScanAndUpdate(); |
126 iCallBackTimer = CPeriodic::NewL(CActive::EPriorityLow); |
|
127 iCallBackTimer->Start(10000000,0,TCallBack(&TimerCallBack,this)); |
|
128 } |
116 } |
129 } |
117 } |
130 |
118 |
131 void CWrtUsbHandler::DoScanAndUpdate() |
119 void CWrtUsbHandler::DoScanAndUpdate() |
132 { |
120 { |
142 if ( deltaDriveFlags ) |
130 if ( deltaDriveFlags ) |
143 { |
131 { |
144 //Unpluging USB from Mass storage . . . |
132 //Unpluging USB from Mass storage . . . |
145 if(iHarvester->IsInMSMode() == 1) |
133 if(iHarvester->IsInMSMode() == 1) |
146 { |
134 { |
147 iHarvester->SetMSMode(0); |
|
148 iHarvester->ClearAllOperations(); |
135 iHarvester->ClearAllOperations(); |
149 TRAP(err, iHarvester->UpdateL() ); |
136 iHarvester->SetRegistryAccess(EFalse); |
150 iFs.NotifyChange( ENotifyDisk, iStatus ); |
137 iFs.NotifyChange( ENotifyDisk, iStatus ); |
151 SetActive(); |
138 SetActive(); |
152 return; |
139 return; |
153 } |
140 } |
154 |
141 |
171 } |
158 } |
172 if( massMemAltered ) |
159 if( massMemAltered ) |
173 { |
160 { |
174 iHarvester->SetMSMode(1); |
161 iHarvester->SetMSMode(1); |
175 } |
162 } |
176 |
163 } |
177 TRAP( err, iHarvester->UpdateL() ); |
|
178 } |
|
179 iFs.NotifyChange( ENotifyDisk, iStatus ); |
164 iFs.NotifyChange( ENotifyDisk, iStatus ); |
180 SetActive(); |
165 SetActive(); |
181 } |
166 } |
182 |
167 |
183 |
168 |
248 } |
233 } |
249 } |
234 } |
250 |
235 |
251 return error; |
236 return error; |
252 } |
237 } |
253 void CWrtUsbHandler::DeleteTimer() |
238 |
254 { |
|
255 iCallBackTimer->Cancel(); |
|
256 delete iCallBackTimer; |
|
257 iCallBackTimer = NULL; |
|
258 } |
|