connectivitylayer/isce/iscapi_dll/src/isaapi.cpp
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /*****************************************************************************
       
    20    R&D NOTES ARE:
       
    21    TODO:     Something needs to be done
       
    22    TBR:        Something could be removed between TBR's
       
    23 *****************************************************************************/
       
    24 
       
    25 // INCLUDE FILES
       
    26 #include <iscapi.h>                 // For RIscApi
       
    27 #include "iaduserapitrace.h"        // For C_TRACE...
       
    28 #include "iadinternaldefinitions.h" // For EIAD
       
    29 #include "iadnokiadefinitions.h"    // For EIADCustom
       
    30 #include "OstTraceDefinitions.h"
       
    31 #ifdef OST_TRACE_COMPILER_IN_USE
       
    32 #include "isaapiTraces.h"
       
    33 #endif
       
    34 
       
    35 // EXTERNAL DATA STRUCTURES
       
    36 
       
    37 // EXTERNAL FUNCTION PROTOTYPES  
       
    38 
       
    39 // CONSTANTS
       
    40 
       
    41 // MACROS
       
    42 
       
    43 // LOCAL CONSTANTS AND MACROS
       
    44 const TUint8 KOneParam( 1 );
       
    45 const TUint8 KTwoParams( 2 );
       
    46 const TUint8 KThreeParams( 3 );
       
    47 
       
    48 const TUint8 KFirstParam( 0 );
       
    49 const TUint8 KSecondParam( 1 );
       
    50 const TUint8 KThirdParam( 2 );
       
    51 const TInt KInfoLength( 1 );
       
    52 
       
    53 // MODULE DATA STRUCTURES
       
    54 
       
    55 // LOCAL FUNCTION PROTOTYPES
       
    56 
       
    57 // FORWARD DECLARATIONS
       
    58 
       
    59 // ============================ MEMBER FUNCTIONS ===============================
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // RIscApi::RIscApi
       
    63 // C++ default constructor can NOT contain any code, that
       
    64 // might leave.
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C RIscApi::RIscApi()
       
    68     :iNeededLen( NULL, 0 ),
       
    69      iNeededDataLen( NULL, 0 ),
       
    70      iConnectionStatus( NULL, 0 ),
       
    71      iFlowControlStatus( NULL, 0 ),
       
    72      iOpen( EFalse ),
       
    73      iChannelNumber( KNotInitializedChannel )
       
    74     {
       
    75     OstTrace0( TRACE_NORMAL, RISCAPI_RISCAPI_ENTRY, "<>RIscApi::RIscApi" );
       
    76 
       
    77     C_TRACE( ( _T( "RIscApi::RIscApi <->" ) ) );
       
    78 
       
    79     }
       
    80 
       
    81 
       
    82 EXPORT_C RIscApi::~RIscApi()
       
    83     {
       
    84     OstTraceExt1( TRACE_NORMAL, DUP1_RISCAPI_RISCAPI_ENTRY, ">RIscApi::~RIscApi;iChannelNumber=%hx", iChannelNumber );
       
    85 
       
    86     C_TRACE( ( _T( "RIscApi::~RIscApi 0x%x ->" ), iChannelNumber ) );
       
    87     Close();
       
    88     C_TRACE( ( _T( "RIscApi::~RIscApi 0x%x <-" ), iChannelNumber ) );
       
    89 
       
    90     OstTrace0( TRACE_NORMAL, DUP1_RISCAPI_RISCAPI_EXIT, "<RIscApi::~RIscApi" );
       
    91     }
       
    92 
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // RIscApi::Initialize
       
    96 // Initialize the ISC Interface
       
    97 // ( other items were commented in a header ).
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 EXPORT_C void RIscApi::InitializeModemInterface(
       
   101         TRequestStatus& aStatus
       
   102         )
       
   103     {
       
   104     OstTraceExt2( TRACE_NORMAL, RISCAPI_INITIALIZEMODEMINTERFACE_ENTRY, ">RIscApi::InitializeModemInterface;aStatus=%x;iChannelNumber=%hx", ( TUint )&( aStatus ), iChannelNumber );
       
   105 
       
   106     C_TRACE( ( _T( "RIscApi::InitializeModemInterface 0x%x 0x%x ->" ), iChannelNumber, &aStatus ) );
       
   107     TRACE_ASSERT_ALWAYS;
       
   108     TRequestStatus* status = &aStatus;
       
   109     User::RequestComplete( status, KErrNone );
       
   110     C_TRACE( ( _T( "RIscApi::InitializeModemInterfaceL 0x%x <-" ), iChannelNumber ) );
       
   111 
       
   112     OstTrace0( TRACE_NORMAL, RISCAPI_INITIALIZEMODEMINTERFACE_EXIT, "<RIscApi::InitializeModemInterface" );
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // RIscApi::InitializeCancel
       
   117 // Cancel ISC Initialization sequence
       
   118 // ( other items were commented in a header ).
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 EXPORT_C void RIscApi::InitializeCancel(
       
   122         // None
       
   123         )
       
   124     {
       
   125     OstTrace0( TRACE_NORMAL, RISCAPI_INITIALIZECANCEL_ENTRY, ">RIscApi::InitializeCancel" );
       
   126 
       
   127     C_TRACE( ( _T( "RIscApi::InitializeCancel ->" ) ) );
       
   128     TRACE_ASSERT_ALWAYS;
       
   129     C_TRACE( ( _T( "RIscApi::InitializeCancel  <-" ) ) );
       
   130 
       
   131     OstTrace0( TRACE_NORMAL, RISCAPI_INITIALIZECANCEL_EXIT, "<RIscApi::InitializeCancel" );
       
   132     }
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // RIscApi::LoadL
       
   136 // Load required drivers using Isc_config.ini file
       
   137 // ( other items were commented in a header ).
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 void RIscApi::LoadL( 
       
   141         const TDesC8&, //aMultiplexerInit,     // Multiplexer init. 
       
   142         const TDesC8& //aDataTransmissionInit // Datatransmission init.
       
   143         ) const
       
   144     {
       
   145     OstTrace0( TRACE_NORMAL, RISCAPI_LOADL_ENTRY, ">RIscApi::LoadL" );
       
   146     
       
   147 
       
   148     C_TRACE( ( _T( "RIscApi::LoadL ->" ) ) );
       
   149     TRACE_ASSERT_ALWAYS;
       
   150     C_TRACE( ( _T( "RIscApi::LoadL <-" ) ) );
       
   151 
       
   152     OstTrace0( TRACE_NORMAL, RISCAPI_LOADL_EXIT, "<RIscApi::LoadL" );
       
   153     }
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // RIscApi::Open
       
   157 // Open ISC channel asyncronously
       
   158 // ( other items were commented in a header ).
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 EXPORT_C void RIscApi::Open(
       
   162         const TUint16 aChannelNumber,
       
   163         TRequestStatus& aStatus,
       
   164         TOwnerType aType,
       
   165         const TDesC8* aOpenParams
       
   166         )
       
   167     {
       
   168     OstTraceExt4( TRACE_NORMAL, RISCAPI_OPEN_ENTRY, ">RIscApi::Open;aChannelNumber=%hu;aStatus=%x;aType=%x;aOpenParams=%x", aChannelNumber, ( TUint )&( aStatus ), ( TUint )&( aType ), ( TUint )( aOpenParams ) );
       
   169 
       
   170     C_TRACE( ( _T( "RIscApi::Open 0x%x, 0x%x, 0x%x, 0x%x this 0x%x ->" ),
       
   171                    aChannelNumber, &aStatus, aType, aOpenParams, this ) );
       
   172     // Driver is tried to load everytime.
       
   173     TInt loadStatus( User::LoadLogicalDevice( KNameOfIsaAccessDriverLdd ) );
       
   174     C_TRACE( ( _T( "RIscApi::Open devicedriver loaded %d" ), loadStatus ) );
       
   175     ASSERT_PANIC_ALWAYS( ( KErrNone == loadStatus || KErrAlreadyExists == loadStatus), EIADDriverLoadFailed );
       
   176     TInt error( KErrInUse );
       
   177     if( KNotInitializedChannel == iChannelNumber )
       
   178         {
       
   179         TBuf8<KInfoLength> info;
       
   180         ASSERT_PANIC_ALWAYS( ( aChannelNumber < EIADNokiaLastUserChannel ), EIADChannelNumberOutofRange );
       
   181         C_TRACE( ( _T( "RIscApi::Open ldd" ) ) );
       
   182         OstTrace0( TRACE_NORMAL, RISCAPI_OPEN, "RIscApi::Open ldd" );        
       
   183         info.Append( aChannelNumber );
       
   184         error = DoCreate( KIADDriverName, 
       
   185                           TVersion(), 
       
   186                           KNullUnit, 
       
   187                           NULL, 
       
   188                           &info, 
       
   189                           aType );
       
   190         }
       
   191     if( KErrNone != error )
       
   192         {
       
   193         C_TRACE( ( _T( "RIscApi::Open  - failed 0x%x error %d" ), aChannelNumber, error ) );
       
   194         OstTraceExt2( TRACE_NORMAL, RISCAPI_OPEN_FAILED, "RIscApi::Open - failed;aChannelNumber=%hx;error=%d", aChannelNumber, error );
       
   195         
       
   196         TRequestStatus* ptrStatus = &aStatus;
       
   197         User::RequestComplete( ptrStatus, error );
       
   198         }
       
   199     else
       
   200         {
       
   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 );        
       
   203         aStatus = KRequestPending;
       
   204         TAny* params[ KThreeParams ];
       
   205         params[ KFirstParam ] = reinterpret_cast< TAny* >( &aStatus );
       
   206         params[ KSecondParam ] = reinterpret_cast< TAny* >( &iChannelNumber );
       
   207         // If opened with resource (aOpenParams).
       
   208         params[ KThirdParam ] = reinterpret_cast< TAny* >( const_cast<TDesC8*>( aOpenParams ) );
       
   209         error = DoControl( EIADAsyncOpen, params );
       
   210         TRACE_ASSERT_ALWAYS_COND( KErrNone == error );
       
   211         // In case of KErrAlreadyExists as a result to open we must close the handle after open.
       
   212         if( KErrAlreadyExists == aStatus.Int() )
       
   213             {
       
   214             C_TRACE(  (  _T(  "RIscApi::Open close handle KErrAlreadyExists" ) ) );
       
   215             OstTraceExt1( TRACE_NORMAL, RISCAPI_OPEN_ALREADY_EXIST, "RIscApi::Open;aChannelNumber=%hx", aChannelNumber );
       
   216             RHandleBase::Close();
       
   217             }
       
   218         }
       
   219     C_TRACE(  (  _T(  "RIscApi::Open <-" ) ) );
       
   220 
       
   221     OstTrace0( TRACE_NORMAL, RISCAPI_OPEN_EXIT, "<RIscApi::Open" );
       
   222     }
       
   223 
       
   224 #if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95)
       
   225 EXPORT_C TInt RIscApi::Loan( 
       
   226         const TUint16 aChannelNumber,
       
   227         TOwnerType aHandleType
       
   228         // None
       
   229         )
       
   230     {
       
   231 
       
   232     C_TRACE( ( _T( "RIscApi::Loan 0x%x ->" ), iChannelNumber ) );
       
   233     OstTraceExt1( TRACE_NORMAL, RISCAPI_LOAN_ENTRY, ">RIscApi::Loan;iChannelNumber=%hx", iChannelNumber );
       
   234     // TODO: panic if open?
       
   235     //    PanicIfNotOpen();
       
   236     // Driver is tried to load everytime.
       
   237     TInt loadStatus( User::LoadLogicalDevice( KNameOfIsaAccessDriverLdd ) );
       
   238     C_TRACE( ( _T( "RIscApi::Open devicedriver loaded %d" ), loadStatus ) );
       
   239     OstTrace1( TRACE_NORMAL, DUY1_RISCAPI_LOAN, "RIscApi::Loan;loaded=%d", loadStatus );
       
   240     ASSERT_PANIC_ALWAYS( ( KErrNone == loadStatus || KErrAlreadyExists == loadStatus), EIADDriverLoadFailed );
       
   241     TInt error( KErrInUse );
       
   242     if( KNotInitializedChannel == iChannelNumber )
       
   243         {
       
   244         TBuf8<KInfoLength> info;
       
   245         ASSERT_PANIC_ALWAYS( ( aChannelNumber < EIADNokiaLastUserChannel ), EIADChannelNumberOutofRange );
       
   246         C_TRACE( ( _T( "RIscApi::Loan ldd" ) ) );
       
   247         info.Append( aChannelNumber );
       
   248         error = DoCreate( KIADDriverName, 
       
   249                           TVersion(), 
       
   250                           KNullUnit, 
       
   251                           NULL, 
       
   252                           &info, 
       
   253                           aHandleType );
       
   254         }
       
   255     if( KErrNone == error )
       
   256         {
       
   257         C_TRACE( ( _T( "RIscApi::Loan iChannelNumber %d aChannelNumber %d " ), iChannelNumber, aChannelNumber ) );
       
   258         OstTraceExt2( TRACE_NORMAL, DUY2_RISCAPI_LOAN, "RIscApi::Loan;iChannelNumber=%d;aChannelNumber=%d", iChannelNumber, aChannelNumber );
       
   259         TAny* params[ KOneParam ];
       
   260         params[ KFirstParam ] = reinterpret_cast< TAny* >( &iChannelNumber );
       
   261         error = DoControl( EIADLoan, params );
       
   262         TRACE_ASSERT_ALWAYS_COND( KErrNone == error );
       
   263         if( KErrNone != error )
       
   264             {
       
   265             C_TRACE(  (  _T(  "RIscApi::Loan loan failed. closing the handle.." ) ) );
       
   266             OstTrace0( TRACE_NORMAL, DUY3_RISCAPI_LOAN, "RIscApi::Loan loan failed. closing the handle.." );
       
   267             RHandleBase::Close();
       
   268             }
       
   269         }
       
   270     TRACE_ASSERT_ALWAYS_COND( KErrNone == error );
       
   271     OstTraceExt1( TRACE_NORMAL, RISCAPI_LOAN_EXIT, "<RIscApi::Loan;iChannelNumber=%hx", iChannelNumber );
       
   272     C_TRACE( ( _T( "RIscApi::Loan 0x%x %d<-" ), iChannelNumber, error ) );
       
   273     return error;
       
   274 
       
   275     }
       
   276 
       
   277 EXPORT_C void RIscApi::ReturnLoan( 
       
   278         const TUint16 // aChannelNumber
       
   279         // None
       
   280         )
       
   281     {
       
   282 
       
   283     C_TRACE( ( _T( "RIscApi::ReturnLoan 0x%x ->" ), iChannelNumber ) );
       
   284     OstTraceExt1( TRACE_NORMAL, RISCAPI_RETURNLOAN_ENTRY, ">RIscApi::Loan;iChannelNumber=%hx", iChannelNumber );
       
   285     PanicIfNotOpen();
       
   286     if( iChannelNumber < EIADNokiaLastUserChannel )
       
   287         {
       
   288         TInt ret( DoControl( EIADReturnLoan ) );
       
   289         ASSERT_PANIC_ALWAYS( KErrNone == ret, EIADReturnLoan );
       
   290         iChannelNumber = KNotInitializedChannel;
       
   291         RHandleBase::Close();// Close the channel handle.
       
   292         }
       
   293     OstTraceExt1( TRACE_NORMAL, RISCAPI_RETURNLOAN_EXIT, "<RIscApi::Loan;iChannelNumber=%hx", iChannelNumber );
       
   294     C_TRACE( ( _T( "RIscApi::ReturnLoan 0x%x %d<-" ), iChannelNumber ) );
       
   295 
       
   296     }
       
   297 #endif
       
   298 
       
   299 // -----------------------------------------------------------------------------
       
   300 // RIscApi::OpenCancel
       
   301 // Cancel asynchronous channel opening
       
   302 // ( other items were commented in a header ).
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 EXPORT_C void RIscApi::OpenCancel(
       
   306         // None
       
   307         )
       
   308     {
       
   309     OstTraceExt1( TRACE_NORMAL, RISCAPI_OPENCANCEL_ENTRY, ">RIscApi::OpenCancel;iChannelNumber=%hx", iChannelNumber );
       
   310 
       
   311     C_TRACE( ( _T( "RIscApi::OpenCancel 0x%x ->" ), iChannelNumber ) );
       
   312     PanicIfNotOpen();
       
   313     DoCancel( EIADAsyncOpen );
       
   314     Close();
       
   315     C_TRACE( ( _T( "RIscApi::OpenCancel 0x%x <-" ), iChannelNumber ) );
       
   316 
       
   317     OstTrace0( TRACE_NORMAL, RISCAPI_OPENCANCEL_EXIT, "<RIscApi::OpenCancel" );
       
   318     }
       
   319 
       
   320 // -----------------------------------------------------------------------------
       
   321 // RIscApi::Close
       
   322 // Close ISC Channel
       
   323 // ( other items were commented in a header ).
       
   324 // -----------------------------------------------------------------------------
       
   325 //
       
   326 EXPORT_C void RIscApi::Close(
       
   327         // None
       
   328         )
       
   329     {
       
   330     OstTraceExt1( TRACE_NORMAL, RISCAPI_CLOSE_ENTRY, ">RIscApi::Close;iChannelNumber=%hx", iChannelNumber );
       
   331 
       
   332 
       
   333     C_TRACE( ( _T( "RIscApi::Close 0x%x 0x%x ->" ), iChannelNumber, this ) );
       
   334     if( iChannelNumber < EIADNokiaLastUserChannel )
       
   335         {
       
   336         PanicIfNotOpen();
       
   337         TInt ret( DoControl( EIADClose ) );
       
   338         ASSERT_PANIC_ALWAYS( KErrNone == ret, EIADCloseFailed );
       
   339         iChannelNumber = KNotInitializedChannel;
       
   340         C_TRACE(  (  _T(  "RIscApi::Close close handle" ) ) );
       
   341         OstTrace0( TRACE_NORMAL, RISCAPI_CLOSE, "RIscApi::Close close handle" );        
       
   342         RHandleBase::Close();
       
   343         }
       
   344     else
       
   345         {
       
   346         C_TRACE((_T("RIscApi::Close error: channel number out of range")));
       
   347         OstTrace0( TRACE_NORMAL, DUP1_RISCAPI_CLOSE, "RIscApi::Close channelnumber out of range" );
       
   348 //        TRACE_ASSERT_ALWAYS;        TODO: Trace assert?
       
   349         }
       
   350     C_TRACE( ( _T( "RIscApi::Close 0x%x <-" ), iChannelNumber ) );
       
   351 
       
   352     OstTrace0( TRACE_NORMAL, RISCAPI_CLOSE_EXIT, "<RIscApi::Close" );
       
   353     }
       
   354 
       
   355 // -----------------------------------------------------------------------------
       
   356 // RIscApi::Close
       
   357 // Close ISC Channel
       
   358 // ( other items were commented in a header ).
       
   359 // -----------------------------------------------------------------------------
       
   360 //
       
   361 EXPORT_C void RIscApi::Close(
       
   362         TRequestStatus& aStatus
       
   363         )
       
   364     {
       
   365     OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_CLOSE_ENTRY, ">RIscApi::Close;aStatus=%x;iChannelNumber=%hx", ( TUint )&( aStatus ), iChannelNumber );
       
   366 
       
   367     C_TRACE( ( _T( "RIscApi::Close 0x%x 0x%x ->" ), iChannelNumber, &aStatus ) );
       
   368     if( iChannelNumber < EIADNokiaLastUserChannel )
       
   369         {
       
   370         PanicIfNotOpen();
       
   371         aStatus = KRequestPending;
       
   372         TAny* params[ KOneParam ];
       
   373         params[ KFirstParam ] = reinterpret_cast< TAny* >( &aStatus );
       
   374         TInt ret( DoControl( EIADAsyncClose, params ) );
       
   375         ASSERT_PANIC_ALWAYS( KErrNone == ret, EIADCloseFailed );
       
   376         iChannelNumber = KNotInitializedChannel;
       
   377         C_TRACE(  (  _T(  "RIscApi::Close a close handle" ) ) );
       
   378         RHandleBase::Close();// Added handle close
       
   379         }
       
   380     else
       
   381         {
       
   382         C_TRACE((_T("RIscApi::Close error: channel number out of range")));
       
   383         TRequestStatus* ptrStatus = &aStatus;
       
   384         User::RequestComplete( ptrStatus, KErrNotReady );
       
   385         }
       
   386     C_TRACE( ( _T( "RIscApi::Close 0x%x 0x%x <-" ), iChannelNumber, &aStatus ) );
       
   387 
       
   388     OstTrace0( TRACE_NORMAL, DUP1_RISCAPI_CLOSE_EXIT, "<RIscApi::Close" );
       
   389     }
       
   390 
       
   391 // -----------------------------------------------------------------------------
       
   392 // RIscApi::ResetBuffers
       
   393 // Resets buffers.
       
   394 // ( other items were commented in a header ).
       
   395 // -----------------------------------------------------------------------------
       
   396 //
       
   397 EXPORT_C void RIscApi::ResetBuffers(
       
   398         // None
       
   399         )
       
   400     {
       
   401     OstTraceExt1( TRACE_NORMAL, RISCAPI_RESETBUFFERS_ENTRY, ">RIscApi::ResetBuffers;iChannelNumber=%hx", iChannelNumber );
       
   402 
       
   403     C_TRACE( ( _T( "RIscApi::ResetBuffers 0x%x ->" ), iChannelNumber ) );
       
   404     PanicIfNotOpen();
       
   405     TRACE_ASSERT_ALWAYS_COND( KErrNone == DoControl( EIADResetQueues ) );
       
   406     C_TRACE( ( _T( "RIscApi::ResetBuffers <-" ) ) );
       
   407 
       
   408     OstTrace0( TRACE_NORMAL, RISCAPI_RESETBUFFERS_EXIT, "<RIscApi::ResetBuffers"  );
       
   409     }
       
   410 
       
   411 // -----------------------------------------------------------------------------
       
   412 // RIscApi::Send
       
   413 // Send data to Domestic OS ( asynchronous )
       
   414 // ( other items were commented in a header ).
       
   415 // -----------------------------------------------------------------------------
       
   416 //
       
   417 EXPORT_C void RIscApi::Send(
       
   418         TRequestStatus& aStatus, 
       
   419         const TDesC8& aData
       
   420         )
       
   421     {
       
   422     OstTraceExt2( TRACE_NORMAL, RISCAPI_SEND_ENTRY, ">RIscApi::Send;aStatus=%x;aData=%x", ( TUint )&( aStatus ), ( TUint )&( aData ) );
       
   423     
       
   424     C_TRACE( ( _T( "RIscApi::Send a 0x%x 0x%x 0x%x this 0x%x ->" ),
       
   425                    iChannelNumber, &aStatus, &aData, this ) );
       
   426     PanicIfNotOpen();
       
   427     TAny* params[ KTwoParams ];
       
   428     params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus );
       
   429     params[ KSecondParam ] = reinterpret_cast<TAny*>( const_cast<TDesC8*>( &aData ));
       
   430     aStatus = KRequestPending;
       
   431     DoControl( EIADAsyncSend, params );
       
   432     C_TRACE( ( _T( "RIscApi::Send <-" )  ) );
       
   433 
       
   434     OstTrace0( TRACE_NORMAL, RISCAPI_SEND_EXIT, "<RIscApi::Send" );
       
   435     }
       
   436 
       
   437 // -----------------------------------------------------------------------------
       
   438 // RIscApi::Send
       
   439 // Send data to Domestic OS ( synchronous )
       
   440 // ( other items were commented in a header ).
       
   441 // -----------------------------------------------------------------------------
       
   442 //
       
   443 EXPORT_C TInt RIscApi::Send(
       
   444         const TDesC8& aData
       
   445         )
       
   446     {
       
   447     OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_SEND_ENTRY, ">RIscApi::Send;aData=%x;iChannelNumber=%hx", ( TUint )&( aData ), iChannelNumber );
       
   448 
       
   449     C_TRACE( ( _T( "RIscApi::Send 0x%x 0x%x 0x%x ->" ), iChannelNumber, &aData, this ) );
       
   450     PanicIfNotOpen();
       
   451     TAny* params[ KOneParam ];
       
   452     params[ KFirstParam ] = reinterpret_cast<TAny*>( &( const_cast<TDesC8&>( aData ) ) );
       
   453     TInt error( DoControl( EIADSend, params ) );
       
   454     C_TRACE( ( _T( "RIscApi::Send 0x%x 0x%x 0x%x %d <-" ), iChannelNumber, &aData, this, error ) );
       
   455 
       
   456     OstTrace1( TRACE_NORMAL, DUP1_RISCAPI_SEND_EXIT, "<RIscApi::Send;return=%d", error );
       
   457     return error;
       
   458     }
       
   459 
       
   460 // -----------------------------------------------------------------------------
       
   461 // RIscApi::SendCancel
       
   462 // Cancel asynchronous Send request
       
   463 // ( other items were commented in a header ).
       
   464 // -----------------------------------------------------------------------------
       
   465 //
       
   466 EXPORT_C void RIscApi::SendCancel(
       
   467         // None
       
   468         )
       
   469     {
       
   470     OstTraceExt1( TRACE_NORMAL, RISCAPI_SENDCANCEL_ENTRY, ">RIscApi::SendCancel;iChannelNumber=%hx", iChannelNumber );
       
   471 
       
   472     C_TRACE(  (  _T(  "RIscApi::SendCancel 0x%x ->" ), iChannelNumber ) );
       
   473     PanicIfNotOpen();
       
   474     DoCancel( EIADAsyncSend );
       
   475     C_TRACE( ( _T( "RIscApi::SendCancel <-" ) ) );
       
   476 
       
   477     OstTrace0( TRACE_NORMAL, RISCAPI_SENDCANCEL_EXIT, "<RIscApi::SendCancel");
       
   478     }
       
   479 
       
   480 // -----------------------------------------------------------------------------
       
   481 // RIscApi::Receive
       
   482 // Receive data from Domestic OS
       
   483 // ( other items were commented in a header ).
       
   484 // -----------------------------------------------------------------------------
       
   485 //
       
   486 EXPORT_C void RIscApi::Receive(
       
   487         TRequestStatus& aStatus,
       
   488         TDes8& aData,
       
   489         TUint16& aNeededBufLen
       
   490         )
       
   491     {
       
   492     OstTraceExt4( TRACE_NORMAL, RISCAPI_RECEIVE_ENTRY, ">RIscApi::Receive;aStatus=%x;aData=%x;aNeededBufLen=%hu;iChannelNumber=%hx", ( TUint )&( aStatus ), ( TUint )&( aData ), aNeededBufLen, iChannelNumber );
       
   493 
       
   494     C_TRACE( ( _T( "RIscApi::Receive 0x%x, 0x%x, 0x%x 0x%x this 0x%x ->" ), &aStatus, &aData, aNeededBufLen, iChannelNumber, this ) );
       
   495     PanicIfNotOpen();
       
   496     TAny* params[ KThreeParams ];
       
   497     // Set status pending, just in case client haven't done it.
       
   498     aStatus = KRequestPending;
       
   499     params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus );
       
   500     params[ KSecondParam ] = reinterpret_cast<TAny*>( &aData );
       
   501     params[ KThirdParam ] = reinterpret_cast<TAny*>( &aNeededBufLen );
       
   502     DoControl( EIADAsyncReceive, params );
       
   503     C_TRACE( ( _T( "RIscApi::Receive 0x%x this 0x%x <-" ), iChannelNumber, this ) );
       
   504 
       
   505     OstTrace0( TRACE_NORMAL, RISCAPI_RECEIVE_EXIT, "<RIscApi::Receive" );
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // RIscApi::ReceiveCancel
       
   510 // Cancel data receiving from Domestic OS
       
   511 // ( other items were commented in a header ).
       
   512 // -----------------------------------------------------------------------------
       
   513 //
       
   514 EXPORT_C void RIscApi::ReceiveCancel(
       
   515         // None
       
   516         )
       
   517     {
       
   518     OstTraceExt1( TRACE_NORMAL, RISCAPI_RECEIVECANCEL_ENTRY, ">RIscApi::ReceiveCancel;iChannelNumber=%hx", iChannelNumber );
       
   519 	
       
   520     C_TRACE( ( _T( "RIscApi::ReceiveCancel 0x%x ->"), iChannelNumber ) );
       
   521     PanicIfNotOpen();
       
   522     DoCancel( EIADAsyncReceive );
       
   523     C_TRACE( ( _T( "RIscApi::ReceiveCancel <-") ) );
       
   524 
       
   525     OstTrace0( TRACE_NORMAL, RISCAPI_RECEIVECANCEL_EXIT, "<RIscApi::ReceiveCancel" );
       
   526     }
       
   527 
       
   528 // -----------------------------------------------------------------------------
       
   529 // RIscApi::DataReceiveCancel
       
   530 // Cancel data receiving from Domestic OS
       
   531 // ( other items were commented in a header ).
       
   532 // -----------------------------------------------------------------------------
       
   533 //
       
   534 EXPORT_C void RIscApi::DataReceiveCancel(
       
   535         // None
       
   536         )
       
   537     {
       
   538     OstTraceExt1( TRACE_NORMAL, RISCAPI_DATARECEIVECANCEL_ENTRY, ">RIscApi::DataReceiveCancel;iChannelNumber=%hx", iChannelNumber );
       
   539 
       
   540     C_TRACE( ( _T( "RIscApi::DataReceiveCancel 0x%x ->" ), iChannelNumber ) );
       
   541     PanicIfNotOpen();
       
   542     DoCancel( EIADAsyncDataReceive );
       
   543     C_TRACE( ( _T( "RIscApi::DataReceiveCancel <-" ) ) );
       
   544 
       
   545     OstTrace0( TRACE_NORMAL, RISCAPI_DATARECEIVECANCEL_EXIT, "<RIscApi::DataReceiveCancel" );
       
   546     }
       
   547 
       
   548 // -----------------------------------------------------------------------------
       
   549 // RIscApi::ConnectionStatus
       
   550 // Get the current connection status
       
   551 // ( other items were commented in a header ).
       
   552 // -----------------------------------------------------------------------------
       
   553 //
       
   554 EXPORT_C TInt RIscApi::ConnectionStatus(
       
   555         // None
       
   556         )
       
   557     {
       
   558     OstTraceExt1( TRACE_NORMAL, RISCAPI_CONNECTIONSTATUS_ENTRY, ">RIscApi::ConnectionStatus;iChannelNumber=%hx", iChannelNumber );
       
   559 
       
   560     C_TRACE( ( _T( "RIscApi::ConnectionStatus 0x%x ->" ), iChannelNumber ) );
       
   561     PanicIfNotOpen();
       
   562     TInt connStatus( DoControl( EIADGetConnectionStatus ) );
       
   563     C_TRACE( ( _T( "RIscApi::ConnectionStatus 0x%x %d <-" ), iChannelNumber, connStatus ) );
       
   564 
       
   565     OstTrace1( TRACE_NORMAL, RISCAPI_CONNECTIONSTATUS_EXIT, "<RIscApi::ConnectionStatus;return=%d", connStatus );
       
   566     return connStatus;
       
   567     }
       
   568 
       
   569 // -----------------------------------------------------------------------------
       
   570 // RIscApi::NotifyConnectionStatus
       
   571 // Listen for connection status changes
       
   572 // ( other items were commented in a header ).
       
   573 // -----------------------------------------------------------------------------
       
   574 //
       
   575 EXPORT_C void RIscApi::NotifyConnectionStatus(
       
   576         TRequestStatus& aStatus,
       
   577         TInt& aConnectionStatus
       
   578         )
       
   579     {
       
   580     OstTraceExt3( TRACE_NORMAL, RISCAPI_NOTIFYCONNECTIONSTATUS_ENTRY, ">RIscApi::NotifyConnectionStatus;aStatus=%x;aConnectionStatus=%d;iChannelNumber=%hx", ( TUint )&( aStatus ), aConnectionStatus, iChannelNumber );
       
   581 
       
   582     C_TRACE( ( _T( "RIscApi::NotifyConnectionStatus 0x%x, 0x%x 0x%x ->" ), &aStatus, aConnectionStatus, iChannelNumber ) );
       
   583     PanicIfNotOpen();
       
   584     TAny* params[ KTwoParams ];
       
   585     aStatus = KRequestPending;
       
   586     params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus );
       
   587     params[ KSecondParam ] = reinterpret_cast<TAny*>( &aConnectionStatus );
       
   588     DoControl( EIADAsyncNotifyConnectionStatus, params );
       
   589     C_TRACE( ( _T( "RIscApi::NotifyConnectionStatus <-" ) ) );
       
   590 
       
   591     OstTrace0( TRACE_NORMAL, RISCAPI_NOTIFYCONNECTIONSTATUS_EXIT, "<RIscApi::NotifyConnectionStatus" );
       
   592     }
       
   593 
       
   594 // -----------------------------------------------------------------------------
       
   595 // RIscApi::NotifyConnectionStatusCancel
       
   596 // Stop listening for connection status changes
       
   597 // ( other items were commented in a header ).
       
   598 // -----------------------------------------------------------------------------
       
   599 //
       
   600 EXPORT_C void RIscApi::NotifyConnectionStatusCancel(
       
   601         // None
       
   602         )
       
   603     {
       
   604     OstTraceExt1( TRACE_NORMAL, RISCAPI_NOTIFYCONNECTIONSTATUSCANCEL_ENTRY, ">RIscApi::NotifyConnectionStatusCancel;iChannelNumber=%hx", iChannelNumber );
       
   605 
       
   606     C_TRACE( ( _T( "RIscApi::NotifyConnectionStatusCancel 0x%x ->" ), iChannelNumber ) );
       
   607     PanicIfNotOpen();
       
   608     DoCancel( EIADAsyncNotifyConnectionStatus );
       
   609     C_TRACE( ( _T( "RIscApi::NotifyConnectionStatusCancel 0x%x <-" ), iChannelNumber ) );
       
   610 
       
   611     OstTrace0( TRACE_NORMAL, RISCAPI_NOTIFYCONNECTIONSTATUSCANCEL_EXIT, "<RIscApi::NotifyConnectionStatusCancel" );
       
   612     }
       
   613 
       
   614 
       
   615 // -----------------------------------------------------------------------------
       
   616 // RIscApi::CustomFunction
       
   617 // Asynchronous API extension function
       
   618 // ( other items were commented in a header ).
       
   619 // -----------------------------------------------------------------------------
       
   620 //
       
   621 EXPORT_C void RIscApi::CustomFunction(
       
   622         TRequestStatus& aStatus,
       
   623         const TUint16 aOperation,
       
   624         TAny* aParameters
       
   625         )
       
   626     {
       
   627     OstTraceExt4( TRACE_NORMAL, RISCAPI_CUSTOMFUNCTION_ENTRY, ">RIscApi::CustomFunction;aStatus=%x;aOperation=%hu;aParameters=%x;iChannelNumber=%hx", ( TUint )&( aStatus ), aOperation, ( TUint )( aParameters ), iChannelNumber );
       
   628 
       
   629     C_TRACE( ( _T( "RIscApi::CustomFunction a %d 0x%x 0x%x 0x%x 0x%x ->"), aOperation, aParameters, &aStatus, iChannelNumber, this ) );
       
   630     PanicIfNotOpen();
       
   631     TAny* params[ KTwoParams ];
       
   632     aStatus = KRequestPending;
       
   633     params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus );
       
   634     params[ KSecondParam ] = aParameters;
       
   635     TUint16 operation( 0xffff );
       
   636     switch( aOperation )
       
   637         {
       
   638         case EIADCustomAsyncSubscribeIndications:
       
   639             {
       
   640             operation = EIADAsyncSubscribeIndications;
       
   641             break;
       
   642             }
       
   643         case EIADCustomAsyncSubscribeIndications32Bit:
       
   644             {
       
   645             operation = EIADAsyncSubscribeIndications32Bit;
       
   646             break;
       
   647             }
       
   648         case EIADCustomAsyncSendIndication:
       
   649             {
       
   650             operation = EIADAsyncSendIndication;
       
   651             break;
       
   652             }
       
   653         default:
       
   654             {
       
   655             ASSERT_PANIC_ALWAYS( 0, EIADWrongCustomFunction );
       
   656             break;
       
   657             }
       
   658         }
       
   659     DoControl( operation, params );
       
   660     C_TRACE( ( _T( "RIscApi::CustomFunction %d 0x%x 0x%x 0x%x 0x%x <-"), aOperation, aParameters, &aStatus, iChannelNumber, this ) );
       
   661 
       
   662     OstTrace0( TRACE_NORMAL, RISCAPI_CUSTOMFUNCTION_EXIT, "<RIscApi::CustomFunction" );
       
   663     }
       
   664 
       
   665 // -----------------------------------------------------------------------------
       
   666 // RIscApi::CustomFunction
       
   667 // Synchronous API extension function
       
   668 // ( other items were commented in a header ).
       
   669 // -----------------------------------------------------------------------------
       
   670 //
       
   671 EXPORT_C TInt RIscApi::CustomFunction(
       
   672         const TUint16 aOperation, 
       
   673         TAny* aParameters
       
   674         )
       
   675     {
       
   676     OstTraceExt3( TRACE_NORMAL, DUP1_RISCAPI_CUSTOMFUNCTION_ENTRY, ">RIscApi::CustomFunction;aOperation=%hu;aParameters=%x;iChannelNumber=%hx", aOperation, ( TUint )( aParameters ), iChannelNumber );
       
   677 
       
   678     C_TRACE( ( _T( "RIscApi::CustomFunction %d 0x%x 0x%x 0x%x ->"), aOperation, aParameters, iChannelNumber, this ) );
       
   679     PanicIfNotOpen();
       
   680     TAny* params[ KOneParam ];
       
   681     params[ KFirstParam ] = aParameters;
       
   682     TUint16 operation( 0xffff );
       
   683     switch( aOperation )
       
   684         {
       
   685         case EIADCustomSubscribeIndications:
       
   686             {
       
   687             operation = EIADSubscribeIndications;
       
   688             break;
       
   689             }
       
   690         case EIADCustomSubscribeIndications32Bit:
       
   691             {
       
   692             operation = EIADSubscribeIndications32Bit;
       
   693             break;
       
   694             }
       
   695         case EIADCustomSendIndication:
       
   696             {
       
   697             operation = EIADSendIndication;
       
   698             break;
       
   699             }
       
   700         default:
       
   701             {
       
   702             ASSERT_PANIC_ALWAYS( 0, EIADWrongCustomFunction );
       
   703             break;
       
   704             }
       
   705         }
       
   706     TInt error( DoControl( operation, params ) );
       
   707     C_TRACE( ( _T( "RIscApi::CustomFunction %d 0x%x %d 0x%x <-" ), aOperation, iChannelNumber, error, this ) );
       
   708 
       
   709     OstTrace1( TRACE_NORMAL, DUP1_RISCAPI_CUSTOMFUNCTION_EXIT, "<RIscApi::CustomFunction;return=%d", error );
       
   710     return error;
       
   711     }
       
   712 
       
   713 // -----------------------------------------------------------------------------
       
   714 // RIscApi::CustomFunctionCancel
       
   715 // Cancel the execution of the asynchronous API extension function
       
   716 // ( other items were commented in a header ).
       
   717 // -----------------------------------------------------------------------------
       
   718 //
       
   719 EXPORT_C void RIscApi::CustomFunctionCancel(
       
   720         const TUint16 aOperation
       
   721         )
       
   722     {
       
   723     OstTraceExt2( TRACE_NORMAL, RISCAPI_CUSTOMFUNCTIONCANCEL_ENTRY, ">RIscApi::CustomFunctionCancel;aOperation=%hu;iChannelNumber=%hx", aOperation, iChannelNumber );
       
   724 
       
   725     C_TRACE( ( _T( "RIscApi::CustomFunctionCancel 0x%x 0x%x ->" ), aOperation, iChannelNumber ) );
       
   726     PanicIfNotOpen();
       
   727     TUint16 operation( 0xffff );
       
   728     switch( aOperation )
       
   729         {
       
   730         case EIADCancelCustomAsyncSubscribeIndications:
       
   731             {
       
   732             operation = EIADAsyncSubscribeIndications;
       
   733             break;
       
   734             }
       
   735         case EIADCancelCustomAsyncSubscribeIndications32Bit:
       
   736             {
       
   737             operation = EIADAsyncSubscribeIndications32Bit;
       
   738             break;
       
   739             }
       
   740         case EIADCancelCustomAsyncSendIndication:
       
   741             {
       
   742             operation = EIADAsyncSendIndication;
       
   743             break;
       
   744             }
       
   745         default:
       
   746             {
       
   747             ASSERT_PANIC_ALWAYS( 0, EIADWrongCustomFunction );
       
   748             break;
       
   749             }
       
   750         }
       
   751     DoCancel( operation );
       
   752     C_TRACE( ( _T( "RIscApi::CustomFunctionCancel <-" ) ) );
       
   753 
       
   754     OstTrace0( TRACE_NORMAL, RISCAPI_CUSTOMFUNCTIONCANCEL_EXIT, "<RIscApi::CustomFunctionCancel" );
       
   755     }
       
   756 
       
   757 // -----------------------------------------------------------------------------
       
   758 // RIscApi::DataSend
       
   759 // Send data to Domestic OS ( asynchronous )
       
   760 // ( other items were commented in a header ).
       
   761 // -----------------------------------------------------------------------------
       
   762 //
       
   763 EXPORT_C void RIscApi::DataSend( 
       
   764         TRequestStatus& aStatus,
       
   765         const TDesC8& aData
       
   766         )
       
   767     {
       
   768     OstTraceExt3( TRACE_NORMAL, RISCAPI_DATASEND_ENTRY, ">RIscApi::DataSend;aStatus=%x;aData=%x;iChannelNumber=%hx", ( TUint )&( aStatus ), ( TUint )&( aData ), iChannelNumber );
       
   769 
       
   770     C_TRACE( ( _T( "RIscApi::DataSend a 0x%x 0x%x 0x%x ->" ), &aStatus, &aData, iChannelNumber ) );
       
   771     PanicIfNotOpen();
       
   772     TAny* params[ KTwoParams ];
       
   773     params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus );
       
   774     params[ KSecondParam ] = reinterpret_cast<TAny*>( const_cast<TDesC8*>( &aData ));
       
   775     aStatus = KRequestPending;
       
   776     DoControl( EIADAsyncDataSend, params );
       
   777     C_TRACE( ( _T( "RIscApi::DataSend <-" ) ) );
       
   778 
       
   779     OstTrace0( TRACE_NORMAL, RISCAPI_DATASEND_EXIT, "<RIscApi::DataSend" );
       
   780     }
       
   781 
       
   782 // -----------------------------------------------------------------------------
       
   783 // RIscApi::DataSend
       
   784 // Send data to Domestic OS ( synchronous )
       
   785 // ( other items were commented in a header ).
       
   786 // -----------------------------------------------------------------------------
       
   787 //
       
   788 EXPORT_C TInt RIscApi::DataSend(
       
   789         const TDesC8& aData
       
   790         )
       
   791     {
       
   792     OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_DATASEND_ENTRY, ">RIscApi::DataSend;aData=%x;iChannelNumber=%hx", ( TUint )&( aData ), iChannelNumber );
       
   793 
       
   794     C_TRACE( ( _T( "RIscApi::DataSend 0x%x 0x%x" ), &aData, iChannelNumber ) );
       
   795     PanicIfNotOpen();
       
   796     TAny* params[ KOneParam ];
       
   797     params[ KFirstParam ] = reinterpret_cast<TAny*>( &( const_cast<TDesC8&>( aData ) ) );
       
   798     TInt error( DoControl( EIADDataSend, params ) );
       
   799     C_TRACE( ( _T( "RIscApi::DataSend %d <-" ), error ) );
       
   800 
       
   801     OstTrace1( TRACE_NORMAL, DUP1_RISCAPI_DATASEND_EXIT, "<RIscApi::DataSend;return=%d", error );
       
   802     return error;
       
   803     }
       
   804 
       
   805 // -----------------------------------------------------------------------------
       
   806 // RIscApi::DataSendCancel
       
   807 // Cancel asynchronous DataSend request
       
   808 // ( other items were commented in a header ).
       
   809 // -----------------------------------------------------------------------------
       
   810 //
       
   811 EXPORT_C void RIscApi::DataSendCancel(
       
   812         // None
       
   813         )
       
   814     {
       
   815     OstTraceExt1( TRACE_NORMAL, RISCAPI_DATASENDCANCEL_ENTRY, ">RIscApi::DataSendCancel;iChannelNumber=%hx", iChannelNumber );
       
   816 
       
   817     C_TRACE( ( _T( "RIscApi::DataSendCancel 0x%x ->" ), iChannelNumber ) );
       
   818     PanicIfNotOpen();
       
   819     DoCancel( EIADAsyncDataSend );
       
   820     C_TRACE( ( _T( "RIscApi::DataSendCancel <-" ) ) );
       
   821 
       
   822     OstTrace0( TRACE_NORMAL, RISCAPI_DATASENDCANCEL_EXIT, "<RIscApi::DataSendCancel" );
       
   823     }
       
   824 
       
   825 // -----------------------------------------------------------------------------
       
   826 // RIscApi::DataReceive
       
   827 // Receive data from Domestic OS
       
   828 // ( other items were commented in a header ).
       
   829 // -----------------------------------------------------------------------------
       
   830 //
       
   831 EXPORT_C void RIscApi::DataReceive(
       
   832         TRequestStatus& aStatus,
       
   833         TDes8& aData,
       
   834         TUint16& aNeededBufLen
       
   835         )
       
   836     {
       
   837     OstTraceExt4( TRACE_NORMAL, RISCAPI_DATARECEIVE_ENTRY, ">RIscApi::DataReceive;aStatus=%x;aData=%x;aNeededBufLen=%hu;iChannelNumber=%hx", ( TUint )&( aStatus ), ( TUint )&( aData ), aNeededBufLen, iChannelNumber );
       
   838 
       
   839     C_TRACE( ( _T( "RIscApi::DataReceive 0x%x 0x%x 0x%x 0x%x ->" ), &aStatus, &aData, aNeededBufLen, iChannelNumber ) );
       
   840     PanicIfNotOpen();
       
   841     TAny* params[ KThreeParams ];
       
   842     // Set status pending, just in case client haven't done it.
       
   843     aStatus = KRequestPending;
       
   844     params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus );
       
   845     params[ KSecondParam ] = reinterpret_cast<TAny*>( &aData );
       
   846     params[ KThirdParam ] = reinterpret_cast<TAny*>( &aNeededBufLen );
       
   847     DoControl( EIADAsyncDataReceive, params );
       
   848     C_TRACE( ( _T( "RIscApi::DataReceive 0x%x <-" ), iChannelNumber ) );
       
   849 
       
   850     OstTrace0( TRACE_NORMAL, RISCAPI_DATARECEIVE_EXIT, "<RIscApi::DataReceive" );
       
   851     }
       
   852 
       
   853 // -----------------------------------------------------------------------------
       
   854 // RIscApi::FlowControlStatus
       
   855 // Get the current flow control status ( in uplink-direction )
       
   856 // ( other items were commented in a header ).
       
   857 // -----------------------------------------------------------------------------
       
   858 //
       
   859 EXPORT_C TInt RIscApi::FlowControlStatus(
       
   860         // None
       
   861         )
       
   862     {
       
   863     OstTraceExt1( TRACE_NORMAL, RISCAPI_FLOWCONTROLSTATUS_ENTRY, ">RIscApi::FlowControlStatus;iChannelNumber=%hx", iChannelNumber );
       
   864 
       
   865 
       
   866     C_TRACE( ( _T( "RIscApi::FlowControlStatus 0x%x ->" ), iChannelNumber ) );
       
   867     PanicIfNotOpen();
       
   868     TInt error( DoControl( EIADGetFlowControlStatus ) );
       
   869     C_TRACE( ( _T( "RIscApi::FlowControlStatus 0x%x %d <-" ), iChannelNumber, error ) );
       
   870 
       
   871     OstTrace1( TRACE_NORMAL, RISCAPI_FLOWCONTROLSTATUS_EXIT, "<RIscApi::FlowControlStatus;return=%d", error );
       
   872     return error;
       
   873     }
       
   874 
       
   875 
       
   876 // -----------------------------------------------------------------------------
       
   877 // RIscApi::NotifyFlowControl
       
   878 // Listen for flow control status changes
       
   879 // ( other items were commented in a header ).
       
   880 // -----------------------------------------------------------------------------
       
   881 //
       
   882 EXPORT_C void RIscApi::NotifyFlowControl(
       
   883         TRequestStatus& aStatus,
       
   884         TInt& aFlowControlStatus
       
   885         )
       
   886     {
       
   887     OstTraceExt3( TRACE_NORMAL, RISCAPI_NOTIFYFLOWCONTROL_ENTRY, ">RIscApi::NotifyFlowControl;aStatus=%x;aFlowControlStatus=%d;iChannelNumber=%hx", ( TUint )&( aStatus ), aFlowControlStatus, iChannelNumber );
       
   888 
       
   889     C_TRACE( ( _T( "RIscApi::NotifyFlowControl 0x%x 0x%x ch 0x%x ->" ),
       
   890                    &aStatus, aFlowControlStatus, iChannelNumber ) );
       
   891     PanicIfNotOpen();
       
   892     TAny* params[ KTwoParams ];
       
   893     aStatus = KRequestPending;
       
   894     params[ KFirstParam ] = reinterpret_cast<TAny*>( &aStatus );
       
   895     params[ KSecondParam ] = reinterpret_cast<TAny*>( &aFlowControlStatus );
       
   896     DoControl( EIADAsyncNotifyFlowControlStatus, params );
       
   897     C_TRACE( ( _T( "RIscApi::NotifyFlowControl <-" ) ) );
       
   898 
       
   899     OstTrace0( TRACE_NORMAL, RISCAPI_NOTIFYFLOWCONTROL_EXIT, "<RIscApi::NotifyFlowControl" );
       
   900     }
       
   901 
       
   902 
       
   903 // -----------------------------------------------------------------------------
       
   904 // RIscApi::NotifyFlowControlCancel
       
   905 // Stop listening for flow control status changes
       
   906 // ( other items were commented in a header ).
       
   907 // -----------------------------------------------------------------------------
       
   908 //
       
   909 EXPORT_C void RIscApi::NotifyFlowControlCancel(
       
   910         // None
       
   911         )
       
   912     {
       
   913     OstTraceExt1( TRACE_NORMAL, RISCAPI_NOTIFYFLOWCONTROLCANCEL_ENTRY, ">RIscApi::NotifyFlowControlCancel;iChannelNumber=%hx", iChannelNumber );
       
   914 
       
   915     C_TRACE(  (  _T(  "RIscApi::NotifyFlowControlCancel 0x%x -> "), iChannelNumber ) );
       
   916     PanicIfNotOpen();
       
   917     DoCancel( EIADAsyncNotifyFlowControlStatus );
       
   918     C_TRACE( ( _T( "RIscApi::NotifyFlowControlCancel 0x%x <-"), iChannelNumber ) );
       
   919 
       
   920     OstTrace0( TRACE_NORMAL, RISCAPI_NOTIFYFLOWCONTROLCANCEL_EXIT, "<RIscApi::NotifyFlowControlCancel" );
       
   921     }
       
   922 
       
   923 // -----------------------------------------------------------------------------
       
   924 // RIscApi::MaximumDataSize
       
   925 // Get maximun data size ( for sending and receiving )
       
   926 // ( other items were commented in a header ).
       
   927 // -----------------------------------------------------------------------------
       
   928 //
       
   929 EXPORT_C TInt RIscApi::MaximumDataSize(
       
   930         // None
       
   931         )
       
   932     {
       
   933     OstTraceExt1( TRACE_NORMAL, RISCAPI_MAXIMUMDATASIZE_ENTRY, ">RIscApi::MaximumDataSize;iChannelNumber=%hx", iChannelNumber );
       
   934 
       
   935     C_TRACE( ( _T( "RIscApi::MaximumDataSize 0x%x ->" ), iChannelNumber ) );
       
   936     PanicIfNotOpen();
       
   937     TInt returnCode( DoControl( EIADGetMaxDataSize ) );
       
   938     // If positive the maximum amount of data in ISI or data message to be send
       
   939     // If negative, one of the error codes. TODO: add to documentation, check possible error codes.
       
   940     C_TRACE( ( _T( "RIscApi::MaximumDataSize 0x%x %d <-" ), iChannelNumber, returnCode ) );
       
   941 
       
   942     OstTrace1( TRACE_NORMAL, RISCAPI_MAXIMUMDATASIZE_EXIT, "<RIscApi::MaximumDataSize;return=%d", returnCode );
       
   943     return returnCode;
       
   944     }
       
   945 
       
   946 // -----------------------------------------------------------------------------
       
   947 // RIscApi::GetChannelInfo
       
   948 // Get channel info from multiplexer
       
   949 // ( other items were commented in a header ).
       
   950 // -----------------------------------------------------------------------------
       
   951 //
       
   952 EXPORT_C TInt RIscApi::GetChannelInfo(
       
   953         const TUint16 aChannel, 
       
   954         TDes8& aInfo
       
   955         )
       
   956     {
       
   957     OstTraceExt3( TRACE_NORMAL, RISCAPI_GETCHANNELINFO_ENTRY, ">RIscApi::GetChannelInfo;aChannel=%hu;aInfo=%x;iChannelNumber=%hx", aChannel, ( TUint )&( aInfo ), iChannelNumber );
       
   958 
       
   959     C_TRACE( ( _T( "RIscApi::GetChannelInfo 0x%x 0x%x ->" ), aChannel, &aInfo ) );
       
   960     PanicIfNotOpen();
       
   961     const TInt KChannelInfoMax( 2 );
       
   962     TInt error( aInfo.MaxLength() >= KChannelInfoMax ? KErrNone : KErrArgument );
       
   963     // TODO: Returns information of user channels only, not possible to get information
       
   964     // about kernel channels at the moment.
       
   965     // TODO: error if channel is out of range?
       
   966     if( KErrArgument != error )
       
   967         {
       
   968         aInfo.SetLength( KChannelInfoMax );
       
   969         aInfo[ KFirstParam ] = static_cast<TUint8>( aChannel >> 8 );
       
   970         aInfo[ KSecondParam ] = static_cast<TUint8>( aChannel );
       
   971         }
       
   972     C_TRACE( ( _T( "RIscApi::GetChannelInfo 0x%x 0x%x %d <-" ), aChannel, &aInfo, error ) );
       
   973     
       
   974     OstTrace1( TRACE_NORMAL, RISCAPI_GETCHANNELINFO_EXIT, "<RIscApi::GetChannelInfo;return=%d", error );
       
   975     return error;
       
   976     }
       
   977 
       
   978 // -----------------------------------------------------------------------------
       
   979 // IscApi::PanicIfNotOpen
       
   980 // Panic if channel is not opened yet
       
   981 // ( other items were commented in a header ).
       
   982 // -----------------------------------------------------------------------------
       
   983 //
       
   984 void RIscApi::PanicIfNotOpen(
       
   985         // None
       
   986         ) const
       
   987     {
       
   988     //OstTraceExt1( TRACE_NORMAL, RISCAPI_PANICIFNOTOPEN_ENTRY, ">RIscApi::PanicIfNotOpen;iChannelNumber=%hx", iChannelNumber );
       
   989 	
       
   990     C_TRACE( ( _T( "RIscApi::PanicIfNotOpen 0x%x>" ), iChannelNumber ) );
       
   991     ASSERT_PANIC_ALWAYS( KNotInitializedChannel != iChannelNumber, EIADChannelNotOpen );
       
   992     C_TRACE( ( _T( "RIscApi::PanicIfNotOpen<" )) );
       
   993 
       
   994     //OstTrace0( TRACE_NORMAL, RISCAPI_PANICIFNOTOPEN_EXIT, "<RIscApi::PanicIfNotOpen" );
       
   995     }
       
   996 
       
   997 //  End of File