SpringCard PC/SC API for .NET  18.10.10
Access PC/SC couplers and smart cards from .NET applications
SpringCard.PCSC.SCardChannel Class Reference

The SCardChannel object provides the actual connection to the smartcard through the PC/SC reader. More...

Inheritance diagram for SpringCard.PCSC.SCardChannel:
SpringCard.PCSC.ICardApduTransmitter SpringCard.PCSC.ICardTransmitter SpringCard.PCSC.ZeroDriver.SCardChannel_CcidOver

Public Member Functions

delegate void TransmitDoneCallback (RAPDU rapdu)
 
 SCardChannel (uint Scope, string ReaderName)
 Create a SCardChannel for the given PC/SC scope and reader name.
 
 SCardChannel (string ReaderName)
 Create a SCardChannel for the given reader name.
 
 SCardChannel (SCardReader Reader)
 Create a SCardChannel from a existing SCardReader.
 
CardBuffer GetAtr ()
 
virtual bool Connect ()
 Open the connection channel to the smart card (according to the specified Protocol, default is either T=0 or T=1)
 
virtual bool ConnectExclusive ()
 Set ShareMode to SCARD.SHARE_EXCLUSIVE and call Connect()
 
virtual bool ConnectShared ()
 Set ShareMode to SCARD.SHARE_SHARED and call Connect()
 
virtual bool ConnectDirect ()
 Set ShareMode to SCARD.SHARE_DIRECT and Protocol to SCARD.PROTOCOL_NONE, and call Connect()
 
virtual bool Disconnect (uint disposition=SCARD.RESET_CARD)
 Close the connection channel with the card. More...
 
void Disconnect ()
 Same as Disconnect(SCARD.RESET_CARD)
 
bool DisconnectEject ()
 Shortcut for Disconnect(SCARD.EJECT_CARD)
 
bool DisconnectUnpower ()
 Shortcut for Disconnect(SCARD.UNPOWER_CARD)
 
bool DisconnectReset ()
 Shortcut for Disconnect(SCARD.RESET_CARD)
 
bool DisconnectLeave ()
 Shortcut for Disconnect(SCARD.LEAVE_CARD)
 
virtual bool Reconnect (uint disposition)
 Keep the connection channel with the card open, but physically disconnect/reconnect the card. More...
 
void Reconnect ()
 Same as Reconnect(SCARD.RESET_CARD)
 
void ReconnectUnpower ()
 Shortcut for Reconnect(SCARD.UNPOWER_CARD)
 
void ReconnectReset ()
 Shortcut for Reconnect(SCARD.RESET_CARD)
 
void ReconnectLeave ()
 Shortcut for Reconnect(SCARD.LEAVE_CARD)
 
- Public Member Functions inherited from SpringCard.PCSC.ICardApduTransmitter
RAPDU Transmit (CAPDU capdu)
 
- Public Member Functions inherited from SpringCard.PCSC.ICardTransmitter
byte [] Transmit (byte[] command)
 

Protected Member Functions

virtual void UpdateState ()
 

Protected Attributes

string _reader_name
 
uint _active_protocol
 
uint _expect_protocols = SCARD.PROTOCOL_T0 | SCARD.PROTOCOL_T1
 
uint _share_mode = SCARD.SHARE_EXCLUSIVE
 
uint _reader_state
 
CAPDU _capdu
 
RAPDU _rapdu
 
CardBuffer _cctrl
 
CardBuffer _rctrl
 
CardBuffer _card_atr
 
uint _last_error
 

Properties

IntPtr hContext [get]
 The PC/SC context handle. See SCARD.CreateContext()
 
IntPtr hCard [get]
 The card handle. See SCARD.Connect()
 
string ReaderName [get]
 The name of the reader.
 
bool CardPresent [get]
 Is there a card in the reader?
 
bool CardAvailable [get]
 Is there a card in the reader, and the card has not been connected by another application yet?
 
CardBuffer CardAtr [get]
 The ATR of the card in the reader. null if no card is present.
 
virtual bool Connected [get]
 Is the SCardChannel object actually connected to a card?
 
virtual bool ConnectedDirect [get]
 Is the SCardChannel object directly connected to the reader?
 
uint Protocol [get, set]
 Card protocol. More...
 
string ProtocolAsString [get, set]
 Translation of Protocol to/from string. More...
 
uint ShareMode [get, set]
 Card share mode. More...
 
string ShareModeAsString [get, set]
 Translation of ShareMode to/from string. More...
 

Detailed Description

The SCardChannel object provides the actual connection to the smartcard through the PC/SC reader.

Member Function Documentation

◆ Disconnect()

virtual bool SpringCard.PCSC.SCardChannel.Disconnect ( uint  disposition = SCARD.RESET_CARD)
virtual

Close the connection channel with the card.

The disposition parameter must take one of the following values:

Reimplemented in SpringCard.PCSC.ZeroDriver.SCardChannel_CcidOver.

◆ Reconnect()

virtual bool SpringCard.PCSC.SCardChannel.Reconnect ( uint  disposition)
virtual

Keep the connection channel with the card open, but physically disconnect/reconnect the card.

The disposition parameter must take one of the following values:

Reimplemented in SpringCard.PCSC.ZeroDriver.SCardChannel_CcidOver.

Property Documentation

◆ Protocol

uint SpringCard.PCSC.SCardChannel.Protocol
getset

Card protocol.

Before the smartcard has been connected, set Protocol to specify the communication protocol(s) to be used by Connect(). Allowed values are SCARD.PROTOCOL_T0, SCARD.PROTOCOL_T1 or SCARD.PROTOCOL_T0|SCARD.PROTOCOL_T1.

Once the smartcard has been connected (Connected == true), Protocol is the current communication protocol. Possible values are SCARD.PROTOCOL_T0 or SCARD.PROTOCOL_T1.

◆ ProtocolAsString

string SpringCard.PCSC.SCardChannel.ProtocolAsString
getset

Translation of Protocol to/from string.

Before the smartcard has been connected, set ProtocolAsString to specify the communication protocol(s) to be used by Connect(). Allowed values are "T=0", "T=1" or "*" (or "T=0|T=1").

Once the smartcard has been connected (Connected == true), ProtocolAsString is the current communication protocol. Possible values are "T=0" or "T=1".

◆ ShareMode

uint SpringCard.PCSC.SCardChannel.ShareMode
getset

Card share mode.

Before the smartcard has been connected, set ShareMode to specify the share mode to be used by Connect(). Allowed values are SCARD.SHARE_EXCLUSIVE, SCARD.SHARE_SHARED or SCARD.SHARE_DIRECT.

◆ ShareModeAsString

string SpringCard.PCSC.SCardChannel.ShareModeAsString
getset

Translation of ShareMode to/from string.

Before the smartcard has been connected, set ShareModeAsString to specify the sharing mode to be used by Connect(). Allowed values are "EXCLUSIVE", "SHARED" or "DIRECT".


The documentation for this class was generated from the following file: