usbengines/usbwatcher/src/cusbwatchersession.cpp
branchRCL_3
changeset 77 5b2a402e96ac
parent 0 1e05558e2206
child 92 dde4619868dc
equal deleted inserted replaced
76:e9b96e674847 77:5b2a402e96ac
     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".
   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 
       
   165     iUsbWatcherServer->Watcher().SetPersonality( aMessage.Int0(),
   162     iUsbWatcherServer->Watcher().SetPersonality( aMessage.Int0(),
   166         static_cast<TBool>( aMessage.Int2() ) );
   163         static_cast<TBool>( aMessage.Int2() ) );
   167 
   164 
   168     return KErrNone;
   165     return KErrNone;
   169     }
   166     }
   181         {
   178         {
   182         LOG( "No outstanding SetPersonality request" );
   179         LOG( "No outstanding SetPersonality request" );
   183         return KErrNone;
   180         return KErrNone;
   184         }
   181         }
   185 
   182 
   186     SetAskOnConnectionSuppression( EFalse );
       
   187     aComplete = EFalse;
   183     aComplete = EFalse;
   188     iCancelSetPersonalityMessage = aMessage;
   184     iCancelSetPersonalityMessage = aMessage;
   189     iCancelSetPersonalityOutstanding = ETrue;
   185     iCancelSetPersonalityOutstanding = ETrue;
   190 
   186 
   191     iUsbWatcherServer->Watcher().CancelSetPersonality();
   187     iUsbWatcherServer->Watcher().CancelSetPersonality();
   209         }
   205         }
   210 
   206 
   211     // Cancel all other pending requests
   207     // Cancel all other pending requests
   212     iUsbWatcherServer->Watcher().Notify( KErrCancel );
   208     iUsbWatcherServer->Watcher().Notify( KErrCancel );
   213 
   209 
   214     SetAskOnConnectionSuppression( EFalse );
       
   215     iSetPreviousPersonalityOutstanding = ETrue;
   210     iSetPreviousPersonalityOutstanding = ETrue;
   216     iSetPreviousPersonalityMessage = aMessage;
   211     iSetPreviousPersonalityMessage = aMessage;
   217     aComplete = EFalse;
   212     aComplete = EFalse;
   218 
   213 
   219     iUsbWatcherServer->Watcher().SetPreviousPersonality();
   214     iUsbWatcherServer->Watcher().SetPreviousPersonality();
   237         }
   232         }
   238 
   233 
   239     // Cancel all other pending requests
   234     // Cancel all other pending requests
   240     iUsbWatcherServer->Watcher().Notify( KErrCancel );
   235     iUsbWatcherServer->Watcher().Notify( KErrCancel );
   241 
   236 
   242     SetAskOnConnectionSuppression( EFalse );
       
   243     iUsbWatcherServer->Watcher().SetPreviousPersonality();
   237     iUsbWatcherServer->Watcher().SetPreviousPersonality();
   244 
   238 
   245     return KErrNone;
   239     return KErrNone;
   246     }
   240     }
   247 
   241 
   275 TInt CUsbWatcherSession::SetPreviousPersonalityOnDisconnect( const RMessage2&
   269 TInt CUsbWatcherSession::SetPreviousPersonalityOnDisconnect( const RMessage2&
   276         /*aMessage*/, TBool& /*aComplete*/ )
   270         /*aMessage*/, TBool& /*aComplete*/ )
   277     {
   271     {
   278     LOG_FUNC
   272     LOG_FUNC
   279 
   273 
   280     //connected currently, so ask on connection can be enabled
       
   281     SetAskOnConnectionSuppression( EFalse );
       
   282     iUsbWatcherServer->Watcher().SetPreviousPersonalityOnDisconnect();
   274     iUsbWatcherServer->Watcher().SetPreviousPersonalityOnDisconnect();
   283 
   275 
   284     return KErrNone;
   276     return KErrNone;
   285     }
   277     }
   286 
   278 
   321         iSetPreviousPersonalityMessage.Complete( aStatus );
   313         iSetPreviousPersonalityMessage.Complete( aStatus );
   322         iSetPreviousPersonalityOutstanding = EFalse;
   314         iSetPreviousPersonalityOutstanding = EFalse;
   323         }
   315         }
   324     }
   316     }
   325 
   317 
   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 
       
   348 // End of file
   318 // End of file