com.dalsemi.onewire.container
Class OneWireContainer18

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

public class OneWireContainer18
extends OneWireContainer

1-Wire® container for a SHA Transaction iButton, DS1963S. This container encapsulates the functionality of the 1-Wire family type 18 (hex).

Features

This container provides the functionality to use the raw power of the DS1963S. It does not immediately implement transactions and authentication. The class SHAiButton does these. The SHAiButton class exists on top of this class, making higher level calls to implement transactions.

This container makes use of several optimizations to help it run fast on TINI. These optimizations do little for the PC, but they do not slow down the PC. Most methods are synchronized because they access an instance byte array. This is less expensive than creating new byte arrays for every method, because there should not be contention for the resources in this container between threads. Threads should use the com.dalsemi.onewire.adapter.DSPortAdapter methods beginExclusive(boolean) and endExclusive() to synchronize on the 1-Wire port.

Notice that for maximum performance, programs should call the method setSpeedCheck(boolean) with an argument false before any other methods that access the 1-Wire. A program that calls this function is assumed to understand and control the speed of communication on the 1-Wire bus. If the speed check is not disabled, a call to the method OneWireContainer.doSpeed() will occur in almost every function. While this should guarantee that the 1-Wire bus is never at an unknown speed, it will slow down throughput considerably.

Memory

In the interest of speed, this container has several methods to quickly access the memory of a DS9163S. These methods include:

The memory can also be accessed through the objects that are returned from the getMemoryBanks method.

The following is a list of the MemoryBank instances that are returned:

Usage

For examples on using the SHA iButton for transactions and authentications, see the examples in the SHAiButton usage section.

For examples regarding memory operations,

DataSheet

http://pdfserv.maxim-ic.com/arpdf/DS1963S.pdf

Note that the protocol for transactions using SHA iButtons calls for 2 iButtons. One belongs to the system that grants authentication and is authorized to validate money. This iButton is usually called the Coprocessor. The other iButton is the device that contains digital money that must be authenticated and verified to perform transactions. This iButton is usually called a User iButton, Roaming iButton, or Roving iButton.

Version:
0.00, 28 Aug 2000
See Also:
SHAiButtonUser18, DSPortAdapter.beginExclusive(boolean), DSPortAdapter.endExclusive(), OneWireContainer.doSpeed()

Field Summary
static byte AUTH_HOST
           
static byte COMPUTE_CHALLENGE
           
static byte COMPUTE_FIRST_SECRET
           
static byte COMPUTE_NEXT_SECRET
           
static byte COMPUTE_SHA
           
static byte COPY_SCRATCHPAD
           
static byte ERASE_SCRATCHPAD
           
static byte[] FF
           
static byte MATCH_SCRATCHPAD
           
static byte READ_AUTHENTICATED_PAGE
           
static byte READ_MEMORY
           
static byte READ_SCRATCHPAD
           
static byte RESUME
           
static byte SIGN_DATA_PAGE
           
static byte VALIDATE_DATA_PAGE
           
static byte WRITE_SCRATCHPAD
           
 
Constructor Summary
OneWireContainer18()
          Creates a new OneWireContainer for communication with a DS1963S SHA iButton.
OneWireContainer18(DSPortAdapter sourceAdapter, byte[] newAddress)
          Creates a new OneWireContainer for communication with a DS1963S SHA iButton.
OneWireContainer18(DSPortAdapter sourceAdapter, long newAddress)
          Creates a new OneWireContainer for communication with a DS1963S SHA iButton.
OneWireContainer18(DSPortAdapter sourceAdapter, String newAddress)
          Creates a new OneWireContainer for communication with a DS1963S SHA iButton.
 
Method Summary
 boolean bindSecretToiButton(int page, byte[] bind_data, byte[] bind_code, int secret_number)
          Binds an installed secret to a DS1963S by using well-known binding data and the DS1963S's unique address.
 boolean copyScratchPad()
          Copies the contents of the scratchpad to the target destination that was specified in a call to writeScratchPad() or eraseScratchPad().
 boolean eraseScratchPad(int page)
          Erases the scratchpad of the DS1963S.
 String getAlternateNames()
          Retrieve the alternate Dallas Semiconductor part numbers or names.
 String getDescription()
          Get a short description of the function of this iButton or 1-Wire Device type.
 int getMaxSpeed()
          Returns the maximum speed this iButton device can communicate at.
 Enumeration getMemoryBanks()
          Gets an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank, PagedMemoryBank, and OTPMemoryBank.
 String getName()
          Get the Dallas Semiconductor part number of the iButton or 1-Wire Device as a java.lang.String.
 boolean installMasterSecret(int page, byte[] secret, int secret_number)
          Installs a secret on a DS1963S.
 boolean matchScratchPad(byte[] mac)
          Verifies the hidden signature in the scratchpad of the DS1963S.
 boolean readAuthenticatedPage(int pageNum, byte[] data, int start)
          Reads and authenticates a page.
 void readMemoryPage(int pageNum, byte[] data, int start)
          Reads a memory page from the DS1963S.
 int readScratchPad(byte[] data, int start)
          Reads the contents of the DS1963S scratchpad.
 void setSpeedCheck(boolean doSpeedCheck)
          Directs the container to avoid the calls to doSpeed() in methods that communicate with the SHA iButton.
 void setupContainer(DSPortAdapter sourceAdapter, byte[] newAddress)
          Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device.
 boolean SHAFunction(byte function)
          Performs one of the DS1963S's cryptographic functions.
 boolean SHAFunction(byte function, int T)
          Performs one of the DS1963S's cryptographic functions.
 void useResume(boolean set)
          Tells this OneWireContainer18 whether it can use the RESUME command.
 boolean waitForSuccessfulFinish()
          Waits for the DS1963S's output to alternate.
 boolean writeDataPage(int page_number, byte[] page_data)
          Writes a data page to the DS1963S.
 boolean writeScratchPad(int targetPage, int targetPageOffset, byte[] inputbuffer, int start, int length)
          Writes data to the scratchpad.
 
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer
doSpeed, getAdapter, getAddress, getAddressAsLong, getAddressAsString, isAlarming, isPresent, setSpeed, setupContainer, setupContainer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FF

public static byte[] FF

READ_MEMORY

public static final byte READ_MEMORY

WRITE_SCRATCHPAD

public static final byte WRITE_SCRATCHPAD

MATCH_SCRATCHPAD

public static final byte MATCH_SCRATCHPAD

ERASE_SCRATCHPAD

public static final byte ERASE_SCRATCHPAD

READ_SCRATCHPAD

public static final byte READ_SCRATCHPAD

READ_AUTHENTICATED_PAGE

public static final byte READ_AUTHENTICATED_PAGE

COPY_SCRATCHPAD

public static final byte COPY_SCRATCHPAD

COMPUTE_SHA

public static final byte COMPUTE_SHA

COMPUTE_FIRST_SECRET

public static final byte COMPUTE_FIRST_SECRET

COMPUTE_NEXT_SECRET

public static final byte COMPUTE_NEXT_SECRET

VALIDATE_DATA_PAGE

public static final byte VALIDATE_DATA_PAGE

SIGN_DATA_PAGE

public static final byte SIGN_DATA_PAGE

COMPUTE_CHALLENGE

public static final byte COMPUTE_CHALLENGE

AUTH_HOST

public static final byte AUTH_HOST

RESUME

public static final byte RESUME
Constructor Detail

OneWireContainer18

public OneWireContainer18()
Creates a new OneWireContainer for communication with a DS1963S SHA iButton. Note that the method setupContainer(com.dalsemi.onewire.adapter.DSPortAdapter,byte[]) must be called to set the correct DSPortAdapter device address.
See Also:
setupContainer(DSPortAdapter,byte[]), OneWireContainer18(DSPortAdapter,byte[]), OneWireContainer18(DSPortAdapter,long), OneWireContainer18(DSPortAdapter,String)

OneWireContainer18

public OneWireContainer18(DSPortAdapter sourceAdapter,
                          byte[] newAddress)
Creates a new OneWireContainer for communication with a DS1963S SHA iButton.
Parameters:
sourceAdapter - adapter object required to communicate with this iButton
newAddress - address of this DS1963S SHA iButton
See Also:
OneWireContainer18(), OneWireContainer18(DSPortAdapter,long), OneWireContainer18(DSPortAdapter,String)

OneWireContainer18

public OneWireContainer18(DSPortAdapter sourceAdapter,
                          long newAddress)
Creates a new OneWireContainer for communication with a DS1963S SHA iButton.
Parameters:
sourceAdapter - adapter object required to communicate with this iButton
newAddress - address of this DS1963S SHA iButton
See Also:
OneWireContainer18(), OneWireContainer18(DSPortAdapter,byte[]), OneWireContainer18(DSPortAdapter,String)

OneWireContainer18

public OneWireContainer18(DSPortAdapter sourceAdapter,
                          String newAddress)
Creates a new OneWireContainer for communication with a DS1963S SHA iButton.
Parameters:
sourceAdapter - adapter object required to communicate with this iButton
newAddress - address of this DS1963S SHA iButton
See Also:
OneWireContainer18(), OneWireContainer18(DSPortAdapter,byte[]), OneWireContainer18(DSPortAdapter,long)
Method Detail

setupContainer

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

Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device. Overrides the OneWireContainer method for speed, as the OneWireContainer version has a byte array allocation. Since there is a call to setupContainer() in the critical path of a transaction (when a roving SHA iButton is introduced to the 1-Wire Bus), this must occur quickly. This improves performance on TINI.

Overrides:
setupContainer in class OneWireContainer
Parameters:
sourceAdapter - adapter object required to communicate with this iButton
newAddress - address of this 1-Wire device
See Also:
Address

getName

public String getName()
Get the Dallas Semiconductor part number of the iButton or 1-Wire Device as a java.lang.String. For example "DS1992".
Overrides:
getName in class OneWireContainer
Returns:
iButton or 1-Wire device name

getAlternateNames

public String getAlternateNames()
Retrieve the alternate Dallas Semiconductor part numbers or names. A 'family' of MicroLAN 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:
the alternate names for this iButton or 1-Wire device

getDescription

public String getDescription()
Get a short description of the function of this iButton or 1-Wire Device type.
Overrides:
getDescription in class OneWireContainer
Returns:
device description

getMaxSpeed

public int getMaxSpeed()
Returns the maximum speed this iButton device can communicate at.
Overrides:
getMaxSpeed in class OneWireContainer
Returns:
maximum speed
See Also:
DSPortAdapter.setSpeed(int)

getMemoryBanks

public Enumeration getMemoryBanks()
Gets an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank, PagedMemoryBank, and OTPMemoryBank.
Overrides:
getMemoryBanks in class OneWireContainer
Returns:
Enumeration of memory banks

setSpeedCheck

public void setSpeedCheck(boolean doSpeedCheck)
Directs the container to avoid the calls to doSpeed() in methods that communicate with the SHA iButton. To ensure that all parts can talk to the 1-Wire bus at their desired speed, each method contains a call to doSpeed(). However, this is an expensive operation. If a user manages the bus speed in an application, call this method with doSpeedCheck as false. The default behavior is to call doSpeed().
Parameters:
doSpeedCheck - true for doSpeed() to be called before every 1-Wire bus access, false to skip this expensive call
See Also:
OneWireContainer.doSpeed()

useResume

public void useResume(boolean set)

Tells this OneWireContainer18 whether it can use the RESUME command. The RESUME command allows the DS1963S to be re-selected for communication quickly by using a one byte RESUME command rather than a nine byte selection sequence. If another 1-Wire device is accessed, useResume(false) must be called, a normal selection of the part must be performed, and then useResume(true) can be called.

Parameters:
set - true to use the one byte RESUME command instead of the nine byte select command
See Also:
RESUME

eraseScratchPad

public boolean eraseScratchPad(int page)
                        throws OneWireIOException,
                               OneWireException

Erases the scratchpad of the DS1963S. The cryptographic features of the DS1963S leave the device in 'hidden mode', which makes most memory functions inaccessible. A call to eraseScratchPad(int) brings the device out of 'hidden mode', filling the scratchpad with 0x0FF bytes.

The argument page is usually unimportant, except in cases where a memory page needs to be erased. Erase a memory page by calling eraseScratchPad(page_number), followed by readScratchPad() and then copyScratchPad().

Parameters:
page - the target page number
Returns:
true if successful, false if the operation failed while waiting for the DS1963S's output to alternate (see the datasheet for a description)
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
waitForSuccessfulFinish(), readScratchPad(byte[],int), copyScratchPad()

waitForSuccessfulFinish

public boolean waitForSuccessfulFinish()
                                throws OneWireIOException,
                                       OneWireException

Waits for the DS1963S's output to alternate. Several operations must wait for the DS1963S to stop sending 0x0ff's and begin alternating its output bits. This method reads until it finds a non-0x0ff byte or until it reaches a specified number of tries, indicating failure.

This method can often be optimized away. A normal 1-Wire transaction involves writing and reading a known number of bytes. If a few more bytes are read, a program can check to see if the DS1963S has started alternating its output much quicker than calling this method will. For instance, to copy the scratchpad, the source code might look like this:

    buffer [0] = COPY_SCRATCHPAD;
    buffer [1] = TA1;
    buffer [2] = TA2;
    buffer [3] = ES;

    adapter.dataBlock(buffer,0,4);
    return waitForSuccessfulFinish();
 
To optimize the code, read more bytes than required:
    buffer [0] = COPY_SCRATCHPAD;
    buffer [1] = TA1;
    buffer [2] = TA2;
    buffer [3] = ES;

    //copy 0x0FF into the buffer, this effectively reads
    System.arraycopy(FF, 0, buffer, 4, 5);

    //read 5 extra bytes
    adapter.dataBlock(buffer, 0, 9);

    //if the last byte has not shown alternating output,
    //still call waitForSuccessfulFinish(), else
    //we are already done
    if (buffer [8] == ( byte ) 0x0ff)
         return waitForSuccessfulFinish();
     else
         return true;
 

The second method is faster because it is more expensive to invoke another method that goes down to the native access layer than it is to just read a few more bytes while the program is already at the native access layer.

See the datasheet for which operations function in this manner. Only call this method after another method which has successfully communicated with the DS1963S.

Returns:
true if the DS1963S completed its operation successfully
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
copyScratchPad(), eraseScratchPad(int), readAuthenticatedPage(int,byte[],int)

readMemoryPage

public void readMemoryPage(int pageNum,
                           byte[] data,
                           int start)
                    throws OneWireIOException,
                           OneWireException

Reads a memory page from the DS1963S. Pages 0-15 are normal memory pages. Pages 16 and 17 contain the secrets--the DS1963S will return all 1's (0x0ff bytes). Page 18 is the physical location of the scratchpad, and will only return valid data if the part is not in hidden mode (0x0ff bytes are returned otherwise). Pages 19 and 20 contain the write cycle counters. Page 21 contains the counter for the pseudo random number generator (PRNG). Consult the datasheet for the memory maps of these special pages.

Note that the same data can be returned through the MemoryBanks returned by getMemoryBanks(). However, this method contains several enhancements for faster reading.

Parameters:
pageNum - page number to read
data - array for the return of the data (must be at least 32 bytes long)
start - offset into the byte array to start copying page data
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
readAuthenticatedPage(int,byte[],int), getMemoryBanks()

readAuthenticatedPage

public boolean readAuthenticatedPage(int pageNum,
                                     byte[] data,
                                     int start)
                              throws OneWireIOException,
                                     OneWireException

Reads and authenticates a page. See readMemoryPage() for a description of page numbers and their contents. This method will also generate a signature for the selected page, used in the authentication of roving (User) iButtons. Extra data is returned with the page as well--such as the write cycle counter for the page and the write cycle counter of the selected secret page.

Note that the CRC will be verified by this method, though it is returned with the data.

Parameters:
pageNum - page number to read and authenticate
data - array for the page data plus extra information (2 write cycle counters of 4 bytes each, one 2 byte CRC, appended after 32 bytes of the data page). This byte array must be at least 42 bytes long.
start - offset to copy into the array
Returns:
true if successful, false if the operation failed while waiting for the DS1963S's output to alternate
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
readMemoryPage(int,byte[],int)

writeScratchPad

public boolean writeScratchPad(int targetPage,
                               int targetPageOffset,
                               byte[] inputbuffer,
                               int start,
                               int length)
                        throws OneWireIOException,
                               OneWireException

Writes data to the scratchpad. In order to write to a data page using this method, next call readScratchPad(), and then copyScratchPad(). Note that the addresses passed to this method will be the addresses the data is copied to if the copyScratchPad() method is called afterward.

Also note that if too many bytes are written, this method will truncate the data so that only a valid number of bytes will be sent.

Parameters:
targetPage - the page number this data will eventually be copied to
targetPageOffset - the offset on the page to copy this data to
inputbuffer - the data that will be copied into the scratchpad
start - offset into the input buffer for the data to write
length - number of bytes to write
Returns:
true if successful, false on a CRC error
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
copyScratchPad(), eraseScratchPad(int), readScratchPad(byte[],int), writeDataPage(int,byte[])

matchScratchPad

public boolean matchScratchPad(byte[] mac)
                        throws OneWireIOException,
                               OneWireException

Verifies the hidden signature in the scratchpad of the DS1963S. After a VALIDATE_DATA_PAGE command, the scratchpad contains a signature that cannot be read, but must be verified. This method gives the DS1963S a signature. The iButton then checks to see if it equals the hidden signature in its scratchpad.

The signature must be 20 bytes long, and it must start at offset 0 of the input array.

Parameters:
mac - the signature starting at offset 0
Returns:
true if the signature matches
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
VALIDATE_DATA_PAGE

readScratchPad

public int readScratchPad(byte[] data,
                          int start)
                   throws OneWireIOException,
                          OneWireException

Reads the contents of the DS1963S scratchpad. If the device is in hidden mode, all 1's (0x0ff bytes) will be returned.

This method will return up to 32 bytes. It may return less if the target address stored internally on the DS1963S is not a multiple of 32.

Parameters:
data - array to hold the contents of the scratchpad
start - offset to copy the scratchpad data into the byte array
Returns:
the number of bytes read, or -1 if there was a CRC failure
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
writeScratchPad(int,int,byte[],int,int)

copyScratchPad

public boolean copyScratchPad()
                       throws OneWireIOException,
                              OneWireException
Copies the contents of the scratchpad to the target destination that was specified in a call to writeScratchPad() or eraseScratchPad(). This method will not success unless a call to readScratchPad() is made first to verify the target address registers in the DS1963S.
Returns:
true if successful, false if the operation failed while waiting for the DS1963S's output to alternate
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
eraseScratchPad(int), readScratchPad(byte[],int), writeScratchPad(int,int,byte[],int,int)

installMasterSecret

public boolean installMasterSecret(int page,
                                   byte[] secret,
                                   int secret_number)
                            throws OneWireIOException,
                                   OneWireException

Installs a secret on a DS1963S. The secret is written in partial phrases of 47 bytes (32 bytes to a memory page, 15 bytes to the scratchpad) and is cumulative until the entire secret is processed. Secrets are associated with a page number. See the datasheet for more information on this association.

In most cases, page should be equal to secret_number or secret_number+8, based on the association of secrets and page numbers. Secrets are stored across pages 16 and 17 of the DS1963S memory. A secret is 8 bytes, so there are 8 secrets. These 8 secrets are associated with the first 16 pages of memory.

On TINI, this method will be slightly faster if the secret's length is divisible by 47. However, since secret key generation is a part of initialization, it is probably not necessary.

Parameters:
page - the page number used to write the partial secrets to
secret - the entire secret, in partial phrases, to be installed
secret_number - the secret 'page' to use (0 - 7)
Returns:
true if successful
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
bindSecretToiButton(int,byte[],byte[],int)

bindSecretToiButton

public boolean bindSecretToiButton(int page,
                                   byte[] bind_data,
                                   byte[] bind_code,
                                   int secret_number)
                            throws OneWireIOException,
                                   OneWireException

Binds an installed secret to a DS1963S by using well-known binding data and the DS1963S's unique address. This makes the secret unique for this iButton. Coprocessor iButtons use this method to recreate the iButton's secret to verify authentication. Roving iButtons use this method to finalize their secret keys.

Note that unlike in the installMasterSecret() method, the page number does not need to be equivalent to the secret_number modulo 8. The new secret (installed secret + binding code) is generated from this page but can be copied into another secret. User iButtons should bind to the same page the secret was installed on. Coprocessor iButtons must copy to a new secret to preserve the general system authentication secret.

The binding should be either 7 bytes long or 15 bytes long. A 15-length byte array is unaltered and placed in the scratchpad for the binding. A 7-length byte array is combined with the page number and DS1963S unique address and then placed in the scratchpad. Coprocessors should use a pre-formatted 15-length byte array. User iButtons should let the method format for them (i.e. use the 7-length byte array option).

Parameters:
page - the page number that has the master secret already installed
bind_data - 32 bytes of binding data used to bind the iButton to the system
bind_code - the 7-byte or 15-byte binding code
secret_number - secret number to copy the resulting secret to
Returns:
true if successful
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
installMasterSecret(int,byte[],int)

writeDataPage

public boolean writeDataPage(int page_number,
                             byte[] page_data)
                      throws OneWireIOException,
                             OneWireException

Writes a data page to the DS1963S. This method is the equivalent of calling:

However, this method makes several optimizations to help it run faster. Because of the optimizations, this is the preferred way of writing data to a normal memory page on the DS1963S.

Parameters:
page_number - page number to write
page_data - page data to write (must be at least 32 bytes long)
Returns:
true if successful, false if the operation failed on a CRC error or while waiting for the DS1963S's output to alternate
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
eraseScratchPad(int), writeScratchPad(int,int,byte[],int,int), readScratchPad(byte[],int), copyScratchPad()

SHAFunction

public boolean SHAFunction(byte function)
                    throws OneWireIOException,
                           OneWireException

Performs one of the DS1963S's cryptographic functions. See the datasheet for more information on these functions.

Valid parameters for the function argument are:

This method uses the last target address used by this OneWireContainer. These are read in the copyScratchPad() and readScratchPad() methods.

Parameters:
function - the SHA function code
Returns:
true if the function successfully completed, false if the operation failed on a CRC error or while waiting for the DS1963S's output to alternate
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
SHAFunction(byte,int), copyScratchPad(), readScratchPad(byte[],int)

SHAFunction

public boolean SHAFunction(byte function,
                           int T)
                    throws OneWireIOException,
                           OneWireException

Performs one of the DS1963S's cryptographic functions. See the datasheet for more information on these functions.

Valid parameters for the function argument are:

This method uses the last target address used by this OneWireContainer. These are read in the copyScratchPad() and readScratchPad() methods.

Parameters:
function - the SHA function code
T - the raw target address for the operation
Returns:
true if the function successfully completed, false if the operation failed on a CRC error or while waiting for the DS1963S's output to alternate
Throws:
OneWireIOException - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
OneWireException - on a communication or setup error with the 1-Wire adapter
See Also:
SHAFunction(byte), copyScratchPad(), readScratchPad(byte[],int)