telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmWimTsywithdispatcher.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CMmWimTsywithdispatcher.cpp.cpp
       
    15 //
       
    16 
       
    17 #ifdef USING_CTSY_DISPATCHER
       
    18 
       
    19 /**
       
    20  * This file contains additional function definitions for the CMmWimTsy class
       
    21  * in CTSY for use when the CTSY is used with the CTSY Dispatcher. 
       
    22  */
       
    23 
       
    24 #include "CMmWimTsy.h"
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // CMmWimTsy::CompleteSendAPDUReq
       
    28 // Completes a Send APDU request.
       
    29 // (other items were commented in a header).
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 void CMmWimTsy::CompleteSendAPDUReq(
       
    33     CMmDataPackage* aDataPackage, 
       
    34     TInt aError )
       
    35     {
       
    36 	// Complete request
       
    37     const TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(EWIMRequestTypeSendAPDUReq);
       
    38 
       
    39     if( reqHandle )
       
    40 		{
       
    41 		if ( KErrNone == aError )
       
    42 	        {
       
    43 	        //unpack the data
       
    44 	        TDesC8* info = NULL;
       
    45 	        TDesC8* data = NULL;
       
    46 	
       
    47 	        aDataPackage->UnPackData( &info, &data );
       
    48 		    // request was successful, copy data to client side
       
    49 		    if ( ( !iRetApduInfo && info ) || (!iRetApduData && data))
       
    50 		    	{
       
    51 		    	aError = KErrBadDescriptor;
       
    52 		    	}
       
    53 		    
       
    54 		    if ( iRetApduInfo && info )
       
    55 		        {
       
    56 		        if (iRetApduInfo->Length() < info->Length())
       
    57 		        	{
       
    58 		        	aError = KErrOverflow;
       
    59 		        	}
       
    60 		        else
       
    61 		        	{
       
    62 		        	iRetApduInfo->Copy(*info);
       
    63 		        	}
       
    64 		        }
       
    65 		
       
    66 		    if ( iRetApduData && data )
       
    67 		        {
       
    68 		        if (iRetApduData->Length() < data->Length())
       
    69 		        	{
       
    70 		        	aError = KErrOverflow;
       
    71 		        	}
       
    72 		        else
       
    73 		        	{
       
    74 		        	iRetApduData->Copy(*data);
       
    75 		        	}
       
    76 		        }
       
    77 		    }
       
    78 		iMmCustomTsy->ReqCompleted( reqHandle, aError );
       
    79 		}
       
    80     }
       
    81 
       
    82 #endif //USING_CTSY_DISPATCHER