LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
logicalaccess::PCSCReaderUnit Class Reference

The PC/SC reader unit class. More...

#include <pcscreaderunit.hpp>

Inheritance diagram for logicalaccess::PCSCReaderUnit:
logicalaccess::ISO7816ReaderUnit logicalaccess::ReaderUnit logicalaccess::XmlSerializable logicalaccess::ACSACR1222LReaderUnit logicalaccess::ACSACRReaderUnit logicalaccess::CherryReaderUnit logicalaccess::ID3ReaderUnit logicalaccess::OmnikeyReaderUnit logicalaccess::SCMReaderUnit logicalaccess::SpringCardReaderUnit logicalaccess::OmnikeyXX21ReaderUnit logicalaccess::OmnikeyXX25ReaderUnit logicalaccess::OmnikeyLANXX21ReaderUnit logicalaccess::OmnikeyXX22ReaderUnit

Public Member Functions

 PCSCReaderUnit (const std::string &name)
 Constructor.
 
virtual ~PCSCReaderUnit ()
 Destructor.
 
std::string getName () const override
 Get the reader unit name.
 
void setName (const std::string &name)
 Set the reader unit name.
 
std::string getConnectedName () override
 Get the connected reader unit name.
 
virtual PCSCReaderUnitType getPCSCType () const
 Get the PC/SC reader unit type.
 
void setCardType (std::string cardType) override
 Set the card type.
 
bool waitInsertion (unsigned int maxwait) override
 Wait for a card insertion.
 
bool waitRemoval (unsigned int maxwait) override
 Wait for a card removal.
 
bool connect () override
 Connect to the card.
 
virtual bool connect (PCSCShareMode share_mode)
 Connect to the card.
 
void disconnect () override
 Disconnect from the card.
 
bool isConnected () override
 Check if the handle is associated to a card (aka. "connected").
 
bool connectToReader () override
 Connect to the reader. Implicit connection on first command sent.
 
void disconnectFromReader () override
 Disconnect from reader.
 
const SCARDHANDLE & getHandle () const
 Get the low-level SCARDHANDLE.
 
unsigned long getActiveProtocol () const
 Get the active protocol for the connected card.
 
PCSCShareMode getShareMode () const
 Get the currently active share mode.
 
std::shared_ptr< ChipcreateChip (std::string type) override
 Create the chip object from card type.
 
std::shared_ptr< ChipgetSingleChip () override
 Get the first and/or most accurate chip found.
 
std::vector< std::shared_ptr< Chip > > getChipList () override
 Get chip available in the RFID rang.
 
virtual ByteVector getCardSerialNumber ()
 Get the card serial number.
 
std::string getReaderSerialNumber () override
 Get a string hexadecimal representation of the reader serial number.
 
const ByteVectorgetATR () const
 Get the card ATR.
 
virtual std::shared_ptr< PCSCReaderCardAdaptergetDefaultPCSCReaderCardAdapter ()
 Get the default PC/SC reader/card adapter.
 
virtual std::shared_ptr< ReaderCardAdaptergetReaderCardAdapter (std::string type)
 Get the PC/SC reader/card adapter for a card type.
 
void serialize (boost::property_tree::ptree &parentNode) override
 Serialize the current object to XML.
 
void unSerialize (boost::property_tree::ptree &node) override
 UnSerialize a XML node to the current object.
 
std::shared_ptr< ReaderUnitConfigurationgetConfiguration () override
 Get the reader unit configuration.
 
void setConfiguration (std::shared_ptr< ReaderUnitConfiguration > config) override
 Set the reader unit configuration.
 
virtual void changeReaderKey (std::shared_ptr< ReaderMemoryKeyStorage > keystorage, const ByteVector &key)
 Change a key in reader memory.
 
std::shared_ptr< PCSCReaderUnitConfigurationgetPCSCConfiguration ()
 Get the PC/SC reader unit configuration.
 
std::shared_ptr< PCSCReaderProvidergetPCSCReaderProvider () const
 
void makeProxy (std::shared_ptr< PCSCReaderUnit > readerUnit, std::shared_ptr< PCSCReaderUnitConfiguration > readerUnitConfig)
 Make the reader unit as a proxy to another. Use when listening on all PC/SC reader unit.
 
virtual void getT_CL_ISOType (bool &isTypeA, bool &isTypeB)
 Get if the inserted card is from ISO 14443-4 A or B.
 
virtual void cardConnected ()
 
std::shared_ptr< PCSCReaderUnitgetProxyReaderUnit () const
 
void setCardTechnologies (const TechnoBitset &bitset) override
 
TechnoBitset getCardTechnologies () override
 
std::shared_ptr< LCDDisplaygetLCDDisplay () override
 Get the LCD Display for this reader unit.
 
void setLCDDisplay (std::shared_ptr< LCDDisplay > d) override
 Get the LCD Display for this reader unit.
 
std::shared_ptr< LEDBuzzerDisplaygetLEDBuzzerDisplay () override
 Get the LED/Buzzer Display for this reader unit.
 
void setLEDBuzzerDisplay (std::shared_ptr< LEDBuzzerDisplay > lbd) override
 Get the LCD Display for this reader unit.
 
ReaderServicePtr getService (const ReaderServiceType &type) override
 
void beginTransaction ()
 
void endTransaction (DWORD dwDisposition=SCARD_LEAVE_CARD)
 
void reset (int action=0)
 Reconnect to the card.
 
void setup_pcsc_connection (PCSCShareMode share_mode)
 
void teardown_pcsc_connection ()
 
- Public Member Functions inherited from logicalaccess::ISO7816ReaderUnit
 ISO7816ReaderUnit (std::string rpt)
 
virtual ~ISO7816ReaderUnit ()
 
bool waitInsertion (unsigned int) override
 Wait for a card insertion.
 
bool waitRemoval (unsigned int) override
 Wait for a card removal.
 
bool isConnected () override
 Check if the card is connected.
 
void setCardType (std::string) override
 Set the forced card type.
 
std::shared_ptr< ChipgetSingleChip () override
 Get the first and/or most accurate chip found.
 
std::vector< std::shared_ptr< Chip > > getChipList () override
 Get chip available in the RFID rang.
 
bool connect () override
 Connect to the card.
 
void disconnect () override
 Disconnect from the card.
 
virtual void connectToSAM ()
 
bool connectToReader () override
 Connect to the reader. Implicit connection on first command sent.
 
virtual void disconnectFromSAM ()
 
void disconnectFromReader () override
 Disconnect from reader.
 
virtual void reloadReaderConfiguration ()
 
virtual void setContext (const std::string &context)
 Set the client context.
 
virtual std::string getContext ()
 Get the client context.
 
std::string getName () const override
 Get the reader unit name.
 
std::string getReaderSerialNumber () override
 Get a string hexadecimal representation of the reader serial number.
 
std::shared_ptr< CardProbecreateCardProbe () override
 
virtual std::shared_ptr< SAMChipgetSAMChip ()
 Get The SAM Chip.
 
virtual void setSAMChip (std::shared_ptr< SAMChip > t)
 Set the SAM Chip.
 
virtual std::shared_ptr< ISO7816ReaderUnitgetSAMReaderUnit ()
 Get The SAM ReaderUnit.
 
virtual void setSAMReaderUnit (std::shared_ptr< ISO7816ReaderUnit > t)
 Set the SAM ReaderUnit.
 
- Public Member Functions inherited from logicalaccess::ReaderUnit
 ReaderUnit (std::string rpt)
 Constructor.
 
virtual ~ReaderUnit ()
 Destructor.
 
std::string getRPType () const
 Get the reader provider type.
 
virtual ByteVector getPingCommand () const
 Get the reader ping command.
 
virtual bool waitInsertion (unsigned int maxwait)=0
 Wait for a card insertion.
 
virtual bool waitInsertion (const ByteVector &identifier, unsigned int maxwait)
 Wait for a specific card insertion.
 
virtual bool waitRemoval (unsigned int maxwait)=0
 Wait for a card removal.
 
virtual bool isConnected ()=0
 Check if the card is connected.
 
std::string getCardType () const
 Get the forced card type.
 
virtual void setCardType (std::string cardType)=0
 Set the forced card type.
 
virtual std::shared_ptr< ChipcreateChip (std::string type)
 Create the chip object from card type.
 
virtual std::shared_ptr< ChipcreateChip (std::string type, const ByteVector &identifier)
 Create the chip object from card type with identifier.
 
virtual ByteVector getNumber (std::shared_ptr< Chip > chip)
 Get the number from the embedded licensing configuration.
 
virtual std::shared_ptr< ChipgetSingleChip ()=0
 Get the first and/or most accurate chip found.
 
virtual std::vector< std::shared_ptr< Chip > > getChipList ()=0
 Get chip available in the RFID rang.
 
virtual ByteVector getNumber (std::shared_ptr< Chip > chip, std::shared_ptr< CardsFormatComposite > composite)
 Get the number from the reader format composite.
 
virtual bool connect ()=0
 Connect to the card.
 
virtual bool reconnect (int action=0)
 Reconnect to the card with the currently active share mode on the same reader.
 
virtual void disconnect ()=0
 Disconnect from the card.
 
virtual bool connectToReader ()=0
 Connect to the reader. Implicit connection on first command sent.
 
virtual void disconnectFromReader ()=0
 Disconnect from reader.
 
virtual std::string getName () const =0
 Get the reader unit name.
 
virtual std::string getConnectedName ()
 Get the connected reader unit name.
 
virtual std::shared_ptr< ReaderUnitConfigurationgetConfiguration ()
 Get the reader unit configuration.
 
virtual void setConfiguration (std::shared_ptr< ReaderUnitConfiguration > config)
 Set the reader unit configuration.
 
virtual std::shared_ptr< ReaderCardAdaptergetDefaultReaderCardAdapter ()
 Get the default reader/card adapter.
 
virtual void setDefaultReaderCardAdapter (std::shared_ptr< ReaderCardAdapter > defaultRca)
 Set the default reader/card adapter.
 
virtual std::shared_ptr< DataTransportgetDataTransport () const
 Get the data transport layer.
 
virtual void setDataTransport (std::shared_ptr< DataTransport > dataTransport)
 Set the data transport layer.
 
virtual std::string getReaderSerialNumber ()=0
 Get a string hexadecimal representation of the reader serial number.
 
std::string getDefaultXmlNodeName () const override
 Get the default Xml Node name for this object.
 
void serialize (boost::property_tree::ptree &node) override
 Serialize the current object to XML.
 
void unSerialize (boost::property_tree::ptree &node) override
 UnSerialize a XML node to the current object.
 
void unSerialize (boost::property_tree::ptree &node, const std::string &rootNode) override
 UnSerialize object from a Xml node.
 
std::shared_ptr< ReaderProvidergetReaderProvider () const
 Get the associated reader provider.
 
void setReaderProvider (std::weak_ptr< ReaderProvider > provider)
 Set the associated reader provider.
 
virtual std::shared_ptr< LCDDisplaygetLCDDisplay ()
 Get the LCD Display for this reader unit.
 
virtual void setLCDDisplay (std::shared_ptr< LCDDisplay > d)
 Get the LCD Display for this reader unit.
 
virtual std::shared_ptr< LEDBuzzerDisplaygetLEDBuzzerDisplay ()
 Get the LED/Buzzer Display for this reader unit.
 
virtual void setLEDBuzzerDisplay (std::shared_ptr< LEDBuzzerDisplay > lbd)
 Get the LCD Display for this reader unit.
 
virtual void setCardTechnologies (const TechnoBitset &bitset)
 
virtual TechnoBitset getCardTechnologies ()
 
virtual TechnoBitset getPossibleCardTechnologies ()
 
virtual ReaderServicePtr getService (const ReaderServiceType &type)
 
virtual std::string serialize ()
 Serialize object to Xml Node string.
 
virtual void serialize (boost::property_tree::ptree &parentNode)=0
 Serialize object to Xml Node.
 
virtual void unSerialize (boost::property_tree::ptree &node)=0
 UnSerialize object from a Xml Node.
 
virtual void unSerialize (const std::string &xmlstring, const std::string &rootNode)
 UnSerialize object from a Xml Node string.
 
virtual void unSerialize (std::istream &is, const std::string &rootNode)
 UnSerialize object from a Xml node.
 
virtual void unSerialize (boost::property_tree::ptree &node, const std::string &rootNode)
 UnSerialize object from a Xml node.
 
- Public Member Functions inherited from logicalaccess::XmlSerializable
virtual ~XmlSerializable ()=default
 
virtual std::string serialize ()
 Serialize object to Xml Node string.
 
virtual std::string serializeWithHeaders ()
 Serialize object to Xml Node string, with xml headers.
 
virtual void serialize (boost::property_tree::ptree &parentNode)=0
 Serialize object to Xml Node.
 
virtual void serializeToFile (const std::string &filename)
 Serialize object to a Xml file.
 
virtual void unSerialize (boost::property_tree::ptree &node)=0
 UnSerialize object from a Xml Node.
 
virtual void unSerialize (const std::string &xmlstring, const std::string &rootNode)
 UnSerialize object from a Xml Node string.
 
virtual void unSerialize (std::istream &is, const std::string &rootNode)
 UnSerialize object from a Xml node.
 
virtual void unSerialize (boost::property_tree::ptree &node, const std::string &rootNode)
 UnSerialize object from a Xml node.
 
virtual void unSerializeFromFile (const std::string &filename)
 UnSerialize object from a Xml file.
 
virtual std::string getDefaultXmlNodeName () const =0
 Get the default Xml Node name for this object.
 

Static Public Member Functions

static std::shared_ptr< PCSCReaderUnitcreatePCSCReaderUnit (const std::string &readerName)
 
- Static Public Member Functions inherited from logicalaccess::ReaderUnit
static uint64_t getFormatedNumber (const ByteVector &number, int padding)
 Get the number as decimal a number.
 
static std::string getFormatedNumber (const ByteVector &number)
 Get a string hexadecimal representation of the number.
 
- Static Public Member Functions inherited from logicalaccess::XmlSerializable
static std::string removeXmlDeclaration (const std::string &xmlstring)
 Remove Xml declaration from a xml string.
 
static ByteVector formatHexString (std::string hexstr)
 Format hex string to hex string with space.
 

Protected Types

using SPtrStringVector = std::vector< std::shared_ptr< std::string > >
 
using ReaderStateVector = std::vector< SCARD_READERSTATE >
 

Protected Member Functions

bool reconnect (int action=0) override
 Reconnect to the card with the currently active share mode on the same reader.
 
std::shared_ptr< ChipadjustChip (std::shared_ptr< Chip > c)
 
std::shared_ptr< ResultCheckercreateDefaultResultChecker () const override
 
std::shared_ptr< CardProbecreateCardProbe () override
 
void configure_mifareplus_chip (std::shared_ptr< Chip > c, std::shared_ptr< Commands > &commands, std::shared_ptr< ResultChecker > &resultChecker) const
 
void detect_mifareplus_security_level (std::shared_ptr< Chip > c)
 
void setSingleChip (std::shared_ptr< Chip > chip)
 Set the first and/or most accurate chip found.
 
std::shared_ptr< SAMChipgetSAMChip () override
 Get The SAM Chip.
 
void setSAMChip (std::shared_ptr< SAMChip > t) override
 Set the SAM Chip.
 
std::shared_ptr< ISO7816ReaderUnitgetSAMReaderUnit () override
 Get The SAM ReaderUnit.
 
void setSAMReaderUnit (std::shared_ptr< ISO7816ReaderUnit > t) override
 Set the SAM ReaderUnit.
 
std::tuple< SPtrStringVector, ReaderStateVectorprepare_poll_parameters ()
 
void waitInsertion_create_proxy (const std::string &reader_name)
 
virtual bool process_insertion (const std::string &cardType, unsigned int maxwait, const ElapsedTimeCounter &elapsed)
 
- Protected Member Functions inherited from logicalaccess::ISO7816ReaderUnit
std::shared_ptr< ResultCheckercreateDefaultResultChecker () const override
 
std::shared_ptr< ISO7816ReaderProvidergetISO7816ReaderProvider () const
 Get the ISO7816 reader provider.
 
std::shared_ptr< ISO7816ReaderUnitConfigurationgetISO7816Configuration ()
 Get the ISO7816 reader unit configuration.
 
bool reconnect (int action) override
 Reconnect to the card with the currently active share mode on the same reader.
 
virtual std::shared_ptr< ResultCheckercreateDefaultResultChecker () const
 
virtual std::shared_ptr< CardProbecreateCardProbe ()
 

Protected Attributes

std::string d_name
 The reader unit name.
 
std::string d_connectedName
 The reader unit connected name.
 
std::unique_ptr< PCSCConnectionconnection_
 
ByteVector atr_
 
std::shared_ptr< PCSCReaderUnitd_proxyReaderUnit
 The proxy reader unit.
 
- Protected Attributes inherited from logicalaccess::ISO7816ReaderUnit
std::shared_ptr< SAMChipd_sam_chip
 The SAM chip.
 
std::shared_ptr< ISO7816ReaderUnitd_sam_readerunit
 The SAM ReaderUnit used SAM Authentication.
 
std::string d_client_context
 The client context.
 
std::string d_sam_client_context
 The sam client context.
 
- Protected Attributes inherited from logicalaccess::ReaderUnit
std::string d_readerProviderType
 The associated reader provider type for the reader unit configuration.
 
std::string d_card_type
 The forced card type.
 
std::weak_ptr< ReaderProviderd_readerProvider
 The associated reader provider for the reader unit.
 
std::shared_ptr< ReaderUnitConfigurationd_readerUnitConfig
 The reader unit configuration.
 
std::shared_ptr< Chipd_insertedChip
 The inserted chip.
 
std::shared_ptr< LCDDisplayd_lcdDisplay
 The inserted chip.
 
std::shared_ptr< LEDBuzzerDisplayd_ledBuzzerDisplay
 The inserted chip.
 

Additional Inherited Members

- Static Protected Member Functions inherited from logicalaccess::XmlSerializable
static unsigned long long atoull (const std::string &str)
 

Detailed Description

The PC/SC reader unit class.

Member Typedef Documentation

◆ ReaderStateVector

using logicalaccess::PCSCReaderUnit::ReaderStateVector = std::vector<SCARD_READERSTATE>
protected

◆ SPtrStringVector

using logicalaccess::PCSCReaderUnit::SPtrStringVector = std::vector<std::shared_ptr<std::string> >
protected

Constructor & Destructor Documentation

◆ PCSCReaderUnit()

logicalaccess::PCSCReaderUnit::PCSCReaderUnit ( const std::string &  name)
explicit

Constructor.

◆ ~PCSCReaderUnit()

logicalaccess::PCSCReaderUnit::~PCSCReaderUnit ( )
virtual

Destructor.

Member Function Documentation

◆ adjustChip()

std::shared_ptr< Chip > logicalaccess::PCSCReaderUnit::adjustChip ( std::shared_ptr< Chip c)
protected

Perform adjustment regarding a Chip.

For example, if the Chip type is desfire, we check that it is not in fact a desfire ev1. Similarly, we check to see if a desfire has random UID enabled or not.

This function may return a new Chip object, that should be used.

◆ beginTransaction()

void logicalaccess::PCSCReaderUnit::beginTransaction ( )

◆ cardConnected()

virtual void logicalaccess::PCSCReaderUnit::cardConnected ( )
inlinevirtual

This method is used to notify the (proxyfied) implementation that a card was connected

◆ changeReaderKey()

void logicalaccess::PCSCReaderUnit::changeReaderKey ( std::shared_ptr< ReaderMemoryKeyStorage keystorage,
const ByteVector key 
)
virtual

Change a key in reader memory.

Parameters
keystorageThe key storage information.
keyThe key value.

Reimplemented in logicalaccess::OmnikeyXX21ReaderUnit.

◆ configure_mifareplus_chip()

void logicalaccess::PCSCReaderUnit::configure_mifareplus_chip ( std::shared_ptr< Chip c,
std::shared_ptr< Commands > &  commands,
std::shared_ptr< ResultChecker > &  resultChecker 
) const
protected

◆ connect() [1/2]

bool logicalaccess::PCSCReaderUnit::connect ( )
overridevirtual

Connect to the card.

Returns
True if the card was connected without error, false otherwise.

If the card handle was already connected, connect() first call disconnect(). If you intend to do a reconnection, call reconnect() instead.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

Reimplemented in logicalaccess::ACSACR1222LReaderUnit, and logicalaccess::ID3ReaderUnit.

◆ connect() [2/2]

bool logicalaccess::PCSCReaderUnit::connect ( PCSCShareMode  share_mode)
virtual

Connect to the card.

Parameters
readerThe reader name. If an empty or invalid reader name is specified, connect will fail.
share_modeThe share mode.
Returns
True if the card was connected without error, false otherwise.

If the card handle was already connected, connect() first call disconnect(). If you intend to do a reconnection, call reconnect() instead.

Reimplemented in logicalaccess::ID3ReaderUnit, and logicalaccess::ID3ReaderUnit.

◆ connectToReader()

bool logicalaccess::PCSCReaderUnit::connectToReader ( )
overridevirtual

Connect to the reader. Implicit connection on first command sent.

Returns
True if the connection successed.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

Reimplemented in logicalaccess::ACSACR1222LReaderUnit, and logicalaccess::OmnikeyLANXX21ReaderUnit.

◆ createCardProbe()

std::shared_ptr< CardProbe > logicalaccess::PCSCReaderUnit::createCardProbe ( )
overrideprotectedvirtual

Create a new CardProbe object that works with the current reader.

This is required because the behaviour of reader varies a lot when probing for cards.

The default implementation returns nullptr;

Reimplemented from logicalaccess::ISO7816ReaderUnit.

Reimplemented in logicalaccess::ID3ReaderUnit, and logicalaccess::SpringCardReaderUnit.

◆ createChip()

std::shared_ptr< Chip > logicalaccess::PCSCReaderUnit::createChip ( std::string  type)
overridevirtual

Create the chip object from card type.

Parameters
typeThe card type.
Returns
The chip.

Reimplemented from logicalaccess::ReaderUnit.

Reimplemented in logicalaccess::OmnikeyXX25ReaderUnit.

◆ createDefaultResultChecker()

std::shared_ptr< ResultChecker > logicalaccess::PCSCReaderUnit::createDefaultResultChecker ( ) const
overrideprotectedvirtual

Create a new ResultChecker object that make sense for the current reader.

It's possible that this ResultChecker won't be used, as more fine-grained check regarding reader/card-type combination happen.

The default implementation returns nullptr.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

Reimplemented in logicalaccess::ACSACR1222LReaderUnit, logicalaccess::ACSACRReaderUnit, and logicalaccess::SpringCardReaderUnit.

◆ createPCSCReaderUnit()

std::shared_ptr< PCSCReaderUnit > logicalaccess::PCSCReaderUnit::createPCSCReaderUnit ( const std::string &  readerName)
static

◆ detect_mifareplus_security_level()

void logicalaccess::PCSCReaderUnit::detect_mifareplus_security_level ( std::shared_ptr< Chip c)
protected

Attempt to detect the security level by sending command to the card once its' been connected.

If we find something, we'll override the commands objects and reconfigure the chip.

◆ disconnect()

void logicalaccess::PCSCReaderUnit::disconnect ( )
overridevirtual

Disconnect from the card.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

Reimplemented in logicalaccess::ID3ReaderUnit.

◆ disconnectFromReader()

void logicalaccess::PCSCReaderUnit::disconnectFromReader ( )
overridevirtual

◆ endTransaction()

void logicalaccess::PCSCReaderUnit::endTransaction ( DWORD  dwDisposition = SCARD_LEAVE_CARD)

◆ getActiveProtocol()

unsigned long logicalaccess::PCSCReaderUnit::getActiveProtocol ( ) const

Get the active protocol for the connected card.

Returns
The active protocol.

◆ getATR()

const std::vector< uint8_t > & logicalaccess::PCSCReaderUnit::getATR ( ) const

Get the card ATR.

Parameters
atrThe array that will contains the ATR data.
atrLengthThe ATR array length.
Returns
The ATR length.

◆ getCardSerialNumber()

ByteVector logicalaccess::PCSCReaderUnit::getCardSerialNumber ( )
virtual

Get the card serial number.

Returns
The card serial number.

If the card handle is not connected to the card, the call fails.

Reimplemented in logicalaccess::OmnikeyXX25ReaderUnit.

◆ getCardTechnologies()

TechnoBitset logicalaccess::PCSCReaderUnit::getCardTechnologies ( )
overridevirtual

Return a bitset describing which cards technology are enabled.

The default implementation returns a bitset with all flags set to false.

Reimplemented from logicalaccess::ReaderUnit.

Reimplemented in logicalaccess::OmnikeyXX21ReaderUnit.

◆ getChipList()

std::vector< std::shared_ptr< Chip > > logicalaccess::PCSCReaderUnit::getChipList ( )
overridevirtual

Get chip available in the RFID rang.

Returns
The chip list.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

Reimplemented in logicalaccess::ID3ReaderUnit.

◆ getConfiguration()

std::shared_ptr< ReaderUnitConfiguration > logicalaccess::PCSCReaderUnit::getConfiguration ( )
overridevirtual

Get the reader unit configuration.

Returns
The reader unit configuration.

Reimplemented from logicalaccess::ReaderUnit.

◆ getConnectedName()

std::string logicalaccess::PCSCReaderUnit::getConnectedName ( )
overridevirtual

Get the connected reader unit name.

Returns
The connected reader unit name.

Reimplemented from logicalaccess::ReaderUnit.

◆ getDefaultPCSCReaderCardAdapter()

std::shared_ptr< PCSCReaderCardAdapter > logicalaccess::PCSCReaderUnit::getDefaultPCSCReaderCardAdapter ( )
virtual

Get the default PC/SC reader/card adapter.

Returns
The default PC/SC reader/card adapter.

◆ getHandle()

const SCARDHANDLE & logicalaccess::PCSCReaderUnit::getHandle ( ) const

Get the low-level SCARDHANDLE.

Returns
The SCARDHANDLE.

◆ getLCDDisplay()

std::shared_ptr< LCDDisplay > logicalaccess::PCSCReaderUnit::getLCDDisplay ( )
overridevirtual

Get the LCD Display for this reader unit.

Returns
The LCD Display.

Reimplemented from logicalaccess::ReaderUnit.

Reimplemented in logicalaccess::ACSACR1222LReaderUnit.

◆ getLEDBuzzerDisplay()

std::shared_ptr< LEDBuzzerDisplay > logicalaccess::PCSCReaderUnit::getLEDBuzzerDisplay ( )
overridevirtual

Get the LED/Buzzer Display for this reader unit.

Returns
The LED/Buzzer Display.

Reimplemented from logicalaccess::ReaderUnit.

Reimplemented in logicalaccess::ACSACR1222LReaderUnit.

◆ getName()

std::string logicalaccess::PCSCReaderUnit::getName ( ) const
overridevirtual

Get the reader unit name.

Returns
The reader unit name.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ getPCSCConfiguration()

std::shared_ptr< PCSCReaderUnitConfiguration > logicalaccess::PCSCReaderUnit::getPCSCConfiguration ( )
inline

Get the PC/SC reader unit configuration.

Returns
The PC/SC reader unit configuration.

◆ getPCSCReaderProvider()

std::shared_ptr< PCSCReaderProvider > logicalaccess::PCSCReaderUnit::getPCSCReaderProvider ( ) const

◆ getPCSCType()

PCSCReaderUnitType logicalaccess::PCSCReaderUnit::getPCSCType ( ) const
virtual

◆ getProxyReaderUnit()

std::shared_ptr< PCSCReaderUnit > logicalaccess::PCSCReaderUnit::getProxyReaderUnit ( ) const

Returns the proxy implementation reader unit, or null.

◆ getReaderCardAdapter()

std::shared_ptr< ReaderCardAdapter > logicalaccess::PCSCReaderUnit::getReaderCardAdapter ( std::string  type)
virtual

Get the PC/SC reader/card adapter for a card type.

Parameters
typeThe card type.
Returns
The PC/SC reader/card adapter.

Reimplemented in logicalaccess::OmnikeyXX21ReaderUnit.

◆ getReaderSerialNumber()

std::string logicalaccess::PCSCReaderUnit::getReaderSerialNumber ( )
overridevirtual

Get a string hexadecimal representation of the reader serial number.

Returns
The reader serial number or an empty string on error.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

Reimplemented in logicalaccess::ACSACR1222LReaderUnit.

◆ getSAMChip()

std::shared_ptr< SAMChip > logicalaccess::PCSCReaderUnit::getSAMChip ( )
overrideprotectedvirtual

Get The SAM Chip.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ getSAMReaderUnit()

std::shared_ptr< ISO7816ReaderUnit > logicalaccess::PCSCReaderUnit::getSAMReaderUnit ( )
overrideprotectedvirtual

Get The SAM ReaderUnit.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ getService()

ReaderServicePtr logicalaccess::PCSCReaderUnit::getService ( const ReaderServiceType type)
overridevirtual

Request a service object of type type.

The service object will be associated with the current reader.

The default implementation returns nullptr;

Reimplemented from logicalaccess::ReaderUnit.

Reimplemented in logicalaccess::OmnikeyXX21ReaderUnit.

◆ getShareMode()

PCSCShareMode logicalaccess::PCSCReaderUnit::getShareMode ( ) const

Get the currently active share mode.

Returns
The currently active share mode.

If the card is not connected, requesting the share mode value is meaningless.

◆ getSingleChip()

std::shared_ptr< Chip > logicalaccess::PCSCReaderUnit::getSingleChip ( )
overridevirtual

Get the first and/or most accurate chip found.

Returns
The single chip.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ getT_CL_ISOType()

void logicalaccess::PCSCReaderUnit::getT_CL_ISOType ( bool &  isTypeA,
bool &  isTypeB 
)
virtual

Get if the inserted card is from ISO 14443-4 A or B.

Parameters
isTypeAWill be set to true if the card is from ISO 14443-4 A, false if not or unknown.
isTypeBWill be set to true if the card is from ISO 14443-4 B, false if not or unknown.

Reimplemented in logicalaccess::OmnikeyXX21ReaderUnit.

◆ isConnected()

bool logicalaccess::PCSCReaderUnit::isConnected ( )
overridevirtual

Check if the handle is associated to a card (aka. "connected").

Returns
True if the handle is associated to a card, false otherwise.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ makeProxy()

void logicalaccess::PCSCReaderUnit::makeProxy ( std::shared_ptr< PCSCReaderUnit readerUnit,
std::shared_ptr< PCSCReaderUnitConfiguration readerUnitConfig 
)

Make the reader unit as a proxy to another. Use when listening on all PC/SC reader unit.

Parameters
readerUnitThe referenced reader unit.
readerUnitConfigThe referenced reader unit configuration.

◆ prepare_poll_parameters()

std::tuple< PCSCReaderUnit::SPtrStringVector, PCSCReaderUnit::ReaderStateVector > logicalaccess::PCSCReaderUnit::prepare_poll_parameters ( )
protected

Prepare the parameters for the call to SCardGetStatusChange invoked by waitInsertion()

◆ process_insertion()

bool logicalaccess::PCSCReaderUnit::process_insertion ( const std::string &  cardType,
unsigned int  maxwait,
const ElapsedTimeCounter elapsed 
)
protectedvirtual

Give a chance to concrete reader implementation to do something just after a insertion has been detected.

This default implemented MUST be called explicitly if you override this method.

Reimplemented in logicalaccess::ID3ReaderUnit.

◆ reconnect()

bool logicalaccess::PCSCReaderUnit::reconnect ( int  action = 0)
overrideprotectedvirtual

Reconnect to the card with the currently active share mode on the same reader.

Parameters
controlthe behavior of the reconnect.
Returns
True if the card was reconnected without error, false otherwise.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ reset()

void logicalaccess::PCSCReaderUnit::reset ( int  action = 0)

Reconnect to the card.

Parameters
controlthe behavior of the reconnect.

◆ serialize()

void logicalaccess::PCSCReaderUnit::serialize ( boost::property_tree::ptree &  parentNode)
overridevirtual

Serialize the current object to XML.

Parameters
parentNodeThe parent node.

Reimplemented from logicalaccess::ReaderUnit.

◆ setCardTechnologies()

void logicalaccess::PCSCReaderUnit::setCardTechnologies ( const TechnoBitset bitset)
overridevirtual

Request that the reader enable or disable the various card technologies as described in the bitset. The default implementation just does nothing.

Reimplemented from logicalaccess::ReaderUnit.

Reimplemented in logicalaccess::OmnikeyXX21ReaderUnit.

◆ setCardType()

void logicalaccess::PCSCReaderUnit::setCardType ( std::string  cardType)
inlineoverridevirtual

Set the card type.

Parameters
cardTypeThe card type.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ setConfiguration()

void logicalaccess::PCSCReaderUnit::setConfiguration ( std::shared_ptr< ReaderUnitConfiguration config)
overridevirtual

Set the reader unit configuration.

Parameters
configThe reader unit configuration.

Reimplemented from logicalaccess::ReaderUnit.

◆ setLCDDisplay()

void logicalaccess::PCSCReaderUnit::setLCDDisplay ( std::shared_ptr< LCDDisplay d)
overridevirtual

Get the LCD Display for this reader unit.

Returns
The LCD Display.

Reimplemented from logicalaccess::ReaderUnit.

◆ setLEDBuzzerDisplay()

void logicalaccess::PCSCReaderUnit::setLEDBuzzerDisplay ( std::shared_ptr< LEDBuzzerDisplay lbd)
overridevirtual

Get the LCD Display for this reader unit.

Returns
The LCD Display.

Reimplemented from logicalaccess::ReaderUnit.

◆ setName()

void logicalaccess::PCSCReaderUnit::setName ( const std::string &  name)

Set the reader unit name.

Parameters
nameThe reader unit name.

◆ setSAMChip()

void logicalaccess::PCSCReaderUnit::setSAMChip ( std::shared_ptr< SAMChip t)
overrideprotectedvirtual

Set the SAM Chip.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ setSAMReaderUnit()

void logicalaccess::PCSCReaderUnit::setSAMReaderUnit ( std::shared_ptr< ISO7816ReaderUnit t)
overrideprotectedvirtual

Set the SAM ReaderUnit.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ setSingleChip()

void logicalaccess::PCSCReaderUnit::setSingleChip ( std::shared_ptr< Chip chip)
protected

Set the first and/or most accurate chip found.

Parameters
chipThe single chip.

◆ setup_pcsc_connection()

void logicalaccess::PCSCReaderUnit::setup_pcsc_connection ( PCSCShareMode  share_mode)

Direct means we established without requiring that a card be near the card reader.

◆ teardown_pcsc_connection()

void logicalaccess::PCSCReaderUnit::teardown_pcsc_connection ( )

Terminate the PCSC connection. This is a noop if the connection is already terminated.

◆ unSerialize()

void logicalaccess::PCSCReaderUnit::unSerialize ( boost::property_tree::ptree &  node)
overridevirtual

UnSerialize a XML node to the current object.

Parameters
nodeThe XML node.

Reimplemented from logicalaccess::ReaderUnit.

◆ waitInsertion()

bool logicalaccess::PCSCReaderUnit::waitInsertion ( unsigned int  maxwait)
overridevirtual

Wait for a card insertion.

Parameters
maxwaitThe maximum time to wait for, in milliseconds. If maxwait is zero, then the call never times out.
Returns
True if a card was inserted, false otherwise. If a card was inserted, the name of the reader on which the insertion was detected is accessible with getReader().
Warning
If the card is already connected, then the method always fail.

Reimplemented from logicalaccess::ISO7816ReaderUnit.

◆ waitInsertion_create_proxy()

void logicalaccess::PCSCReaderUnit::waitInsertion_create_proxy ( const std::string &  reader_name)
protected

Create the proxy reader based on which reader detected a card during waitInsertion.

◆ waitRemoval()

bool logicalaccess::PCSCReaderUnit::waitRemoval ( unsigned int  maxwait)
overridevirtual

Wait for a card removal.

Parameters
maxwaitThe maximum time to wait for, in milliseconds. If maxwait is zero, then the call never times out.
Returns
True if a card was removed, false otherwise. If a card was removed, the name of the reader on which the removal was detected is accessible with getReader().

Reimplemented from logicalaccess::ISO7816ReaderUnit.

Reimplemented in logicalaccess::ACSACR1222LReaderUnit, logicalaccess::OmnikeyReaderUnit, and logicalaccess::OmnikeyXX21ReaderUnit.

Member Data Documentation

◆ atr_

ByteVector logicalaccess::PCSCReaderUnit::atr_
protected

The current ATR

◆ connection_

std::unique_ptr<PCSCConnection> logicalaccess::PCSCReaderUnit::connection_
protected

A PCSC connection object.

◆ d_connectedName

std::string logicalaccess::PCSCReaderUnit::d_connectedName
protected

The reader unit connected name.

◆ d_name

std::string logicalaccess::PCSCReaderUnit::d_name
protected

The reader unit name.

◆ d_proxyReaderUnit

std::shared_ptr<PCSCReaderUnit> logicalaccess::PCSCReaderUnit::d_proxyReaderUnit
protected

The proxy reader unit.


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