usbengines/usbwatcher/src/cusbwatchersession.cpp
branchRCL_3
changeset 92 dde4619868dc
parent 77 5b2a402e96ac
equal deleted inserted replaced
86:703a2b94c06c 92:dde4619868dc
     1 /*
     1 /*
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2009 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".
   157 
   157 
   158     iSetPersonalityMessage = aMessage;
   158     iSetPersonalityMessage = aMessage;
   159     aComplete = EFalse;
   159     aComplete = EFalse;
   160     iSetPersonalityOutstanding = ETrue;
   160     iSetPersonalityOutstanding = ETrue;
   161 
   161 
       
   162     //Set force parameter to this session.
       
   163     SetAskOnConnectionSuppression( aMessage.Int1() );
       
   164 
   162     iUsbWatcherServer->Watcher().SetPersonality( aMessage.Int0(),
   165     iUsbWatcherServer->Watcher().SetPersonality( aMessage.Int0(),
   163         static_cast<TBool>( aMessage.Int2() ) );
   166         static_cast<TBool>( aMessage.Int2() ) );
   164 
   167 
   165     return KErrNone;
   168     return KErrNone;
   166     }
   169     }
   178         {
   181         {
   179         LOG( "No outstanding SetPersonality request" );
   182         LOG( "No outstanding SetPersonality request" );
   180         return KErrNone;
   183         return KErrNone;
   181         }
   184         }
   182 
   185 
       
   186     SetAskOnConnectionSuppression( EFalse );
   183     aComplete = EFalse;
   187     aComplete = EFalse;
   184     iCancelSetPersonalityMessage = aMessage;
   188     iCancelSetPersonalityMessage = aMessage;
   185     iCancelSetPersonalityOutstanding = ETrue;
   189     iCancelSetPersonalityOutstanding = ETrue;
   186 
   190 
   187     iUsbWatcherServer->Watcher().CancelSetPersonality();
   191     iUsbWatcherServer->Watcher().CancelSetPersonality();
   205         }
   209         }
   206 
   210 
   207     // Cancel all other pending requests
   211     // Cancel all other pending requests
   208     iUsbWatcherServer->Watcher().Notify( KErrCancel );
   212     iUsbWatcherServer->Watcher().Notify( KErrCancel );
   209 
   213 
       
   214     SetAskOnConnectionSuppression( EFalse );
   210     iSetPreviousPersonalityOutstanding = ETrue;
   215     iSetPreviousPersonalityOutstanding = ETrue;
   211     iSetPreviousPersonalityMessage = aMessage;
   216     iSetPreviousPersonalityMessage = aMessage;
   212     aComplete = EFalse;
   217     aComplete = EFalse;
   213 
   218 
   214     iUsbWatcherServer->Watcher().SetPreviousPersonality();
   219     iUsbWatcherServer->Watcher().SetPreviousPersonality();
   232         }
   237         }
   233 
   238 
   234     // Cancel all other pending requests
   239     // Cancel all other pending requests
   235     iUsbWatcherServer->Watcher().Notify( KErrCancel );
   240     iUsbWatcherServer->Watcher().Notify( KErrCancel );
   236 
   241 
       
   242     SetAskOnConnectionSuppression( EFalse );
   237     iUsbWatcherServer->Watcher().SetPreviousPersonality();
   243     iUsbWatcherServer->Watcher().SetPreviousPersonality();
   238 
   244 
   239     return KErrNone;
   245     return KErrNone;
   240     }
   246     }
   241 
   247 
   269 TInt CUsbWatcherSession::SetPreviousPersonalityOnDisconnect( const RMessage2&
   275 TInt CUsbWatcherSession::SetPreviousPersonalityOnDisconnect( const RMessage2&
   270         /*aMessage*/, TBool& /*aComplete*/ )
   276         /*aMessage*/, TBool& /*aComplete*/ )
   271     {
   277     {
   272     LOG_FUNC
   278     LOG_FUNC
   273 
   279 
       
   280     //connected currently, so ask on connection can be enabled
       
   281     SetAskOnConnectionSuppression( EFalse );
   274     iUsbWatcherServer->Watcher().SetPreviousPersonalityOnDisconnect();
   282     iUsbWatcherServer->Watcher().SetPreviousPersonalityOnDisconnect();
   275 
   283 
   276     return KErrNone;
   284     return KErrNone;
   277     }
   285     }
   278 
   286 
   313         iSetPreviousPersonalityMessage.Complete( aStatus );
   321         iSetPreviousPersonalityMessage.Complete( aStatus );
   314         iSetPreviousPersonalityOutstanding = EFalse;
   322         iSetPreviousPersonalityOutstanding = EFalse;
   315         }
   323         }
   316     }
   324     }
   317 
   325 
       
   326 // ----------------------------------------------------------------------------
       
   327 // Set or clear AskOnConnection suppression
       
   328 // ----------------------------------------------------------------------------
       
   329 //
       
   330 void CUsbWatcherSession::SetAskOnConnectionSuppression( TBool aSuppress )
       
   331     {
       
   332     LOG_FUNC
       
   333 
       
   334     iSuppressAskOnConnection = aSuppress;
       
   335     }
       
   336 
       
   337 // ----------------------------------------------------------------------------
       
   338 // Check if AskOnConnection is suppressed
       
   339 // ----------------------------------------------------------------------------
       
   340 //
       
   341 TBool CUsbWatcherSession::IsAskOnConnectionSuppressed()
       
   342     {
       
   343     LOG_FUNC
       
   344 
       
   345     return iSuppressAskOnConnection;
       
   346     }
       
   347 
   318 // End of file
   348 // End of file