|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.container.OneWireContainer
A OneWireContainer
encapsulates the DSPortAdapter
,
the 1-Wire® network address, and methods to manipulate a specific 1-Wire device. A
1-Wire device may be in the form of a stainless steel armored can, called an iButton®,
or in standard IC plastic packaging.
General 1-Wire device container class with basic communication functions.
This class should only be used if a device specific class is not available
or known. Most OneWireContainer
classes will extend this basic class.
1-Wire devices with memory can be accessed through the objects that
are returned from the getMemoryBanks
method. See the
usage example below.
MemoryBank
,
PagedMemoryBank
, and
OTPMemoryBank
for specific examples.
MemoryBank mb;
PagedMemoryBank pg_mb;
OTPMemoryBank otp_mb;
for(Enumeration bank_enum = owd.getMemoryBanks();
bank_enum.hasMoreElements(); )
{
// get the next memory bank, cast to MemoryBank
mb = (MemoryBank)bank_enum.nextElement();
// check if has paged services
if (mb instanceof PagedMemoryBank)
pg_mb = (PagedMemoryBank)mb;
// check if has One-Time-Programable services
if (mb instanceof OTPMemoryBank)
otp_mb = (OTPMemoryBank)mb;
}
com.dalsemi.onewire.container.MemoryBank
,
com.dalsemi.onewire.container.PagedMemoryBank
,
com.dalsemi.onewire.container.OTPMemoryBank
Field Summary | |
protected DSPortAdapter |
adapter
Reference to the adapter that is needed to communicate with this iButton or 1-Wire device. |
protected byte[] |
address
1-Wire Network Address of this iButton or 1-Wire device. |
protected int |
speed
Communication speed requested. |
protected boolean |
speedFallBackOK
Flag to indicate that falling back to a slower speed then requested is OK. |
Constructor Summary | |
OneWireContainer()
Create an empty container. |
|
OneWireContainer(DSPortAdapter sourceAdapter,
byte[] newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer(DSPortAdapter sourceAdapter,
long newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
|
OneWireContainer(DSPortAdapter sourceAdapter,
java.lang.String newAddress)
Create a container with a provided adapter object and the address of the iButton or 1-Wire device. |
Method Summary | |
void |
doSpeed()
Go to the specified speed for this container. |
boolean |
equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one. |
DSPortAdapter |
getAdapter()
Retrieves the port adapter object used to create this container. |
byte[] |
getAddress()
Gets the 1-Wire Network address of this device as an array of bytes. |
long |
getAddressAsLong()
Gets this device's 1-Wire Network address as a long. |
java.lang.String |
getAddressAsString()
Gets this device's 1-Wire Network address as a String. |
java.lang.String |
getAlternateNames()
Retrieves the alternate Dallas Semiconductor part numbers or names. |
java.lang.String |
getDescription()
Retrieves a short description of the function of the 1-Wire device type. |
int |
getMaxSpeed()
Returns the maximum speed this iButton or 1-Wire device can communicate at. |
java.util.Enumeration |
getMemoryBanks()
Returns an Enumeration of MemoryBank . |
java.lang.String |
getName()
Retrieves the Dallas Semiconductor part number of the 1-Wire device as a String . |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
isAlarming()
Verifies that the iButton or 1-Wire device is present on the 1-Wire Network and in an alarm state. |
boolean |
isPresent()
Verifies that the iButton or 1-Wire device is present on the 1-Wire Network. |
void |
setSpeed(int newSpeed,
boolean fallBack)
Sets the maximum speed for this container. |
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,
java.lang.String newAddress)
Provides this container with the adapter object used to access this device and the address of the iButton or 1-Wire device. |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected DSPortAdapter adapter
protected byte[] address
Address
protected int speed
DSPortAdapter.setSpeed(int)
protected boolean speedFallBackOK
Constructor Detail |
public OneWireContainer()
setupContainer
before
using this new container.This is one of the methods to construct a container. The others are through creating a OneWireContainer with parameters.
OneWireContainer(DSPortAdapter,byte[])
,
OneWireContainer(DSPortAdapter,long)
,
OneWireContainer(DSPortAdapter,String)
,
setupContainer(DSPortAdapter,byte[])
,
setupContainer(DSPortAdapter,long)
,
setupContainer(DSPortAdapter,String)
public OneWireContainer(DSPortAdapter sourceAdapter, byte[] newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire deviceOneWireContainer()
,
Address
public OneWireContainer(DSPortAdapter sourceAdapter, long newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire deviceOneWireContainer()
,
Address
public OneWireContainer(DSPortAdapter sourceAdapter, java.lang.String newAddress)
This is one of the methods to construct a container. The other is through creating a OneWireContainer with NO parameters.
sourceAdapter
- adapter object required to communicate with
this iButton.newAddress
- address of this 1-Wire deviceOneWireContainer()
,
Address
Method Detail |
public void setupContainer(DSPortAdapter sourceAdapter, byte[] newAddress)
sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this 1-Wire deviceAddress
public void setupContainer(DSPortAdapter sourceAdapter, long newAddress)
sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this 1-Wire deviceAddress
public void setupContainer(DSPortAdapter sourceAdapter, java.lang.String newAddress)
sourceAdapter
- adapter object required to communicate with
this iButtonnewAddress
- address of this 1-Wire deviceAddress
public DSPortAdapter getAdapter()
public java.lang.String getName()
String
. For example 'Crypto iButton' or 'DS1992'.public java.lang.String getAlternateNames()
public java.lang.String getDescription()
public void setSpeed(int newSpeed, boolean fallBack)
newSpeed
- fallBack
- boolean indicating it is OK to fall back to a slower
speed if truepublic int getMaxSpeed()
DSPortAdapter.setSpeed(int)
public byte[] getAddress()
Address
public java.lang.String getAddressAsString()
Address
public long getAddressAsLong()
Address
public java.util.Enumeration getMemoryBanks()
Enumeration
of MemoryBank
. Default is no memory banks.MemoryBank
public boolean isPresent() throws OneWireIOException, OneWireException
true
if device present on the 1-Wire Networkpublic boolean isAlarming() throws OneWireIOException, OneWireException
true
if device present and in alarm conditionpublic void doSpeed() throws OneWireIOException, OneWireException
setSpeed(int,boolean)
public int hashCode()
java.util.Hashtable
.Hashtable
public boolean equals(java.lang.Object o)
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |