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

MemoryBankNVCRCPW Class Reference

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

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

List of all members.

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.

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

Constructor & Destructor Documentation

Memory bank contstuctor.

Requires reference to the OneWireContainer this memory bank resides on.


Member Function Documentation

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:
startAddrstarting physical address
readContinueif '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.
readBufbyte array to place read data into
offsetoffset into readBuf to place data
lenlength in bytes to read
Exceptions:
OneWireIOException
OneWireException

Reimplemented from MemoryBankNV.

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:
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
extraLengthlength of extra information
Exceptions:
OneWireIOException
OneWireException

Reimplemented from MemoryBankNVCRC.

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 MemoryBankNVCRC.

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:
startAddrstarting address
writeBufbyte array containing data to write
offsetoffset into writeBuf to get data
lenlength 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: