MemoryBankNVCRCPW Class Reference

Inherits com::dalsemi::onewire::container::MemoryBankNVCRC.

List of all members.


Detailed Description

Memory bank class for the NVRAM with built-in CRC generation and Password protected memory read/write iButtons and 1-Wire Devices.

An example of such a devices is the DS1922 Thermochron with 8k or password protected log memory.

Version:
1.00, 11 Feb 2002
Author:
SH

Public Member Functions

 MemoryBankNVCRCPW (PasswordContainer ibutton, MemoryBankScratchCRCPW scratch)
 Memory bank contstuctor.
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 read (int startAddr, boolean readContinue, byte[] readBuf, int offset, int len) throws OneWireIOException, OneWireException
 Read memory in the current bank with no CRC checking (device or data).
void write (int startAddr, byte[] writeBuf, int offset, int len) throws OneWireIOException, OneWireException
 Write memory in the current bank.

Public Attributes

boolean enablePower = false
 Enable Provided Power for some Password checking.

Static Public Attributes

static final byte READ_MEMORY_CRC_PW_COMMAND = (byte)0x69
 Read Memory (with CRC and Password) Command.

Protected Member Functions

void readPageCRC (int page, boolean readContinue, byte[] readBuf, int offset, byte[] extraInfo, int extraLength) throws OneWireIOException, OneWireException
 Read a complete memory page with CRC verification provided by the device with extra information.

Protected Attributes

MemoryBankScratchCRCPW scratchpadPW = null
 Scratchpad with Password.
PasswordContainer ibPass = null
 Password Container to access the passwords for the memory bank.

Constructor & Destructor Documentation

Memory bank contstuctor.

Requires reference to the OneWireContainer this memory bank resides on.


Member Function Documentation

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:
page page number to read
readContinue if '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.
readBuf byte array to put data read. Must have at least 'getMaxPacketDataLength()' elements.
offset offset into readBuf to place data
extraInfo byte array to put extra info read into
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankNVCRC.

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

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

Not supported by all devices. If not extra information available then just call with extraLength=0.

Parameters:
page page number to read
readContinue if '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.
readBuf byte array to put data read. Must have at least 'getMaxPacketDataLength()' elements.
offset offset into readBuf to place data
extraInfo byte array to put extra info read into
extraLength length of extra information
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankNVCRC.

void read ( int  startAddr,
boolean  readContinue,
byte[]  readBuf,
int  offset,
int  len 
) throws OneWireIOException, OneWireException

Read memory in the current bank with no CRC checking (device or data).

The resulting data from this API may or may not be what is on the 1-Wire device. It is recommends that the data contain some kind of checking (CRC) like in the readPagePacket() method or have the 1-Wire device provide the CRC as in readPageCRC(). readPageCRC() however is not supported on all memory types, see 'hasPageAutoCRC()'. If neither is an option then this method could be called more then once to at least verify that the same thing is read consistantly.

Parameters:
startAddr starting physical address
readContinue if 'true' then device read is continued without re-selecting. This can only be used if the new read() continious where the last one led off and it is inside a 'beginExclusive/endExclusive' block.
readBuf byte array to place read data into
offset offset into readBuf to place data
len length in bytes to read
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankNV.

void write ( int  startAddr,
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:
startAddr starting address
writeBuf byte array containing data to write
offset offset into writeBuf to get data
len length in bytes to write
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankNV.


Member Data Documentation

Scratchpad with Password.

Used as container for password.


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

Generated on Thu Aug 28 15:42:33 2008 for 1-Wire API for .NET by  doxygen 1.5.6