usbengines/usbwatcher/src/cusbactivestate.cpp
changeset 8 7e15987c4500
parent 0 1e05558e2206
child 52 831068540b07
child 63 ef2686f7597e
equal deleted inserted replaced
3:47c263f7e521 8:7e15987c4500
    93 void CUsbActiveState::RunL()
    93 void CUsbActiveState::RunL()
    94     {
    94     {
    95     LOG_FUNC
    95     LOG_FUNC
    96 
    96 
    97     LEAVEIFERROR( iStatus.Int() ); // Close process if error happens here
    97     LEAVEIFERROR( iStatus.Int() ); // Close process if error happens here
    98     LOG2( "DeviceState change: %d ==> %d", iPreviousState, iCurrentState );
    98 
    99     TUsbDeviceState newState = iCurrentState;
    99     TUsbDeviceState newState = iCurrentState;
   100     iUsbMan.DeviceStateNotification( KUsbAllStates, iCurrentState,
   100     iUsbMan.DeviceStateNotification( KUsbAllStates, iCurrentState,
   101             iStatus );
   101             iStatus );
   102     SetActive();
   102     SetActive();
   103     iOwner.StateChangeNotify( iPreviousState, newState );
   103     
   104     iPreviousState = newState;
   104     // Notify only if there is a change
       
   105     if ( newState != iPreviousState )
       
   106         {
       
   107         LOG2( "USB device state changed: %d ==> %d", iPreviousState,
       
   108             newState );
       
   109         iOwner.StateChangeNotify( iPreviousState, newState );
       
   110         iPreviousState = newState;
       
   111         }
       
   112      else
       
   113         {
       
   114         LOG2("USB device change ignored: %d -> %d", iPreviousState,
       
   115             newState ); 
       
   116         }
   105     }
   117     }
   106  
   118  
   107 // ----------------------------------------------------------------------------
   119 // ----------------------------------------------------------------------------
   108 // Standard active object cancellation function.
   120 // Standard active object cancellation function.
   109 // ----------------------------------------------------------------------------
   121 // ----------------------------------------------------------------------------