com.dalsemi.onewire.container
Class OneWireContainer16

java.lang.Object
  |
  +--com.dalsemi.onewire.container.OneWireContainer
        |
        +--com.dalsemi.onewire.container.OneWireContainer16

public class OneWireContainer16
extends OneWireContainer

OneWireContainer for iButton family type 0x16 (Java iButton).

Version:
0.00, 28 Aug 2000

Field Summary
static int AID_LENGTH_OFFSET
          offset of AID length in applet APDU data stream
static int AID_LENGTH_SIZE
          size of AID length in byte
static int AID_NAME_OFFSET
          offset of AID name in applet APDU data stream
static int AID_SIZE
          maximum length of AID in byte
static int APDU_PACKET_LENGTH
          default APDU data packet length in byte
static int APPLET_FILE_HEADER_SIZE
          size of applet file header in byte
static int PASSWORD_LENGTH_SIZE
          size of password length in byte
static int PASSWORD_SIZE
          maximum length of password in byte
 
Constructor Summary
OneWireContainer16()
          Constructs a generic instance of the OneWireContainer16 class.
 
Method Summary
 ResponseAPDU deleteAppletByAID(java.lang.String aid)
          Deletes an applet by its AID.
 ResponseAPDU deleteAppletByNumber(int index)
          Deletes an applet by its installed number.
 ResponseAPDU deleteSelectedApplet()
          Deletes the currently selected applet.
 ResponseAPDU getAIDByNumber(int index)
          Gets the AID of the applet by its installed number.
 java.lang.String getAlternateNames()
          Gets the alternate Dallas Semiconductor part numbers or names.
 ResponseAPDU getAppletGCMode()
          Gets the Applet Garbage Collection Mode.
 ResponseAPDU getATR()
          Gets the Answer To Reset (ATR) from Java iButton.
 CommandAPDU getCommandAPDUInfo()
          Gets the current CommandAPDU sent to the Java iButton
 ResponseAPDU getCommandPINMode()
          Gets the Command PIN Mode.
 ResponseAPDU getCommitBufferSize()
          Gets the size of the Commit Buffer.
 java.lang.String getDescription()
          Gets a short description of the function of the Java iButton.
 ResponseAPDU getEphemeralGCMode()
          Gets the Ephemeral Gabage Collection Mode.
 ResponseAPDU getErrorReportingMode()
          Gets the Error Reporting Mode.
 ResponseAPDU getExceptionMode()
          Gets the Exception Mode.
 ResponseAPDU getFirmwareVersionString()
          Gets the firmware version string.
 ResponseAPDU getFreeRAM()
          Gets the amount of free RAM in the Java iButton.
 ResponseAPDU getLastError()
          Gets the last error value.
 int getLoadPacketSize()
          Gets the size of the packets sent on load.
 ResponseAPDU getLoadPINMode()
          Gets the Load PIN Mode.
 int getMaxSpeed()
          Gets the maximum speed this One-Wire device can communicate at.
 java.lang.String getName()
          Gets the Dallas Semiconductor part number of the Java iButton as a string.
 ResponseAPDU getPORCount()
          Gets the number of times the Java iButton has been power on reset (POR) since the last master erase.
 ResponseAPDU getRandomBytes(int numBytes)
          Gets requested number of bytes of random data generated by Java iButton.
 ResponseAPDU getRealTimeClock()
          Gets the Real Time Clock.
 ResponseAPDU getResponseAPDUInfo()
          Gets the current ResponseAPDU received from the Java iButton
 ResponseAPDU getRestoreMode()
          Gets the Restore Mode.
 int getRunTime()
          Gets the default run time value of the Java iButton
 ResponseAPDU loadApplet(java.lang.String fileName, java.lang.String directoryName, java.lang.String aid)
          Loads an applet onto the Java iButton.
 ResponseAPDU masterErase()
          Clears all memory in the Java iButton.
 ResponseAPDU process(CommandAPDU capdu)
          Sends a generic process command to the JavaiButton.
 ResponseAPDU select(java.lang.String aid)
          Selects an applet by AID.
 ResponseAPDU sendAPDU(CommandAPDU capdu, int runTime)
          Sends a CommandAPDU to the Java iButton.
 ResponseAPDU setAppletGCMode(int mode)
          Sets the Applet Garbage Collection Mode.
 ResponseAPDU setCommandPINMode(int mode)
          Sets the Command PIN Mode.
 ResponseAPDU setCommitBufferSize(int size)
          Sets the Commit Buffer size.
 ResponseAPDU setCommonPIN(java.lang.String newPIN)
          Sets the Common PIN.
 ResponseAPDU setEphemeralGCMode(int mode)
          Sets the Ephemeral Garbage Collection Mode.
 ResponseAPDU setErrorReportingMode(int mode)
          Sets the Error Reporting mode.
 ResponseAPDU setExceptionMode(int mode)
          Sets the Exception Mode.
 boolean setLoadPacketSize(int size)
          Sets the size of the packets sent on load.
 ResponseAPDU setLoadPINMode(int mode)
          Sets the Load PIN Mode.
 void setPIN(java.lang.String passwd)
          Sets the PIN used to communicate with the Java iButton.
 ResponseAPDU setRestoreMode(int mode)
          Sets the Restore Mode.
 void setRunTime(int newRunTime)
          Sets the run time value for the Java iButton
 void setupContainer(DSPortAdapter sourceAdapter, byte[] newAddress)
          Provides this container an adapter object to access the Java iButton.
 void setupContainer(DSPortAdapter sourceAdapter, long newAddress)
          Provides this container an adapter object to access the Java iButton.
 void setupContainer(DSPortAdapter sourceAdapter, java.lang.String newAddress)
          Provides this container an adapter object to access the Java iButton.
 void setupJibComm(DSPortAdapter sourceAdapter, byte[] newAddress)
          Provide this container an JibComm object to communicate with the Java iButton.
 
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer
doSpeed, getAdapter, getAddress, getAddressAsLong, getAddressAsString, getMemoryBanks, isAlarming, isPresent, setSpeed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASSWORD_LENGTH_SIZE

public static final int PASSWORD_LENGTH_SIZE
size of password length in byte

PASSWORD_SIZE

public static final int PASSWORD_SIZE
maximum length of password in byte

AID_LENGTH_SIZE

public static final int AID_LENGTH_SIZE
size of AID length in byte

AID_SIZE

public static final int AID_SIZE
maximum length of AID in byte

AID_LENGTH_OFFSET

public static final int AID_LENGTH_OFFSET
offset of AID length in applet APDU data stream

AID_NAME_OFFSET

public static final int AID_NAME_OFFSET
offset of AID name in applet APDU data stream

APPLET_FILE_HEADER_SIZE

public static final int APPLET_FILE_HEADER_SIZE
size of applet file header in byte

APDU_PACKET_LENGTH

public static int APDU_PACKET_LENGTH
default APDU data packet length in byte
Constructor Detail

OneWireContainer16

public OneWireContainer16()
Constructs a generic instance of the OneWireContainer16 class.
Method Detail

getName

public java.lang.String getName()
Gets the Dallas Semiconductor part number of the Java iButton as a string. For example "DS1954".
Overrides:
getName in class OneWireContainer
Returns:
string represetation of the Java iButton name.

getAlternateNames

public java.lang.String getAlternateNames()
Gets the alternate Dallas Semiconductor part numbers or names. A 'family' of One-Wire devices may have more than one part number depending on packaging. There can also be nicknames such as 'Crypto iButton'.
Overrides:
getAlternateNames in class OneWireContainer
Returns:
string represetation of the alternate names.

getDescription

public java.lang.String getDescription()
Gets a short description of the function of the Java iButton.
Overrides:
getDescription in class OneWireContainer
Returns:
string represetation of the function description.

setupContainer

public void setupContainer(DSPortAdapter sourceAdapter,
                           byte[] newAddress)
Provides this container an adapter object to access the Java iButton.
Overrides:
setupContainer in class OneWireContainer
Parameters:
sourceAdapter - adapter object required to communicate with this Java iButton.
newAddress - address of this One-Wire device as a byte array.

setupContainer

public void setupContainer(DSPortAdapter sourceAdapter,
                           long newAddress)
Provides this container an adapter object to access the Java iButton.
Overrides:
setupContainer in class OneWireContainer
Parameters:
sourceAdapter - adapter object required to communicate with this Java iButton.
newAddress - address of this One-Wire device as a long.

setupContainer

public void setupContainer(DSPortAdapter sourceAdapter,
                           java.lang.String newAddress)
Provides this container an adapter object to access the Java iButton.
Overrides:
setupContainer in class OneWireContainer
Parameters:
sourceAdapter - adapter object required to communicate with this Java iButton.
newAddress - address of this One-Wire device as a string

setupJibComm

public void setupJibComm(DSPortAdapter sourceAdapter,
                         byte[] newAddress)
Provide this container an JibComm object to communicate with the Java iButton.
Parameters:
sourceAdapter - adapter object required to communicate with this Java iButton.
newAddress - address of this One-Wire device as a byte array.

getMaxSpeed

public int getMaxSpeed()
Gets the maximum speed this One-Wire device can communicate at.
Overrides:
getMaxSpeed in class OneWireContainer
Returns:
maximum speed of the One-Wire device

getCommandAPDUInfo

public CommandAPDU getCommandAPDUInfo()
Gets the current CommandAPDU sent to the Java iButton
Returns:
current CommandAPDU sent to the Java iButton

getResponseAPDUInfo

public ResponseAPDU getResponseAPDUInfo()
Gets the current ResponseAPDU received from the Java iButton
Returns:
current ResponseAPDU received from the Java iButton

getRunTime

public int getRunTime()
Gets the default run time value of the Java iButton
Returns:
run time value of the Java iButton

setRunTime

public void setRunTime(int newRunTime)
Sets the run time value for the Java iButton
Parameters:
newRunTime - new run time value

setLoadPacketSize

public boolean setLoadPacketSize(int size)
Sets the size of the packets sent on load. The range can be from 64 to 112 bytes.
Parameters:
size - new packet size.
Returns:
true if packet size is set to the new value. false if invalid packet size is requested.

getLoadPacketSize

public int getLoadPacketSize()
Gets the size of the packets sent on load.
Returns:
size of the packets sent on load.

setPIN

public void setPIN(java.lang.String passwd)
Sets the PIN used to communicate with the Java iButton. Once this method has been called, the PIN will be sent to every method that requires a PIN.
Parameters:
passwd - PIN to be set and sent to the Java iButton for each command that requires a PIN.

getFreeRAM

public ResponseAPDU getFreeRAM()
                        throws OneWireException,
                               OneWireIOException,
                               java.lang.IllegalArgumentException
Gets the amount of free RAM in the Java iButton.
Returns:
ResponseAPDU with a data field containing the amount of free RAM in the Java iButton. Value returned is in little endian format.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getRandomBytes

public ResponseAPDU getRandomBytes(int numBytes)
                            throws OneWireException,
                                   OneWireIOException,
                                   java.lang.IllegalArgumentException
Gets requested number of bytes of random data generated by Java iButton.
Parameters:
numBytes - the number of bytes requested. numByes should not exceed 119. If the number is greater than 119, the API only returns 119.
Returns:
ResponseAPDU with a data field containing random bytes generated.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getFirmwareVersionString

public ResponseAPDU getFirmwareVersionString()
                                      throws OneWireException,
                                             OneWireIOException,
                                             java.lang.IllegalArgumentException
Gets the firmware version string.
Returns:
ResponseAPDU with a data field containing the firmware version string of the Java iButton
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getLastError

public ResponseAPDU getLastError()
                          throws OneWireException,
                                 OneWireIOException,
                                 java.lang.IllegalArgumentException
Gets the last error value. If the error reporting mode is set, then this method will return the value of the last exception.
Returns:
ResponseAPDU containing the last exception value.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getErrorReportingMode

public ResponseAPDU getErrorReportingMode()
                                   throws OneWireException,
                                          OneWireIOException,
                                          java.lang.IllegalArgumentException
Gets the Error Reporting Mode. This function is not supported in the .033 version of the firmware.
Returns:
ResponseAPDU containing the error reporting mode.
  • Success SW 0x9000.
  • Failure SW 0x6A02. Command not supported by the Java iButton
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setErrorReportingMode

public ResponseAPDU setErrorReportingMode(int mode)
                                   throws OneWireException,
                                          OneWireIOException,
                                          java.lang.IllegalArgumentException
Sets the Error Reporting mode. If the error reporting mode is set, the Java iButton stores the last exception value code. This code can be retreived by calling getLastError().
Parameters:
mode -  
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  
See Also:
getLastError

getAIDByNumber

public ResponseAPDU getAIDByNumber(int index)
                            throws OneWireException,
                                   OneWireIOException,
                                   java.lang.IllegalArgumentException
Gets the AID of the applet by its installed number.
Parameters:
index - installed number of the applet on the Java iButton to get the AID of.
Returns:
ResponseAPDU containing the AID of the applet requested.
  • Success SW 0x9000.
  • Failure SW 0x8453. Applet not found. Valid applet index are in the range of 0 - 15.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

deleteSelectedApplet

public ResponseAPDU deleteSelectedApplet()
                                  throws OneWireException,
                                         OneWireIOException,
                                         java.lang.IllegalArgumentException
Deletes the currently selected applet. If PIN protection is enabled, a PIN must be supplied.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

deleteAppletByNumber

public ResponseAPDU deleteAppletByNumber(int index)
                                  throws OneWireException,
                                         OneWireIOException,
                                         java.lang.IllegalArgumentException
Deletes an applet by its installed number.
Parameters:
index - installed number of the applet to delete.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
  • Failure SW 0x8453. Applet not found.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

deleteAppletByAID

public ResponseAPDU deleteAppletByAID(java.lang.String aid)
                               throws OneWireException,
                                      OneWireIOException,
                                      java.lang.IllegalArgumentException
Deletes an applet by its AID.
Parameters:
aid - AID of applet to be deleted.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
  • Failure SW 0x8453. Applet not found.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

loadApplet

public ResponseAPDU loadApplet(java.lang.String fileName,
                               java.lang.String directoryName,
                               java.lang.String aid)
                        throws OneWireException,
                               OneWireIOException,
                               java.lang.IllegalArgumentException,
                               java.io.FileNotFoundException,
                               java.io.IOException
Loads an applet onto the Java iButton. This method takes an applet filename, directory and AID. The AID must NOT exceed 16 bytes.
Parameters:
fileName - file name of the applet to be loaded into the Java iButton.
directoryName - path to the applet to be loaded.
aid - AID of the applet to be loaded.
Returns:
ResponseAPDU indicating success or failure. Possible return values are
  • Success SW 0x9000.
  • Failure SW 0x6400. Insufficient Memory
  • Failure SW 0x6901. Invalid AID Length
  • Failure SW 0x6902. Invalid API Version
  • Failure SW 0x6903. Invalid Password
  • Failure SW 0x6904. Invalid Signature Length
  • Failure SW 0x6905. Hash Corruption
  • Failure SW 0x6906. Hash Failure
  • Failure SW 0x6982. Invalid Signature
  • Failure SW 0x6A84. Class Length Overrun
  • Failure SW 0x6A86. Invalid Loader Command
  • Failure SW 0x6A87. Invalid Packet
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  
java.io.FileNotFoundException -  
java.io.IOException -  

masterErase

public ResponseAPDU masterErase()
                         throws OneWireException,
                                OneWireIOException,
                                java.lang.IllegalArgumentException
Clears all memory in the Java iButton.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getPORCount

public ResponseAPDU getPORCount()
                         throws OneWireException,
                                OneWireIOException,
                                java.lang.IllegalArgumentException
Gets the number of times the Java iButton has been power on reset (POR) since the last master erase. Return value is in little endian format. No PIN required.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000. Data field contains the POR count.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getRealTimeClock

public ResponseAPDU getRealTimeClock()
                              throws OneWireException,
                                     OneWireIOException,
                                     java.lang.IllegalArgumentException
Gets the Real Time Clock. No PIN required.
Returns:
ResponseAPDU containing the value of the real time clock.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getATR

public ResponseAPDU getATR()
                    throws OneWireException,
                           OneWireIOException,
                           java.lang.IllegalArgumentException
Gets the Answer To Reset (ATR) from Java iButton.
Returns:
ResponseAPDU containing the ATR in the data field.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getEphemeralGCMode

public ResponseAPDU getEphemeralGCMode()
                                throws OneWireException,
                                       OneWireIOException,
                                       java.lang.IllegalArgumentException
Gets the Ephemeral Gabage Collection Mode. A value of 1 indicates ephemeral garbage collection is turned on, 0 if turned off.
Returns:
ResponseAPDU containing the Ephemeral Garbage Collector Mode.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getAppletGCMode

public ResponseAPDU getAppletGCMode()
                             throws OneWireException,
                                    OneWireIOException,
                                    java.lang.IllegalArgumentException
Gets the Applet Garbage Collection Mode. A value of 1 indicates applet garbage collection is turned on, 0 if turned off.
Returns:
ResponseAPDU containing the Applet Garbage Collector Mode.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getCommandPINMode

public ResponseAPDU getCommandPINMode()
                               throws OneWireException,
                                      OneWireIOException,
                                      java.lang.IllegalArgumentException
Gets the Command PIN Mode. A value of 1 indicates that a PIN is required for all Administrative and AID commands, 0 indicates free access.
Returns:
ResponseAPDU containing the Command PIN Mode.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getLoadPINMode

public ResponseAPDU getLoadPINMode()
                            throws OneWireException,
                                   OneWireIOException,
                                   java.lang.IllegalArgumentException
Gets the Load PIN Mode. A value of 1 indicates that a PIN is required for Applet loading.
Returns:
ResponseAPDU containing the Load PIN Mode.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getRestoreMode

public ResponseAPDU getRestoreMode()
                            throws OneWireException,
                                   OneWireIOException,
                                   java.lang.IllegalArgumentException
Gets the Restore Mode. When Restore Mode is enabled, all field updates and javacard.framework.System transactions are considered atomic. If a tear occurs in the middle of these updates, values just prior to the update are restored.
Returns:
ResponseAPDU containing the Restore Mode.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getExceptionMode

public ResponseAPDU getExceptionMode()
                              throws OneWireException,
                                     OneWireIOException,
                                     java.lang.IllegalArgumentException
Gets the Exception Mode. When Exception Mode is enabled, Java API exceptions are thrown. All uncaught exceptions return 0x6F00 in the SW. When disabled, an error is returned from the VM.
Returns:
ResponseAPDU containing the Exception Mode value.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

getCommitBufferSize

public ResponseAPDU getCommitBufferSize()
                                 throws OneWireException,
                                        OneWireIOException,
                                        java.lang.IllegalArgumentException
Gets the size of the Commit Buffer. Committing one field to the buffer requires 9 bytes. Therefore the default size of 72 bytes allows 8 field updates. The minimum size allowed is 72 bytes and the maximum is restricted by the amount of free RAM. All values will be rounded up to the next multiple of 9.
Returns:
ResponseAPDU containing the Commit Buffer size in little endian format.
  • Success SW 0x9000.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setCommonPIN

public ResponseAPDU setCommonPIN(java.lang.String newPIN)
                          throws OneWireException,
                                 OneWireIOException,
                                 java.lang.IllegalArgumentException
Sets the Common PIN. This method is used to change the value of the Common PIN on the Java iButton. If the Java iButton currently has a PIN, the setPIN() method should be called prior to this method with the 'oldPIN' value.
Parameters:
newPIN - the value of the PIN to be set in the Java iButton
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setEphemeralGCMode

public ResponseAPDU setEphemeralGCMode(int mode)
                                throws OneWireException,
                                       OneWireIOException,
                                       java.lang.IllegalArgumentException
Sets the Ephemeral Garbage Collection Mode. A value of 1 turns the Ephemeral Garbage Collection on and a value of 0 turns it off.
Parameters:
mode - to turn on/off ephemeral garbage collector.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setAppletGCMode

public ResponseAPDU setAppletGCMode(int mode)
                             throws OneWireException,
                                    OneWireIOException,
                                    java.lang.IllegalArgumentException
Sets the Applet Garbage Collection Mode. A value of 1 turns the Applet Garbage Collection on and a value of 0 turns it off.
Parameters:
mode - to turn on/off applet garbage collector.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setCommandPINMode

public ResponseAPDU setCommandPINMode(int mode)
                               throws OneWireException,
                                      OneWireIOException,
                                      java.lang.IllegalArgumentException
Sets the Command PIN Mode. If command PIN mode is set to 1, a PIN is required for all Administrative commands.
Parameters:
mode - to turn on/off command PIN requirement.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setLoadPINMode

public ResponseAPDU setLoadPINMode(int mode)
                            throws OneWireException,
                                   OneWireIOException,
                                   java.lang.IllegalArgumentException
Sets the Load PIN Mode. If the load PIN mode is set, then PINs are required on applet loading.
Parameters:
mode - to turn on/off load PIN mode.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setRestoreMode

public ResponseAPDU setRestoreMode(int mode)
                            throws OneWireException,
                                   OneWireIOException,
                                   java.lang.IllegalArgumentException
Sets the Restore Mode. When Restore Mode is enabled, all field updates and javacard.framework.System transactions are considered atomic. If a tear occurs in the middle of these updates, values just prior to the update are restored.
Parameters:
mode - to turn on/off restore mode.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setExceptionMode

public ResponseAPDU setExceptionMode(int mode)
                              throws OneWireException,
                                     OneWireIOException,
                                     java.lang.IllegalArgumentException
Sets the Exception Mode. When Exception Mode is enabled, Java API exceptions are thrown. All uncaught exceptions return 0x6F00 in the SW. When disabled, an error is returned from the VM.
Parameters:
mode -  
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

setCommitBufferSize

public ResponseAPDU setCommitBufferSize(int size)
                                 throws OneWireException,
                                        OneWireIOException,
                                        java.lang.IllegalArgumentException
Sets the Commit Buffer size. Committing one field to the buffer requires 9 bytes. Therefore the default size of 72 bytes allows 8 field updates. The minimum size allowed is 72 bytes and the maximum is restricted by the amount of free RAM. All values will be rounded up to the next multiple of 9.
Parameters:
size - size of the desired commit buffer.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x6681. Invalid PIN.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

select

public ResponseAPDU select(java.lang.String aid)
                    throws OneWireException,
                           OneWireIOException,
                           java.lang.IllegalArgumentException
Selects an applet by AID. Lenght of AID should not exceed AID_SIZE.
Parameters:
aid - the AID of the applet to be selected.
Returns:
ResponseAPDU indicating success or failure.
  • Success SW 0x9000.
  • Failure SW 0x8453. Applet not found.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

process

public ResponseAPDU process(CommandAPDU capdu)
                     throws OneWireException,
                            OneWireIOException,
                            java.lang.IllegalArgumentException
Sends a generic process command to the JavaiButton. This method can be used to send any CommandAPDU.
Parameters:
capdu - CommandAPDU to be sent to the Java iButton.
Returns:
ResponseAPDU the response from the Java iButton.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -  

sendAPDU

public ResponseAPDU sendAPDU(CommandAPDU capdu,
                             int runTime)
                      throws OneWireException,
                             OneWireIOException,
                             java.lang.IllegalArgumentException
Sends a CommandAPDU to the Java iButton.
Parameters:
capdu - the CommandAPDU to be sent to the Java iButton
runTime - the run time value sent to the OWUS register
Returns:
ResponseAPDU the ResponseAPDU from the Java iButton.
Throws:
OneWireException -  
OneWireIOException -  
java.lang.IllegalArgumentException -