|
||||||||||
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.OneWireContainer37
1-Wire® container for a 32K bytes of read-only and read/write password protected memory, DS1977. This container encapsulates the functionality of the 1-Wire family type 37 (hex).
The memory can be accessed through the objects that are returned
from the getMemoryBanks
method.
MemoryBank
,
PagedMemoryBank
MemoryBank
,
PagedMemoryBank
MemoryBank
,
PagedMemoryBank
OneWireContainer
to enumerate the MemoryBanks.
MemoryBank
and
PagedMemoryBank
for bank specific operations.
PasswordContainer
Field Summary | |
static byte |
COPY_SCRATCHPAD_PW_COMMAND
1-Wire command for Copy Scratchpad With Password |
static int |
PASSWORD_CONTROL_REGISTER
Address of the Password Control Register. |
static int |
READ_ACCESS_PASSWORD
Address of Read Access Password. |
static byte |
READ_MEMORY_PW_COMMAND
1-Wire command for Read Memory With Password |
static int |
READ_ONLY_PWD
|
static byte |
READ_SCRATCHPAD_COMMAND
1-Wire command for Read Scratchpad |
static byte |
READ_VERSION
1-Wire command for getting Read Version |
static int |
READ_WRITE_ACCESS_PASSWORD
Address of the Read Write Access Password. |
static int |
READ_WRITE_PWD
|
static byte |
VERIFY_PSW_COMMAND
1-Wire command for Verifing the Password |
static byte |
WRITE_SCRATCHPAD_COMMAND
1-Wire command for Write Scratchpad |
Constructor Summary | |
OneWireContainer37()
Creates a new OneWireContainer for communication with a
DS1977. |
|
OneWireContainer37(DSPortAdapter sourceAdapter,
byte[] newAddress)
Creates a new OneWireContainer for communication with a
DS1977. |
|
OneWireContainer37(DSPortAdapter sourceAdapter,
long newAddress)
Creates a new OneWireContainer for communication with a
DS1977. |
|
OneWireContainer37(DSPortAdapter sourceAdapter,
String newAddress)
Creates a new OneWireContainer for communication with a
DS1977. |
Method Summary | |
String |
getAlternateNames()
Retrieves the alternate Dallas Semiconductor part numbers or names. |
void |
getContainerReadOnlyPassword(byte[] password,
int offset)
Returns the read password used by this container to read the memory of the device. |
void |
getContainerReadWritePassword(byte[] password,
int offset)
Returns the read/write password used by this container to read from and write to the memory of the device. |
void |
getContainerWriteOnlyPassword(byte[] password,
int offset)
Returns the read/write password used by this container to read from and write to the memory of the device. |
String |
getDescription()
Gets a short description of the function of this iButton or 1-Wire Device type. |
boolean |
getDeviceReadOnlyPasswordEnable()
Tells whether the read only password has been enabled. |
boolean |
getDeviceReadWritePasswordEnable()
Tells whether the read/write password has been enabled. |
boolean |
getDeviceWriteOnlyPasswordEnable()
Tells whether the write only password has been enabled. |
int |
getMaxSpeed()
Returns the maximum speed this iButton device can communicate at. |
Enumeration |
getMemoryBanks()
Gets an enumeration of memory bank instances that implement one or more of the following interfaces: MemoryBank ,
PagedMemoryBank ,
and OTPMemoryBank . |
String |
getName()
Gets the Dallas Semiconductor part number of the iButton or 1-Wire Device as a java.lang.String . |
int |
getReadOnlyPasswordAddress()
Retrieves the address the read only password starts |
int |
getReadOnlyPasswordLength()
Retrieves the password length for the read-only password. |
int |
getReadWritePasswordAddress()
Retrieves the address the read/write password starts |
int |
getReadWritePasswordLength()
Retrieves the password length for the read/write password. |
int |
getWriteOnlyPasswordAddress()
Retrieves the address the write only password starts |
int |
getWriteOnlyPasswordLength()
Retrieves the password length for the write-only password. |
boolean |
hasReadOnlyPassword()
Tells whether the device has a read only password. |
boolean |
hasReadWritePassword()
Tells whether the device has a read/write password. |
boolean |
hasSinglePasswordEnable()
Returns true if this device has the capability to enable one type of password while leaving another type disabled. |
boolean |
hasWriteOnlyPassword()
Tells whether the device has a write only password. |
boolean |
isContainerReadOnlyPasswordSet()
Returns true if the container's read password has been set. |
boolean |
isContainerReadWritePasswordSet()
Returns true if the container's read/write password has been set. |
boolean |
isContainerWriteOnlyPasswordSet()
Returns true if the container's read/write password has been set. |
void |
setContainerReadOnlyPassword(byte[] password,
int offset)
Sets the value of the read password for the container. |
void |
setContainerReadWritePassword(byte[] password,
int offset)
Sets the value of the read/write password for the container. |
void |
setContainerWriteOnlyPassword(byte[] password,
int offset)
Sets the value of the read/write password for the container. |
void |
setDevicePasswordEnable(boolean enableReadOnly,
boolean enableReadWrite,
boolean enableWriteOnly)
Enables/disables passwords by writing to the devices password control register. |
void |
setDevicePasswordEnableAll(boolean enableAll)
Enables/Disables passwords for this device. |
void |
setDeviceReadOnlyPassword(byte[] password,
int offset)
Attempts to change the value of the read password in the device's register. |
void |
setDeviceReadWritePassword(byte[] password,
int offset)
Attempts to change the value of the read/write password in the device's register. |
void |
setDeviceWriteOnlyPassword(byte[] password,
int offset)
Attempts to change the value of the write only password in the device's register. |
void |
setSpeedCheck(boolean doSpeedCheck)
Directs the container to avoid the calls to doSpeed() in methods that communicate with the Thermocron. |
void |
setupContainer(DSPortAdapter sourceAdapter,
byte[] newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device. |
void |
setupContainer(DSPortAdapter sourceAdapter,
long newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device. |
void |
setupContainer(DSPortAdapter sourceAdapter,
String newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device. |
boolean |
verifyPassword(byte[] password,
int offset,
int type)
|
Methods inherited from class com.dalsemi.onewire.container.OneWireContainer |
doSpeed, equals, getAdapter, getAddress, getAddressAsLong, getAddressAsString, hashCode, isAlarming, isPresent, setSpeed, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final byte WRITE_SCRATCHPAD_COMMAND
public static final byte READ_SCRATCHPAD_COMMAND
public static final byte COPY_SCRATCHPAD_PW_COMMAND
public static final byte READ_MEMORY_PW_COMMAND
public static final byte VERIFY_PSW_COMMAND
public static final byte READ_VERSION
public static final int PASSWORD_CONTROL_REGISTER
public static final int READ_ACCESS_PASSWORD
public static final int READ_WRITE_ACCESS_PASSWORD
public static final int READ_WRITE_PWD
public static final int READ_ONLY_PWD
Constructor Detail |
public OneWireContainer37()
OneWireContainer
for communication with a
DS1977.
Note that the method setupContainer(DSPortAdapter,byte[])
must be called to set the correct DSPortAdapter
device address.setupContainer(DSPortAdapter,byte[])
,
OneWireContainer37(DSPortAdapter,byte[])
,
OneWireContainer37(DSPortAdapter,long)
,
OneWireContainer37(DSPortAdapter,String)
public OneWireContainer37(DSPortAdapter sourceAdapter, byte[] newAddress)
OneWireContainer
for communication with a
DS1977.sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this DS1977OneWireContainer37()
,
OneWireContainer37(DSPortAdapter,long)
,
OneWireContainer37(DSPortAdapter,String)
public OneWireContainer37(DSPortAdapter sourceAdapter, long newAddress)
OneWireContainer
for communication with a
DS1977.sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this DS1977OneWireContainer37()
,
OneWireContainer37(DSPortAdapter,byte[])
,
OneWireContainer37(DSPortAdapter,String)
public OneWireContainer37(DSPortAdapter sourceAdapter, String newAddress)
OneWireContainer
for communication with a
DS1977.sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this DS1977OneWireContainer37()
,
OneWireContainer37(DSPortAdapter,long)
,
OneWireContainer37(DSPortAdapter,String)
Method Detail |
public void setupContainer(DSPortAdapter sourceAdapter, byte[] newAddress)
setupContainer
in class OneWireContainer
sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this 1-Wire deviceAddress
public void setupContainer(DSPortAdapter sourceAdapter, long newAddress)
setupContainer
in class OneWireContainer
sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this 1-Wire deviceAddress
public void setupContainer(DSPortAdapter sourceAdapter, String newAddress)
setupContainer
in class OneWireContainer
sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this 1-Wire deviceAddress
public Enumeration getMemoryBanks()
MemoryBank
,
PagedMemoryBank
,
and OTPMemoryBank
.getMemoryBanks
in class OneWireContainer
Enumeration
of memory bankspublic int getMaxSpeed()
getMaxSpeed
in class OneWireContainer
DSPortAdapter.setSpeed(int)
public String getName()
java.lang.String
.
For example "DS1977".getName
in class OneWireContainer
public String getAlternateNames()
getAlternateNames
in class OneWireContainer
public String getDescription()
getDescription
in class OneWireContainer
public void setSpeedCheck(boolean doSpeedCheck)
doSpeed()
. However, this is an expensive operation.
If a user manages the bus speed in an
application, call this method with doSpeedCheck
as false
. The default behavior is
to call doSpeed()
.doSpeedCheck
- true
for doSpeed()
to be called before every
1-Wire bus access, false
to skip this expensive callOneWireContainer.doSpeed()
public int getReadOnlyPasswordLength() throws OneWireException
getReadOnlyPasswordLength
in interface PasswordContainer
OneWireException
- public int getReadWritePasswordLength() throws OneWireException
getReadWritePasswordLength
in interface PasswordContainer
OneWireException
- public int getWriteOnlyPasswordLength() throws OneWireException
getWriteOnlyPasswordLength
in interface PasswordContainer
OneWireException
- public int getReadOnlyPasswordAddress() throws OneWireException
getReadOnlyPasswordAddress
in interface PasswordContainer
public int getReadWritePasswordAddress() throws OneWireException
getReadWritePasswordAddress
in interface PasswordContainer
public int getWriteOnlyPasswordAddress() throws OneWireException
getWriteOnlyPasswordAddress
in interface PasswordContainer
public boolean hasReadOnlyPassword()
hasReadOnlyPassword
in interface PasswordContainer
public boolean hasReadWritePassword()
hasReadWritePassword
in interface PasswordContainer
public boolean hasWriteOnlyPassword()
hasWriteOnlyPassword
in interface PasswordContainer
public boolean getDeviceReadOnlyPasswordEnable() throws OneWireException
getDeviceReadOnlyPasswordEnable
in interface PasswordContainer
OneWireException
- public boolean getDeviceReadWritePasswordEnable() throws OneWireException
getDeviceReadWritePasswordEnable
in interface PasswordContainer
OneWireException
- public boolean getDeviceWriteOnlyPasswordEnable() throws OneWireException
getDeviceWriteOnlyPasswordEnable
in interface PasswordContainer
OneWireException
- public boolean hasSinglePasswordEnable()
hasSinglePasswordEnable
in interface PasswordContainer
true
if the device has the capability to enable one type
of password while leaving another type disabled.public void setDevicePasswordEnableAll(boolean enableAll) throws OneWireException, OneWireIOException
Enables/Disables passwords for this device. If the part has more than one
type of password (Read-Only, Write-Only, or Read/Write), all passwords
will be enabled. This function is equivalent to the following:
owc37.setDevicePasswordEnable(
owc37.hasReadOnlyPassword(),
owc37.hasReadWritePassword(),
owc37.hasWriteOnlyPassword() );
For this to be successful, either write-protect passwords must be disabled, or the write-protect password(s) for this container must be set and must match the value of the write-protect password(s) in the device's register.
WARNING: Enabling passwords requires that both the read password and the read/write password be re-written to the part. Before calling this method, you should set the container read password and read/write password values. This will ensure that the correct value is written into the part.
setDevicePasswordEnableAll
in interface PasswordContainer
enableAll
- if true
, all passwords are enabled. Otherwise,
all passwords are disabled.public void setDeviceReadOnlyPassword(byte[] password, int offset) throws OneWireException, OneWireIOException
WARNING: Setting the read password requires that both the read password and the read/write password be written to the part. Before calling this method, you should set the container read/write password value. This will ensure that the correct value is written into the part.
setDeviceReadOnlyPassword
in interface PasswordContainer
password
- the new value of 8-byte device read password, to be copied
into the devices register.offset
- the offset to start copying the 8 bytes from the arraypublic void setDeviceReadWritePassword(byte[] password, int offset) throws OneWireException, OneWireIOException
setDeviceReadWritePassword
in interface PasswordContainer
password
- the new value of 8-byte device read/write password, to be
copied into the devices register.offset
- the offset to start copying the 8 bytes from the arraypublic void setDeviceWriteOnlyPassword(byte[] password, int offset) throws OneWireException, OneWireIOException
setDeviceWriteOnlyPassword
in interface PasswordContainer
password
- the new value of 8-byte device read/write password, to be
copied into the devices register.offset
- the offset to start copying the 8 bytes from the arraypublic void setDevicePasswordEnable(boolean enableReadOnly, boolean enableReadWrite, boolean enableWriteOnly) throws OneWireException, OneWireIOException
Enables/disables passwords by writing to the devices password control register. For this to be successful, either passwords must be disabled, or the read/write password for this container must be set and must match the current value of the read/write password in the device's register.
WARNING: Enabling passwords requires that both the read password and the read/write password be re-written to the part. Before calling this method, you should set the container read password and read/write password values. This will ensure that the correct value is written into the part.
setDevicePasswordEnable
in interface PasswordContainer
enable
- if true
, device passwords will be enabled.
All subsequent read and write operations will require that the
passwords for the container are set.public void setContainerReadOnlyPassword(byte[] password, int offset) throws OneWireException
setContainerReadOnlyPassword
in interface PasswordContainer
password
- New 8-byte value of container's read password.offset
- Index to start copying the password from the array.public void getContainerReadOnlyPassword(byte[] password, int offset) throws OneWireException
getContainerReadOnlyPassword
in interface PasswordContainer
password
- Holds the 8-byte value of container's read password.offset
- Index to start copying the password into the array.public boolean isContainerReadOnlyPasswordSet() throws OneWireException
isContainerReadOnlyPasswordSet
in interface PasswordContainer
true
if the container's read password has been setpublic void setContainerReadWritePassword(byte[] password, int offset) throws OneWireException
setContainerReadWritePassword
in interface PasswordContainer
password
- New 8-byte value of container's read/write password.offset
- Index to start copying the password from the array.public void getContainerReadWritePassword(byte[] password, int offset) throws OneWireException
getContainerReadWritePassword
in interface PasswordContainer
password
- Holds the 8-byte value of container's read/write password.offset
- Index to start copying the password into the array.public boolean isContainerReadWritePasswordSet() throws OneWireException
isContainerReadWritePasswordSet
in interface PasswordContainer
true
if the container's read/write password has been
set.public void setContainerWriteOnlyPassword(byte[] password, int offset) throws OneWireException
setContainerWriteOnlyPassword
in interface PasswordContainer
password
- New 8-byte value of container's read/write password.offset
- Index to start copying the password from the array.public void getContainerWriteOnlyPassword(byte[] password, int offset) throws OneWireException
getContainerWriteOnlyPassword
in interface PasswordContainer
password
- Holds the 8-byte value of container's read/write password.offset
- Index to start copying the password into the array.public boolean isContainerWriteOnlyPasswordSet() throws OneWireException
isContainerWriteOnlyPasswordSet
in interface PasswordContainer
true
if the container's read/write password has been
set.public boolean verifyPassword(byte[] password, int offset, int type) throws OneWireException, OneWireIOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |