1-Wire API for .NET Version 4.00
|
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.
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. |
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.
MemoryBankNVCRCPW | ( | PasswordContainer | ibutton, |
MemoryBankScratchCRCPW | scratch | ||
) |
Memory bank contstuctor.
Requires reference to the OneWireContainer this memory bank resides on.
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.
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 |
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.
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 |
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.
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 |
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.
startAddr | starting address |
writeBuf | byte array containing data to write |
offset | offset into writeBuf to get data |
len | length in bytes to write |
OneWireIOException | |
OneWireException |
Reimplemented from MemoryBankNV.
MemoryBankScratchCRCPW scratchpadPW = null [protected] |
Scratchpad with Password.
Used as container for password.