Dallas Semiconductor 1-Wire API 1.00 Alpha: Class OneWireContainer16

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.onewire.container
Class OneWireContainer16

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

public class OneWireContainer16
extends OneWireContainer

1-Wire container for Java-powered iButton, DS195X. This container encapsulates the functionality of the iButton family type 16 and 96 (hex)

### Features

- Java Card™ 2.0-compliant
- True 32-bit Java integers for straightforward computation
- Automatic garbage collection for efficient reuse of memory space
- Resizable scratchpad optimizes memory usage and allows large atomic transactions
- Dynamic applet capability for post-issuance updates
- up to 64-kbyte ROM for Java VM and operating system
- 6-kbyte NV SRAM–writes in 100 nanoseconds–supports multiple applications
- Java-accessible True Time Clock time-stamps transactions
- Java-accessible random number generator for cryptographic keys
- JavaCardX.Crypto, SHA-1, RSA DES, triple DES cryptographic classes for secret key digital signatures
- PKI support: PKCS # 11(Netscape®), CSP (Microsoft®), X509 certificates
- Support for Win2000 log-on
- Physically secure iButtonTM case zeroizes contents on tampering
- 3V to 5V operating range
- ESD protection >25,000V
- Over 10 years of data retention

### Usage

  See the usage examples in `CommandAPDU` to create `CommandAPDU`.
  See the usage examples in `ResponseAPDU` to create `ResponseAPDU`.

### DataSheet

  http://www.ibutton.com/ibuttons/java.html

Version:
  0.00, 28 Aug 2000
See Also:
  `CommandAPDU`, `ResponseAPDU`

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()` Creates an empty OneWireContainer16.
`OneWireContainer16(DSPortAdapter sourceAdapter, byte[] newAddress)` Creates a OneWireContainer16 with the provided adapter object and the address of this Java iButton.
`OneWireContainer16(DSPortAdapter sourceAdapter, long newAddress)` Creates a OneWireContainer16 with the provided adapter object and the address of this Java iButton.
`OneWireContainer16(DSPortAdapter sourceAdapter, String newAddress)` Creates a OneWireContainer16 with the provided adapter object and the address of this Java iButton.

Method Summary
`ResponseAPDU` | `deleteAppletByAID(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.
`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 this Java iButton.
`CommandAPDU` | `getCommandAPDUInfo()` Gets the current `CommandAPDU` sent to this Java iButton
`ResponseAPDU` | `getCommandPINMode()` Gets the Command PIN Mode.
`ResponseAPDU` | `getCommitBufferSize()` Gets the size of the Commit Buffer.
`String` | `getDescription()` Gets a short description of the function of this 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 this 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.
`String` | `getName()` Gets the Dallas Semiconductor part number of this Java iButton as a string.
`ResponseAPDU` | `getPORCount()` Gets the number of times this 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 this Java iButton.
`ResponseAPDU` | `getRealTimeClock()` Gets the Real Time Clock.
`ResponseAPDU` | `getResponseAPDUInfo()` Gets the current `ResponseAPDU` received from this Java iButton
`ResponseAPDU` | `getRestoreMode()` Gets the Restore Mode.
`int` | `getRunTime()` Gets the run time value set for this Java iButton
`ResponseAPDU` | `loadApplet(InputStream appletInputStream, String aid)` Loads an applet onto this Java iButton.
`ResponseAPDU` | `loadApplet(String fileName, String directoryName, String aid)` Loads an applet onto this Java iButton.
`ResponseAPDU` | `masterErase()` Clears all memory in this Java iButton.
`ResponseAPDU` | `process(CommandAPDU capdu)` Sends a generic process command to this JavaiButton.
`ResponseAPDU` | `select(String aid)` Selects an applet by AID.
`ResponseAPDU` | `sendAPDU(CommandAPDU capdu, int runTime)` Sends a `CommandAPDU` to this 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(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(String passwd)` Sets the PIN used to communicate with this Java iButton.
`ResponseAPDU` | `setRestoreMode(int mode)` Sets the Restore Mode.
`void` | `setRunTime(int newRunTime)` Sets the run time value for this Java iButton
`void` | `setupContainer(DSPortAdapter sourceAdapter, byte[] newAddress)` Provides an adapter object to access this Java iButton.
`void` | `setupContainer(DSPortAdapter sourceAdapter, long newAddress)` Provides an adapter object to access this Java iButton.
`void` | `setupContainer(DSPortAdapter sourceAdapter, String newAddress)` Provides an adapter object to access this Java iButton.
`void` | `setupJibComm(DSPortAdapter sourceAdapter, byte[] newAddress)` Provides an `JibComm` object to communicate with this 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()

  Creates an empty OneWireContainer16. Must call `setupContainer()` method before using this new container.

  This is one of the methods to construct a OneWireContainer16. The others are through creating a OneWireContainer16 with parameters.

  See Also:
    `OneWireContainer16(DSPortAdapter,byte[])`, `OneWireContainer16(DSPortAdapter,long)`, `OneWireContainer16(DSPortAdapter,String)`, `setupContainer(DSPortAdapter,byte[])`, `setupContainer(DSPortAdapter,long)`, `setupContainer(DSPortAdapter,String)`

### OneWireContainer16

    public OneWireContainer16(DSPortAdapter sourceAdapter,
                              byte[] newAddress)

  Creates a OneWireContainer16 with the provided adapter object and the address of this Java iButton. This is one of the methods to construct a OneWireContainer16. The others are through creating a OneWireContainer16 with different parameters types.
  Parameters:
    `sourceAdapter` - adapter object required to communicate with this Java iButton
    `newAddress` - address of this Java iButton
  See Also:
    `Address`, `OneWireContainer16()`, `OneWireContainer16(DSPortAdapter,long)`, `OneWireContainer16(DSPortAdapter,String)`

### OneWireContainer16

    public OneWireContainer16(DSPortAdapter sourceAdapter,
                              long newAddress)

  Creates a OneWireContainer16 with the provided adapter object and the address of this Java iButton. This is one of the methods to construct a OneWireContainer16. The others are through creating a OneWireContainer16 with different parameters types.
  Parameters:
    `sourceAdapter` - adapter object required to communicate with this Java iButton
    `newAddress` - address of this Java iButton
  See Also:
    `Address`, `OneWireContainer16()`, `OneWireContainer16(DSPortAdapter,byte[])`, `OneWireContainer16(DSPortAdapter,String)`

### OneWireContainer16

    public OneWireContainer16(DSPortAdapter sourceAdapter,
                              String newAddress)

  Creates a OneWireContainer16 with the provided adapter object and the address of this Java iButton. This is one of the methods to construct a OneWireContainer16. The others are through creating a OneWireContainer16 with different parameters types.
  Parameters:
    `sourceAdapter` - adapter object required to communicate with this Java iButton
    `newAddress` - address of this Java iButton
  See Also:
    `Address`, `OneWireContainer16()`, `OneWireContainer16(DSPortAdapter,byte[])`, `OneWireContainer16(DSPortAdapter,long)`

Method Detail

### getName

    public String getName()

  Gets the Dallas Semiconductor part number of this Java iButton as a string. For example "DS195X".
  Overrides:
    `getName` in class `OneWireContainer`
  Returns:
    string represetation of this Java iButton name

### getAlternateNames

    public 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 String getDescription()

  Gets a short description of the function of this Java iButton.
  Overrides:
    `getDescription` in class `OneWireContainer`
  Returns:
    string represetation of the function description

### setupContainer

    public void setupContainer(DSPortAdapter sourceAdapter,
                               byte[] newAddress)

  Provides an adapter object to access this 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.
  See Also:
    `Address`

### setupContainer

    public void setupContainer(DSPortAdapter sourceAdapter,
                               long newAddress)

  Provides an adapter object to access this 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
  See Also:
    `Address`

### setupContainer

    public void setupContainer(DSPortAdapter sourceAdapter,
                               String newAddress)

  Provides an adapter object to access this 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
  See Also:
    `Address`

### setupJibComm

    public void setupJibComm(DSPortAdapter sourceAdapter,
                             byte[] newAddress)

  Provides an `JibComm` object to communicate with this Java iButton.
  Parameters:
    `sourceAdapter` - adapter object required to communicate with this Java iButton
    `newAddress` - address of this One-Wire device as a byte array
  See Also:
    `Address`

### getMaxSpeed

    public int getMaxSpeed()

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

### getCommandAPDUInfo

    public CommandAPDU getCommandAPDUInfo()

  Gets the current `CommandAPDU` sent to this Java iButton
  Returns:
    current `CommandAPDU` sent to this Java iButton

### getResponseAPDUInfo

    public ResponseAPDU getResponseAPDUInfo()

  Gets the current `ResponseAPDU` received from this Java iButton
  Returns:
    current `ResponseAPDU` received from this Java iButton

### getRunTime

    public int getRunTime()

  Gets the run time value set for this Java iButton
  Returns:
    run time value of this Java iButton
  See Also:
    `setRunTime(int)`

### setRunTime

    public void setRunTime(int newRunTime)
                    throws IllegalArgumentException

  Sets the run time value for this Java iButton
  Parameters:
    `runTime` - a `4` bit value (`0 -15`) that represents the expected run time of the device Actual run time is calculated as followed: `

            runTime * 250 + 62.5 mS

          Therefore, 0 -> 0 * 250 + 62.5 =  62.5 mS
                     1 -> 1 * 250 + 62.5 = 312.5 mS

    ` and so on.
  Throws:
    `IllegalArgumentException` - Invalid run time value
  See Also:
    `getRunTime()`

### 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
  See Also:
    `getLoadPacketSize()`, `loadApplet(java.io.InputStream, java.lang.String)`

### getLoadPacketSize

    public int getLoadPacketSize()

  Gets the size of the packets sent on load.
  Returns:
    size of the packets sent on load
  See Also:
    `setLoadPacketSize(int)`, `loadApplet(java.io.InputStream, java.lang.String)`

### setPIN

    public void setPIN(String passwd)

  Sets the PIN used to communicate with this 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 this Java iButton for each command that requires a PIN
  See Also:
    `getCommandPINMode()`, `setCommandPINMode(int)`, `setCommonPIN(java.lang.String)`

### getFreeRAM

    public ResponseAPDU getFreeRAM()
                            throws OneWireException,
                                   OneWireIOException,
                                   IllegalArgumentException

  Gets the amount of free RAM in this Java iButton. No PIN required.
  Returns:
    `ResponseAPDU` with a data field containing the amount of free RAM in this Java iButton. Value returned is in little endian format.
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]

### getRandomBytes

    public ResponseAPDU getRandomBytes(int numBytes)
                                throws OneWireException,
                                       OneWireIOException,
                                       IllegalArgumentException

  Gets requested number of bytes of random data generated by this Java iButton. No PIN required.
  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.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]

### getFirmwareVersionString

    public ResponseAPDU getFirmwareVersionString()
                                          throws OneWireException,
                                                 OneWireIOException,
                                                 IllegalArgumentException

  Gets the firmware version string. No PIN required.
  Returns:
    `ResponseAPDU` with a data field containing the firmware version string of this Java iButton
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]

### getLastError

    public ResponseAPDU getLastError()
                              throws OneWireException,
                                     OneWireIOException,
                                     IllegalArgumentException

  Gets the last error value. If the error reporting mode is set (`1`), then this method will return the value of the last exception. No PIN required.
  Returns:
    `ResponseAPDU` containing the last exception value
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getErrorReportingMode()`, `setErrorReportingMode(int)`

### getErrorReportingMode

    public ResponseAPDU getErrorReportingMode()
                                       throws OneWireException,
                                              OneWireIOException,
                                              IllegalArgumentException

  Gets the Error Reporting Mode. This function is not supported in the `.033` version of the firmware. No PIN required.
  Returns:
    `ResponseAPDU` containing the error reporting mode
    - Success SW 0x9000.
    - Failure SW 0x6A02. Command not supported by this Java iButton.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getLastError()`, `setErrorReportingMode(int)`

### setErrorReportingMode

    public ResponseAPDU setErrorReportingMode(int mode)
                                       throws OneWireException,
                                              OneWireIOException,
                                              IllegalArgumentException

  Sets the Error Reporting mode. If the error reporting mode is set (`1`), this Java iButton stores the last exception value code. This code can be retreived by calling `getLastError()`.
  Parameters:
    `mode` - `1` to turn on Error Reporting Mode. `0` to turn off.
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getLastError()`, `getErrorReportingMode()`

### getAIDByNumber

    public ResponseAPDU getAIDByNumber(int index)
                                throws OneWireException,
                                       OneWireIOException,
                                       IllegalArgumentException

  Gets the AID of the applet by its installed number. No PIN required.
  Parameters:
    `index` - installed number of the applet on this 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`.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]

### deleteSelectedApplet

    public ResponseAPDU deleteSelectedApplet()
                                      throws OneWireException,
                                             OneWireIOException,
                                             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.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `deleteAppletByAID(java.lang.String)`, `deleteAppletByNumber(int)`

### deleteAppletByNumber

    public ResponseAPDU deleteAppletByNumber(int index)
                                      throws OneWireException,
                                             OneWireIOException,
                                             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.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `deleteAppletByAID(java.lang.String)`, `deleteSelectedApplet()`

### deleteAppletByAID

    public ResponseAPDU deleteAppletByAID(String aid)
                                   throws OneWireException,
                                          OneWireIOException,
                                          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.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `deleteSelectedApplet()`, `deleteAppletByNumber(int)`

### loadApplet

    public ResponseAPDU loadApplet(InputStream appletInputStream,
                                   String aid)
                            throws OneWireException,
                                   OneWireIOException,
                                   IllegalArgumentException,
                                   IOException

  Loads an applet onto this Java iButton. This method takes an input stream and an AID. The AID length must NOT exceed `AID_SIZE`.
  Parameters:
    `in` - Stream to read the applet from
    `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
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IOException` - Problem reading applet from the stream
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getLoadPINMode()`, `setLoadPINMode(int)`

### loadApplet

    public ResponseAPDU loadApplet(String fileName,
                                   String directoryName,
                                   String aid)
                            throws OneWireException,
                                   OneWireIOException,
                                   IllegalArgumentException,
                                   FileNotFoundException,
                                   IOException

  Loads an applet onto this Java iButton. This method takes an applet filename, directory and AID. The AID length must NOT exceed `AID_SIZE`.
  Parameters:
    `fileName` - file name of the applet to be loaded into this 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
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `FileNotFoundException` - Applet file not found
    `IOException` - Problem reading applet file
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getLoadPINMode()`, `setLoadPINMode(int)`

### masterErase

    public ResponseAPDU masterErase()
                             throws OneWireException,
                                    OneWireIOException,
                                    IllegalArgumentException

  Clears all memory in this Java iButton. The erase will occur at the beginning of the next command.
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]

### getPORCount

    public ResponseAPDU getPORCount()
                             throws OneWireException,
                                    OneWireIOException,
                                    IllegalArgumentException

  Gets the number of times this 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.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `masterErase()`

### getRealTimeClock

    public ResponseAPDU getRealTimeClock()
                                  throws OneWireException,
                                         OneWireIOException,
                                         IllegalArgumentException

  Gets the Real Time Clock. No PIN required.
  Returns:
    `ResponseAPDU` containing the value of the real time clock
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]

### getATR

    public ResponseAPDU getATR()
                        throws OneWireException,
                               OneWireIOException,
                               IllegalArgumentException

  Gets the Answer To Reset (ATR) from this Java iButton. No PIN required.
  Returns:
    `ResponseAPDU` containing the ATR in the data field
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]

### getEphemeralGCMode

    public ResponseAPDU getEphemeralGCMode()
                                    throws OneWireException,
                                           OneWireIOException,
                                           IllegalArgumentException

  Gets the Ephemeral Gabage Collection Mode. A value of `1` indicates ephemeral garbage collection is turned on, `0` if turned off. No PIN required.
  Returns:
    `ResponseAPDU` containing the Ephemeral Garbage Collector Mode
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `setEphemeralGCMode(int)`

### getAppletGCMode

    public ResponseAPDU getAppletGCMode()
                                 throws OneWireException,
                                        OneWireIOException,
                                        IllegalArgumentException

  Gets the Applet Garbage Collection Mode. A value of `1` indicates applet garbage collection is turned on, `0` if turned off. No PIN required.
  Returns:
    `ResponseAPDU` containing the Applet Garbage Collector Mode
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `setAppletGCMode(int)`

### getCommandPINMode

    public ResponseAPDU getCommandPINMode()
                                   throws OneWireException,
                                          OneWireIOException,
                                          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. No PIN required.
  Returns:
    `ResponseAPDU` containing the Command PIN Mode
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `setCommandPINMode(int)`, `setCommonPIN(java.lang.String)`, `setPIN(java.lang.String)`

### getLoadPINMode

    public ResponseAPDU getLoadPINMode()
                                throws OneWireException,
                                       OneWireIOException,
                                       IllegalArgumentException

  Gets the Load PIN Mode. A value of `1` indicates that a PIN is required for Applet loading. No PIN required.
  Returns:
    `ResponseAPDU` containing the Load PIN Mode
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `loadApplet(java.io.InputStream, java.lang.String)`, `setLoadPINMode(int)`

### getRestoreMode

    public ResponseAPDU getRestoreMode()
                                throws OneWireException,
                                       OneWireIOException,
                                       IllegalArgumentException

  Gets the Restore Mode. When Restore Mode is enabled (`1`), 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. No PIN required.
  Returns:
    `ResponseAPDU` containing the Restore Mode
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `setRestoreMode(int)`

### getExceptionMode

    public ResponseAPDU getExceptionMode()
                                  throws OneWireException,
                                         OneWireIOException,
                                         IllegalArgumentException

  Gets the Exception Mode. When Exception Mode is enabled (`1`), Java API exceptions are thrown. All uncaught exceptions return 0x6F00 in the SW. When disabled, an error is returned from the VM. No PIN required.
  Returns:
    `ResponseAPDU` containing the Exception Mode value
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `setExceptionMode(int)`

### getCommitBufferSize

    public ResponseAPDU getCommitBufferSize()
                                     throws OneWireException,
                                            OneWireIOException,
                                            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`. No PIN required.
  Returns:
    `ResponseAPDU` containing the Commit Buffer size in little endian format
    - Success SW 0x9000.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getFreeRAM()`, `setCommitBufferSize(int)`

### setCommonPIN

    public ResponseAPDU setCommonPIN(String newPIN)
                              throws OneWireException,
                                     OneWireIOException,
                                     IllegalArgumentException

  Sets the Common PIN. This method is used to change the value of the Common PIN on the Java iButton. If this 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 this Java iButton
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getCommandPINMode()`, `setCommandPINMode(int)`, `setPIN(java.lang.String)`

### setEphemeralGCMode

    public ResponseAPDU setEphemeralGCMode(int mode)
                                    throws OneWireException,
                                           OneWireIOException,
                                           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` - `1` to turn on Ephemeral Garbage Collection Mode. `0` to turn off.
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getEphemeralGCMode()`

### setAppletGCMode

    public ResponseAPDU setAppletGCMode(int mode)
                                 throws OneWireException,
                                        OneWireIOException,
                                        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` - `1` to turn on Applet Garbage Collection Mode. `0` to turn off.
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getAppletGCMode()`

### setCommandPINMode

    public ResponseAPDU setCommandPINMode(int mode)
                                   throws OneWireException,
                                          OneWireIOException,
                                          IllegalArgumentException

  Sets the Command PIN Mode. If command PIN mode is set to `1`, a PIN is required for all Administrative commands.
  Parameters:
    `mode` - `1` to turn on Command PIN Mode. `0` to turn off.
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getCommandPINMode()`, `setCommonPIN(java.lang.String)`, `setPIN(java.lang.String)`

### setLoadPINMode

    public ResponseAPDU setLoadPINMode(int mode)
                                throws OneWireException,
                                       OneWireIOException,
                                       IllegalArgumentException

  Sets the Load PIN Mode. If the load PIN mode is set (`1`), then PINs are required on applet loading.
  Parameters:
    `mode` - `1` to turn on Load PIN Mode. `0` to turn off.
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getLoadPINMode()`, `loadApplet(java.io.InputStream, java.lang.String)`

### setRestoreMode

    public ResponseAPDU setRestoreMode(int mode)
                                throws OneWireException,
                                       OneWireIOException,
                                       IllegalArgumentException

  Sets the Restore Mode. When Restore Mode is enabled (`1`), 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` - `1` to turn on Restore Mode. `0` to turn off.
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getRestoreMode()`

### setExceptionMode

    public ResponseAPDU setExceptionMode(int mode)
                                  throws OneWireException,
                                         OneWireIOException,
                                         IllegalArgumentException

  Sets the Exception Mode. When Exception Mode is enabled (`1`), Java API exceptions are thrown. All uncaught exceptions return 0x6F00 in the SW. When disabled, an error is returned from the VM.
  Parameters:
    `mode` - `1` to turn on Exception Mode. `0` to turn off.
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6681. Invalid PIN.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getExceptionMode()`

### setCommitBufferSize

    public ResponseAPDU setCommitBufferSize(int size)
                                     throws OneWireException,
                                            OneWireIOException,
                                            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.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `getCommitBufferSize()`

### select

    public ResponseAPDU select(String aid)
                        throws OneWireException,
                               OneWireIOException,
                               IllegalArgumentException

  Selects an applet by AID. Lenght of AID should not exceed `AID_SIZE`. No PIN required.
  Parameters:
    `aid` - the AID of the applet to be selected
  Returns:
    `ResponseAPDU` indicating success or failure
    - Success SW 0x9000.
    - Failure SW 0x6A82. Unable to Select Applet
    - Failure SW 0x8453. Applet not found.
    - For additional error codes, please see: http://www.ibutton.com/jibkit/documents/sw.html
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `deleteAppletByAID(java.lang.String)`, `deleteAppletByNumber(int)`, `deleteSelectedApplet()`, `getAIDByNumber(int)`, `process(com.dalsemi.onewire.container.CommandAPDU)`

### process

    public ResponseAPDU process(CommandAPDU capdu)
                         throws OneWireException,
                                OneWireIOException,
                                IllegalArgumentException

  Sends a generic process command to this JavaiButton. This method can be used to send any `CommandAPDU`. No PIN required.
  Parameters:
    `capdu` - `CommandAPDU` to be sent to this Java iButton
  Returns:
    `ResponseAPDU` the response from this Java iButton
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]
  See Also:
    `select(java.lang.String)`

### sendAPDU

    public ResponseAPDU sendAPDU(CommandAPDU capdu,
                                 int runTime)
                          throws OneWireException,
                                 OneWireIOException,
                                 IllegalArgumentException

  Sends a `CommandAPDU` to this Java iButton. No PIN required.
  Parameters:
    `capdu` - the `CommandAPDU` to be sent to this Java iButton
    `runTime` - a `4` bit value (`0 -15`) that represents the expected run time of the device `

            runTime * 250 + 62.5 mS

          Therefore, 0 -> 0 * 250 + 62.5 =  62.5 mS
                     1 -> 1 * 250 + 62.5 = 312.5 mS

    ` and so on.
  Returns:
    `ResponseAPDU` the `ResponseAPDU` from this Java iButton
  Throws:
    `IllegalArgumentException` - Invalid run time value
    `OneWireException` - Part could not be found [ fatal ]
    `OneWireIOException` - Data wasn't transferred properly [ recoverable ]

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD