1-Wire API for .NET Version 4.00
Public Member Functions | Static Public Attributes | Protected Attributes | Static Protected Attributes

MemoryBankScratchSHAEE Class Reference

Memory bank class for the Scratchpad section of SHA EEPROM iButtons and 1-Wire devices with SHA write-protected memory pages. More...

Inherits com::dalsemi::onewire::container::MemoryBankScratchEx.

List of all members.

Public Member Functions

 MemoryBankScratchSHAEE (OneWireContainer33 ibutton)
 Memory bank contstuctor.
void readPageCRC (int page, boolean readContinue, byte[] readBuf, int offset) throws OneWireIOException, OneWireException
 Read a complete memory page with CRC verification provided by the device.
void readPageCRC (int page, boolean readContinue, byte[] readBuf, int offset, byte[] extraInfo) throws OneWireIOException, OneWireException
 Read a complete memory page with CRC verification provided by the device with extra information.
void readScratchpad (byte[] readBuf, int offset, int len, byte[] extraInfo) throws OneWireIOException, OneWireException
 Read the scratchpad page of memory from a NVRAM device This method reads and returns the entire scratchpad after the byte offset regardless of the actual ending offset.
void copyScratchpad (int addr, int len) throws OneWireIOException, OneWireException
 Copy the scratchpad page to memory.
void copyScratchpad (int addr, byte[] scratchpad, int offset) throws OneWireIOException, OneWireException
 Copy the scratchpad page to memory.
void copyScratchpad (int addr, byte[] scratchpad, int scratchpadOffset, byte[] pageData, int pageDataOffset) throws OneWireIOException, OneWireException
 Copy the scratchpad page to memory.
void copyScratchpadWithMAC (int addr, byte[] authMAC, int authOffset) throws OneWireIOException, OneWireException
 Copy all 8 bytes of the Sratch Pad to a certain address in memory using the provided authorization MAC.
void writeScratchpad (int addr, byte[] writeBuf, int offset, int len) throws OneWireIOException, OneWireException
 Write to the scratchpad page of memory a NVRAM device.
void write (int addr, byte[] writeBuf, int offset, int len) throws OneWireIOException, OneWireException
 Write memory in the current bank.
void loadFirstSecret (int addr, byte[] data, int offset) throws OneWireIOException, OneWireException
 Load First Secret for the DS2432.
void loadFirstSecret (int addr) throws OneWireIOException, OneWireException
 Load First Secret for the DS2432.
void computeNextSecret (int addr) throws OneWireIOException, OneWireException
 Computes the next secret.
void computeNextSecret (int addr, byte[] partialsecret, int offset) throws OneWireIOException, OneWireException
 Computes the next secret.
void refreshScratchpad (int addr) throws OneWireIOException, OneWireException
 Refreshes the scratchpad for DS1961S.

Static Public Attributes

static final byte LOAD_FIRST_SECRET = ( byte ) 0x5A
 Load First Secret.
static final byte COMPUTE_NEXT_SECRET = ( byte ) 0x33
 Compute next Secret command.
static final byte REFRESH_SCRATCHPAD = ( byte ) 0xA3
 Refresh Scratchpad command.

Protected Attributes

OneWireContainer33 owc33 = null
 The Password container to acces the 8 byte passwords.

Static Protected Attributes

static final byte[] ffBlock = OneWireContainer33.ffBlock
 block of 0xFF's used for faster read pre-fill of 1-Wire blocks Comes from OneWireContainer33 that this MemoryBank references.
static final byte[] zeroBlock = OneWireContainer33.zeroBlock
 block of 0x00's used for faster read pre-fill of 1-Wire blocks Comes from OneWireContainer33 that this MemoryBank references.

Detailed Description

Memory bank class for the Scratchpad section of SHA EEPROM iButtons and 1-Wire devices with SHA write-protected memory pages.

Version:
1.00, 11 Aug 2002
Author:
SH

Constructor & Destructor Documentation

Memory bank contstuctor.

Requires reference to the OneWireContainer this memory bank resides on.


Member Function Documentation

void computeNextSecret ( int  addr) throws OneWireIOException, OneWireException

Computes the next secret.

Parameters:
addrthe physical address of the page to use for secret computation
partialsecretbyte array containing next partial secret for writing to the scratchpad
Exceptions:
OneWireIOException
OneWireException
void computeNextSecret ( int  addr,
byte[]  partialsecret,
int  offset 
) throws OneWireIOException, OneWireException

Computes the next secret.

Parameters:
addrthe physical address of the page to use for secret computation
partialsecretbyte array containing next partial secret for writing to the scratchpad
offsetinto partialsecret byte array to start reading
Exceptions:
OneWireIOException
OneWireException
void copyScratchpad ( int  addr,
byte[]  scratchpad,
int  offset 
) throws OneWireIOException, OneWireException

Copy the scratchpad page to memory.

Parameters:
addrthe address to copy to
scratchpadthe scratchpad contents that will be copied
offsetthe offset into scratchpad byte[] where scratchpad data begins
Exceptions:
OneWireIOException
OneWireException
void copyScratchpad ( int  addr,
int  len 
) throws OneWireIOException, OneWireException

Copy the scratchpad page to memory.

Parameters:
addrthe address to copy the data to
lenlength byte is ignored, must always be 8.
Exceptions:
OneWireIOException
OneWireException

Reimplemented from MemoryBankScratchEx.

void copyScratchpad ( int  addr,
byte[]  scratchpad,
int  scratchpadOffset,
byte[]  pageData,
int  pageDataOffset 
) throws OneWireIOException, OneWireException

Copy the scratchpad page to memory.

Parameters:
addrthe address to copy to
scratchpadthe scratchpad contents that will be copied
scratchpadOffsetthe offset into scratchpad byte[] where scratchpad data begins
pageDatathe data on the page of memory to be written to
pageDataOffsetthe offset into pageData byte[] where pageData begins
Exceptions:
OneWireIOException
OneWireException
void copyScratchpadWithMAC ( int  addr,
byte[]  authMAC,
int  authOffset 
) throws OneWireIOException, OneWireException

Copy all 8 bytes of the Sratch Pad to a certain address in memory using the provided authorization MAC.

Parameters:
addrthe address to copy the data to
authMACbyte[] containing write authorization MAC
authOffsetoffset into authMAC where authorization MAC begins
Exceptions:
OneWireIOException
OneWireException
void loadFirstSecret ( int  addr,
byte[]  data,
int  offset 
) throws OneWireIOException, OneWireException

Load First Secret for the DS2432.

Loads the specified data to the specified location. If the address is data memory (instead of secret memory), this command must have been preceded by a Refresh Scratchpad command for it to be successful.

Parameters:
addrthe address to write the data to
datathe data to 'load' with the Load First Secret command
offsetthe offset to use for reading the data byte[]
Exceptions:
OneWireIOException
OneWireException
void loadFirstSecret ( int  addr) throws OneWireIOException, OneWireException

Load First Secret for the DS2432.

Loads current contents of the scratchpad to the specified location. If the address is data memory (instead of secret memory), this command must have been preceded by a Refresh Scratchpad command for it to be successful.

Parameters:
addrthe address to write the data to
Exceptions:
OneWireIOException
OneWireException
void readPageCRC ( int  page,
boolean  readContinue,
byte[]  readBuf,
int  offset,
byte[]  extraInfo 
) throws OneWireIOException, OneWireException

Read a complete memory page with CRC verification provided by the device with extra information.

Not supported by all devices. See the method 'hasPageAutoCRC()'. See the method 'hasExtraInfo()' for a description of the optional extra information.

Parameters:
pagepage number to read
readContinueif 'true' then device read is continued without re-selecting. This can only be used if the new readPagePacket() continious where the last one stopped and it is inside a 'beginExclusive/endExclusive' block.
readBufbyte array to put data read. Must have at least 'getMaxPacketDataLength()' elements.
offsetoffset into readBuf to place data
extraInfobyte array to put extra info read into
Exceptions:
OneWireIOException
OneWireException

Reimplemented from MemoryBankScratch.

void readPageCRC ( int  page,
boolean  readContinue,
byte[]  readBuf,
int  offset 
) throws OneWireIOException, OneWireException

Read a complete memory page with CRC verification provided by the device.

Not supported by all devices. See the method 'hasPageAutoCRC()'.

Parameters:
pagepage number to read
readContinueif 'true' then device read is continued without re-selecting. This can only be used if the new readPagePacket() continious where the last one stopped and it is inside a 'beginExclusive/endExclusive' block.
readBufbyte array to put data read. Must have at least 'getMaxPacketDataLength()' elements.
offsetoffset into readBuf to place data
Exceptions:
OneWireIOException
OneWireException

Reimplemented from MemoryBankScratch.

void readScratchpad ( byte[]  readBuf,
int  offset,
int  len,
byte[]  extraInfo 
) throws OneWireIOException, OneWireException

Read the scratchpad page of memory from a NVRAM device This method reads and returns the entire scratchpad after the byte offset regardless of the actual ending offset.

Parameters:
readBufbyte array to place read data into length of array is always pageLength.
offsetoffset into readBuf to pug data
lenlength in bytes to read
extraInfobyte array to put extra info read into (TA1, TA2, e/s byte) length of array is always extraInfoLength. Can be 'null' if extra info is not needed.
Exceptions:
OneWireIOException
OneWireException

Reimplemented from MemoryBankScratch.

void refreshScratchpad ( int  addr) throws OneWireIOException, OneWireException

Refreshes the scratchpad for DS1961S.

Command has no effect on DS2432 devices. After this command is executed, the data at the address specified will be loaded into the scratchpad. The Load First Secret command can then be used to re-write the data back to the page, correcting any weakly-programmed EEPROM bits.

Parameters:
addrthe address to load the data from into the scratchpad
Exceptions:
OneWireIOException
OneWireException
void write ( int  addr,
byte[]  writeBuf,
int  offset,
int  len 
) throws OneWireIOException, OneWireException

Write memory in the current bank.

It is recommended that when writing data that some structure in the data is created to provide error free reading back with read(). Or the method 'writePagePacket()' could be used which automatically wraps the data in a length and CRC.

When using on Write-Once devices care must be taken to write into into empty space. If write() is used to write over an unlocked page on a Write-Once device it will fail. If write verification is turned off with the method 'setWriteVerification(false)' then the result will be an 'AND' of the existing data and the new data.

Parameters:
addrthe address to write to
writeBufbyte array containing data to write
offsetoffset into writeBuf to get data
lenlength in bytes to write
Exceptions:
OneWireIOException
OneWireException

Reimplemented from MemoryBankScratch.

void writeScratchpad ( int  addr,
byte[]  writeBuf,
int  offset,
int  len 
) throws OneWireIOException, OneWireException

Write to the scratchpad page of memory a NVRAM device.

Parameters:
addrphysical address to copy data to
writeBufbyte array containing data to write
offsetoffset into readBuf to place data
lenlength in bytes to write
Exceptions:
OneWireIOException
OneWireException

Reimplemented from MemoryBankScratchEx.


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