usbclasses/usbmscpersonality/src/CUsbActiveMscHandlerMdrv.cpp
changeset 46 0ffee699d6c7
parent 3 47c263f7e521
child 63 ef2686f7597e
child 89 3592750162a5
equal deleted inserted replaced
45:718eb10f3711 46:0ffee699d6c7
     1 /*
     1 /*
     2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2010 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 "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".
    45 // C++ default constructor can NOT contain any code, that
    45 // C++ default constructor can NOT contain any code, that
    46 // might leave.
    46 // might leave.
    47 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    48 //
    48 //
    49 CUsbActiveMscHandler::CUsbActiveMscHandler(TUsbPersonalityParams& aPersonalityParams)
    49 CUsbActiveMscHandler::CUsbActiveMscHandler(TUsbPersonalityParams& aPersonalityParams)
    50     : CUsbPersonalityPlugin(aPersonalityParams), iMountChanged(EFalse)
    50     : CUsbPersonalityPlugin(aPersonalityParams), 
       
    51       iMountChanged(EFalse),
       
    52       iIsQueryNoteShown(EFalse)
    51     {
    53     {
    52     CActiveScheduler::Add( this );
    54     CActiveScheduler::Add( this );
    53     }
    55     }
    54 
    56 
    55 // ----------------------------------------------------------------------------
    57 // ----------------------------------------------------------------------------
   254         UnmountMassStorage();
   256         UnmountMassStorage();
   255         }
   257         }
   256         
   258         
   257     RemoveMassStorageFileSystem();
   259     RemoveMassStorageFileSystem();
   258 
   260 
   259     // Remove all queries shown by this personality
   261     if (iIsQueryNoteShown)
   260     iPersonalityParams.PersonalityNotifier().CancelQuery(KQueriesNotifier);
   262         {
   261 
   263         // Remove all queries shown by this personality
       
   264         iPersonalityParams.PersonalityNotifier().CancelQuery(KQueriesNotifier);
       
   265         iIsQueryNoteShown = EFalse;
       
   266         }
       
   267         
   262     iMscState = EUsbMscStateIdle;
   268     iMscState = EUsbMscStateIdle;
   263 
   269 
   264     iRequestStatus = &aStatus;
   270     iRequestStatus = &aStatus;
   265     aStatus = KRequestPending;
   271     aStatus = KRequestPending;
   266     CompleteRequest(KErrNone);
   272     CompleteRequest(KErrNone);
   293                     }
   299                     }
   294                 else
   300                 else
   295                     {
   301                     {
   296                     if ( GlobalSystemState() == EUsbGSStateCategoryNormal )
   302                     if ( GlobalSystemState() == EUsbGSStateCategoryNormal )
   297                         {
   303                         {
       
   304                         iIsQueryNoteShown = ETrue;
   298                         // if the error is something abnormal, note still needs to be shown
   305                         // if the error is something abnormal, note still needs to be shown
   299                         iQueryParams().iQuery = EUSBStorageMediaFailure;
   306                         iQueryParams().iQuery = EUSBStorageMediaFailure;
   300                         iPersonalityParams.PersonalityNotifier().ShowQuery(
   307                         iPersonalityParams.PersonalityNotifier().ShowQuery(
   301                             KQueriesNotifier, iQueryParams, iDummy);
   308                             KQueriesNotifier, iQueryParams, iDummy);
   302                         }            
   309                         }            
   489         
   496         
   490     if (!iDrives.Count())
   497     if (!iDrives.Count())
   491         {
   498         {
   492         FLOG( _L( "[USBWATCHER]\tCUsbActiveMscHandler::GetDrives: No removable drives found." ) );
   499         FLOG( _L( "[USBWATCHER]\tCUsbActiveMscHandler::GetDrives: No removable drives found." ) );
   493 
   500 
       
   501         iIsQueryNoteShown = ETrue;
   494         iQueryParams().iQuery = EUSBStorageMediaFailure;
   502         iQueryParams().iQuery = EUSBStorageMediaFailure;
   495         iPersonalityParams.PersonalityNotifier().ShowQuery(KQueriesNotifier, iQueryParams, iDummy);
   503         iPersonalityParams.PersonalityNotifier().ShowQuery(KQueriesNotifier, iQueryParams, iDummy);
   496 
   504 
   497         return KErrNotFound;
   505         return KErrNotFound;
   498         }
   506         }