connectivitylayer/isce/iscapi_dll/src/isaapi.cpp
changeset 5 8ccc39f9d787
parent 0 63b37f68c1ce
child 8 6295dc2169f3
equal deleted inserted replaced
4:510c70acdbf6 5:8ccc39f9d787
   199     else
   199     else
   200         {
   200         {
   201         C_TRACE( ( _T( "RIscApi::Open iChannelNumber %d aChannelNumber %d " ), iChannelNumber, aChannelNumber ) );
   201         C_TRACE( ( _T( "RIscApi::Open iChannelNumber %d aChannelNumber %d " ), iChannelNumber, aChannelNumber ) );
   202         OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_OPEN, "RIscApi::Open;iChannelNumber=%hx;aChannelNumber=%hx", iChannelNumber, aChannelNumber );        
   202         OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_OPEN, "RIscApi::Open;iChannelNumber=%hx;aChannelNumber=%hx", iChannelNumber, aChannelNumber );        
   203         aStatus = KRequestPending;
   203         aStatus = KRequestPending;
       
   204         TRequestStatus status = KRequestPending;
   204         TAny* params[ KThreeParams ];
   205         TAny* params[ KThreeParams ];
   205         params[ KFirstParam ] = reinterpret_cast< TAny* >( &aStatus );
   206         params[ KFirstParam ] = reinterpret_cast< TAny* >( &status );
   206         params[ KSecondParam ] = reinterpret_cast< TAny* >( &iChannelNumber );
   207         params[ KSecondParam ] = reinterpret_cast< TAny* >( &iChannelNumber );
   207         // If opened with resource (aOpenParams).
   208         // If opened with resource (aOpenParams).
   208         params[ KThirdParam ] = reinterpret_cast< TAny* >( const_cast<TDesC8*>( aOpenParams ) );
   209         params[ KThirdParam ] = reinterpret_cast< TAny* >( const_cast<TDesC8*>( aOpenParams ) );
   209         error = DoControl( EIADAsyncOpen, params );
   210         error = DoControl( EIADAsyncOpen, params );
   210         TRACE_ASSERT_ALWAYS_COND( KErrNone == error );
   211         TRACE_ASSERT_ALWAYS_COND( KErrNone == error );
       
   212         User::WaitForRequest(status);
   211         // In case of KErrAlreadyExists as a result to open we must close the handle after open.
   213         // In case of KErrAlreadyExists as a result to open we must close the handle after open.
   212         if( KErrAlreadyExists == aStatus.Int() )
   214         if( status.Int() == KErrAlreadyExists )
   213             {
   215             {
   214             C_TRACE(  (  _T(  "RIscApi::Open close handle KErrAlreadyExists" ) ) );
   216             C_TRACE(  (  _T(  "RIscApi::Open close handle KErrAlreadyExists" ) ) );
   215             OstTraceExt1( TRACE_NORMAL, RISCAPI_OPEN_ALREADY_EXIST, "RIscApi::Open;aChannelNumber=%hx", aChannelNumber );
   217             OstTraceExt1( TRACE_NORMAL, RISCAPI_OPEN_ALREADY_EXIST, "RIscApi::Open;aChannelNumber=%hx", aChannelNumber );
   216             RHandleBase::Close();
   218             RHandleBase::Close();
   217             }
   219             }
       
   220         TRequestStatus* statusPtr=&aStatus;
       
   221 
       
   222         User::RequestComplete(statusPtr, status.Int());
   218         }
   223         }
   219     C_TRACE(  (  _T(  "RIscApi::Open <-" ) ) );
   224     C_TRACE(  (  _T(  "RIscApi::Open <-" ) ) );
   220 
   225 
   221     OstTrace0( TRACE_NORMAL, RISCAPI_OPEN_EXIT, "<RIscApi::Open" );
   226     OstTrace0( TRACE_NORMAL, RISCAPI_OPEN_EXIT, "<RIscApi::Open" );
   222     }
   227     }