eID middleware |

# eIDMW::PTEID_ReaderContext Class Reference

This class represent a reader. More...

`#include <eidlib.h>`

Inheritance diagram for eIDMW::PTEID_ReaderContext:

List of all members.

## Public Member Functions
PTEIDSDK_API | PTEID_ReaderContext (PTEID_FileType fileType, const char *fileName)
| Construct using a fileType and fileName.
PTEIDSDK_API | PTEID_ReaderContext (PTEID_FileType fileType, const PTEID_ByteArray &data)
| Construct using a fileType and its content (for compatibility with SetRawFile).
PTEIDSDK_API | PTEID_ReaderContext (const PTEID_RawData_Eid &data)
| Construct using Raw data for Eid.
PTEIDSDK_API | PTEID_ReaderContext (const PTEID_RawData_Sis &data)
| Construct using Raw data for Sis.
virtual PTEIDSDK_API | ~PTEID_ReaderContext ()
| Destructor.
PTEIDSDK_API const char * | getName ()
| Return the name of the reader.
PTEIDSDK_API bool | isCardPresent ()
| Return true if a card is present and false otherwise.
PTEIDSDK_API void | releaseCard (bool bAllReference=false)
| Release the card.
PTEIDSDK_API bool | isCardChanged (unsigned long &ulOldId)
| Return true if a card has changed since the last called (with the same ulOldId parameter).
PTEIDSDK_API PTEID_CardType | getCardType ()
| Return the type of the card in the reader.
PTEIDSDK_API PTEID_Card & | getCard ()
| Get the card in the reader.
PTEIDSDK_API PTEID_EIDCard & | getEIDCard ()
| Get the EIDcard in the reader.
PTEIDSDK_API PTEID_KidsCard & | getKidsCard ()
| Get the KidsCard in the reader.
PTEIDSDK_API PTEID_ForeignerCard & | getForeignerCard ()
| Get the ForeignerCard in the reader.
PTEIDSDK_API PTEID_SISCard & | getSISCard ()
| Get the SISCard in the reader.
PTEIDSDK_API unsigned long | SetEventCallback (void(*callback)(long lRet, unsigned long ulState, void *pvRef), void *pvRef)
| Specify a callback function to be called each time a card is inserted/remove in/from this reader.
PTEIDSDK_API void | StopEventCallback (unsigned long ulHandle)
| To tell that the callbacks are not longer needed.
PTEIDSDK_API void | BeginTransaction ()
| Begin a transaction with the reader.
PTEIDSDK_API void | EndTransaction ()
| End the transaction.
PTEIDSDK_API bool | isVirtualReader ()
| Return true if this is a virtual reader (create from a file).
## Friends
PTEID_ReaderContext & | PTEID_ReaderSet::getReader (APL_ReaderContext *pAplReader)
| For internal use : This method must access protected constructor.

## Detailed Description

This class represent a reader.

You get reader object from the ReaderSet either by its index (getReaderByNum) or by its name (getReaderByName). Once you have a reader object, you can check if a card is present (isCardPresent). Then you can ask which type of card is in the reader with getCardType() and then get a card object using one of this method : getCard, getEIDCard, getKidsCard, getForeignerCard or getSISCard.

## Constructor & Destructor Documentation

PTEIDSDK_API eIDMW::PTEID_ReaderContext::PTEID_ReaderContext | ( | PTEID_FileType | fileType,
|  | const char * | fileName |
| ) |  |  |

Construct using a fileType and fileName.

No physical reader are connected (m_reader=NULL)

PTEIDSDK_API eIDMW::PTEID_ReaderContext::PTEID_ReaderContext | ( | PTEID_FileType | fileType,
|  | const PTEID_ByteArray & | data |
| ) |  |  |

Construct using a fileType and its content (for compatibility with SetRawFile).

No physical reader are connected (m_reader=NULL)

PTEIDSDK_API eIDMW::PTEID_ReaderContext::PTEID_ReaderContext | ( | const PTEID_RawData_Eid & | data | ) |

Construct using Raw data for Eid.

No physical reader are connected (m_reader=NULL)

PTEIDSDK_API eIDMW::PTEID_ReaderContext::PTEID_ReaderContext | ( | const PTEID_RawData_Sis & | data | ) |

Construct using Raw data for Sis.

No physical reader are connected (m_reader=NULL)

virtual PTEIDSDK_API eIDMW::PTEID_ReaderContext::~PTEID_ReaderContext | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

PTEIDSDK_API void eIDMW::PTEID_ReaderContext::BeginTransaction | ( |  | ) |

Begin a transaction with the reader.

PTEIDSDK_API void eIDMW::PTEID_ReaderContext::EndTransaction | ( |  | ) |

End the transaction.

PTEIDSDK_API PTEID_Card& eIDMW::PTEID_ReaderContext::getCard | ( |  | ) |

Get the card in the reader.

Instantiation is made regarding the type of the card (PTEID_EIDCard, PTEID_KidsCard, PTEID_ForeignerCard or PTEID_SISCard).

If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown. If the card type is not supported, exception PTEID_ExCardTypeUnknown is thrown.

PTEIDSDK_API PTEID_CardType eIDMW::PTEID_ReaderContext::getCardType | ( |  | ) |

Return the type of the card in the reader.

Throw PTEID_ExNoCardPresent exception if no card is present.

PTEIDSDK_API PTEID_EIDCard& eIDMW::PTEID_ReaderContext::getEIDCard | ( |  | ) |

Get the EIDcard in the reader.

Instantiation is made regarding the type of the card (PTEID_EIDCard, PTEID_KidsCard, PTEID_ForeignerCard).

If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown. If the card is not an EIDcard, exception PTEID_ExCardBadType is thrown.

PTEIDSDK_API PTEID_ForeignerCard& eIDMW::PTEID_ReaderContext::getForeignerCard | ( |  | ) |

Get the ForeignerCard in the reader.

If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown If the card is not a ForeignerCard, exception PTEID_ExCardBadType is thrown.

PTEIDSDK_API PTEID_KidsCard& eIDMW::PTEID_ReaderContext::getKidsCard | ( |  | ) |

Get the KidsCard in the reader.

If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown. If the card is not a KidsCard, exception PTEID_ExCardBadType is thrown.

PTEIDSDK_API const char* eIDMW::PTEID_ReaderContext::getName | ( |  | ) |

Return the name of the reader.

PTEIDSDK_API PTEID_SISCard& eIDMW::PTEID_ReaderContext::getSISCard | ( |  | ) |

Get the SISCard in the reader.

If no card is present in the reader, exception PTEID_ExNoCardPresent is thrown. If the card is not a SISCard, exception PTEID_ExCardBadType is thrown.

PTEIDSDK_API bool eIDMW::PTEID_ReaderContext::isCardChanged | ( | unsigned long & | ulOldId | ) |

Return true if a card has changed since the last called (with the same ulOldId parameter).

PTEIDSDK_API bool eIDMW::PTEID_ReaderContext::isCardPresent | ( |  | ) |

Return true if a card is present and false otherwise.

PTEIDSDK_API bool eIDMW::PTEID_ReaderContext::isVirtualReader | ( |  | ) |

Return true if this is a virtual reader (create from a file).

PTEIDSDK_API void eIDMW::PTEID_ReaderContext::releaseCard | ( | bool | bAllReference = `false` | ) |

Release the card.

Parameters:

  | bAllReference | If true all the invalid reference/pointer are destroyed.
  | bAllReference | PUT THIS PARAMETER TO TRUE IS THREAD UNSAFE.
  | bAllReference | You have to be sure that you will not use any old reference/pointer after this release

PTEIDSDK_API unsigned long eIDMW::PTEID_ReaderContext::SetEventCallback | ( | void(*)(long lRet, unsigned long ulState, void *pvRef) | callback,
|  | void * | pvRef |
| ) |  |  |

Specify a callback function to be called each time a card is inserted/remove in/from this reader.

Returns:
  A handle can be used to stop the callbacks when they are no longer needed.

PTEIDSDK_API void eIDMW::PTEID_ReaderContext::StopEventCallback | ( | unsigned long | ulHandle | ) |

To tell that the callbacks are not longer needed.

Parameters:

  | ulHandle | is the handle return by SetEventCallback

## Friends And Related Function Documentation

PTEID_ReaderContext& PTEID_ReaderSet::getReader | ( | APL_ReaderContext * | pAplReader | ) | `[friend]`

For internal use : This method must access protected constructor.

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

- eidlib.h