Crescendo SDK
Loading...
Searching...
No Matches
CrescendoDLL.PCSC.APDUEngine Class Reference

The CrescendoDLL.PCSC.APDUEngine class contains references to applet objects, their current properties and all the necessary internal methods to allow PCSC communication with the SmartCard. More...

Inheritance diagram for CrescendoDLL.PCSC.APDUEngine:

Public Member Functions

void Dispose ()
 Releases all resources used by this instance.
 
void EndTransaction ()
 Ends the current smart card transaction, releasing exclusive access while maintaining the token's state.
 
async Task MaintainTransactionAsync (CancellationToken ct)
 Maintains an active smart card transaction by periodically checking the SCardStatus (in 2.5 second intervals).
 
void StartTransaction ()
 Begins a smart card transaction, establishing exclusive access to the token.
 

Public Attributes

CommandApdu LastCommand = default!
 Last APDU command send to the token.
 
string LastError = default!
 String description of the last APDU error received from the token.
 
Response LastResponse = default!
 Last APDU response received from the token.
 
byte[] TokenATR = default!
 ATR (Answer To Reset) message output of the token.
 
string TokenName = string.Empty
 String name of the token.
 

Detailed Description

The CrescendoDLL.PCSC.APDUEngine class contains references to applet objects, their current properties and all the necessary internal methods to allow PCSC communication with the SmartCard.

Member Function Documentation

◆ Dispose()

void CrescendoDLL.PCSC.APDUEngine.Dispose ( )
inline

Releases all resources used by this instance.

This method:

  • Ends any ongoing transaction
  • Disconnects from the smart card reader, preserving the card's state
  • Disposes of the PCSC implementation and reader objects
  • Suppresses finalization

Successful disconnection is logged at DEBUG level.

Exceptions
ExceptionThrown if disconnection from the reader fails (SCardError != Success).

References CrescendoDLL.PCSC.APDUEngine.EndTransaction().

Referenced by CrescendoDLL.SDKCore.Dispose().

◆ EndTransaction()

void CrescendoDLL.PCSC.APDUEngine.EndTransaction ( )
inline

Ends the current smart card transaction, releasing exclusive access while maintaining the token's state.

Exceptions
ExceptionThrown if the transaction cannot be properly ended (SCardError != Success).

Uses SCardReaderDisposition.Leave to preserve the token's state after transaction completion. Successful execution is logged at DEBUG level.

Referenced by CrescendoDLL.PCSC.APDUEngine.Dispose().

◆ MaintainTransactionAsync()

async Task CrescendoDLL.PCSC.APDUEngine.MaintainTransactionAsync ( CancellationToken  ct)
inline

Maintains an active smart card transaction by periodically checking the SCardStatus (in 2.5 second intervals).

Parameters
ctCancellationToken used to terminate the keep-alive loop gracefully.
Exceptions
ExceptionThrown if the status check fails during the transaction maintenance.
Returns
A Task that represents the asynchronous operation.

This method prevents transaction timeouts by performing status checks every 2.5 seconds. It automatically terminates when cancellation is requested via the token.

◆ StartTransaction()

void CrescendoDLL.PCSC.APDUEngine.StartTransaction ( )
inline

Begins a smart card transaction, establishing exclusive access to the token.

Exceptions
ExceptionThrown if the transaction cannot be started (SCardError != Success).

This method initiates a transaction that maintains exclusive access to the token until CrescendoDLL.PCSC.APDUEngine.EndTransaction is called. Successful execution is logged at DEBUG level.

Member Data Documentation

◆ LastCommand

CommandApdu CrescendoDLL.PCSC.APDUEngine.LastCommand = default!

Last APDU command send to the token.

◆ LastError

string CrescendoDLL.PCSC.APDUEngine.LastError = default!

String description of the last APDU error received from the token.

◆ LastResponse

Response CrescendoDLL.PCSC.APDUEngine.LastResponse = default!

Last APDU response received from the token.

◆ TokenATR

byte [] CrescendoDLL.PCSC.APDUEngine.TokenATR = default!

ATR (Answer To Reset) message output of the token.

◆ TokenName

string CrescendoDLL.PCSC.APDUEngine.TokenName = string.Empty