wim/Scard/inc/ScardMessageStack.inl
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2003 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 "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:  Inline functions for smart card message stack
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // ============================ MEMBER FUNCTIONS ===============================
       
    20 
       
    21 // -----------------------------------------------------------------------------
       
    22 // CScardMessageStack::Count
       
    23 // Returns count of messages in the stack.
       
    24 // -----------------------------------------------------------------------------
       
    25 //
       
    26 inline const TInt CScardMessageStack::Count()
       
    27     {
       
    28     return iMessages->Count();
       
    29     }   
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CScardMessageStack::CancelOne
       
    33 // Cancel one message
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 inline void CScardMessageStack::CancelOne( 
       
    37     const TInt aIndex, 
       
    38     const TInt aReason,
       
    39     const TBool aCancelTimer )
       
    40     {
       
    41     TMessageHandle& tmp = (*iMessages)[aIndex]; 
       
    42 
       
    43     // Do not cancel twice
       
    44     if ( !tmp.iCancelled )
       
    45         {
       
    46         tmp.iCancelled = ETrue;
       
    47         //  There are two special types of messages that don't need completing.
       
    48         //  One is a transmission from a connector and the other
       
    49         //  is ConnectToReader
       
    50         if ( ! ( (tmp.iAdditionalParameter & KConnection ) |
       
    51             ( tmp.iMessage.Function() == EScardServerConnectToReader ) ) ) 
       
    52             {
       
    53             tmp.iMessage.Complete( aReason );
       
    54             }
       
    55 
       
    56         if ( aCancelTimer && tmp.iTimer )
       
    57             {
       
    58             tmp.iTimer->Cancel();
       
    59             }
       
    60         }
       
    61     }
       
    62 
       
    63 // End of File