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 OneWireContainer
s.
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.
Public Member Functions | |
void | addContainer (OneWireContainer c) |
Adds a OneWireContainer to the list of containers that this adapter object will find. | |
void | removeContainer (OneWireContainer c) |
Removes a OneWireContainer from the list of containers that this adapter object will find. | |
String | getAdapterName () |
Retrieves the name of the port adapter as a string. | |
String | getPortTypeDescription () |
Retrieves a description of the port required by this port adapter. | |
String | getClassVersion () |
Retrieves a version string for this class. | |
Enumeration | getPortNames () |
Retrieves a list of the platform appropriate port names for this adapter. | |
void | registerOneWireContainerClass (int family, Class OneWireContainerClass) |
This method does nothing in DumbAdapter . | |
boolean | selectPort (String portName) |
This method does nothing in DumbAdapter . | |
void | freePort () |
This method does nothing in DumbAdapter . | |
String | getPortName () |
Retrieves the name of the selected port as a String . | |
boolean | adapterDetected () |
Detects adapter presence on the selected port. | |
boolean | canOverdrive () |
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 | canFlex () |
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 . | |
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 | canBreak () |
Applications might check this method and not attempt operation unless this method returns true . | |
Enumeration | getAllDeviceContainers () |
Returns an enumeration of OneWireContainer objects corresponding to all of the iButtons or 1-Wire devices found on the 1-Wire Network. | |
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. | |
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 | 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. | |
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. | |
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 | select (byte[] address) |
Selects the specified iButton or 1-Wire device by broadcasting its address. | |
boolean | select (long address) throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address. | |
boolean | select (String address) throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address. | |
void | setSearchOnlyAlarmingDevices () |
This method does nothing in DumbAdapter . | |
void | setNoResetSearch () |
This method does nothing in DumbAdapter . | |
void | setSearchAllDevices () |
This method does nothing in DumbAdapter . | |
void | targetAllFamilies () |
This method does nothing in DumbAdapter . | |
void | targetFamily (int family) |
This method does nothing in DumbAdapter . | |
void | targetFamily (byte family[]) |
This method does nothing in DumbAdapter . | |
void | excludeFamily (int family) |
This method does nothing in DumbAdapter . | |
void | excludeFamily (byte family[]) |
This method does nothing in DumbAdapter . | |
boolean | beginExclusive (boolean blocking) |
This method does nothing in DumbAdapter . | |
void | endExclusive () |
This method does nothing in DumbAdapter . | |
void | putBit (boolean bitValue) |
Sends a bit to the 1-Wire Network. | |
boolean | getBit () |
Gets a bit from the 1-Wire Network. | |
void | putByte (int byteValue) |
This method does nothing in DumbAdapter . | |
int | getByte () |
This method does nothing in DumbAdapter . | |
byte[] | getBlock (int len) |
This method does nothing in DumbAdapter . | |
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 . | |
void | dataBlock (byte dataBlock[], int off, int len) |
This method does nothing in DumbAdapter . | |
int | reset () |
Sends a Reset to the 1-Wire Network. | |
void | setPowerDuration (int timeFactor) |
This method does nothing in DumbAdapter . | |
boolean | startPowerDelivery (int changeCondition) |
This method does nothing in DumbAdapter . | |
void | setProgramPulseDuration (int timeFactor) |
This method does nothing in DumbAdapter . | |
boolean | startProgramPulse (int changeCondition) |
This method does nothing in DumbAdapter . | |
void | startBreak () |
This method does nothing in DumbAdapter . | |
void | setPowerNormal () |
This method does nothing in DumbAdapter . | |
void | setSpeed (int speed) |
This method does nothing in DumbAdapter . | |
int | getSpeed () |
This method does nothing in DumbAdapter . | |
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 | getDeviceContainer () |
Returns a OneWireContainer object using the current 1-Wire network address. | |
Protected Member Functions | |
boolean | isValidFamily (byte[] address) |
Checks to see if the family found is in the desired include group. |
void addContainer | ( | OneWireContainer | c | ) |
Adds a 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 search |
void removeContainer | ( | OneWireContainer | c | ) |
Removes a 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 search |
String getAdapterName | ( | ) | [virtual] |
Retrieves the name of the port adapter as a string.
The 'Adapter' is a device that connects to a 'port' that allows one to communicate with an iButton or other 1-Wire device. As example of this is 'DS9097U'.
String
representation of the port adapter. Implements DSPortAdapter.
String getPortTypeDescription | ( | ) | [virtual] |
Retrieves a description of the port required by this port adapter.
An example of a 'Port' would 'serial communication port'.
String
description of the port type required. Implements DSPortAdapter.
String getClassVersion | ( | ) | [virtual] |
Enumeration getPortNames | ( | ) | [virtual] |
Retrieves a list of the platform appropriate port names for this adapter.
A port must be selected with the method 'selectPort' before any other communication methods can be used. Using a communcation method before 'selectPort' will result in a OneWireException
exception.
Enumeration
of type String
that contains the port names Implements DSPortAdapter.
boolean selectPort | ( | String | portName | ) | [virtual] |
This method does nothing in DumbAdapter
.
portName | name of the target port, retrieved from getPortNames() |
true
Implements DSPortAdapter.
String getPortName | ( | ) | [virtual] |
Retrieves the name of the selected port as a String
.
String
"NULL0" Implements DSPortAdapter.
boolean adapterDetected | ( | ) | [virtual] |
Detects adapter presence on the selected port.
In DumbAdapter
, the adapter is always detected.
true
Implements DSPortAdapter.
boolean canOverdrive | ( | ) |
Applications might check this method and not attempt operation unless this method returns true
.
To make sure that a wide variety of applications can use this class, this method always returns true
.
true
Reimplemented from DSPortAdapter.
boolean canHyperdrive | ( | ) |
Applications might check this method and not attempt operation unless this method returns true
.
To make sure that a wide variety of applications can use this class, this method always returns true
.
true
Reimplemented from DSPortAdapter.
boolean canFlex | ( | ) |
Applications might check this method and not attempt operation unless this method returns true
.
To make sure that a wide variety of applications can use this class, this method always returns true
.
true
Reimplemented from DSPortAdapter.
boolean canProgram | ( | ) |
Applications might check this method and not attempt operation unless this method returns true
.
To make sure that a wide variety of applications can use this class, this method always returns true
.
true
Reimplemented from DSPortAdapter.
boolean canDeliverPower | ( | ) |
Applications might check this method and not attempt operation unless this method returns true
.
To make sure that a wide variety of applications can use this class, this method always returns true
.
true
Reimplemented from DSPortAdapter.
boolean canDeliverSmartPower | ( | ) |
Applications might check this method and not attempt operation unless this method returns true
.
To make sure that a wide variety of applications can use this class, this method always returns true
.
true
Reimplemented from DSPortAdapter.
boolean canBreak | ( | ) |
Applications might check this method and not attempt operation unless this method returns true
.
To make sure that a wide variety of applications can use this class, this method always returns true
.
true
Reimplemented from DSPortAdapter.
Enumeration getAllDeviceContainers | ( | ) |
Returns an enumeration of 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.
Enumeration
of OneWireContainer
objects found on the 1-Wire Network. Reimplemented from DSPortAdapter.
OneWireContainer getFirstDeviceContainer | ( | ) |
Returns a 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
.
OneWireContainer
object found on the 1-Wire Network, or null
if no devices found. Reimplemented from DSPortAdapter.
OneWireContainer getNextDeviceContainer | ( | ) |
Returns a 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
.
OneWireContainer
object found on the 1-Wire Network, or null
if no iButtons found. Reimplemented from DSPortAdapter.
boolean findFirstDevice | ( | ) | [virtual] |
Returns 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.
true
if an iButton or 1-Wire device is found. Implements DSPortAdapter.
boolean findNextDevice | ( | ) | [virtual] |
Returns 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.
true
if an iButton or 1-Wire device is found. Implements DSPortAdapter.
void getAddress | ( | byte[] | address | ) | [virtual] |
Copies the 'current' 1-Wire device address being used by the adapter into the array.
This address is the last iButton or 1-Wire device found in a search (findNextDevice()...). This method copies into a user generated array to allow the reuse of the buffer. When searching many iButtons on the one wire network, this will reduce the memory burn rate.
address | An array to be filled with the current iButton address. |
Implements DSPortAdapter.
long getAddressAsLong | ( | ) |
Gets the 'current' 1-Wire device address being used by the adapter as a long.
This address is the last iButton or 1-Wire device found in a search (findNextDevice()...).
long
representation of the iButton address Reimplemented from DSPortAdapter.
String getAddressAsString | ( | ) |
Gets the 'current' 1-Wire device address being used by the adapter as a String.
This address is the last iButton or 1-Wire device found in a search (findNextDevice()...).
String
representation of the iButton address Reimplemented from DSPortAdapter.
boolean isPresent | ( | byte[] | address | ) |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network.
This does not affect the 'current' device state information used in searches (findNextDevice...).
address | device address to verify is present |
true
if device is present, else false
.Reimplemented from DSPortAdapter.
boolean isPresent | ( | long | address | ) |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network.
This does not affect the 'current' device state information used in searches (findNextDevice...).
address | device address to verify is present |
true
if device is present, else false
.Reimplemented from DSPortAdapter.
boolean isPresent | ( | String | address | ) |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network.
This does not affect the 'current' device state information used in searches (findNextDevice...).
address | device address to verify is present |
true
if device is present, else false
.Reimplemented from DSPortAdapter.
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.
This method is currently not implemented in DumbAdapter
.
address | device address to verify is present and alarming |
false
Reimplemented from DSPortAdapter.
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.
This method is currently not implemented in DumbAdapter
.
address | device address to verify is present and alarming |
false
Reimplemented from DSPortAdapter.
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.
This method is currently not implemented in DumbAdapter
.
address | device address to verify is present and alarming |
false
Reimplemented from DSPortAdapter.
boolean select | ( | byte[] | address | ) |
Selects the specified iButton or 1-Wire device by broadcasting its address.
With a DumbAdapter
, this method simply returns true.
Warning, this does not verify that the device is currently present on the 1-Wire Network (See isPresent).
address | address of iButton or 1-Wire device to select |
true
if device address was sent, false
otherwise.Reimplemented from DSPortAdapter.
boolean select | ( | long | address | ) | throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address.
With a DumbAdapter
, this method simply returns true.
Warning, this does not verify that the device is currently present on the 1-Wire Network (See isPresent).
address | address of iButton or 1-Wire device to select |
true
if device address was sent, false
otherwise.Reimplemented from DSPortAdapter.
boolean select | ( | String | address | ) | throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address.
With a DumbAdapter
, this method simply returns true.
Warning, this does not verify that the device is currently present on the 1-Wire Network (See isPresent).
address | address of iButton or 1-Wire device to select |
true
if device address was sent, false
otherwise.Reimplemented from DSPortAdapter.
void setSearchOnlyAlarmingDevices | ( | ) | [virtual] |
void setSearchAllDevices | ( | ) | [virtual] |
void targetAllFamilies | ( | ) |
This method does nothing in DumbAdapter
.
targetFamily(byte[])
excludeFamily(byte[])
Reimplemented from DSPortAdapter.
void targetFamily | ( | int | family | ) |
This method does nothing in DumbAdapter
.
family | the code of the family type to target for searches |
Reimplemented from DSPortAdapter.
void targetFamily | ( | byte | family[] | ) |
This method does nothing in DumbAdapter
.
family | array of the family types to target for searches |
Reimplemented from DSPortAdapter.
void excludeFamily | ( | int | family | ) |
This method does nothing in DumbAdapter
.
family | the code of the family type NOT to target in searches |
Reimplemented from DSPortAdapter.
void excludeFamily | ( | byte | family[] | ) |
This method does nothing in DumbAdapter
.
family | array of family cods NOT to target for searches |
Reimplemented from DSPortAdapter.
boolean beginExclusive | ( | boolean | blocking | ) | [virtual] |
This method does nothing in DumbAdapter
.
blocking | true if want to block waiting for an excluse access to the adapter |
true
Implements DSPortAdapter.
void putBit | ( | boolean | bitValue | ) | [virtual] |
Sends a bit to the 1-Wire Network.
This method does nothing in DumbAdapter
.
bitValue | the bit value to send to the 1-Wire Network. |
Implements DSPortAdapter.
boolean getBit | ( | ) | [virtual] |
Gets a bit from the 1-Wire Network.
This method does nothing in DumbAdapter
.
true
Implements DSPortAdapter.
void putByte | ( | int | byteValue | ) | [virtual] |
This method does nothing in DumbAdapter
.
byteValue | the byte value to send to the 1-Wire Network. |
Implements DSPortAdapter.
int getByte | ( | ) | [virtual] |
byte [] getBlock | ( | int | len | ) | [virtual] |
This method does nothing in DumbAdapter
.
len | length of data bytes to receive |
len
Implements DSPortAdapter.
void getBlock | ( | byte[] | arr, | |
int | len | |||
) | [virtual] |
This method does nothing in DumbAdapter
.
arr | array in which to write the received bytes | |
len | length of data bytes to receive |
Implements DSPortAdapter.
void getBlock | ( | byte[] | arr, | |
int | off, | |||
int | len | |||
) | [virtual] |
This method does nothing in DumbAdapter
.
arr | array in which to write the received bytes | |
off | offset into the array to start | |
len | length of data bytes to receive |
Implements DSPortAdapter.
void dataBlock | ( | byte | dataBlock[], | |
int | off, | |||
int | len | |||
) | [virtual] |
This method does nothing in DumbAdapter
.
dataBlock | array of data to transfer to and from the 1-Wire Network. | |
off | offset into the array of data to start | |
len | length of data to send / receive starting at 'off' |
Implements DSPortAdapter.
int reset | ( | ) | [virtual] |
Sends a Reset to the 1-Wire Network.
DumbAdapter
, the only possible results are 0 and 1. Implements DSPortAdapter.
void setPowerDuration | ( | int | timeFactor | ) |
This method does nothing in DumbAdapter
.
timeFactor |
|
Reimplemented from DSPortAdapter.
boolean startPowerDelivery | ( | int | changeCondition | ) |
This method does nothing in DumbAdapter
.
changeCondition |
|
true
Reimplemented from DSPortAdapter.
void setProgramPulseDuration | ( | int | timeFactor | ) |
This method does nothing in DumbAdapter
.
timeFactor |
|
Reimplemented from DSPortAdapter.
boolean startProgramPulse | ( | int | changeCondition | ) |
This method does nothing in DumbAdapter
.
changeCondition |
|
true
Reimplemented from DSPortAdapter.
void setSpeed | ( | int | speed | ) |
This method does nothing in DumbAdapter
.
speed |
|
Reimplemented from DSPortAdapter.
int getSpeed | ( | ) |
This method does nothing in DumbAdapter
.
setSpeed(int)
method, or 0 Reimplemented from DSPortAdapter.
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
.
address | device address with which to find a container |
OneWireContainer
object, or null
if no match could be found. Reimplemented from DSPortAdapter.
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
.
address | device address with which to find a container |
OneWireContainer
object, or null
if no match could be found. Reimplemented from DSPortAdapter.
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
.
address | device address with which to find a container |
OneWireContainer
object, or null
if no match could be found. Reimplemented from DSPortAdapter.
OneWireContainer getDeviceContainer | ( | ) |
Returns a 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.
OneWireContainer
object Reimplemented from DSPortAdapter.
boolean isValidFamily | ( | byte[] | address | ) | [protected] |
Checks to see if the family found is in the desired include group.
true
if in include group Reimplemented from DSPortAdapter.