com.dalsemi.onewire.jib.terminal
Class JiBCardTerminal

java.lang.Object
  |
  +--opencard.core.terminal.CardTerminal
        |
        +--com.dalsemi.onewire.jib.terminal.JiBCardTerminal
All Implemented Interfaces:
opencard.core.terminal.Pollable

public class JiBCardTerminal
extends opencard.core.terminal.CardTerminal
implements opencard.core.terminal.Pollable

The JiBCardTerminal class represents a physical card terminal for a Java Powered iButton. It polls for Java iButton insertions and removals.


Constructor Summary
JiBCardTerminal(String name, String type, String address)
          Instantiate a JiBCardTerminal object.
 
Method Summary
 void close()
          Closes the terminal and stops polling the 1-Wire bus for Java Powered iButtons.
 byte[] getAdapterAddress()
          Gets the ROM ID of the adapter.
 int[] getAdapterId()
          Gets the ROM ID of the adapter.
 opencard.core.terminal.CardID getCardID(int slot_id)
          Gets the CardID from the Java Powered iButton on the specified slot.
 opencard.core.terminal.CardID getCardID(int slot_id, int ex_timeout)
          Get the CardID from the Java Powered iButton on the specified slot.
 OneWireContainer16 getContainer(int slot_id)
          Gets the com.dalsemi.onewire.container.OneWireContainer of the currently inserted Java Powered iButton.
 byte[] getiButtonAddress(int slot_id)
          Gets the ROM ID of the currently inserted Java Powered iButton.
 int[] getiButtonId(int slot_id)
          Gets the ROM ID of the currently inserted Java Powered iButton.
 boolean isCardPresent(int slot_id)
          Determines if there is a Java Powered iButton on the given slot.
 void open()
          Open the terminal for communication.
 void poll()
          Method called to poll the One-Wire bus for the presence of a Java Powered iButton.
 
Methods inherited from class opencard.core.terminal.CardTerminal
closeSlotChannel, enumerateSlots, features, getAddress, getName, getSlot, getSlots, getType, isCardPresent, isSlotChannelAvailable, isSlotChannelAvailable, openSlotChannel, openSlotChannel, openSlotChannel, reset, reset, sendAPDU, sendAPDU, sendVerifiedCommandAPDU, slots, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JiBCardTerminal

public JiBCardTerminal(String name,
                       String type,
                       String address)
Instantiate a JiBCardTerminal object. This should be handled invisibly by the OpenCard internals.
Parameters:
name - - The user friendly name of the terminal.
type - - the port type.
address - - The address/name of the port (i.e. COM1 or /dev/ttya).
Method Detail

getiButtonId

public int[] getiButtonId(int slot_id)
Gets the ROM ID of the currently inserted Java Powered iButton. Returns an int array for legacy reasons.
Returns:
the unique serial number of the Java Powered iButton.
See Also:
getiButtonAddress(int)

getiButtonAddress

public byte[] getiButtonAddress(int slot_id)
Gets the ROM ID of the currently inserted Java Powered iButton.
Returns:
the unique serial number of the Java Powered iButton.

getContainer

public OneWireContainer16 getContainer(int slot_id)
Gets the com.dalsemi.onewire.container.OneWireContainer of the currently inserted Java Powered iButton.
Returns:
container object for communication with Java Powered iButton

getAdapterAddress

public byte[] getAdapterAddress()
Gets the ROM ID of the adapter.
Returns:
the unique serial number of the adapter.

getAdapterId

public int[] getAdapterId()
Gets the ROM ID of the adapter. Returns an int array for legacy reasons.
Returns:
the unique serial number of the adapter.

open

public void open()
          throws opencard.core.terminal.CardTerminalException
Open the terminal for communication. This begins the polling of the One-Wire bus for Java Powered iButtons.
Overrides:
open in class opencard.core.terminal.CardTerminal

close

public void close()
Closes the terminal and stops polling the 1-Wire bus for Java Powered iButtons.
Overrides:
close in class opencard.core.terminal.CardTerminal

isCardPresent

public boolean isCardPresent(int slot_id)
                      throws opencard.core.terminal.CardTerminalException
Determines if there is a Java Powered iButton on the given slot.
Overrides:
isCardPresent in class opencard.core.terminal.CardTerminal
Parameters:
int - the id of the slot.

getCardID

public opencard.core.terminal.CardID getCardID(int slot_id)
                                        throws opencard.core.terminal.CardTerminalException
Gets the CardID from the Java Powered iButton on the specified slot.
Overrides:
getCardID in class opencard.core.terminal.CardTerminal
Parameters:
int - the id of the slot
Returns:
the CardID object containing the ATR of the Java Powered iButton.
Throws:
opencard.core.terminal.CardTerminalException -  

getCardID

public opencard.core.terminal.CardID getCardID(int slot_id,
                                               int ex_timeout)
                                        throws opencard.core.terminal.CardTerminalException
Get the CardID from the Java Powered iButton on the specified slot. This method will timeout after the specified timeout period.
Overrides:
getCardID in class opencard.core.terminal.CardTerminal
Parameters:
slot_id - - the id of the slot
ex_timeout - - the period of time to wait before timing out.
Returns:
the CardID object containing the ATR of the Java Powered iButton
Throws:
opencard.core.terminal.CardTerminalException -  

poll

public void poll()
          throws opencard.core.terminal.CardTerminalException
Method called to poll the One-Wire bus for the presence of a Java Powered iButton.
Specified by:
poll in interface opencard.core.terminal.Pollable
Throws:
opencard.core.terminal.CardTerminalException - on communications error with the iButton