40 #include "usbmsshared.h" |
40 #include "usbmsshared.h" |
41 |
41 |
42 #include "drivepublisher.h" |
42 #include "drivepublisher.h" |
43 #include "drivemanager.h" |
43 #include "drivemanager.h" |
44 #include "debug.h" |
44 #include "debug.h" |
45 #include "msdebug.h" |
|
46 |
45 |
47 // |
46 // |
48 // Use Lookup table to translate from the internal pair of state variables |
47 // Use Lookup table to translate from the internal pair of state variables |
49 // to the externally published drive state code. |
48 // to the externally published drive state code. |
50 // |
49 // |
51 LOCAL_D const TUint8 table[][5] = |
50 LOCAL_D const TUint8 table[][5] = |
52 { |
51 { |
53 //TMountState=EDisconnected |
52 //TMountState=EDisconnected |
54 {EUsbMsDriveState_Disconnected, |
53 {EUsbMsDriveState_Disconnected, |
55 EUsbMsDriveState_Disconnected, |
54 EUsbMsDriveState_Disconnected, |
56 EUsbMsDriveState_Disconnected, |
55 EUsbMsDriveState_Disconnected, |
57 EUsbMsDriveState_Disconnected, |
56 EUsbMsDriveState_Disconnected, |
58 EUsbMsDriveState_Disconnected}, |
57 EUsbMsDriveState_Disconnected}, |
59 //TMountState=EConnecting |
58 //TMountState=EConnecting |
60 {EUsbMsDriveState_Connecting, |
59 {EUsbMsDriveState_Connecting, |
61 EUsbMsDriveState_Connecting, |
60 EUsbMsDriveState_Connecting, |
62 EUsbMsDriveState_Connecting, |
61 EUsbMsDriveState_Connecting, |
63 EUsbMsDriveState_Connecting, |
62 EUsbMsDriveState_Connecting, |
64 EUsbMsDriveState_Connecting}, |
63 EUsbMsDriveState_Connecting}, |
65 //TMountState=EConnected |
64 //TMountState=EConnected |
66 //EIdle,EActive,ELocked,EMediaNotPresent,EErrDisMounted |
65 //EIdle,EActive,ELocked,EMediaNotPresent,EErrDisMounted |
67 {EUsbMsDriveState_Connected, |
66 {EUsbMsDriveState_Connected, |
68 EUsbMsDriveState_Active, |
67 EUsbMsDriveState_Active, |
69 EUsbMsDriveState_Locked, |
68 EUsbMsDriveState_Locked, |
70 EUsbMsDriveState_MediaNotPresent, |
69 EUsbMsDriveState_MediaNotPresent, |
71 EUsbMsDriveState_Removed}, |
70 EUsbMsDriveState_Removed}, |
72 //TMountState=EDisconnecting |
71 //TMountState=EDisconnecting |
73 {EUsbMsDriveState_Disconnecting, |
72 {EUsbMsDriveState_Disconnecting, |
74 EUsbMsDriveState_Disconnecting, |
73 EUsbMsDriveState_Disconnecting, |
75 EUsbMsDriveState_Disconnecting, |
74 EUsbMsDriveState_Disconnecting, |
76 EUsbMsDriveState_Disconnecting, |
75 EUsbMsDriveState_Disconnecting, |
77 EUsbMsDriveState_Disconnecting} |
76 EUsbMsDriveState_Disconnecting} |
78 }; |
77 }; |
79 |
78 |
80 |
79 |
81 //---------------------------------------------------------------------------- |
80 //---------------------------------------------------------------------------- |
82 /** |
81 /** |
83 Constructor |
82 Constructor |
84 */ |
83 */ |
85 RDriveMediaErrorPublisher::RDriveMediaErrorPublisher() |
84 RDriveMediaErrorPublisher::RDriveMediaErrorPublisher() |
86 { |
85 { |
87 __MSFNLOG |
86 _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); |
88 _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); |
87 _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); |
89 _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); |
88 |
90 |
89 TInt result = RProperty::Define(EUsbMsDriveState_MediaError, RProperty::EInt, |
91 TInt result = RProperty::Define(EUsbMsDriveState_MediaError, RProperty::EInt, |
90 KMassStorageReadPolicy, KMassStorageWritePolicy); |
92 KMassStorageReadPolicy, KMassStorageWritePolicy); |
91 |
93 |
92 __ASSERT_DEBUG(result == KErrAlreadyExists || result == KErrNone, User::Invariant()); |
94 __ASSERT_DEBUG(result == KErrAlreadyExists || result == KErrNone, User::Invariant()); |
93 |
95 |
94 result = iMediaErrorProperty.Attach(KUsbMsDriveState_Category, EUsbMsDriveState_MediaError); |
96 result = iMediaErrorProperty.Attach(KUsbMsDriveState_Category, EUsbMsDriveState_MediaError); |
95 __ASSERT_DEBUG(result == KErrNone, User::Invariant()); |
97 __ASSERT_DEBUG(result == KErrNone, User::Invariant()); |
96 } |
98 } |
|
99 |
97 |
100 |
98 |
101 RDriveMediaErrorPublisher::~RDriveMediaErrorPublisher() |
99 RDriveMediaErrorPublisher::~RDriveMediaErrorPublisher() |
102 { |
100 { |
103 __MSFNLOG |
101 iMediaErrorProperty.Close(); |
104 iMediaErrorProperty.Close(); |
102 RProperty::Delete(KUsbMsDriveState_Category, EUsbMsDriveState_MediaError); |
105 RProperty::Delete(KUsbMsDriveState_Category, EUsbMsDriveState_MediaError); |
103 } |
106 } |
|
107 |
104 |
108 /** |
105 /** |
109 Publishing method |
106 Publishing method |
110 |
107 |
111 Publishes the Media Error property event |
108 Publishes the Media Error property event |
112 |
109 |
113 @param aError ETrue if drive media has an error else EFalse for no error |
110 @param aError ETrue if drive media has an error else EFalse for no error |
114 */ |
111 */ |
115 void RDriveMediaErrorPublisher::PublishErrorL(TBool aError) |
112 void RDriveMediaErrorPublisher::PublishErrorL(TBool aError) |
116 { |
113 { |
117 __MSFNLOG |
114 __PRINT1(_L("<< RDriveMediaErrorPublisher::PublishError %x"), aError); |
118 __PRINT1(_L("<< RDriveMediaErrorPublisher::PublishError %x"), aError); |
115 |
119 |
116 TInt oldValue; |
120 TInt oldValue; |
117 iMediaErrorProperty.Get(oldValue); |
121 iMediaErrorProperty.Get(oldValue); |
118 |
122 |
119 if (oldValue != aError) |
123 if (oldValue != aError) |
120 { |
124 { |
121 User::LeaveIfError(iMediaErrorProperty.Set(aError)); |
125 User::LeaveIfError(iMediaErrorProperty.Set(aError)); |
122 } |
126 } |
123 } |
127 } |
|
128 |
124 |
129 //---------------------------------------------------------------------------- |
125 //---------------------------------------------------------------------------- |
130 /** |
126 /** |
131 Constructor |
127 Constructor |
132 |
128 |
133 @param aDrives |
129 @param aDrives |
134 @param aDriveMap |
130 @param aDriveMap |
135 */ |
131 */ |
136 RDriveStateChangedPublisher::RDriveStateChangedPublisher(const TMsDriveList& aDrives, |
132 RDriveStateChangedPublisher::RDriveStateChangedPublisher(const TMsDriveList& aDrives, |
137 const TLunToDriveMap& aDriveMap) |
133 const TLunToDriveMap& aDriveMap) |
138 : |
134 : |
139 iDrives(aDrives), |
135 iDrives(aDrives), |
140 iDriveMap(aDriveMap) |
136 iDriveMap(aDriveMap) |
141 { |
137 { |
142 __MSFNLOG |
138 _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); |
143 _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); |
139 _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); |
144 _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); |
140 |
145 |
141 TInt result = RProperty::Define(KUsbMsDriveState_Category, |
146 TInt result = RProperty::Define(KUsbMsDriveState_Category, |
142 EUsbMsDriveState_DriveStatus, RProperty::EByteArray, |
147 EUsbMsDriveState_DriveStatus, RProperty::EByteArray, |
143 KMassStorageReadPolicy, KMassStorageWritePolicy, |
148 KMassStorageReadPolicy, KMassStorageWritePolicy, |
144 KUsbMsMaxDrives*2); |
149 KUsbMsMaxDrives*2); |
145 __ASSERT_DEBUG(result == KErrAlreadyExists || result == KErrNone, User::Invariant()); |
150 __ASSERT_DEBUG(result == KErrAlreadyExists || result == KErrNone, User::Invariant()); |
146 result = result; // remove urel warning |
151 result = result; // remove urel warning |
147 } |
152 } |
|
153 |
148 |
154 |
149 |
155 RDriveStateChangedPublisher::~RDriveStateChangedPublisher() |
150 RDriveStateChangedPublisher::~RDriveStateChangedPublisher() |
156 { |
151 { |
157 __MSFNLOG |
152 RProperty::Delete(KUsbMsDriveState_Category, EUsbMsDriveState_DriveStatus); |
158 RProperty::Delete(KUsbMsDriveState_Category, EUsbMsDriveState_DriveStatus); |
153 } |
159 } |
|
160 |
154 |
161 |
155 |
162 /** |
156 /** |
163 Publishing method |
157 Publishing method |
164 |
158 |
165 Sends a property event on behalf of CMassStorageDrive, with the mountstate and drivestate |
159 Sends a property event on behalf of CMassStorageDrive, with the mountstate and drivestate |
166 values encoded into one 32-bit word. |
160 values encoded into one 32-bit word. |
167 */ |
161 */ |
168 void RDriveStateChangedPublisher::DriveStateChanged() |
162 void RDriveStateChangedPublisher::DriveStateChanged() |
169 { |
163 { |
170 __MSFNLOG |
164 TUsbMsDrivesStatus allDrivesStatus; |
171 TUsbMsDrivesStatus allDrivesStatus; |
165 |
172 |
166 for(TUint8 i = 0; i < iDrives.Count(); i++) |
173 for(TUint8 i = 0; i < iDrives.Count(); i++) |
167 { |
174 { |
168 allDrivesStatus.Append(iDriveMap[i]); |
175 allDrivesStatus.Append(iDriveMap[i]); |
169 |
176 |
170 CMassStorageDrive::TMountState ms = iDrives[i]->MountState(); |
177 CMassStorageDrive::TMountState ms = iDrives[i]->MountState(); |
171 TLocalDriveRef::TDriveState ds = iDrives[i]->DriveState(); |
178 TLocalDriveRef::TDriveState ds = iDrives[i]->DriveState(); |
172 TInt driveStatus = EUsbMsDriveState_Error; |
179 TInt driveStatus = EUsbMsDriveState_Error; |
173 if((TUint8)ds < sizeof(table[0]) && (TUint8)ms < sizeof(table)/sizeof(table[0])) |
180 if((TUint8)ds < sizeof(table[0]) && (TUint8)ms < sizeof(table)/sizeof(table[0])) |
174 { |
181 { |
175 driveStatus = table[ms][ds]; |
182 driveStatus = table[ms][ds]; |
176 __PRINT3(_L("ms=%d ds=%d %d"), ms, ds, driveStatus); |
183 __PRINT3(_L("ms=%d ds=%d %d"), ms, ds, driveStatus); |
177 } |
184 } |
178 allDrivesStatus.Append(driveStatus); |
185 allDrivesStatus.Append(driveStatus); |
179 } |
186 } |
180 |
187 |
181 |
188 |
182 __PRINT1(_L("Publishing EUsbMsDriveState_DriveStatus for %d drives\n"), |
189 __PRINT1(_L("Publishing EUsbMsDriveState_DriveStatus for %d drives\n"), |
183 allDrivesStatus.Length()/2); |
190 allDrivesStatus.Length()/2); |
184 |
191 |
185 if(KErrNone != RProperty::Set(KUsbMsDriveState_Category, |
192 if(KErrNone != RProperty::Set(KUsbMsDriveState_Category, |
186 EUsbMsDriveState_DriveStatus, |
193 EUsbMsDriveState_DriveStatus, |
187 allDrivesStatus)) |
194 allDrivesStatus)) |
188 { |
195 { |
189 __ASSERT_DEBUG(EFalse,User::Invariant()); |
196 __ASSERT_DEBUG(EFalse,User::Invariant()); |
190 } |
197 } |
191 } |
198 } |
|
199 |
192 |
200 |
193 |
201 //---------------------------------------------------------------------------- |
194 //---------------------------------------------------------------------------- |
202 |
195 |
203 /** |
196 /** |
207 @param aArray |
200 @param aArray |
208 */ |
201 */ |
209 CUsbTransferPublisher::CUsbTransferPublisher(TUsbMsDriveState_Subkey aSubKey, |
202 CUsbTransferPublisher::CUsbTransferPublisher(TUsbMsDriveState_Subkey aSubKey, |
210 const TBytesTransferedList& aArray) |
203 const TBytesTransferedList& aArray) |
211 : iSubKey(aSubKey), |
204 : iSubKey(aSubKey), |
212 iArray(aArray) |
205 iArray(aArray) |
213 { |
206 { |
214 __MSFNLOG |
207 } |
215 } |
|
216 |
208 |
217 |
209 |
218 void CUsbTransferPublisher::ConstructL() |
210 void CUsbTransferPublisher::ConstructL() |
219 { |
211 { |
220 __MSFNLOG |
212 _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); |
221 |
213 _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); |
222 _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); |
214 |
223 _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); |
215 TInt r = RProperty::Define(iSubKey, RProperty::EByteArray, |
224 |
216 KMassStorageReadPolicy, KMassStorageWritePolicy, |
225 TInt r = RProperty::Define(iSubKey, RProperty::EByteArray, |
217 KUsbMsMaxDrives*sizeof(TInt)); |
226 KMassStorageReadPolicy, KMassStorageWritePolicy, |
218 |
227 KUsbMsMaxDrives*sizeof(TInt)); |
219 if (r != KErrAlreadyExists) |
228 |
220 { |
229 if (r != KErrAlreadyExists) |
221 User::LeaveIfError(r); |
230 { |
222 } |
231 User::LeaveIfError(r); |
223 |
232 } |
224 // Attach to the properties here. Only do this once, continuously attaching |
233 |
225 // will currently cause a memory leak |
234 // Attach to the properties here. Only do this once, continuously attaching |
226 User::LeaveIfError(iProperty.Attach(KUsbMsDriveState_Category, iSubKey)); |
235 // will currently cause a memory leak |
227 |
236 User::LeaveIfError(iProperty.Attach(KUsbMsDriveState_Category, iSubKey)); |
228 // Create the EDataTransferred timer |
237 |
229 iTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
238 // Create the EDataTransferred timer |
230 iTimerRunning = EFalse; |
239 iTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
231 } |
240 iTimerRunning = EFalse; |
|
241 } |
|
242 |
232 |
243 |
233 |
244 /** |
234 /** |
245 Destructor |
235 Destructor |
246 */ |
236 */ |
247 CUsbTransferPublisher::~CUsbTransferPublisher() |
237 CUsbTransferPublisher::~CUsbTransferPublisher() |
248 { |
238 { |
249 __MSFNLOG |
239 if(iTimer) |
250 if(iTimer) |
240 { |
251 { |
241 iTimer->Cancel(); |
252 iTimer->Cancel(); |
242 } |
253 } |
243 delete iTimer; |
254 delete iTimer; |
244 iProperty.Close(); |
255 iProperty.Close(); |
245 |
256 |
246 RProperty::Delete(KUsbMsDriveState_Category, iSubKey); |
257 RProperty::Delete(KUsbMsDriveState_Category, iSubKey); |
247 } |
258 } |
|
259 |
248 |
260 |
249 |
261 /** |
250 /** |
262 A static wrapper for the DoPublishDataTransferredEvent member function |
251 A static wrapper for the DoPublishDataTransferredEvent member function |
263 for use as a timer callback function. |
252 for use as a timer callback function. |
264 |
253 |
265 @param obj 'this' pointer |
254 @param obj 'this' pointer |
266 @return not used in CPeriodic callback (see TCallback) |
255 @return not used in CPeriodic callback (see TCallback) |
267 */ |
256 */ |
268 TInt CUsbTransferPublisher::PublishDataTransferredEvent(TAny* obj) |
257 TInt CUsbTransferPublisher::PublishDataTransferredEvent(TAny* obj) |
269 { |
258 { |
270 __MSFNSLOG |
259 static_cast<CUsbTransferPublisher*>(obj)->DoPublishDataTransferredEvent(); |
271 static_cast<CUsbTransferPublisher*>(obj)->DoPublishDataTransferredEvent(); |
260 return 1; |
272 return 1; |
261 } |
273 } |
|
274 |
262 |
275 |
263 |
276 /** |
264 /** |
277 Update the data transferred properties if the counts have changed since |
265 Update the data transferred properties if the counts have changed since |
278 the last update. |
266 the last update. |
279 */ |
267 */ |
280 void CUsbTransferPublisher::DoPublishDataTransferredEvent() |
268 void CUsbTransferPublisher::DoPublishDataTransferredEvent() |
281 { |
269 { |
282 __MSFNLOG |
270 if (PublishDataTransferred()) |
283 if (PublishDataTransferred()) |
271 { |
284 { |
272 // some data has been transfered so reset the counter |
285 // some data has been transfered so reset the counter |
273 iTimerCancelCnt = ETimerCancelDelay; |
286 iTimerCancelCnt = ETimerCancelDelay; |
274 } |
287 } |
275 |
288 |
276 // Update the cancel count if no data was transferred the last |
289 // Update the cancel count if no data was transferred the last |
277 // (few) times this has been called |
290 // (few) times this has been called |
278 if (--iTimerCancelCnt == 0) |
291 if (--iTimerCancelCnt == 0) |
279 { |
292 { |
280 StopTimer(); |
293 StopTimer(); |
281 iTimerCancelCnt = ETimerCancelDelay; |
294 iTimerCancelCnt = ETimerCancelDelay; |
282 } |
295 } |
283 } |
296 } |
|
297 |
284 |
298 |
285 |
299 /** |
286 /** |
300 Update the data transferred properties if the counts have changed since |
287 Update the data transferred properties if the counts have changed since |
301 the last update. |
288 the last update. |
302 */ |
289 */ |
303 TBool CUsbTransferPublisher::PublishDataTransferred() |
290 TBool CUsbTransferPublisher::PublishDataTransferred() |
304 { |
291 { |
305 __MSFNLOG |
292 TUsbMsBytesTransferred bytesTransferred; |
306 TUsbMsBytesTransferred bytesTransferred; |
293 TBool dataTransferred = EFalse; |
307 TBool dataTransferred = EFalse; |
294 |
308 |
295 for (TInt i = 0; i < iArray.Count(); i++) |
309 for (TInt i = 0; i < iArray.Count(); i++) |
296 { |
310 { |
297 bytesTransferred[i] = GetBytesTransferred(i); |
311 bytesTransferred[i] = GetBytesTransferred(i); |
298 } |
312 } |
299 |
313 |
300 // Update the properties only if they have changed |
314 // Update the properties only if they have changed |
301 // (or if there's an error reading the old value.) |
315 // (or if there's an error reading the old value.) |
302 // Possible optimisation: keep a copy of the value |
316 // Possible optimisation: keep a copy of the value |
303 // as a member variable so we don't need the Get. |
317 // as a member variable so we don't need the Get. |
304 TUsbMsBytesTransferred oldValue; |
318 TUsbMsBytesTransferred oldValue; |
305 |
319 |
306 if ((iProperty.Get(oldValue) != KErrNone) || (oldValue != bytesTransferred)) |
320 if ((iProperty.Get(oldValue) != KErrNone) || (oldValue != bytesTransferred)) |
307 { |
321 { |
|
322 #ifdef __PRINT3 |
308 #ifdef __PRINT3 |
323 // trace of the bytes transferred |
309 // trace of the bytes transferred |
324 for (TInt j=0; j < iArray.Count(); j++) |
310 for (TInt j=0; j < iArray.Count(); j++) |
325 { |
311 { |
326 if(oldValue[j] != bytesTransferred[j]) |
312 if(oldValue[j] != bytesTransferred[j]) |
327 { |
313 { |
328 __PRINT3(_L("CDrivePublisher: KBytes[%d] %d->%d\n"), j, oldValue[j], bytesTransferred[j]); |
314 __PRINT3(_L("CDrivePublisher: KBytes[%d] %d->%d\n"), j, oldValue[j], bytesTransferred[j]); |
329 } |
315 } |
330 } |
316 } |
331 #endif |
317 #endif |
332 if (KErrNone != iProperty.Set(bytesTransferred)) |
318 if (KErrNone != iProperty.Set(bytesTransferred)) |
333 { |
319 { |
334 __ASSERT_DEBUG(EFalse, User::Invariant()); |
320 __ASSERT_DEBUG(EFalse, User::Invariant()); |
335 } |
321 } |
336 dataTransferred = ETrue; |
322 dataTransferred = ETrue; |
337 } |
323 } |
338 |
324 |
339 return dataTransferred; |
325 return dataTransferred; |
340 } |
326 } |
341 |
327 |
342 |
328 |
343 /** |
329 /** |
344 Starts timer to periodically publish results. |
330 Starts timer to periodically publish results. |
345 If the timer is not yet running then start it. |
331 If the timer is not yet running then start it. |
346 */ |
332 */ |
347 void CUsbTransferPublisher::StartTimer() |
333 void CUsbTransferPublisher::StartTimer() |
348 { |
334 { |
349 __MSFNLOG |
335 if (!iTimerRunning) |
350 if (!iTimerRunning) |
336 { |
351 { |
337 // EDataTransferred event every second |
352 // EDataTransferred event every second |
338 const TTimeIntervalMicroSeconds32 interval = 1 * 1000 * 1000; |
353 const TTimeIntervalMicroSeconds32 interval = 1 * 1000 * 1000; |
339 TCallBack callback(PublishDataTransferredEvent, this); |
354 TCallBack callback(PublishDataTransferredEvent, this); |
340 __PRINT(_L("Starting timer")); |
355 __PRINT(_L("Starting timer")); |
341 iTimer->Start(interval, interval, callback); |
356 iTimer->Start(interval, interval, callback); |
342 iTimerRunning = ETrue; |
357 iTimerRunning = ETrue; |
343 } |
358 } |
344 } |
359 } |
|
360 |
345 |
361 |
346 |
362 /** |
347 /** |
363 Ensure that the Timer is stopped |
348 Ensure that the Timer is stopped |
364 */ |
349 */ |
365 void CUsbTransferPublisher::StopTimer() |
350 void CUsbTransferPublisher::StopTimer() |
366 { |
351 { |
367 __MSFNLOG |
352 if (iTimerRunning) |
368 if (iTimerRunning) |
353 { |
369 { |
354 __PRINT(_L("Stopping timer")); |
370 __PRINT(_L("Stopping timer")); |
355 iTimer->Cancel(); |
371 iTimer->Cancel(); |
356 iTimerRunning = EFalse; |
372 iTimerRunning = EFalse; |
357 } |
373 } |
358 } |
374 } |
|
375 |
359 |
376 |
360 |
377 //---------------------------------------------------------------------------- |
361 //---------------------------------------------------------------------------- |
378 /** |
362 /** |
379 Constructor for Write property |
363 Constructor for Write property |
380 |
364 |
381 @param aArray |
365 @param aArray |
382 */ |
366 */ |
383 CUsbWriteTransferPublisher* CUsbWriteTransferPublisher::NewL(const TBytesTransferedList& aArray) |
367 CUsbWriteTransferPublisher* CUsbWriteTransferPublisher::NewL(const TBytesTransferedList& aArray) |
384 { |
368 { |
385 __MSFNSLOG |
369 CUsbWriteTransferPublisher* self = new (ELeave) CUsbWriteTransferPublisher(aArray); |
386 CUsbWriteTransferPublisher* self = new (ELeave) CUsbWriteTransferPublisher(aArray); |
370 CleanupStack::PushL(self); |
387 CleanupStack::PushL(self); |
371 self->ConstructL(); |
388 self->ConstructL(); |
372 CleanupStack::Pop(); |
389 CleanupStack::Pop(); |
373 return self; |
390 return self; |
374 } |
391 } |
|
392 |
375 |
393 |
376 |
394 CUsbWriteTransferPublisher::CUsbWriteTransferPublisher(const TBytesTransferedList& aArray) |
377 CUsbWriteTransferPublisher::CUsbWriteTransferPublisher(const TBytesTransferedList& aArray) |
395 : CUsbTransferPublisher(EUsbMsDriveState_KBytesWritten, aArray) |
378 : CUsbTransferPublisher(EUsbMsDriveState_KBytesWritten, aArray) |
396 { |
379 { |
397 __MSFNLOG |
380 } |
398 } |
|
399 |
381 |
400 |
382 |
401 //---------------------------------------------------------------------------- |
383 //---------------------------------------------------------------------------- |
402 /** |
384 /** |
403 Constructor for Read property |
385 Constructor for Read property |
404 |
386 |
405 @param aArray |
387 @param aArray |
406 */ |
388 */ |
407 CUsbReadTransferPublisher* CUsbReadTransferPublisher::NewL(const TBytesTransferedList& aArray) |
389 CUsbReadTransferPublisher* CUsbReadTransferPublisher::NewL(const TBytesTransferedList& aArray) |
408 { |
390 { |
409 __MSFNSLOG |
391 CUsbReadTransferPublisher* self = new (ELeave) CUsbReadTransferPublisher(aArray); |
410 CUsbReadTransferPublisher* self = new (ELeave) CUsbReadTransferPublisher(aArray); |
392 CleanupStack::PushL(self); |
411 CleanupStack::PushL(self); |
393 self->ConstructL(); |
412 self->ConstructL(); |
394 CleanupStack::Pop(); |
413 CleanupStack::Pop(); |
395 return self; |
414 return self; |
396 } |
415 } |
|
416 |
397 |
417 |
398 |
418 CUsbReadTransferPublisher::CUsbReadTransferPublisher(const TBytesTransferedList& aArray) |
399 CUsbReadTransferPublisher::CUsbReadTransferPublisher(const TBytesTransferedList& aArray) |
419 : CUsbTransferPublisher(EUsbMsDriveState_KBytesRead, aArray) |
400 : CUsbTransferPublisher(EUsbMsDriveState_KBytesRead, aArray) |
420 { |
401 { |
421 __MSFNLOG |
402 } |
422 } |
|
423 |
403 |
424 /** |
404 /** |
425 Transfer function for the property |
405 Transfer function for the property |
426 |
406 |
427 @return Cumulative bytes read since the host connected to the drive, |
407 @return Cumulative bytes read since the host connected to the drive, |
428 in multiples of KBytesPerKilobyte rounded to nearest integer value. |
408 in multiples of KBytesPerKilobyte rounded to nearest integer value. |
429 The KBytes refer to multiples of 1000, not 1024. |
409 The KBytes refer to multiples of 1000, not 1024. |
430 */ |
410 */ |
431 TUint CUsbTransferPublisher::GetBytesTransferred(TLun aLun) const |
411 TUint CUsbTransferPublisher::GetBytesTransferred(TLun aLun) const |
432 { |
412 { |
433 return I64LOW(iArray[aLun] / (TUint64)1000); |
413 return I64LOW(iArray[aLun] / (TUint64)1000); |
434 } |
414 } |