|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
One-Time-Programmable (OTP) Memory bank interface for iButtons (or 1-Wire devices)
with OTP features. This interface extents the base functionality of
the super-interfaces MemoryBank
and PagedMemoryBank
by providing One-Time-Programmable services.
The OTPMemoryBank methods can be organized into the following categories:
if (otp.canRedirectPage())
{
int new_page = getRedirectedPage(0);
if (new_page != 0)
System.out.println("Page 0 is redirected to " + new_page);
}
if (otp.canLockPage())
{
if (otp.isPageLocked(0))
System.out.println("Page 0 is locked");
}
if (otp.canLockRedirectPage())
{
if (otp.isRedirectPageLocked(0))
System.out.println("Page 0 redirection is locked");
}
if (otp.canLockPage())
{
// loop to lock each page
for (int pg = 0; pg < otp.getNumberPages(); pg++)
{
otp.lockPage(pg);
}
}
else
System.out.println("OTPMemoryBank does not support page locking");
MemoryBank
,
PagedMemoryBank
,
OneWireContainer09
,
OneWireContainer0B
,
OneWireContainer0F
,
OneWireContainer12
,
OneWireContainer13
Method Summary | |
boolean |
canLockPage()
Checks to see if this memory bank has pages that can be locked. |
boolean |
canLockRedirectPage()
Checks to see if this memory bank has pages that can be locked from being redirected. |
boolean |
canRedirectPage()
Checks to see if this memory bank has pages that can be redirected to a new page. |
int |
getRedirectedPage(int page)
Gets the page redirection of the specified page. |
boolean |
isPageLocked(int page)
Checks to see if the specified page is locked. |
int |
isPageRedirected(int page)
Deprecated. As of 1-Wire API 0.01, replaced by getRedirectedPage(int) |
boolean |
isRedirectPageLocked(int page)
Checks to see if the specified page has redirection locked. |
void |
lockPage(int page)
Locks the specifed page in this memory bank. |
void |
lockRedirectPage(int page)
Locks the redirection of the specifed page. |
void |
redirectPage(int page,
int newPage)
Redirects the specifed page to a new page. |
Methods inherited from interface com.dalsemi.onewire.container.PagedMemoryBank |
getExtraInfoDescription, getExtraInfoLength, getMaxPacketDataLength, getNumberPages, getPageLength, hasExtraInfo, hasPageAutoCRC, haveExtraInfo, readPage, readPage, readPageCRC, readPageCRC, readPagePacket, readPagePacket, writePagePacket |
Methods inherited from interface com.dalsemi.onewire.container.MemoryBank |
getBankDescription, getSize, getStartPhysicalAddress, isGeneralPurposeMemory, isNonVolatile, isReadOnly, isReadWrite, isWriteOnce, needsPowerDelivery, needsProgramPulse, read, setWriteVerification, write |
Method Detail |
public boolean canRedirectPage()
true
if this memory bank pages can be redirected
to a new pageredirectPage
,
getRedirectedPage
public boolean canLockPage()
true
if this memory bank has pages that can be
lockedlockPage
,
isPageLocked
public boolean canLockRedirectPage()
true
if this memory bank has pages that can
be locked from being redirected to a new pagelockRedirectPage
,
isRedirectPageLocked
public void lockPage(int page) throws OneWireIOException, OneWireException
page
- number of page to lockOneWireIOException
- on a 1-Wire communication error such as
no device present or a read back verification fails. This could be
caused by a physical interruption in the 1-Wire Network due to
shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapter. It will also be thrown if the device needs 'program' voltage
and the adapter used by this device does not support it.isPageLocked
,
canLockPage
,
DSPortAdapter.canProgram()
public boolean isPageLocked(int page) throws OneWireIOException, OneWireException
page
- page to check true
if page is lockedOneWireIOException
- on a 1-Wire communication error such as
no device present or a CRC read from the device is incorrect. This could be
caused by a physical interruption in the 1-Wire Network due to
shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapter.lockPage
,
canLockPage
public void redirectPage(int page, int newPage) throws OneWireIOException, OneWireException
page
- number of page to redirectnewPage
- new page number to redirect toOneWireIOException
- on a 1-Wire communication error such as
no device present or a CRC read from the device is incorrect. This could be
caused by a physical interruption in the 1-Wire Network due to
shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapter. It will also be thrown if the device needs 'program' voltage
and the adapter used by this device does not support it.canRedirectPage
,
getRedirectedPage
,
DSPortAdapter.canProgram()
public int isPageRedirected(int page) throws OneWireIOException, OneWireException
getRedirectedPage(int)
page
- page to check for redirectionOneWireIOException
- on a 1-Wire communication error such as
no device present or a CRC read from the device is incorrect. This could be
caused by a physical interruption in the 1-Wire Network due to
shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapter.canRedirectPage
,
redirectPage
public int getRedirectedPage(int page) throws OneWireIOException, OneWireException
page
- page to check for redirectionOneWireIOException
- on a 1-Wire communication error such as
no device present or a CRC read from the device is incorrect. This could be
caused by a physical interruption in the 1-Wire Network due to
shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapter.canRedirectPage
,
redirectPage
public void lockRedirectPage(int page) throws OneWireIOException, OneWireException
page
- page to redirectOneWireIOException
- on a 1-Wire communication error such as
no device present or a CRC read from the device is incorrect. This could be
caused by a physical interruption in the 1-Wire Network due to
shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapter. It will also be thrown if the device needs 'program' voltage
and the adapter used by this device does not support it.canLockRedirectPage
,
isRedirectPageLocked
,
DSPortAdapter.canProgram()
public boolean isRedirectPageLocked(int page) throws OneWireIOException, OneWireException
page
- page to check for locked redirection true
if redirection is locked for this pageOneWireIOException
- on a 1-Wire communication error such as
no device present or a CRC read from the device is incorrect. This could be
caused by a physical interruption in the 1-Wire Network due to
shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.OneWireException
- on a communication or setup error with the 1-Wire
adapter.canLockRedirectPage
,
lockRedirectPage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |