|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.dalsemi.onewire.adapter.DSPortAdapter
|
+--com.dalsemi.onewire.adapter.DumbAdapter
This DSPortAdapter class was designed to be used for
the iB-IDE's emulator. The DumbAdapter allows
programmers to add and remove OneWireContainer
objects that will be found in its search. The Java iButton
emulator works by creating a class that subclasses all of
OneWireContainer16's relevant methods and redirecting them
to the emulation code. That object is then added to this class's
list of OneWireContainers.
Note that methods such as selectPort and
beginExclusive by default do nothing. This class is
mainly meant for debugging using an emulated iButton. It will do
a poor job of debugging any multi-threading, port-sharing issues.
DSPortAdapter,
OneWireContainer| Fields inherited from class com.dalsemi.onewire.adapter.DSPortAdapter |
CONDITION_AFTER_BIT, CONDITION_AFTER_BYTE, CONDITION_NOW, DELIVERY_CURRENT_DETECT, DELIVERY_EPROM, DELIVERY_FOUR_SECONDS, DELIVERY_HALF_SECOND, DELIVERY_INFINITE, DELIVERY_ONE_SECOND, DELIVERY_SMART_DONE, DELIVERY_TWO_SECONDS, LEVEL_BREAK, LEVEL_NORMAL, LEVEL_POWER_DELIVERY, LEVEL_PROGRAM, RESET_ALARM, RESET_NOPRESENCE, RESET_PRESENCE, RESET_SHORT, SPEED_FLEX, SPEED_HYPERDRIVE, SPEED_OVERDRIVE, SPEED_REGULAR |
| Constructor Summary | |
DumbAdapter()
|
|
| Method Summary | |
boolean |
adapterDetected()
Detects adapter presence on the selected port. |
void |
addContainer(OneWireContainer c)
Adds a OneWireContainer to the list of containers that
this adapter object will find. |
boolean |
beginExclusive(boolean blocking)
This method does nothing in DumbAdapter. |
boolean |
canBreak()
Applications might check this method and not attempt operation unless this method returns true. |
boolean |
canDeliverPower()
Applications might check this method and not attempt operation unless this method returns true. |
boolean |
canDeliverSmartPower()
Applications might check this method and not attempt operation unless this method returns true. |
boolean |
canFlex()
Applications might check this method and not attempt operation unless this method returns true. |
boolean |
canHyperdrive()
Applications might check this method and not attempt operation unless this method returns true. |
boolean |
canOverdrive()
Applications might check this method and not attempt operation unless this method returns true. |
boolean |
canProgram()
Applications might check this method and not attempt operation unless this method returns true. |
void |
dataBlock(byte[] dataBlock,
int off,
int len)
This method does nothing in DumbAdapter. |
void |
endExclusive()
This method does nothing in DumbAdapter. |
void |
excludeFamily(byte[] family)
This method does nothing in DumbAdapter. |
void |
excludeFamily(int family)
This method does nothing in DumbAdapter. |
boolean |
findFirstDevice()
Returns true if the first iButton or 1-Wire device
is found on the 1-Wire Network. |
boolean |
findNextDevice()
Returns true if the next iButton or 1-Wire device
is found. |
void |
freePort()
This method does nothing in DumbAdapter. |
String |
getAdapterName()
Retrieves the name of the port adapter as a string. |
void |
getAddress(byte[] address)
Copies the 'current' 1-Wire device address being used by the adapter into the array. |
long |
getAddressAsLong()
Gets the 'current' 1-Wire device address being used by the adapter as a long. |
String |
getAddressAsString()
Gets the 'current' 1-Wire device address being used by the adapter as a String. |
Enumeration |
getAllDeviceContainers()
Returns an enumeration of OneWireContainer objects corresponding
to all of the iButtons or 1-Wire devices found on the 1-Wire Network. |
boolean |
getBit()
Gets a bit from the 1-Wire Network. |
void |
getBlock(byte[] arr,
int len)
This method does nothing in DumbAdapter. |
void |
getBlock(byte[] arr,
int off,
int len)
This method does nothing in DumbAdapter. |
byte[] |
getBlock(int len)
This method does nothing in DumbAdapter. |
int |
getByte()
This method does nothing in DumbAdapter. |
String |
getClassVersion()
Retrieves a version string for this class. |
OneWireContainer |
getDeviceContainer()
Returns a OneWireContainer object using the current 1-Wire network address. |
OneWireContainer |
getDeviceContainer(byte[] address)
Gets the container from this adapter whose address matches the address of a container in the DumbAdapter's internal java.util.Vector. |
OneWireContainer |
getDeviceContainer(long address)
Gets the container from this adapter whose address matches the address of a container in the DumbAdapter's internal java.util.Vector. |
OneWireContainer |
getDeviceContainer(String address)
Gets the container from this adapter whose address matches the address of a container in the DumbAdapter's internal java.util.Vector. |
OneWireContainer |
getFirstDeviceContainer()
Returns a OneWireContainer object corresponding to the first iButton
or 1-Wire device found on the 1-Wire Network. |
OneWireContainer |
getNextDeviceContainer()
Returns a OneWireContainer object corresponding to the next iButton
or 1-Wire device found. |
String |
getPortName()
Retrieves the name of the selected port as a String. |
Enumeration |
getPortNames()
Retrieves a list of the platform appropriate port names for this adapter. |
String |
getPortTypeDescription()
Retrieves a description of the port required by this port adapter. |
int |
getSpeed()
This method does nothing in DumbAdapter. |
boolean |
isAlarming(byte[] address)
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network and in an alarm state. |
boolean |
isAlarming(long address)
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network and in an alarm state. |
boolean |
isAlarming(String address)
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network and in an alarm state. |
boolean |
isPresent(byte[] address)
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network. |
boolean |
isPresent(long address)
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network. |
boolean |
isPresent(String address)
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network. |
void |
putBit(boolean bitValue)
Sends a bit to the 1-Wire Network. |
void |
putByte(int byteValue)
This method does nothing in DumbAdapter. |
void |
registerOneWireContainerClass(int family,
Class OneWireContainerClass)
This method does nothing in DumbAdapter. |
void |
removeContainer(OneWireContainer c)
Removes a OneWireContainer from the list of containers that
this adapter object will find. |
int |
reset()
Sends a Reset to the 1-Wire Network. |
boolean |
select(byte[] address)
Selects the specified iButton or 1-Wire device by broadcasting its address. |
boolean |
select(long address)
Selects the specified iButton or 1-Wire device by broadcasting its address. |
boolean |
select(String address)
Selects the specified iButton or 1-Wire device by broadcasting its address. |
boolean |
selectPort(String portName)
This method does nothing in DumbAdapter. |
void |
setNoResetSearch()
This method does nothing in DumbAdapter. |
void |
setPowerDuration(int timeFactor)
This method does nothing in DumbAdapter. |
void |
setPowerNormal()
This method does nothing in DumbAdapter. |
void |
setProgramPulseDuration(int timeFactor)
This method does nothing in DumbAdapter. |
void |
setSearchAllDevices()
This method does nothing in DumbAdapter. |
void |
setSearchOnlyAlarmingDevices()
This method does nothing in DumbAdapter. |
void |
setSpeed(int speed)
This method does nothing in DumbAdapter. |
void |
startBreak()
This method does nothing in DumbAdapter. |
boolean |
startPowerDelivery(int changeCondition)
This method does nothing in DumbAdapter. |
boolean |
startProgramPulse(int changeCondition)
This method does nothing in DumbAdapter. |
void |
targetAllFamilies()
This method does nothing in DumbAdapter. |
void |
targetFamily(byte[] family)
This method does nothing in DumbAdapter. |
void |
targetFamily(int family)
This method does nothing in DumbAdapter. |
| Methods inherited from class com.dalsemi.onewire.adapter.DSPortAdapter |
getAdapterAddress, getAdapterVersion |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DumbAdapter()
| Method Detail |
public void addContainer(OneWireContainer c)
OneWireContainer to the list of containers that
this adapter object will find.c - represents a 1-Wire device that this adapter will report from a searchpublic void removeContainer(OneWireContainer c)
OneWireContainer from the list of containers that
this adapter object will find.c - represents a 1-Wire device that this adapter should no longer
report as found by a searchpublic String getAdapterName()
getAdapterName in class DSPortAdapterString representation of the port adapter.public String getPortTypeDescription()
getPortTypeDescription in class DSPortAdapterString description of the port type required.public String getClassVersion()
getClassVersion in class DSPortAdapterpublic Enumeration getPortNames()
OneWireException exception.getPortNames in class DSPortAdapterEnumeration of type String that contains the port
names
public void registerOneWireContainerClass(int family,
Class OneWireContainerClass)
DumbAdapter.registerOneWireContainerClass in class DSPortAdaptercom.dalsemi.onewire.adapter.DSPortAdapterfamily - the code of the family type to associate with this class.OneWireContainerClass - User provided classOneWireException - If OneWireContainerClass is not found.ClassCastException - If user supplied OneWireContainer does not
extend com.dalsemi.onewire.container.OneWireContainer.public boolean selectPort(String portName)
DumbAdapter.selectPort in class DSPortAdapterportName - name of the target port, retrieved from
getPortNames()truepublic void freePort()
DumbAdapter.freePort in class DSPortAdaptercom.dalsemi.onewire.adapter.DSPortAdapterOneWireException - If port does not existpublic String getPortName()
String.getPortName in class DSPortAdapterString "NULL0"public boolean adapterDetected()
DumbAdapter,
the adapter is always detected.adapterDetected in class DSPortAdaptertruepublic boolean canOverdrive()
true. To make sure that a wide variety of applications can use this class,
this method always returns true.canOverdrive in class DSPortAdaptertruepublic boolean canHyperdrive()
true. To make sure that a wide variety of applications can use this class,
this method always returns true.canHyperdrive in class DSPortAdaptertruepublic boolean canFlex()
true. To make sure that a wide variety of applications can use this class,
this method always returns true.canFlex in class DSPortAdaptertruepublic boolean canProgram()
true. To make sure that a wide variety of applications can use this class,
this method always returns true.canProgram in class DSPortAdaptertruepublic boolean canDeliverPower()
true. To make sure that a wide variety of applications can use this class,
this method always returns true.canDeliverPower in class DSPortAdaptertruepublic boolean canDeliverSmartPower()
true. To make sure that a wide variety of applications can use this class,
this method always returns true.canDeliverSmartPower in class DSPortAdaptertruepublic boolean canBreak()
true. To make sure that a wide variety of applications can use this class,
this method always returns true.canBreak in class DSPortAdaptertruepublic Enumeration getAllDeviceContainers()
OneWireContainer objects corresponding
to all of the iButtons or 1-Wire devices found on the 1-Wire Network. In the case of
the DumbAdapter, this method returns a simple copy of the internal
java.util.Vector that stores all the 1-Wire devices this class finds
in a search.getAllDeviceContainers in class DSPortAdapterEnumeration of OneWireContainer objects
found on the 1-Wire Network.public OneWireContainer getFirstDeviceContainer()
OneWireContainer object corresponding to the first iButton
or 1-Wire device found on the 1-Wire Network. If no devices are found,
then a null reference will be returned. In most cases, all further
communication with the device is done through the OneWireContainer.getFirstDeviceContainer in class DSPortAdapterOneWireContainer object found on the
1-Wire Network, or null if no devices found.public OneWireContainer getNextDeviceContainer()
OneWireContainer object corresponding to the next iButton
or 1-Wire device found. The previous 1-Wire device found is used
as a starting point in the search. If no devices are found,
then a null reference will be returned. In most cases, all further
communication with the device is done through the OneWireContainer.getNextDeviceContainer in class DSPortAdapterOneWireContainer object found on the
1-Wire Network, or null if no iButtons found.public boolean findFirstDevice()
true if the first iButton or 1-Wire device
is found on the 1-Wire Network.
If no devices are found, then false will be returned.findFirstDevice in class DSPortAdaptertrue if an iButton or 1-Wire device is found.public boolean findNextDevice()
true if the next iButton or 1-Wire device
is found. The previous 1-Wire device found is used
as a starting point in the search. If no more devices are found
then false will be returned.findNextDevice in class DSPortAdaptertrue if an iButton or 1-Wire device is found.public void getAddress(byte[] address)
getAddress in class DSPortAdapteraddress - An array to be filled with the current iButton address.Addresspublic long getAddressAsLong()
getAddressAsLong in class DSPortAdapterlong representation of the iButton addressAddresspublic String getAddressAsString()
getAddressAsString in class DSPortAdapterString representation of the iButton addressAddresspublic boolean isPresent(byte[] address)
isPresent in class DSPortAdapteraddress - device address to verify is presenttrue if device is present, else
false.Addresspublic boolean isPresent(long address)
isPresent in class DSPortAdapteraddress - device address to verify is presenttrue if device is present, else
false.Addresspublic boolean isPresent(String address)
isPresent in class DSPortAdapteraddress - device address to verify is presenttrue if device is present, else
false.Addresspublic boolean isAlarming(byte[] address)
DumbAdapter.isAlarming in class DSPortAdapteraddress - device address to verify is present and alarmingfalseAddresspublic boolean isAlarming(long address)
DumbAdapter.isAlarming in class DSPortAdapteraddress - device address to verify is present and alarmingfalseAddresspublic boolean isAlarming(String address)
DumbAdapter.isAlarming in class DSPortAdapteraddress - device address to verify is present and alarmingfalseAddresspublic boolean select(byte[] address)
DumbAdapter, this method simply
returns true.
Warning, this does not verify that the device is currently present
on the 1-Wire Network (See isPresent).select in class DSPortAdapteraddress - address of iButton or 1-Wire device to selecttrue if device address was sent, false
otherwise.isPresent(byte[]),
Address
public boolean select(long address)
throws OneWireIOException,
OneWireException
DumbAdapter, this method simply
returns true.
Warning, this does not verify that the device is currently present
on the 1-Wire Network (See isPresent).select in class DSPortAdapteraddress - address of iButton or 1-Wire device to selecttrue if device address was sent, false
otherwise.isPresent(byte[]),
Address
public boolean select(String address)
throws OneWireIOException,
OneWireException
DumbAdapter, this method simply
returns true.
Warning, this does not verify that the device is currently present
on the 1-Wire Network (See isPresent).select in class DSPortAdapteraddress - address of iButton or 1-Wire device to selecttrue if device address was sent, false
otherwise.isPresent(byte[]),
Addresspublic void setSearchOnlyAlarmingDevices()
DumbAdapter.setSearchOnlyAlarmingDevices in class DSPortAdaptersetNoResetSearch()public void setNoResetSearch()
DumbAdapter.setNoResetSearch in class DSPortAdapterpublic void setSearchAllDevices()
DumbAdapter.setSearchAllDevices in class DSPortAdaptersetNoResetSearch()public void targetAllFamilies()
DumbAdapter.targetAllFamilies in class DSPortAdaptertargetFamily(int),
targetFamily(byte[]),
excludeFamily(int),
excludeFamily(byte[])public void targetFamily(int family)
DumbAdapter.targetFamily in class DSPortAdapterfamily - the code of the family type to target for searchesAddress,
targetAllFamilies()public void targetFamily(byte[] family)
DumbAdapter.targetFamily in class DSPortAdapterfamily - array of the family types to target for searchesAddress,
targetAllFamilies()public void excludeFamily(int family)
DumbAdapter.excludeFamily in class DSPortAdapterfamily - the code of the family type NOT to target in searchesAddress,
targetAllFamilies()public void excludeFamily(byte[] family)
DumbAdapter.excludeFamily in class DSPortAdapterfamily - array of family cods NOT to target for searchesAddress,
targetAllFamilies()public boolean beginExclusive(boolean blocking)
DumbAdapter.beginExclusive in class DSPortAdapterblocking - true if want to block waiting
for an excluse access to the adaptertruepublic void endExclusive()
DumbAdapter.endExclusive in class DSPortAdapterpublic void putBit(boolean bitValue)
DumbAdapter.putBit in class DSPortAdapterbitValue - the bit value to send to the 1-Wire Network.public boolean getBit()
DumbAdapter.getBit in class DSPortAdaptertruepublic void putByte(int byteValue)
DumbAdapter.putByte in class DSPortAdapterbyteValue - the byte value to send to the 1-Wire Network.public int getByte()
DumbAdapter.getByte in class DSPortAdapterpublic byte[] getBlock(int len)
DumbAdapter.getBlock in class DSPortAdapterlen - length of data bytes to receivelen
public void getBlock(byte[] arr,
int len)
DumbAdapter.getBlock in class DSPortAdapterarr - array in which to write the received byteslen - length of data bytes to receive
public void getBlock(byte[] arr,
int off,
int len)
DumbAdapter.getBlock in class DSPortAdapterarr - array in which to write the received bytesoff - offset into the array to startlen - length of data bytes to receive
public void dataBlock(byte[] dataBlock,
int off,
int len)
DumbAdapter.dataBlock in class DSPortAdapterdataBlock - array of data to transfer to and from the 1-Wire Network.off - offset into the array of data to startlen - length of data to send / receive starting at 'off'public int reset()
reset in class DSPortAdapterDumbAdapter, the only possible results are 0 and 1.public void setPowerDuration(int timeFactor)
DumbAdapter.setPowerDuration in class DSPortAdaptertimeFactor - public boolean startPowerDelivery(int changeCondition)
DumbAdapter.startPowerDelivery in class DSPortAdapterchangeCondition - truepublic void setProgramPulseDuration(int timeFactor)
DumbAdapter.setProgramPulseDuration in class DSPortAdaptertimeFactor - public boolean startProgramPulse(int changeCondition)
DumbAdapter.startProgramPulse in class DSPortAdapterchangeCondition - truepublic void startBreak()
DumbAdapter.startBreak in class DSPortAdaptercom.dalsemi.onewire.adapter.DSPortAdapterOneWireIOException - on a 1-Wire communication errorOneWireException - on a setup error with the 1-Wire adapter
or the adapter does not support this operationpublic void setPowerNormal()
DumbAdapter.setPowerNormal in class DSPortAdaptercom.dalsemi.onewire.adapter.DSPortAdapterOneWireIOException - on a 1-Wire communication errorOneWireException - on a setup error with the 1-Wire adapter
or the adapter does not support this operationpublic void setSpeed(int speed)
DumbAdapter.setSpeed in class DSPortAdapterspeed - public int getSpeed()
DumbAdapter.getSpeed in class DSPortAdapterpublic OneWireContainer getDeviceContainer(byte[] address)
DumbAdapter's internal java.util.Vector.getDeviceContainer in class DSPortAdapteraddress - device address with which to find a containerOneWireContainer object, or null if no match could be found.Addresspublic OneWireContainer getDeviceContainer(long address)
DumbAdapter's internal java.util.Vector.getDeviceContainer in class DSPortAdapteraddress - device address with which to find a containerOneWireContainer object, or null if no match could be found.Addresspublic OneWireContainer getDeviceContainer(String address)
DumbAdapter's internal java.util.Vector.getDeviceContainer in class DSPortAdapteraddress - device address with which to find a containerOneWireContainer object, or null if no match could be found.Addresspublic OneWireContainer getDeviceContainer()
OneWireContainer object using the current 1-Wire network address.
The internal state of the port adapter keeps track of the last
address found and is able to create container objects from this
state.getDeviceContainer in class DSPortAdapterOneWireContainer object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||