SmartCardSession::connect()

Connect to the smart card that's located in the provided smart card reader.

Synopsis:

#include <smartcard_spi/SmartCardSession.hpp>
virtual sc_response_code_t smartcard_spi::SmartCardSession::connect(const sc_reader_name_t &deviceName, unsigned int flags, unsigned int preferredProtocols, sc_protocol_t &activeProtocol)=0

Since:

BlackBerry 10.3.0

Arguments:

deviceName

The reader device name holding the card to connect to. The specified device must be a slot-logical device.

flags
This parameter describes the desired access mode and is used to indicate three things:
  • First, it indicates whether the connection is opened for shared or exclusive access. If the requested mode is unavailable, an error is returned.
  • Second, it indicates whether the caller desires a "direct" connection to the reader. Direct mode implies that a connection will be established even if a card is not present.
  • Finally, it is a hint to the reader indicating whether it should use default reader-card communication settings to attempt to optimize those settings if the card is still in negotiable mode, as defined by ISO/IEC 7816.
preferredProtocols

The set of protocols that can be used when initializing the connection to the card. Note that only one of the protocols identified in this parameter will be used. If none of the listed protocols is available, then an error is returned.

activeProtocol

The actual protocol used in the connection to the smart card, which is populated by this function.

Library:

libscs (For the qcc command, use the -l scs option to link against this library)

Description:

This function opens a connection to the smart card that's located in the provided smart card reader.

Returns:

If successful, SCARD_S_SUCCESS is returned. Otherwise, an error code is returned.