+
     h  c                   s\    R t ^ RIt^ RIHt ^ RIHt ^ RIHtH	t	H
t
HtHt  ! R R]4      tR# )a  Sample CardConnectionDecorator that provides exclusive transmit()

__author__ = "https://www.gemalto.com/"

Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com

This file is part of pyscard.

pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
N)CardConnectionDecorator)CardConnectionException)SCARD_LEAVE_CARDSCARD_S_SUCCESSSCardBeginTransactionSCardEndTransactionSCardGetErrorMessagec                   s@   a  ] tR t^%t o RtR tR tR tRR ltRt	V t
R# )	ExclusiveTransmitCardConnectionzThis decorator uses
L{SCardBeginTransaction}/L{SCardEndTransaction} to preserve other
processes of threads to access the card during transmit().c                s2    \         P                  ! W4       R # N)r    __init__)selfZcardconnections   &&P/usr/lib64/python3.14/site-packages/smartcard/ExclusiveTransmitCardConnection.pyr	   Z(ExclusiveTransmitCardConnection.__init__*   s    ((>    c                sD   V P                   p \        V\        P                  P                  P                  4      '       d?   \        VP                  4      p\        V8w  d   \        R\        V4      ,           4      h R# \        VR4      '       d   VP                   pK  R# )z(Lock card with L{SCardBeginTransaction}.z+Failed to lock with SCardBeginTransaction: 	componentN)r   
isinstance	smartcardpcscPCSCCardConnectionr   hcardr   r   r   hasattrr
   r   Zhresult   &  r   lockZ$ExclusiveTransmitCardConnection.lock-   s     NN	9>><<OO  0	@"g-1E.w78  y+..%//	r   c                sN   V P                   p \        V\        P                  P                  P                  4      '       dD   \        VP                  \        4      p\        V8w  d   \        R\        V4      ,           4      h R# \        VR4      '       d   VP                   pK  R# )z(Unlock card with L{SCardEndTransaction}.z+Failed to unlock with SCardEndTransaction: r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   unlockZ&ExclusiveTransmitCardConnection.unlockD   s    NN	9>><<OO  .ioo?OP"g-1E.w78  y+..%//	r   Nc                s>    \         P                  ! WV4      w  r4pW4V3# )zlGain exclusive access to card during APDU transmission for if this
decorator decorates a PCSCCardConnection.)r    transmit)r
   ZcommandZprotocolZdataZsw1Zsw2s   &&&   r   r   Z(ExclusiveTransmitCardConnection.transmitZ   s$     199$R3#~r    r   )Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r	   r   r   r   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   %   s$     B?., r   r   )r   Zsmartcard.pcscr   Z!smartcard.CardConnectionDecoratorr    Zsmartcard.Exceptionsr   Zsmartcard.scardr   r   r   r   r   r   r   r   r   <module>r      s,   0  E 8 9&= 9r   