Interface ReaderSpi

  • All Known Subinterfaces:
    AutonomousSelectionReaderSpi, ConfigurableReaderSpi, ObservableReaderSpi, PoolReaderSpi

    public interface ReaderSpi
    Reader able to communicate with smart cards whose purpose is to remain present in the reader (for example a SAM reader).

    The target devices must comply with the following Calypsonet Terminal requirements:

    • RL-CL-TS16794 (for contactless communication)
    • RL-DET-PCIBLOCK.1 (for contactless communication)
    • RL-CT-T0 (for contact communication)
    • RL-PERF-TIME.1
    Since:
    2.0.0
    • Method Detail

      • getName

        java.lang.String getName()
        Gets the name of the reader.
        Returns:
        A not empty string.
        Since:
        2.0.0
      • openPhysicalChannel

        void openPhysicalChannel()
                          throws ReaderIOException,
                                 CardIOException
        Attempts to open the physical channel (to established a communication with the card).
        Throws:
        ReaderIOException - If the communication with the reader has failed.
        CardIOException - If the communication with the card has failed.
        Since:
        2.0.0
      • closePhysicalChannel

        void closePhysicalChannel()
                           throws ReaderIOException
        Attempts to close the current physical channel.

        The physical channel may have been implicitly closed previously by a card withdrawal.

        Throws:
        ReaderIOException - If the communication with the reader has failed.
        Since:
        2.0.0
      • isPhysicalChannelOpen

        boolean isPhysicalChannelOpen()
        Tells if the physical channel is open or not.
        Returns:
        True is the physical channel is open, false if not.
      • checkCardPresence

        boolean checkCardPresence()
                           throws ReaderIOException
        Verifies the presence of a card.
        Returns:
        True if a card is present
        Throws:
        ReaderIOException - If the communication with the reader has failed.
        Since:
        2.0.0
      • getPowerOnData

        java.lang.String getPowerOnData()
        Gets the power-on data.

        The power-on data is defined as the data retrieved by the reader when the card is inserted.

        In the case of a contact reader, this is the Answer To Reset data (ATR) defined by ISO7816.

        In the case of a contactless reader, the reader decides what this data is. Contactless readers provide a virtual ATR (partially standardized by the PC/SC standard), but other devices can have their own definition, including for example elements from the anti-collision stage of the ISO14443 protocol (ATQA, ATQB, ATS, SAK, etc).

        These data being variable from one reader to another, they are defined here in string format which can be either a hexadecimal string or any other relevant information.

        Returns:
        A not empty String.
        Since:
        2.0.0
      • transmitApdu

        byte[] transmitApdu​(byte[] apduIn)
                     throws ReaderIOException,
                            CardIOException
        Transmits an APDU and returns its response.

        Caution: the implementation must handle the case where the card response is 61xy and execute the appropriate get response command (Calypsonet Terminal requirement "RL-SW-61XX.1").

        Parameters:
        apduIn - The data to be sent to the card.
        Returns:
        A buffer of at least 2 bytes.
        Throws:
        ReaderIOException - If the communication with the reader has failed.
        CardIOException - If the communication with the card has failed.
        Since:
        2.0.0
      • isContactless

        boolean isContactless()
        Tells if the reader is a contactless type.
        Returns:
        True if the reader a contactless type, false if not
        Since:
        2.0.0
      • onUnregister

        void onUnregister()
        Invoked when unregistering the associated plugin.
        Since:
        2.0.0