From: <lu...@us...> - 2009-06-26 14:54:37
|
Revision: 294 http://pyscard.svn.sourceforge.net/pyscard/?rev=294&view=rev Author: ludov Date: 2009-06-26 14:54:32 +0000 (Fri, 26 Jun 2009) Log Message: ----------- connect() now accept a mode parameter. Default value is SCARD_SHARE_SHARED Modified Paths: -------------- trunk/pyscard/src/smartcard/CardConnection.py trunk/pyscard/src/smartcard/CardConnectionDecorator.py trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py Modified: trunk/pyscard/src/smartcard/CardConnection.py =================================================================== --- trunk/pyscard/src/smartcard/CardConnection.py 2009-06-16 12:49:49 UTC (rev 293) +++ trunk/pyscard/src/smartcard/CardConnection.py 2009-06-26 14:54:32 UTC (rev 294) @@ -70,10 +70,12 @@ """Remove a CardConnection observer.""" Observable.deleteObserver( self, observer ) - def connect( self, protocol=None ): + def connect( self, protocol=None, mode=None ): """Connect to card. protocol: a bit mask of the protocols to use, from CardConnection.T0_protocol, CardConnection.T1_protocol, CardConnection.RAW_protocol, CardConnection.T15_protocol + + mode: passed as-is to the PC/SC layer """ Observable.setChanged( self ) Observable.notifyObservers( self, CardConnectionEvent('connect') ) Modified: trunk/pyscard/src/smartcard/CardConnectionDecorator.py =================================================================== --- trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2009-06-16 12:49:49 UTC (rev 293) +++ trunk/pyscard/src/smartcard/CardConnectionDecorator.py 2009-06-26 14:54:32 UTC (rev 294) @@ -48,9 +48,9 @@ """call inner component deleteObserver""" self.component.deleteObserver( observer ) - def connect( self, protocol=None ): + def connect( self, protocol=None, mode=None ): """call inner component connect""" - self.component.connect( protocol ) + self.component.connect( protocol, mode ) def disconnect( self ): """call inner component disconnect""" Modified: trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2009-06-16 12:49:49 UTC (rev 293) +++ trunk/pyscard/src/smartcard/pcsc/PCSCCardConnection.py 2009-06-26 14:54:32 UTC (rev 294) @@ -82,14 +82,19 @@ raise CardConnectionException( 'Failed to release context: ' + SCardGetErrorMessage(hresult) ) CardConnection.__del__( self ) - def connect( self, protocol=None ): - """Connect to the card. If protocol is not specified, connect with the default connection protocol.""" + def connect( self, protocol=None, mode=None ): + """Connect to the card. + + If protocol is not specified, connect with the default connection protocol. + + If mode is not specified, connect with SCARD_SHARE_SHARED.""" CardConnection.connect( self, protocol ) pcscprotocol = translateprotocolmask( protocol ) if 0==pcscprotocol: pcscprotocol = self.getProtocol() + if mode==None: mode = SCARD_SHARE_SHARED hresult, self.hcard, dwActiveProtocol = SCardConnect( - self.hcontext, str(self.reader), SCARD_SHARE_SHARED, pcscprotocol ) + self.hcontext, str(self.reader), mode, pcscprotocol ) if hresult!=0: self.hcard=None if SCARD_W_REMOVED_CARD==hresult: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |