1-Wire API for .NET Version 4.00
Public Member Functions

OneWireContainer18 Class Reference

Inherits com::dalsemi::onewire::container::OneWireContainer.

List of all members.

Public Member Functions

 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.
void setupContainer (DSPortAdapter sourceAdapter, byte[] newAddress)
String getName ()
 Get the Maxim Integrated Products part number of the iButton or 1-Wire Device as a java.lang.String.
String getAlternateNames ()
 Retrieve the alternate Maxim Integrated Products 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.
synchronized void setSpeedCheck (boolean doSpeedCheck)
 Directs the container to avoid the calls to doSpeed() in methods that communicate with the SHA iButton.
synchronized void useResume (boolean set)
synchronized boolean eraseScratchPad (int page) throws OneWireIOException, OneWireException
synchronized boolean waitForSuccessfulFinish () throws OneWireIOException, OneWireException
void readMemoryPage (int pageNum, byte[] data, int start) throws OneWireIOException, OneWireException
boolean readAuthenticatedPage (int pageNum, byte[] data, int start) throws OneWireIOException, OneWireException
synchronized boolean writeScratchPad (int targetPage, int targetPageOffset, byte[] inputbuffer, int start, int length) throws OneWireIOException, OneWireException
synchronized boolean matchScratchPad (byte[] mac) throws OneWireIOException, OneWireException
synchronized int readScratchPad (byte[] data, int start) throws OneWireIOException, OneWireException
synchronized 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().
synchronized boolean installMasterSecret (int page, byte[] secret, int secret_number) throws OneWireIOException, OneWireException
synchronized boolean bindSecretToiButton (int page, byte[] bind_data, byte[] bind_code, int secret_number) throws OneWireIOException, OneWireException
synchronized boolean writeDataPage (int page_number, byte[] page_data) throws OneWireIOException, OneWireException
boolean SHAFunction (byte function) throws OneWireIOException, OneWireException
synchronized boolean SHAFunction (byte function, int T) throws OneWireIOException, OneWireException

Detailed Description

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.

Author:
KLA
Version:
0.00, 28 Aug 2000
See also:
com.dalsemi.onewire.application.sha.SHAiButtonUser18
com.dalsemi.onewire.adapter.DSPortAdapter.beginExclusive(boolean)
com.dalsemi.onewire.adapter.DSPortAdapter.endExclusive()
OneWireContainer.doSpeed()

Constructor & Destructor Documentation

OneWireContainer18 ( DSPortAdapter  sourceAdapter,
byte[]  newAddress 
)

Creates a new OneWireContainer for communication with a DS1963S SHA iButton.

Parameters:
sourceAdapteradapter object required to communicate with this iButton
newAddressaddress of this DS1963S SHA iButton
See also:
OneWireContainer18()
OneWireContainer18(com.dalsemi.onewire.adapter.DSPortAdapter,long) OneWireContainer18(DSPortAdapter,long)
OneWireContainer18(com.dalsemi.onewire.adapter.DSPortAdapter,java.lang.String) OneWireContainer18(DSPortAdapter,String)
OneWireContainer18 ( DSPortAdapter  sourceAdapter,
long  newAddress 
)

Creates a new OneWireContainer for communication with a DS1963S SHA iButton.

Parameters:
sourceAdapteradapter object required to communicate with this iButton
newAddressaddress of this DS1963S SHA iButton
See also:
OneWireContainer18()
OneWireContainer18(com.dalsemi.onewire.adapter.DSPortAdapter,byte[]) OneWireContainer18(DSPortAdapter,byte[])
OneWireContainer18(com.dalsemi.onewire.adapter.DSPortAdapter,java.lang.String) OneWireContainer18(DSPortAdapter,String)
OneWireContainer18 ( DSPortAdapter  sourceAdapter,
String  newAddress 
)

Creates a new OneWireContainer for communication with a DS1963S SHA iButton.

Parameters:
sourceAdapteradapter object required to communicate with this iButton
newAddressaddress of this DS1963S SHA iButton
See also:
OneWireContainer18()
OneWireContainer18(com.dalsemi.onewire.adapter.DSPortAdapter,byte[]) OneWireContainer18(DSPortAdapter,byte[])
OneWireContainer18(com.dalsemi.onewire.adapter.DSPortAdapter,long) OneWireContainer18(DSPortAdapter,long)

Member Function Documentation

synchronized 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:
pagethe page number that has the master secret already installed
bind_data32 bytes of binding data used to bind the iButton to the system
bind_codethe 7-byte or 15-byte binding code
secret_numbersecret number to copy the resulting secret to
Returns:
true if successful
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
installMasterSecret(int,byte[],int)
synchronized 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
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
eraseScratchPad(int)
readScratchPad(byte[],int)
writeScratchPad(int,int,byte[],int,int)
synchronized 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:
pagethe 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)
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
waitForSuccessfulFinish()
readScratchPad(byte[],int)
copyScratchPad()
String getAlternateNames ( )

Retrieve the alternate Maxim Integrated Products 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".

Returns:
the alternate names for this iButton or 1-Wire device

Reimplemented from OneWireContainer.

String getDescription ( )

Get a short description of the function of this iButton or 1-Wire Device type.

Returns:
device description

Reimplemented from OneWireContainer.

int getMaxSpeed ( )

Returns the maximum speed this iButton device can communicate at.

Returns:
maximum speed
See also:
DSPortAdapter.setSpeed

Reimplemented from OneWireContainer.

Enumeration getMemoryBanks ( )

Gets an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank, PagedMemoryBank, and OTPMemoryBank.

Returns:
Enumeration of memory banks

Reimplemented from OneWireContainer.

String getName ( )

Get the Maxim Integrated Products part number of the iButton or 1-Wire Device as a java.lang.String.

For example "DS1992".

Returns:
iButton or 1-Wire device name

Reimplemented from OneWireContainer.

synchronized 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:
pagethe page number used to write the partial secrets to
secretthe entire secret, in partial phrases, to be installed
secret_numberthe secret 'page' to use (0 - 7)
Returns:
true if successful
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
bindSecretToiButton(int,byte[],byte[],int)
synchronized 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:
macthe signature starting at offset 0
Returns:
true if the signature matches
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
#VALIDATE_DATA_PAGE
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.

  • 32 bytes of page data
  • 4 bytes secret counter for page
  • 4 bytes write cycle counter for page
  • 2 byte CRC

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

Parameters:
pageNumpage number to read and authenticate
dataarray 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.
startoffset to copy into the array
Returns:
true if successful, false if the operation failed while waiting for the DS1963S's output to alternate
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
readMemoryPage(int,byte[],int)
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:
pageNumpage number to read
dataarray for the return of the data (must be at least 32 bytes long)
startoffset into the byte array to start copying page data
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
readAuthenticatedPage(int,byte[],int)
getMemoryBanks()
synchronized 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:
dataarray to hold the contents of the scratchpad
startoffset to copy the scratchpad data into the byte array
Returns:
the number of bytes read, or -1 if there was a CRC failure
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
writeScratchPad(int,int,byte[],int,int)
synchronized 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:
doSpeedChecktrue for doSpeed() to be called before every 1-Wire bus access, false to skip this expensive call
See also:
OneWireContainer.doSpeed()
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.

Parameters:
sourceAdapteradapter object required to communicate with this iButton
newAddressaddress of this 1-Wire device
See also:
com.dalsemi.onewire.utils.Address

Reimplemented from OneWireContainer.

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:

  • COMPUTE_FIRST_SECRET
  • COMPUTE_NEXT_SECRET
  • VALIDATE_DATA_PAGE
  • SIGN_DATA_PAGE
  • COMPUTE_CHALLENGE
  • AUTH_HOST

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

Parameters:
functionthe 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
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
SHAFunction(byte,int)
copyScratchPad()
readScratchPad(byte[],int)
synchronized 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:

  • COMPUTE_FIRST_SECRET
  • COMPUTE_NEXT_SECRET
  • VALIDATE_DATA_PAGE
  • SIGN_DATA_PAGE
  • COMPUTE_CHALLENGE
  • AUTH_HOST

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

Parameters:
functionthe SHA function code
Tthe 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
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
SHAFunction(byte)
copyScratchPad()
readScratchPad(byte[],int)
synchronized 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:
settrue to use the one byte RESUME command instead of the nine byte select command
See also:
#RESUME
synchronized 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
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
copyScratchPad()
eraseScratchPad(int)
readAuthenticatedPage(int,byte[],int)
synchronized 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:

  • eraseScratchPad(0);
  • writeScratchPad(page_number,0,page_data_array,0,32);
  • readScratchPad(buffer,0);
  • copyScratchPad();

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_numberpage number to write
page_datapage 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
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
eraseScratchPad(int)
writeScratchPad(int,int,byte[],int,int)
readScratchPad(byte[],int)
copyScratchPad()
synchronized 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:
targetPagethe page number this data will eventually be copied to
targetPageOffsetthe offset on the page to copy this data to
inputbufferthe data that will be copied into the scratchpad
startoffset into the input buffer for the data to write
lengthnumber of bytes to write
Returns:
true if successful, false on a CRC error
Exceptions:
OneWireIOExceptionon 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter
See also:
copyScratchPad()
eraseScratchPad(int)
readScratchPad(byte[],int)
writeDataPage(int,byte[])

The documentation for this class was generated from the following file: