usbengines/usbwatcher/src/cusbwatcher.cpp
branchRCL_3
changeset 65 a44cdf4b4bf0
parent 64 8ecef05bbada
child 21 ff9df6630274
child 52 831068540b07
equal deleted inserted replaced
64:8ecef05bbada 65:a44cdf4b4bf0
     1 /*
     1 /*
     2 * Copyright (c) 2006-2009 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".
   385     switch ( iState )
   385     switch ( iState )
   386         {
   386         {
   387         case EUsbStarting:
   387         case EUsbStarting:
   388             LOG( "Personality started" );
   388             LOG( "Personality started" );
   389             Notify( ret );
   389             Notify( ret );
       
   390             if( iStopStartScenario )
       
   391                 {
       
   392                 iStopStartScenario = EFalse;
       
   393                 }
       
   394             //check if StartPersonality() fails     
       
   395             LEAVEIFERROR( ret );
   390             iState = EUsbStarted;
   396             iState = EUsbStarted;
   391             if( iStopStartScenario )
       
   392                 {
       
   393                 iStopStartScenario = EFalse;
       
   394                 }
       
   395             break;
   397             break;
   396 
   398 
   397         case EUsbStopping:
   399         case EUsbStopping:
   398             LOG( "Personality stopped" );
   400             LOG( "Personality stopped" );
   399             iState = EUsbIdle;
   401             iState = EUsbIdle;
   451 
   453 
   452 // ----------------------------------------------------------------------------
   454 // ----------------------------------------------------------------------------
   453 // This method is not called cause RunL() never leaves.
   455 // This method is not called cause RunL() never leaves.
   454 // ----------------------------------------------------------------------------
   456 // ----------------------------------------------------------------------------
   455 //
   457 //
   456 TInt CUsbWatcher::RunError(TInt /*aError*/)
   458 TInt CUsbWatcher::RunError(TInt aError)
   457     {
   459     {
   458     LOG_FUNC
   460     LOG_FUNC
   459     // Left empty cause this can't happend
   461     
       
   462     LOG2("Returned error: %d, iState: %d", aError, iState);
       
   463     if ( iState == EUsbStarting )
       
   464         {
       
   465         RProperty::Set( KPSUidUsbWatcher,
       
   466                 KUsbWatcherSelectedPersonality,
       
   467                 KUsbWatcherSelectedPersonalityNone );
       
   468         LOG( "personality set to none" );
       
   469 
       
   470         iState = EUsbIdle;
       
   471         }
       
   472     
   460     return KErrNone;
   473     return KErrNone;
   461     }
   474     }
   462 
   475 
   463 // ----------------------------------------------------------------------------
   476 // ----------------------------------------------------------------------------
   464 // Function is called when state of the device is locked.
   477 // Function is called when state of the device is locked.