Public Member Functions | |
MemoryBankEEPROMstatus (OneWireContainer ibutton) | |
Memory bank contstuctor. | |
String | getBankDescription () |
Query to see get a string description of the current memory bank. | |
boolean | isGeneralPurposeMemory () |
Query to see if the current memory bank is general purpose user memory. | |
boolean | isReadWrite () |
Query to see if current memory bank is read/write. | |
boolean | isWriteOnce () |
Query to see if current memory bank is write write once such as with EPROM technology. | |
boolean | isReadOnly () |
Query to see if current memory bank is read only. | |
boolean | isNonVolatile () |
Query to see if current memory bank non-volatile. | |
boolean | needsProgramPulse () |
Query to see if current memory bank pages need the adapter to have a 'ProgramPulse' in order to write to the memory. | |
boolean | needsPowerDelivery () |
Query to see if current memory bank pages need the adapter to have a 'PowerDelivery' feature in order to write to the memory. | |
int | getStartPhysicalAddress () |
Query to get the starting physical address of this bank. | |
int | getSize () |
Query to get the memory bank size in bytes. | |
int | getNumberPages () |
Query to get the number of pages in current memory bank. | |
int | getPageLength () |
Query to get page length in bytes in current memory bank. | |
int | getMaxPacketDataLength () |
Query to get Maximum data page length in bytes for a packet read or written in the current memory bank. | |
boolean | hasPageAutoCRC () |
Query to see if current memory bank pages can be read with the contents being verified by a device generated CRC. | |
boolean | hasExtraInfo () |
Checks to see if this memory bank's pages deliver extra information outside of the normal data space, when read. | |
int | getExtraInfoLength () |
Query to get the length in bytes of extra information that is read when read a page in the current memory bank. | |
String | getExtraInfoDescription () |
Query to get a string description of what is contained in the Extra Informationed return when reading pages in the current memory bank. | |
void | setWriteVerification (boolean doReadVerf) |
Set the write verification for the 'write()' method. | |
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. | |
void | checkSpeed () throws OneWireIOException, OneWireException |
Check the device speed if has not been done before or if an error was detected. | |
void | forceVerify () |
Set the flag to indicate the next 'checkSpeed()' will force a speed set and verify 'doSpeed()'. | |
boolean | writeScratchpad (int addr, byte[] out_buf, int offset, int len) throws OneWireIOException, OneWireException |
Write to the Scratch Pad, which is a max of 8 bytes. | |
synchronized void | copyScratchpad (byte[] es_data) throws OneWireIOException, OneWireException |
Copy all 8 bytes of the Sratch Pad to a certain address in memory. | |
boolean | readScratchpad (byte[] readBuf, int offset, int len, byte[] es_data) throws OneWireIOException, OneWireException |
Read from the Scratch Pad, which is a max of 8 bytes. | |
Static Public Attributes | |
static final byte | READ_MEMORY_COMMAND = ( byte ) 0xF0 |
Read Memory Command. | |
static final byte | WRITE_SCRATCHPAD_COMMAND = ( byte ) 0x0F |
Write Scratchpad Command. | |
static final byte | READ_SCRATCHPAD_COMMAND = ( byte ) 0xAA |
Read Scratchpad Command. | |
static final byte | COPY_SCRATCHPAD_COMMAND = ( byte ) 0x55 |
Copy Scratchpad Command. | |
static final byte | CHANNEL_ACCESS_WRITE = ( byte ) 0x5A |
Channel acces write to change the property of the channel. | |
Protected Attributes | |
OneWireContainer | ib |
Reference to the OneWireContainer this bank resides on. | |
byte[] | ffBlock |
block of 0xFF's used for faster read pre-fill of 1-Wire blocks | |
boolean | doSetSpeed |
Flag to indicate that speed needs to be set. | |
int | size |
Size of memory bank in bytes. | |
String | bankDescription |
Memory bank descriptions. | |
boolean | generalPurposeMemory |
Memory bank usage flags. | |
boolean | readWrite |
Flag if memory bank is read/write. | |
boolean | writeOnce |
Flag if memory bank is write once (EPROM). | |
boolean | readOnly |
Flag if memory bank is read only. | |
boolean | nonVolatile |
Flag if memory bank is non volatile (will not erase when power removed). | |
boolean | programPulse |
Flag if memory bank needs program Pulse to write. | |
boolean | powerDelivery |
Flag if memory bank needs power delivery to write. | |
int | startPhysicalAddress |
Starting physical address in memory bank. | |
boolean | writeVerification |
Flag if read back verification is enabled in 'write()'. | |
int | numberPages |
Number of pages in memory bank. | |
int | pageLength |
page length in memory bank | |
int | maxPacketDataLength |
Max data length in page packet in memory bank. | |
boolean | pageAutoCRC |
Flag if memory bank has page auto-CRC generation. |
MemoryBankEEPROMstatus | ( | OneWireContainer | ibutton | ) |
Memory bank contstuctor.
Requires reference to the OneWireContainer this memory bank resides on. Requires reference to memory banks used in OTP operations.
String getBankDescription | ( | ) |
Query to see get a string description of the current memory bank.
Implements MemoryBank.
boolean isGeneralPurposeMemory | ( | ) |
Query to see if the current memory bank is general purpose user memory.
If it is NOT then it is Memory-Mapped and writing values to this memory will affect the behavior of the 1-Wire device.
Implements MemoryBank.
boolean isReadWrite | ( | ) |
Query to see if current memory bank is read/write.
Implements MemoryBank.
boolean isWriteOnce | ( | ) |
Query to see if current memory bank is write write once such as with EPROM technology.
Implements MemoryBank.
boolean isReadOnly | ( | ) |
Query to see if current memory bank is read only.
Implements MemoryBank.
boolean isNonVolatile | ( | ) |
Query to see if current memory bank non-volatile.
Memory is non-volatile if it retains its contents even when removed from the 1-Wire network.
Implements MemoryBank.
boolean needsProgramPulse | ( | ) |
Query to see if current memory bank pages need the adapter to have a 'ProgramPulse' in order to write to the memory.
Implements MemoryBank.
boolean needsPowerDelivery | ( | ) |
Query to see if current memory bank pages need the adapter to have a 'PowerDelivery' feature in order to write to the memory.
Implements MemoryBank.
int getStartPhysicalAddress | ( | ) |
Query to get the starting physical address of this bank.
Physical banks are sometimes sub-divided into logical banks due to changes in attributes.
Implements MemoryBank.
int getSize | ( | ) |
Query to get the memory bank size in bytes.
Implements MemoryBank.
int getNumberPages | ( | ) |
Query to get the number of pages in current memory bank.
int getPageLength | ( | ) |
Query to get page length in bytes in current memory bank.
int getMaxPacketDataLength | ( | ) |
Query to get Maximum data page length in bytes for a packet read or written in the current memory bank.
See the 'ReadPagePacket()' and 'WritePagePacket()' methods. This method is only usefull if the current memory bank is general purpose memory.
boolean hasPageAutoCRC | ( | ) |
Query to see if current memory bank pages can be read with the contents being verified by a device generated CRC.
This is used to see if the 'ReadPageCRC()' can be used.
boolean hasExtraInfo | ( | ) |
Checks to see if this memory bank's pages deliver extra information outside of the normal data space, when read.
Examples of this may be a redirection byte, counter, tamper protection bytes, or SHA-1 result. If this method returns true then the methods with an 'extraInfo' parameter can be used: readPage, readPageCRC, and readPagePacket.
true
if reading the this memory bank's pages provides extra informationreadPageCRC(int,boolean,byte[],int,byte[]) readPageCRC(extra)
readPagePacket(int,boolean,byte[],int,byte[]) readPagePacket(extra)
int getExtraInfoLength | ( | ) |
Query to get the length in bytes of extra information that is read when read a page in the current memory bank.
See 'hasExtraInfo()'.
String getExtraInfoDescription | ( | ) |
Query to get a string description of what is contained in the Extra Informationed return when reading pages in the current memory bank.
See 'hasExtraInfo()'.
void setWriteVerification | ( | boolean | doReadVerf | ) |
Set the write verification for the 'write()' method.
doReadVerf | true (default) verify write in 'write' false, don't verify write (used on Write-Once bit manipulation) |
Implements MemoryBank.
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 |
Implements MemoryBank.
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 |
Implements MemoryBank.
void checkSpeed | ( | ) | throws OneWireIOException, OneWireException |
Check the device speed if has not been done before or if an error was detected.
OneWireIOException | ||
OneWireException |
boolean writeScratchpad | ( | int | addr, | |
byte[] | out_buf, | |||
int | offset, | |||
int | len | |||
) | throws OneWireIOException, OneWireException |
Write to the Scratch Pad, which is a max of 8 bytes.
.. Note that if less than 8 bytes are written, the ending offset will still report that a full eight bytes are on the buffer. This means that all 8 bytes of the data in the scratchpad will be copied, not just the bytes user wrote into it.
addr | the address to write the data to | |
out_buf | byte array to write into scratch pad | |
offset | offset into out_buf to write the data | |
len | length of the write data |
OneWireIOException | ||
OneWireException |
synchronized void copyScratchpad | ( | byte[] | es_data | ) | throws OneWireIOException, OneWireException |
Copy all 8 bytes of the Sratch Pad to a certain address in memory.
addr | the address to copy the data to | |
auth | byte[] containing write authorization |
OneWireIOException | ||
OneWireException |
boolean readScratchpad | ( | byte[] | readBuf, | |
int | offset, | |||
int | len, | |||
byte[] | es_data | |||
) | throws OneWireIOException, OneWireException |
Read from the Scratch Pad, which is a max of 8 bytes.
readBuf | byte array to place read data into length of array is always pageLength. | |
offset | offset into readBuf to pug data | |
len | length in bytes to read | |
extraInfo | byte array to put extra info read into (TA1, TA2, e/s byte) Can be 'null' if extra info is not needed. |
OneWireIOException | ||
OneWireException |
int startPhysicalAddress [protected] |
Starting physical address in memory bank.
Needed for different types of memory in the same logical memory bank. This can be used to seperate them into two virtual memory banks. Example: DS2406 status page has mixed EPROM and Volatile RAM.