Class CadDevice

  • Direct Known Subclasses:
    CadPCSCClient, CadT0, CadT1

    public abstract class CadDevice
    extends java.lang.Object
    Factory class producing CardClientInterface instances (connections to a card)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.util.ResourceBundle _messages
      Properties file with messages
      protected boolean debug
      Internal debug flag.
      protected byte deviceProtocol
      The currentry used protocol
      protected java.io.InputStream in
      The input stream which data is read from.
      protected java.io.OutputStream out
      The output stream to which data is written.
      static byte PROTOCOL_PCSC
      PC/SC constant
      static byte PROTOCOL_T0
      Protocol constant
      static byte PROTOCOL_T1
      Protocol constant
      static byte PROTOCOL_TCL
      Protocol constant
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected CadDevice​(byte devProtocolType)
      PCSC streams is using this form of constructor and are not applicable
      protected CadDevice​(byte devProtocolType, java.io.InputStream in, java.io.OutputStream out)
      T=0, T=1 implementations is using this form of constructor
    • Field Detail

      • _messages

        protected static java.util.ResourceBundle _messages
        Properties file with messages
      • in

        protected java.io.InputStream in
        The input stream which data is read from. This field is used to store the reference to the input stream which an instance of the Cad class reads from.
      • out

        protected java.io.OutputStream out
        The output stream to which data is written. This field is used to store the reference to the output stream which an instance of the Cad class writes to.
      • debug

        protected boolean debug
        Internal debug flag. Set the system property apduIODebug to 0x01 to activate transport level debugging.
      • deviceProtocol

        protected byte deviceProtocol
        The currentry used protocol
    • Constructor Detail

      • CadDevice

        protected CadDevice​(byte devProtocolType,
                            java.io.InputStream in,
                            java.io.OutputStream out)
        T=0, T=1 implementations is using this form of constructor
        Parameters:
        devProtocolType - Procol constant: T1 or T1
        in - Input stream from a simulator or a TLP224 card reader
        out - Output stream to a simulator or a TLP224 card reader
      • CadDevice

        protected CadDevice​(byte devProtocolType)
        PCSC streams is using this form of constructor and are not applicable
        Parameters:
        devProtocolType - Protocol type (PCSC)
    • Method Detail

      • getDeviceProtocol

        public byte getDeviceProtocol()
        Get the value of the protocol byte
        Returns:
        the value of the protocol byte
      • getCadClientInstance

        public static CadClientInterface getCadClientInstance​(byte protocolType,
                                                              java.io.InputStream in,
                                                              java.io.OutputStream out)
        A factory method
        Parameters:
        protocolType - Protocol constant
        in - Input stream from a simulator
        out - Output stream to a simulator
        Returns:
        New instance of a card connection
      • getPCSCClientInstance

        public static CadClientInterface getPCSCClientInstance​(int readerNumber)
        A factory method for connecting to a PCSC card readed
        Parameters:
        readerNumber - PC/SC reader number (0, 1, 2...)
        Returns:
        Connection to the reader
      • close

        public void close()
                   throws java.io.IOException
        Flush and close the input and output streams.
        Throws:
        java.io.IOException - If there is an error closing or flushing the input or output streams.