class CardConnection(Observable):
Known subclasses: smartcard.pcsc.PCSCCardConnection.PCSCCardConnection
Constructor: CardConnection(reader)
Card connection abstract class.
| Method | __del__ |
Connect to card. |
| Method | __enter__ |
Enter the runtime context. |
| Method | __exit__ |
Exit the runtime context trying to disconnect. |
| Method | __init__ |
Construct a new card connection. |
| Method | add |
Add a CardConnection observer. |
| Method | add |
Add a status word exception class to be filtered. |
| Method | connect |
Connect to card. |
| Method | control |
Send a control command and buffer. Internally calls doControl() class method and notify observers upon command/response events. Subclasses must override the doControl() class method. |
| Method | delete |
Remove a CardConnection observer. |
| Method | disconnect |
Disconnect from card. |
| Method | do |
Performs the command control. |
| Method | do |
Performs the command get attrib. |
| Method | do |
Performs the command APDU transmission. |
| Method | get |
Return card ATR |
| Method | get |
return the requested attribute |
| Method | get |
Return bit mask for the protocol of connection, or None if no protocol set. The return value is a bit mask of CardConnection.T0_protocol, CardConnection.T1_protocol, CardConnection.RAW_protocol, CardConnection.T15_protocol... |
| Method | get |
Return card connection reader |
| Method | reconnect |
Reconnect to card. |
| Method | release |
Release the context. |
| Method | set |
Add an error checking chain. |
| Method | set |
Set protocol for card connection. |
| Method | transmit |
Transmit an apdu. Internally calls doTransmit() class method and notify observers upon command/response APDU events. Subclasses must override the doTransmit() class method. |
| Class Variable | |
protocol RAW (direct access to the reader) |
| Class Variable | |
protocol T=0 |
| Class Variable | |
protocol T=15 |
| Class Variable | |
protocol T=1 |
| Instance Variable | defaultprotocol |
see setProtocol and getProtocol |
| Instance Variable | errorcheckingchain |
see setErrorCheckingChain |
| Instance Variable | reader |
reader name |
Inherited from Observable:
| Method | clear |
Clear the change flag |
| Method | count |
Return the number of Observers |
| Method | delete |
Remove all observers |
| Method | has |
Somethig has changed? |
| Method | notify |
If 'changed' indicates that this object has changed, notify all its observers, then call clearChanged(). Each observer has its update() called with two arguments: this observable object and the generic 'handlers'. |
| Method | set |
Set the change flag |
| Instance Variable | changed |
Undocumented |
| Instance Variable | obs |
Undocumented |
Inherited from Synchronization (via Observable):
| Instance Variable | mutex |
Undocumented |
smartcard.Observer.Observable.__init__smartcard.pcsc.PCSCCardConnection.PCSCCardConnectionConstruct a new card connection.
| Parameters | |
| reader | name of the reader in which the smartcard to connect to is located. |
Add a status word exception class to be filtered.
| Parameters | |
| ex | the class to filter, e.g. Filtered exceptions will not be raised when encountered in the error checking chain. |
smartcard.pcsc.PCSCCardConnection.PCSCCardConnectionConnect to card.
| Parameters | |
| protocol | a bit mask of the protocols to use, from CardConnection.T0_protocol, CardConnection.T1_protocol, CardConnection.RAW_protocol, CardConnection.T15_protocol |
| mode | smartcard.scard.SCARD_SHARE_SHARED (default), smartcard.scard.SCARD_SHARE_EXCLUSIVE or smartcard.scard.SCARD_SHARE_DIRECT |
| disposition | smartcard.scard.SCARD_LEAVE_CARD (default), smartcard.scard.SCARD_RESET_CARD, smartcard.scard.SCARD_UNPOWER_CARD or smartcard.scard.SCARD_EJECT_CARD |
Send a control command and buffer. Internally calls doControl() class method and notify observers upon command/response events. Subclasses must override the doControl() class method.
| Parameters | |
| control | command code |
| command | list of bytes to transmit |
smartcard.pcsc.PCSCCardConnection.PCSCCardConnectionPerforms the command control.
Subclasses must override this method for implementing control.
smartcard.pcsc.PCSCCardConnection.PCSCCardConnectionPerforms the command get attrib.
Subclasses must override this method for implementing get attrib.
smartcard.pcsc.PCSCCardConnection.PCSCCardConnectionPerforms the command APDU transmission.
Subclasses must override this method for implementing apdu transmission.
return the requested attribute
| Parameters | |
| attrib | attribute id like smartcard.scard.SCARD_ATTR_VENDOR_NAME |
Return bit mask for the protocol of connection, or None if no protocol set. The return value is a bit mask of CardConnection.T0_protocol, CardConnection.T1_protocol, CardConnection.RAW_protocol, CardConnection.T15_protocol
smartcard.pcsc.PCSCCardConnection.PCSCCardConnectionReconnect to card.
| Parameters | |
| protocol | a bit mask of the protocols to use, from CardConnection.T0_protocol, CardConnection.T1_protocol, CardConnection.RAW_protocol, CardConnection.T15_protocol |
| mode | smartcard.scard.SCARD_SHARE_SHARED (default), smartcard.scard.SCARD_SHARE_EXCLUSIVE or smartcard.scard.SCARD_SHARE_DIRECT |
| disposition | smartcard.scard.SCARD_LEAVE_CARD, smartcard.scard.SCARD_RESET_CARD (default), smartcard.scard.SCARD_UNPOWER_CARD or smartcard.scard.SCARD_EJECT_CARD |
Add an error checking chain.
| Parameters | |
| errorcheckingchain | a smartcard.sw.ErrorCheckingChain object The error checking strategies in errorchecking chain will be tested with each received response APDU, and a smartcard.sw.SWExceptions.SWException will be raised upon error. |
Set protocol for card connection.
| Parameters | |
| protocol | a bit mask of
>>> setProtocol(CardConnection.T1_protocol | CardConnection.T0_protocol) |
Transmit an apdu. Internally calls doTransmit() class method and notify observers upon command/response APDU events. Subclasses must override the doTransmit() class method.
| Parameters | |
| command | list of bytes to transmit |
| protocol | the transmission protocol, from CardConnection.T0_protocol, CardConnection.T1_protocol, or CardConnection.RAW_protocol |