connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp
changeset 8 6295dc2169f3
parent 7 fa67e03b87df
child 9 8486d82aef45
equal deleted inserted replaced
7:fa67e03b87df 8:6295dc2169f3
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-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 the License "Eclipse Public License v1.0"
     5 * under the terms of the License "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".
   130     {
   130     {
   131     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL_ENTRY, "CUsbPnUsbReceiver::DoCancel" );
   131     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL_ENTRY, "CUsbPnUsbReceiver::DoCancel" );
   132     C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel()" ) ) );
   132     C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel()" ) ) );
   133 
   133 
   134     iLdd.ReadCancel( EEndpoint2 );
   134     iLdd.ReadCancel( EEndpoint2 );
       
   135 
       
   136 #ifdef _DEBUG
   135     TRAPD(err, iPacket->ReleaseL());
   137     TRAPD(err, iPacket->ReleaseL());
       
   138 #elif defined OST_TRACE_COMPILER_IN_USE
       
   139     TRAPD(err, iPacket->ReleaseL());
       
   140 #else
       
   141     TRAP_IGNORE(iPacket->ReleaseL());
       
   142 #endif
   136 
   143 
   137     OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL, "CUsbPnUsbReceiver::DoCancel - err=%d", err );
   144     OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL, "CUsbPnUsbReceiver::DoCancel - err=%d", err );
   138     C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel() - err=%d" ), err ) );
   145     C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel() - err=%d" ), err ) );
   139 
   146 
   140     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL_EXIT, "CUsbPnUsbReceiver::DoCancel - return void" );
   147     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL_EXIT, "CUsbPnUsbReceiver::DoCancel - return void" );
   230             C_TRACE( ( _T( "CUsbPnUsbReceiver::RunError - Cable detached!" )));
   237             C_TRACE( ( _T( "CUsbPnUsbReceiver::RunError - Cable detached!" )));
   231             break;
   238             break;
   232             }
   239             }
   233         default:
   240         default:
   234             {
   241             {
   235             TRACE_ASSERT_ALWAYS;
   242             TRACE_ASSERT_ALWAYS;           
   236             User::Panic( KUsbPnPanicCat, aError );
       
   237             break;
   243             break;
   238             }
   244             }
   239         }
   245         }
   240 
   246 
   241     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RUNERROR_EXIT, "CUsbPnUsbReceiver::RunError - return" );
   247     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RUNERROR_EXIT, "CUsbPnUsbReceiver::RunError - return" );
   242     C_TRACE( ( _T( "CUsbPnUsbReceiver::RunL() - return" ) ) );
   248     C_TRACE( ( _T( "CUsbPnUsbReceiver::RunError() - return" ) ) );
   243     return KErrNone;
   249     return KErrNone;
   244     }
   250     }
   245 
   251 
   246 // -----------------------------------------------------------------------------
   252 // -----------------------------------------------------------------------------
   247 // CUsbPnUsbReceiver::Receive
   253 // CUsbPnUsbReceiver::Receive
   375             iRecvPtr.Append( *iStorage );
   381             iRecvPtr.Append( *iStorage );
   376             delete iStorage;
   382             delete iStorage;
   377             iStorage = NULL;
   383             iStorage = NULL;
   378             }
   384             }
   379 
   385 
       
   386 #ifdef ISI_LENGTH_LITTLE_ENDIAN
   380         // Converts the endianess of message length
   387         // Converts the endianess of message length
   381         TUint8 tmp4(iRecvPtr[ISI_HEADER_OFFSET_LENGTH]);
   388         TUint8 tmp4(iRecvPtr[ISI_HEADER_OFFSET_LENGTH]);
   382         TUint8 tmp5(iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1]);
   389         TUint8 tmp5(iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1]);
   383         iRecvPtr[ISI_HEADER_OFFSET_LENGTH] = tmp5;
   390         iRecvPtr[ISI_HEADER_OFFSET_LENGTH] = tmp5;
   384         iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1] = tmp4;
   391         iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1] = tmp4;
       
   392 #endif // #ifdef ISI_LENGTH_LITTLE_ENDIAN
   385 
   393 
   386 #ifndef NCP_COMMON_BRIDGE_FAMILY
   394 #ifndef NCP_COMMON_BRIDGE_FAMILY
   387         // Message directly to APE Test Server.
   395         // Message directly to APE Test Server.
   388         if( (iRecvPtr[ISI_HEADER_OFFSET_RESOURCEID] == PN_EPOC_TEST) &&
   396         if( (iRecvPtr[ISI_HEADER_OFFSET_RESOURCEID] == PN_EPOC_TEST) &&
   389             (iRecvPtr[ISI_HEADER_OFFSET_MESSAGEID] == TS_SOS_FILE_WRITE_REQ ) )
   397             (iRecvPtr[ISI_HEADER_OFFSET_MESSAGEID] == TS_SOS_FILE_WRITE_REQ ) )