The OpenCard Framework offers general functionality for dealing with card terminals. (Although they're often called card readers, the OCF uses the more general, all-encompassing term card terminal for these devices.) Unfortunately, no concrete card terminal class was provided in the core and opt packages (although there are a few example implementations in the OCF Reference Implementation). Including a concrete card
terminal class simply isn't possible due to the sheer variety of existing devices. This means some work remains to be done
by the "terminal integrator" -- yes, that's you!
The missing terminal-dependent functionality is comprised of the following facilities:
Smart card-related functionality:
In the following section, we'll show you what to implement in order to realize this functionality.
Step 1. Obtain the required information & make the basic decisions
To ensure an efficient development process, it is recommended that you collect the following information and make a few decisions
right from the beginning:
Objects of subclasses of CardTerminal are brought into being by means of a factory object. If you already have such a factory class, reuse it and change it such that it can handle the new CardTerminal class too. If you don't have a factory class yet, well, write one from scratch! (We'll explain how to do this later on in
the article.)
B. Determine the name of the terminal family
The card terminal device should come with a name. So take this name and make a name string from it that complies with the Java syntax.
C. Determine the number of slots
The number of slots will default to one in most cases, but as the smart card market expands we'll see devices with more than one slot.
D. Enable communication over javax.comm or native methods
Your Java terminal class must somehow communicate with the physical device. This can be accomplished in one of several ways.
If the terminal comes with prebuilt libraries, you can use those by means of Java's native method interface (JNI). The advantage
to this is that a lot of the required functionality is already implemented. The downside is, of course, that this approach
renders your card terminal implementation platform-dependent. The second possibility is to use Java's mechanism of accessing
the serial port of your machine using the package javax.comm. This package isn't included in the current JDK release but it is part of Java's extension classes in the just-released major
upgrade to JDK 1.2 (now known as the Java 2 platform). A beta release can be obtained separately from the Java Developer Connection
on Sun's java.sun.com site. Currently javax.comm supports only serial and parallel devices.