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
        Validates the opening of the physical channel. Performs the actual opening if this has not been done by the checkCardPresence() method. In all cases, memorizes the new state for the operation of the isPhysicalChannelOpen() method. After executing this method, the reader is able to send APDUs to 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
        Tells the reader that card processing is complete and that the next step is to remove the card from the reader.

        If the reader has the ability to sense the presence of the card without communicating with it, then this method must proceed to the actual closing of the physical channel (e.g. power down in the case of a contact reader). Otherwise, this method is limited to changing the logical opening state of the physical channel and letting the removal procedure do the closing.

        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.

        Depending on the reader's capabilities, this method will either use a card presence indicator without necessarily communicating with the card (for example, in the case of a contact reader equipped with a physical insertion detector using a switch), or will communicate with the card (in the case of contactless hunting). In the latter case, we can consider that the physical channel has been opened (and therefore no longer needs to be opened in the openPhysicalChannel() method).

        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