equal
deleted
inserted
replaced
112 |
112 |
113 void CMMCMountTaskAO::StartMountL( TMountData& aMountData ) |
113 void CMMCMountTaskAO::StartMountL( TMountData& aMountData ) |
114 { |
114 { |
115 WRITELOG("CMMCMountTaskAO::StartMount"); |
115 WRITELOG("CMMCMountTaskAO::StartMount"); |
116 |
116 |
117 // Remove pending mount request for the same drive |
|
118 // if for example USB cable is pluged and unpluged |
|
119 // several times in a row |
|
120 for( TInt i = iMountDataQueue.Count() - 1; i >=0; i-- ) |
|
121 { |
|
122 WRITELOG( "CMMCMountTaskAO::StartUnmountL - checking for pending mount notifications" ); |
|
123 TMountData* tempData = iMountDataQueue[i]; |
|
124 if( tempData->iMediaID == aMountData.iMediaID && |
|
125 tempData->iMountType == TMountData::EMount && |
|
126 aMountData.iMountType == TMountData::EMount && |
|
127 tempData->iDrivePath == aMountData.iDrivePath ) |
|
128 { |
|
129 WRITELOG( "CMMCMountTaskAO::StartUnmountL - removing obsolite mount notifications" ); |
|
130 iMountDataQueue.Remove(i); |
|
131 delete tempData; |
|
132 tempData = NULL; |
|
133 } |
|
134 } |
|
135 |
|
136 User::LeaveIfError( iMountDataQueue.Append( &aMountData )); |
117 User::LeaveIfError( iMountDataQueue.Append( &aMountData )); |
137 |
118 |
138 if ( iNextRequest == ERequestIdle ) |
119 if ( iNextRequest == ERequestIdle ) |
139 { |
120 { |
140 SetNextRequest( ERequestStartTask ); |
121 SetNextRequest( ERequestStartTask ); |
152 { |
133 { |
153 Cancel(); |
134 Cancel(); |
154 Deinitialize(); |
135 Deinitialize(); |
155 } |
136 } |
156 } |
137 } |
157 |
138 |
158 // Remove pending unmount request for the same drive |
|
159 // if for example USB cable is pluged and unpluged |
|
160 // several times in a row |
|
161 for( TInt i = iMountDataQueue.Count() - 1; i >=0; i-- ) |
|
162 { |
|
163 WRITELOG( "CMMCMountTaskAO::StartUnmountL - checking for pending unmount notifications" ); |
|
164 TMountData* tempData = iMountDataQueue[i]; |
|
165 if( tempData->iMediaID == aMountData.iMediaID && |
|
166 tempData->iMountType == TMountData::EUnmount && |
|
167 aMountData.iMountType == TMountData::EUnmount && |
|
168 tempData->iDrivePath == aMountData.iDrivePath ) |
|
169 { |
|
170 WRITELOG( "CMMCMountTaskAO::StartUnmountL - removing obsolite unmount notifications" ); |
|
171 iMountDataQueue.Remove(i); |
|
172 delete tempData; |
|
173 tempData = NULL; |
|
174 } |
|
175 } |
|
176 |
|
177 User::LeaveIfError( iMountDataQueue.Append( &aMountData )); |
139 User::LeaveIfError( iMountDataQueue.Append( &aMountData )); |
178 |
140 |
179 SetNextRequest( ERequestStartTask ); |
141 SetNextRequest( ERequestStartTask ); |
180 } |
142 } |
181 |
143 |
217 iMountData = iMountDataQueue[0]; |
179 iMountData = iMountDataQueue[0]; |
218 iMountDataQueue.Remove(0); |
180 iMountDataQueue.Remove(0); |
219 |
181 |
220 WRITELOG1( "iMountData.iMountType: %d", iMountData->iMountType ); |
182 WRITELOG1( "iMountData.iMountType: %d", iMountData->iMountType ); |
221 WRITELOG1( "iMountData.iDrivePath: %S", &iMountData->iDrivePath ); |
183 WRITELOG1( "iMountData.iDrivePath: %S", &iMountData->iDrivePath ); |
222 WRITELOG1( "iMountData.iMediaID: %u", iMountData->iMediaID ); |
184 WRITELOG1( "iMountData.iMediaID: %d", iMountData->iMediaID ); |
223 |
185 |
224 if ( iMountData->iMountType == TMountData::EMount ) |
186 if ( iMountData->iMountType == TMountData::EMount ) |
225 { |
187 { |
226 SetNextRequest( ERequestMount ); |
188 SetNextRequest( ERequestMount ); |
227 } |
189 } |
429 TInt CMMCMountTaskAO::RunError( TInt ) |
391 TInt CMMCMountTaskAO::RunError( TInt ) |
430 #endif |
392 #endif |
431 { |
393 { |
432 WRITELOG1( "CMMCMountTaskAO::RunError with error code: %d", aError ); |
394 WRITELOG1( "CMMCMountTaskAO::RunError with error code: %d", aError ); |
433 Deinitialize(); |
395 Deinitialize(); |
434 SetNextRequest( ERequestStartTask ); |
|
435 return KErrNone; |
396 return KErrNone; |
436 } |
397 } |
437 |
398 |
438 void CMMCMountTaskAO::DoCancel() |
399 void CMMCMountTaskAO::DoCancel() |
439 { |
400 { |
452 } |
413 } |
453 } |
414 } |
454 |
415 |
455 void CMMCMountTaskAO::SetNotPresentToMDE() |
416 void CMMCMountTaskAO::SetNotPresentToMDE() |
456 { |
417 { |
457 WRITELOG1("CMMCMountTaskAO::SetNotPresentToMDE - MediaID %u", iMountData->iMediaID); |
418 WRITELOG1("CMMCMountTaskAO::SetNotPresentToMDE - MediaID %d", iMountData->iMediaID); |
458 if ( iMountData->iMediaID ) |
419 if ( iMountData->iMediaID ) |
459 { |
420 { |
460 iMdeSession->SetFilesToNotPresent( iMountData->iMediaID ); |
421 iMdeSession->SetFilesToNotPresent( iMountData->iMediaID ); |
461 } |
422 } |
462 else |
423 else |
575 delete iMountData; |
536 delete iMountData; |
576 iMountData = NULL; |
537 iMountData = NULL; |
577 } |
538 } |
578 } |
539 } |
579 |
540 |
580 TUint32 CMMCMountTaskAO::GetInternalDriveMediaId( TBool& aPresent ) |
541 TUint32 CMMCMountTaskAO::GetInternalDriveMediaId() |
581 { |
542 { |
582 WRITELOG( "CMMCMountTaskAO::GetInternalDriveMediaId" ); |
543 WRITELOG( "CMMCMountTaskAO::GetInternalDriveMediaId" ); |
583 |
544 |
584 TDriveInfo driveInfo; |
545 TDriveInfo driveInfo; |
585 TDriveList driveList; |
546 TDriveList driveList; |
618 if ( driveInfo.iType == EMediaHardDisk ) |
579 if ( driveInfo.iType == EMediaHardDisk ) |
619 { |
580 { |
620 // check if disk is internal |
581 // check if disk is internal |
621 TUint driveStatus; |
582 TUint driveStatus; |
622 const TInt err = DriveInfo::GetDriveStatus( iFs, i, driveStatus ); |
583 const TInt err = DriveInfo::GetDriveStatus( iFs, i, driveStatus ); |
623 if ( ( err == KErrNone ) && |
584 if ( (err == KErrNone ) && ( driveStatus & DriveInfo::EDriveInternal ) ) |
624 ( driveStatus & DriveInfo::EDriveInternal )) |
|
625 { |
585 { |
626 // get media id |
586 // get media id |
627 hdMediaId = FSUtil::MediaID( iFs, i ); |
587 hdMediaId = FSUtil::MediaID( iFs, i ); |
628 if( driveStatus & DriveInfo::EDrivePresent ) |
|
629 { |
|
630 aPresent = ETrue; |
|
631 } |
|
632 break; |
588 break; |
633 } |
589 } |
634 } |
590 } |
635 } |
591 } |
636 } |
592 } |