|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.container.OneWireContainer | +--com.dalsemi.onewire.container.OneWireContainer33
1-Wire® container for the '1K-Bit protected 1-Wire EEPROM with SHA-1 Engine' family type 33 (hex), Dallas Semiconductor part number: DS1961S,DS2432.
The memory can also be accessed through the objects that are returned
from the getMemoryBanks
method.
MemoryBank
,
PagedMemoryBank
MemoryBank
,
PagedMemoryBank
MemoryBank
,
PagedMemoryBank
MemoryBank
,
PagedMemoryBank
byte[] read_buf = new byte [bank.getPageLength()];
byte[] extra_buf = new byte [bank.getExtraInfoLength()];
byte[] challenge = new byte [8];
// read a page (use the most verbose and secure method)
if (bank.hasPageAutoCRC())
{
System.out.println("Using device generated CRC");
if (bank.hasExtraInfo())
{
bank.readPageCRC(pg, false, read_buf, 0, extra_buf);
owd.getChallenge(challenge);
owd.getSecret(secret);
sernum = owd.getAddress();
macvalid = owd.isMACValid(bank.getStartPhysicalAddress()+pg*bank.getPageLength(),
sernum,read_buf,extra_buf,challenge,secret);
}
else
bank.readPageCRC(pg, false, read_buf, 0);
}
else
{
if (bank.hasExtraInfo())
bank.readPage(pg, false, read_buf, 0, extra_buf);
else
bank.readPage(pg, false, read_buf, 0);
}
Constructor Summary | |
OneWireContainer33()
Constructor OneWireContainer33 |
|
OneWireContainer33(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer33(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer33(DSPortAdapter sourceAdapter,
String newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
Method Summary | |
void |
computeNextSecret(int addr,
byte[] nextsecret,
byte[] partialsecret,
byte[] mac)
Compute Next Secret |
String |
getAlternateNames()
Retrieve the alternate Dallas Semiconductor part numbers or names. |
void |
getChallenge(byte[] get)
Get the challenge of this device as an array of bytes. |
String |
getDescription()
Retrieve a short description of the function of the iButton type. |
int |
getMaxSpeed()
Returns the maximum speed this iButton can communicate at. |
Enumeration |
getMemoryBanks()
Get an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank ,
PagedMemoryBank ,
and OTPMemoryBank . |
String |
getName()
Retrieve the Dallas Semiconductor part number of the iButton as a string. |
void |
getSecret(byte[] get)
Get the secret of this device as an array of bytes. |
boolean |
isContainerSecretSet()
Get the current status of the secret. |
static boolean |
isMACValid(int addr,
byte[] SerNum,
byte[] memory,
byte[] mac,
byte[] challenge,
byte[] secret)
Authenticates page data given a MAC. |
boolean |
isPageOneEPROMmode()
Get the status of page zero, if it is in EPROM mode. |
boolean |
isSecretWriteProtected()
Get the status of the secret, if it is write protected. |
boolean |
isWriteProtectAllSet()
Get the status of all the pages, if they are write protected. |
boolean |
isWriteProtectPageZeroSet()
Get the status of page zero, if it is write protected. |
boolean |
loadFirstSecret(byte[] data)
Load First Secret |
void |
setChallenge(byte[] challengeset)
Sets the challenge for the Read Authenticate Page |
void |
setContainerSecret(byte[] secretset)
Sets the bus master secret for this DS2432. |
void |
setEPROMModePageOne()
Sets the DS2432 in EPROM mode for page 1. |
void |
setupContainer(DSPortAdapter sourceAdapter,
byte[] newAddress)
Provide this container the adapter object used to access this device and provide the address of this iButton or 1-Wire device. |
void |
setupContainer(DSPortAdapter sourceAdapter,
long newAddress)
Provide this container the adapter object used to access this device and provide the address of this iButton or 1-Wire device. |
void |
setupContainer(DSPortAdapter sourceAdapter,
String newAddress)
Provide this container the adapter object used to access this device and provide the address of this iButton or 1-Wire device. |
void |
writeProtectAll()
Write protect pages 0 to 3 |
void |
writeProtectPageZero()
Write protect page 0 only. |
void |
writeProtectSecret()
Write protects the secret for the DS2432. |
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer |
doSpeed, getAdapter, getAddress, getAddressAsLong, getAddressAsString, isAlarming, isPresent, setSpeed |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OneWireContainer33()
public OneWireContainer33(DSPortAdapter sourceAdapter, byte[] newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic OneWireContainer33(DSPortAdapter sourceAdapter, long newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic OneWireContainer33(DSPortAdapter sourceAdapter, String newAddress)
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire deviceMethod Detail |
public void setupContainer(DSPortAdapter sourceAdapter, byte[] newAddress)
setupContainer
in class OneWireContainer
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic void setupContainer(DSPortAdapter sourceAdapter, long newAddress)
setupContainer
in class OneWireContainer
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic void setupContainer(DSPortAdapter sourceAdapter, String newAddress)
setupContainer
in class OneWireContainer
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire devicepublic String getName()
getName
in class OneWireContainer
public String getAlternateNames()
getAlternateNames
in class OneWireContainer
public String getDescription()
getDescription
in class OneWireContainer
public int getMaxSpeed()
getMaxSpeed
in class OneWireContainer
public Enumeration getMemoryBanks()
MemoryBank
,
PagedMemoryBank
,
and OTPMemoryBank
.getMemoryBanks
in class OneWireContainer
Enumeration
of memory bankspublic void setContainerSecret(byte[] secretset)
secretset
- Secret for this DS2432.public void setChallenge(byte[] challengeset)
challengeset
- Challenge for all the memory banks.public void getSecret(byte[] get)
get
- array of bytes containing the iButton secretpublic void getChallenge(byte[] get)
get
- array of bytes containing the iButton challengepublic boolean isContainerSecretSet() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public boolean isSecretWriteProtected() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public boolean isPageOneEPROMmode() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public boolean isWriteProtectAllSet() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public boolean isWriteProtectPageZeroSet() throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public void writeProtectSecret() throws OneWireIOException, OneWireException
public void writeProtectAll() throws OneWireIOException, OneWireException
public void setEPROMModePageOne() throws OneWireIOException, OneWireException
public void writeProtectPageZero() throws OneWireIOException, OneWireException
public void computeNextSecret(int addr, byte[] nextsecret, byte[] partialsecret, byte[] mac) throws OneWireIOException, OneWireException
addr
- address of page to use for the next secret computation.nextsecret
- new secret for this DS2432.parialsecret
- the data to put into the scrathpad in computing next secret.public boolean loadFirstSecret(byte[] data) throws OneWireIOException, OneWireException
OneWireIOException
- OneWireException
- public static boolean isMACValid(int addr, byte[] SerNum, byte[] memory, byte[] mac, byte[] challenge, byte[] secret) throws OneWireException, OneWireIOException
addr
- address of the data to be readmemory
- the memory read from the pagemac
- the MAC calculated for this function given back as the extra infochallenge
- the 8 bytes of the scratch pad used in calculating the macOneWireIOException
- OneWireException
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |