1-Wire API for .NET Version 4.00
|
The abstract base class for all 1-Wire port adapter objects. More...
Inherited by DotNetAdapterx64, DotNetAdapterx86, DumbAdapter, and NetAdapter.
Public Member Functions | |
abstract String | getAdapterName () |
Retrieves the name of the port adapter as a string. | |
abstract String | getPortTypeDescription () |
Retrieves a description of the port required by this port adapter. | |
abstract String | getClassVersion () |
Retrieves a version string for this class. | |
abstract Enumeration | getPortNames () |
Retrieves a list of the platform appropriate port names for this adapter. | |
void | registerOneWireContainerClass (int family, Class OneWireContainerClass) throws OneWireException |
Registers a user provided OneWireContainer class. | |
abstract boolean | selectPort (String portName) throws OneWireIOException, OneWireException |
Specifies a platform appropriate port name for this adapter. | |
abstract void | freePort () throws OneWireException |
Frees ownership of the selected port, if it is currently owned, back to the system. | |
abstract String | getPortName () throws OneWireException |
Retrieves the name of the selected port as a String . | |
abstract boolean | adapterDetected () throws OneWireIOException, OneWireException |
Detects adapter presence on the selected port. | |
String | getAdapterVersion () throws OneWireIOException, OneWireException |
Retrieves the version of the adapter. | |
String | getAdapterAddress () throws OneWireIOException, OneWireException |
Retrieves the address of the adapter, if it has one. | |
boolean | canOverdrive () throws OneWireIOException, OneWireException |
Returns whether adapter can physically support overdrive mode. | |
boolean | canHyperdrive () throws OneWireIOException, OneWireException |
Returns whether the adapter can physically support hyperdrive mode. | |
boolean | canFlex () throws OneWireIOException, OneWireException |
Returns whether the adapter can physically support flex speed mode. | |
boolean | canProgram () throws OneWireIOException, OneWireException |
Returns whether adapter can physically support 12 volt power mode. | |
boolean | canDeliverPower () throws OneWireIOException, OneWireException |
Returns whether the adapter can physically support strong 5 volt power mode. | |
boolean | canDeliverSmartPower () throws OneWireIOException, OneWireException |
Returns whether the adapter can physically support "smart" strong 5 volt power mode. | |
boolean | canBreak () throws OneWireIOException, OneWireException |
Returns whether adapter can physically support 0 volt 'break' mode. | |
Enumeration | getAllDeviceContainers () throws OneWireIOException, OneWireException |
Returns an enumeration of OneWireContainer objects corresponding to all of the iButtons or 1-Wire devices found on the 1-Wire Network. | |
OneWireContainer | getFirstDeviceContainer () throws OneWireIOException, OneWireException |
Returns a OneWireContainer object corresponding to the first iButton or 1-Wire device found on the 1-Wire Network. | |
OneWireContainer | getNextDeviceContainer () throws OneWireIOException, OneWireException |
Returns a OneWireContainer object corresponding to the next iButton or 1-Wire device found. | |
abstract boolean | findFirstDevice () throws OneWireIOException, OneWireException |
Returns true if the first iButton or 1-Wire device is found on the 1-Wire Network. | |
abstract boolean | findNextDevice () throws OneWireIOException, OneWireException |
Returns true if the next iButton or 1-Wire device is found. | |
abstract 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) throws OneWireIOException, OneWireException |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network. | |
boolean | isPresent (long address) throws OneWireIOException, OneWireException |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network. | |
boolean | isPresent (String address) throws OneWireIOException, OneWireException |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network. | |
boolean | isAlarming (byte[] address) throws OneWireIOException, OneWireException |
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) throws OneWireIOException, OneWireException |
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) throws OneWireIOException, OneWireException |
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) throws OneWireIOException, OneWireException |
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 | assertSelect (byte[] address) throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address. | |
void | assertSelect (long address) throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address. | |
void | assertSelect (String address) throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address. | |
abstract void | setSearchOnlyAlarmingDevices () |
Sets the 1-Wire Network search to find only iButtons and 1-Wire devices that are in an 'Alarm' state that signals a need for attention. | |
abstract void | setNoResetSearch () |
Sets the 1-Wire Network search to not perform a 1-Wire reset before a search. | |
abstract void | setSearchAllDevices () |
Sets the 1-Wire Network search to find all iButtons and 1-Wire devices whether they are in an 'Alarm' state or not and restores the default setting of providing a 1-Wire reset command before each search. | |
void | targetAllFamilies () |
Removes any selectivity during a search for iButtons or 1-Wire devices by family type. | |
void | targetFamily (int family) |
Takes an integer to selectively search for this desired family type. | |
void | targetFamily (byte family[]) |
Takes an array of bytes to use for selectively searching for acceptable family codes. | |
void | excludeFamily (int family) |
Takes an integer family code to avoid when searching for iButtons. | |
void | excludeFamily (byte family[]) |
Takes an array of bytes containing family codes to avoid when finding iButtons or 1-Wire devices. | |
abstract boolean | beginExclusive (boolean blocking) throws OneWireException |
Gets exclusive use of the 1-Wire to communicate with an iButton or 1-Wire Device. | |
abstract void | endExclusive () |
Relinquishes exclusive control of the 1-Wire Network. | |
abstract void | putBit (boolean bitValue) throws OneWireIOException, OneWireException |
Sends a bit to the 1-Wire Network. | |
abstract boolean | getBit () throws OneWireIOException, OneWireException |
Gets a bit from the 1-Wire Network. | |
abstract void | putByte (int byteValue) throws OneWireIOException, OneWireException |
Sends a byte to the 1-Wire Network. | |
abstract int | getByte () throws OneWireIOException, OneWireException |
Gets a byte from the 1-Wire Network. | |
abstract byte[] | getBlock (int len) throws OneWireIOException, OneWireException |
Gets a block of data from the 1-Wire Network. | |
abstract void | getBlock (byte[] arr, int len) throws OneWireIOException, OneWireException |
Gets a block of data from the 1-Wire Network and write it into the provided array. | |
abstract void | getBlock (byte[] arr, int off, int len) throws OneWireIOException, OneWireException |
Gets a block of data from the 1-Wire Network and write it into the provided array. | |
abstract void | dataBlock (byte dataBlock[], int off, int len) throws OneWireIOException, OneWireException |
Sends a block of data and returns the data received in the same array. | |
abstract int | reset () throws OneWireIOException, OneWireException |
Sends a Reset to the 1-Wire Network. | |
void | setPowerDuration (int timeFactor) throws OneWireIOException, OneWireException |
Sets the duration to supply power to the 1-Wire Network. | |
boolean | startPowerDelivery (int changeCondition) throws OneWireIOException, OneWireException |
Sets the 1-Wire Network voltage to supply power to a 1-Wire device. | |
void | setProgramPulseDuration (int timeFactor) throws OneWireIOException, OneWireException |
Sets the duration for providing a program pulse on the 1-Wire Network. | |
boolean | startProgramPulse (int changeCondition) throws OneWireIOException, OneWireException |
Sets the 1-Wire Network voltage to eprom programming level. | |
void | startBreak () throws OneWireIOException, OneWireException |
Sets the 1-Wire Network voltage to 0 volts. | |
void | setPowerNormal () throws OneWireIOException, OneWireException |
Sets the 1-Wire Network voltage to normal level. | |
void | setSpeed (int speed) throws OneWireIOException, OneWireException |
Sets the new speed of data transfer on the 1-Wire Network. | |
int | getSpeed () |
Returns the current data transfer speed on the 1-Wire Network. | |
OneWireContainer | getDeviceContainer (byte[] address) |
Constructs a OneWireContainer object with a user supplied 1-Wire network address. | |
OneWireContainer | getDeviceContainer (long address) |
Constructs a OneWireContainer object with a user supplied 1-Wire network address. | |
OneWireContainer | getDeviceContainer (String address) |
Constructs a OneWireContainer object with a user supplied 1-Wire network address. | |
OneWireContainer | getDeviceContainer () |
Constructs a OneWireContainer object using the current 1-Wire network address. | |
boolean | equals (Object o) |
Returns a hashcode for this object. | |
String | toString () |
Returns a string representation of this DSPortAdapter, in the format of "<adapter name> <port name>". | |
Static Public Attributes | |
static final int | SPEED_REGULAR = 0 |
Speed modes for 1-Wire Network, regular. | |
static final int | SPEED_FLEX = 1 |
Speed modes for 1-Wire Network, flexible for long lines. | |
static final int | SPEED_OVERDRIVE = 2 |
Speed modes for 1-Wire Network, overdrive. | |
static final int | SPEED_HYPERDRIVE = 3 |
Speed modes for 1-Wire Network, hyperdrive. | |
static final char | LEVEL_NORMAL = 0 |
1-Wire Network level, normal (weak 5Volt pullup) | |
static final char | LEVEL_POWER_DELIVERY = 1 |
1-Wire Network level, (strong 5Volt pullup, used for power delivery) | |
static final char | LEVEL_BREAK = 2 |
1-Wire Network level, (strong pulldown to 0Volts, reset 1-Wire) | |
static final char | LEVEL_PROGRAM = 3 |
1-Wire Network level, (strong 12Volt pullup, used to program eprom ) | |
static final int | RESET_NOPRESENCE = 0x00 |
1-Wire Network reset result = no presence | |
static final int | RESET_PRESENCE = 0x01 |
1-Wire Network reset result = presence | |
static final int | RESET_ALARM = 0x02 |
1-Wire Network reset result = alarm | |
static final int | RESET_SHORT = 0x03 |
1-Wire Network reset result = shorted | |
static final int | CONDITION_NOW = 0 |
Condition for power state change, immediate. | |
static final int | CONDITION_AFTER_BIT = 1 |
Condition for power state change, after next bit communication. | |
static final int | CONDITION_AFTER_BYTE = 2 |
Condition for power state change, after next byte communication. | |
static final int | DELIVERY_HALF_SECOND = 0 |
Duration used in delivering power to the 1-Wire, 1/2 second. | |
static final int | DELIVERY_ONE_SECOND = 1 |
Duration used in delivering power to the 1-Wire, 1 second. | |
static final int | DELIVERY_TWO_SECONDS = 2 |
Duration used in delivering power to the 1-Wire, 2 seconds. | |
static final int | DELIVERY_FOUR_SECONDS = 3 |
Duration used in delivering power to the 1-Wire, 4 second. | |
static final int | DELIVERY_SMART_DONE = 4 |
Duration used in delivering power to the 1-Wire, smart complete. | |
static final int | DELIVERY_INFINITE = 5 |
Duration used in delivering power to the 1-Wire, infinite. | |
static final int | DELIVERY_CURRENT_DETECT = 6 |
Duration used in delivering power to the 1-Wire, current detect. | |
static final int | DELIVERY_EPROM = 7 |
Duration used in delivering power to the 1-Wire, 480 us. | |
Protected Member Functions | |
boolean | isValidFamily (byte[] address) |
Checks to see if the family found is in the desired include group. |
The abstract base class for all 1-Wire port adapter objects.
An implementation class of this type is therefore independent of the adapter type. Instances of valid DSPortAdapter's are retrieved from methods in OneWireAccessProvider.
The DSPortAdapter methods can be organized into the following categories:
abstract boolean adapterDetected | ( | ) | throws OneWireIOException, OneWireException [pure virtual] |
Detects adapter presence on the selected port.
true
if the adapter is confirmed to be connected to the selected port, false
if the adapter is not connected.OneWireIOException | |
OneWireException |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
void assertSelect | ( | byte[] | address | ) | throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address.
This operation is refered to a 'MATCH ROM' operation in the iButton and 1-Wire device data sheets. This does not affect the 'current' device state information used in searches (findNextDevice...).
In addition, this method asserts that the select did find some devices on the 1-Wire net. If no devices were found, a OneWireException is thrown.
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 |
OneWireIOException | on a 1-Wire communication error, or if their are no devices on the 1-Wire net. |
OneWireException | on a setup error with the 1-Wire adapter |
void assertSelect | ( | long | address | ) | throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address.
This operation is refered to a 'MATCH ROM' operation in the iButton and 1-Wire device data sheets. This does not affect the 'current' device state information used in searches (findNextDevice...).
In addition, this method asserts that the select did find some devices on the 1-Wire net. If no devices were found, a OneWireException is thrown.
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.OneWireIOException | on a 1-Wire communication error, or if their are no devices on the 1-Wire net. |
OneWireException | on a setup error with the 1-Wire adapter |
void assertSelect | ( | String | address | ) | throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address.
This operation is refered to a 'MATCH ROM' operation in the iButton and 1-Wire device data sheets. This does not affect the 'current' device state information used in searches (findNextDevice...).
In addition, this method asserts that the select did find some devices on the 1-Wire net. If no devices were found, a OneWireException is thrown.
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 |
OneWireIOException | on a 1-Wire communication error, or if their are no devices on the 1-Wire net. |
OneWireException | on a setup error with the 1-Wire adapter |
abstract boolean beginExclusive | ( | boolean | blocking | ) | throws OneWireException [pure virtual] |
Gets exclusive use of the 1-Wire to communicate with an iButton or 1-Wire Device.
This method should be used for critical sections of code where a sequence of commands must not be interrupted by communication of threads with other iButtons, and it is permissible to sustain a delay in the special case that another thread has already been granted exclusive access and this access has not yet been relinquished.
It can be called through the OneWireContainer class by the end application if they want to ensure exclusive use. If it is not called around several methods then it will be called inside each method.
blocking | true if want to block waiting for an excluse access to the adapter |
true
if blocking was false and a exclusive session with the adapter was aquiredOneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean canBreak | ( | ) | throws OneWireIOException, OneWireException |
Returns whether adapter can physically support 0 volt 'break' mode.
true
if this port adapter can do break, false
otherwise.OneWireIOException | on a 1-Wire communication error with the adapter |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean canDeliverPower | ( | ) | throws OneWireIOException, OneWireException |
Returns whether the adapter can physically support strong 5 volt power mode.
true
if this port adapter can do strong 5 volt mode, false
otherwise.OneWireIOException | on a 1-Wire communication error with the adapter |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean canDeliverSmartPower | ( | ) | throws OneWireIOException, OneWireException |
Returns whether the adapter can physically support "smart" strong 5 volt power mode.
"smart" power delivery is the ability to deliver power until it is no longer needed. The current drop it detected and power delivery is stopped.
true
if this port adapter can do "smart" strong 5 volt mode, false
otherwise.OneWireIOException | on a 1-Wire communication error with the adapter |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean canFlex | ( | ) | throws OneWireIOException, OneWireException |
Returns whether the adapter can physically support flex speed mode.
true
if this port adapter can do flex speed, false
otherwise.OneWireIOException | on a 1-Wire communication error with the adapter |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean canHyperdrive | ( | ) | throws OneWireIOException, OneWireException |
Returns whether the adapter can physically support hyperdrive mode.
true
if this port adapter can do HyperDrive, false
otherwise.OneWireIOException | on a 1-Wire communication error with the adapter |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean canOverdrive | ( | ) | throws OneWireIOException, OneWireException |
Returns whether adapter can physically support overdrive mode.
true
if this port adapter can do OverDrive, false
otherwise.OneWireIOException | on a 1-Wire communication error with the adapter |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean canProgram | ( | ) | throws OneWireIOException, OneWireException |
Returns whether adapter can physically support 12 volt power mode.
true
if this port adapter can do Program voltage, false
otherwise.OneWireIOException | on a 1-Wire communication error with the adapter |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void dataBlock | ( | byte | dataBlock[], |
int | off, | ||
int | len | ||
) | throws OneWireIOException, OneWireException [pure virtual] |
Sends a block of data and returns the data received in the same array.
This method is used when sending a block that contains reads and writes. The 'read' portions of the data block need to be pre-loaded with 0xFF's. It starts sending data from the index at offset 'off' for length 'len'.
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' |
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void endExclusive | ( | ) | [pure virtual] |
Relinquishes exclusive control of the 1-Wire Network.
This command dynamically marks the end of a critical section and should be used when exclusive control is no longer needed.
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean equals | ( | Object | o | ) |
Returns a hashcode for this object.
o | the Object to compare this DSPortAdapter to |
void excludeFamily | ( | int | family | ) |
Takes an integer family code to avoid when searching for iButtons.
or 1-Wire devices. If this method is used, then no devices of this family will be found by any of the search methods.
family | the code of the family type NOT to target in searches |
Reimplemented in DumbAdapter, and NetAdapter.
void excludeFamily | ( | byte | family[] | ) |
Takes an array of bytes containing family codes to avoid when finding iButtons or 1-Wire devices.
If used, then no devices with family codes in this array will be found by any of the search methods.
family | array of family cods NOT to target for searches |
Reimplemented in DumbAdapter, and NetAdapter.
abstract boolean findFirstDevice | ( | ) | throws OneWireIOException, OneWireException [pure 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.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract boolean findNextDevice | ( | ) | throws OneWireIOException, OneWireException [pure 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.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void freePort | ( | ) | throws OneWireException [pure virtual] |
Frees ownership of the selected port, if it is currently owned, back to the system.
This should only be called if the recently selected port does not have an adapter, or at the end of your application's use of the port.
OneWireException | If port does not exist |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
String getAdapterAddress | ( | ) | throws OneWireIOException, OneWireException |
Retrieves the address of the adapter, if it has one.
String
of the adapter address. It will return "<na>" if the adapter does not have an address. The address is a string representation of an 1-Wire address.OneWireIOException | on a 1-Wire communication error such as no device present. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'. |
OneWireException | on a communication or setup error with the 1-Wire adapter |
Reimplemented in DotNetAdapterx64, and DotNetAdapterx86.
abstract String getAdapterName | ( | ) | [pure 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. Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
String getAdapterVersion | ( | ) | throws OneWireIOException, OneWireException |
Retrieves the version of the adapter.
String
of the adapter version. It will return "<na>" if the adapter version is not or cannot be known.OneWireIOException | on a 1-Wire communication error such as no device present. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'. |
OneWireException | on a communication or setup error with the 1-Wire adapter |
Reimplemented in DotNetAdapterx64, and DotNetAdapterx86.
abstract void getAddress | ( | byte[] | address | ) | [pure 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. |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
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 in DumbAdapter.
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 in DumbAdapter.
Enumeration getAllDeviceContainers | ( | ) | throws OneWireIOException, OneWireException |
Returns an enumeration of OneWireContainer
objects corresponding to all of the iButtons or 1-Wire devices found on the 1-Wire Network.
If no devices are found, then an empty enumeration will be returned. In most cases, all further communication with the device is done through the OneWireContainer.
Enumeration
of OneWireContainer
objects found on the 1-Wire Network.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
abstract boolean getBit | ( | ) | throws OneWireIOException, OneWireException [pure virtual] |
Gets a bit from the 1-Wire Network.
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void getBlock | ( | byte[] | arr, |
int | off, | ||
int | len | ||
) | throws OneWireIOException, OneWireException [pure virtual] |
Gets a block of data from the 1-Wire Network and write it into the provided array.
arr | array in which to write the received bytes |
off | offset into the array to start |
len | length of data bytes to receive |
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract byte [] getBlock | ( | int | len | ) | throws OneWireIOException, OneWireException [pure virtual] |
Gets a block of data from the 1-Wire Network.
len | length of data bytes to receive |
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void getBlock | ( | byte[] | arr, |
int | len | ||
) | throws OneWireIOException, OneWireException [pure virtual] |
Gets a block of data from the 1-Wire Network and write it into the provided array.
arr | array in which to write the received bytes |
len | length of data bytes to receive |
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract int getByte | ( | ) | throws OneWireIOException, OneWireException [pure virtual] |
Gets a byte from the 1-Wire Network.
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract String getClassVersion | ( | ) | [pure virtual] |
Retrieves a version string for this class.
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
OneWireContainer getDeviceContainer | ( | byte[] | address | ) |
Constructs a OneWireContainer
object with a user supplied 1-Wire network address.
address | device address with which to create a new container |
OneWireContainer
object Reimplemented in DumbAdapter.
OneWireContainer getDeviceContainer | ( | long | address | ) |
Constructs a OneWireContainer
object with a user supplied 1-Wire network address.
address | device address with which to create a new container |
OneWireContainer
object Reimplemented in DumbAdapter.
OneWireContainer getDeviceContainer | ( | ) |
Constructs 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 in DumbAdapter.
OneWireContainer getDeviceContainer | ( | String | address | ) |
Constructs a OneWireContainer
object with a user supplied 1-Wire network address.
address | device address with which to create a new container |
OneWireContainer
object Reimplemented in DumbAdapter.
OneWireContainer getFirstDeviceContainer | ( | ) | throws OneWireIOException, OneWireException |
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.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
OneWireContainer getNextDeviceContainer | ( | ) | throws OneWireIOException, OneWireException |
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.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
abstract String getPortName | ( | ) | throws OneWireException [pure virtual] |
Retrieves the name of the selected port as a String
.
String
of selected portOneWireException | if valid port not yet selected |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract Enumeration getPortNames | ( | ) | [pure 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 Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract String getPortTypeDescription | ( | ) | [pure 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. Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
int getSpeed | ( | ) |
Returns the current data transfer speed on the 1-Wire Network.
int
representing the current 1-Wire speed Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean isAlarming | ( | String | address | ) | throws OneWireIOException, OneWireException |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network and in an alarm state.
This does not affect the 'current' device state information used in searches (findNextDevice...).
address | device address to verify is present and alarming |
true
if device is present and alarming, else false
.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
boolean isAlarming | ( | byte[] | address | ) | throws OneWireIOException, OneWireException |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network and in an alarm state.
This does not affect the 'current' device state information used in searches (findNextDevice...).
address | device address to verify is present and alarming |
true
if device is present and alarming, else false
.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean isAlarming | ( | long | address | ) | throws OneWireIOException, OneWireException |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network and in an alarm state.
This does not affect the 'current' device state information used in searches (findNextDevice...).
address | device address to verify is present and alarming |
true
if device is present and alarming, else false
.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
boolean isPresent | ( | byte[] | address | ) | throws OneWireIOException, OneWireException |
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
.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean isPresent | ( | String | address | ) | throws OneWireIOException, OneWireException |
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
.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
boolean isPresent | ( | long | address | ) | throws OneWireIOException, OneWireException |
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
.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
boolean isValidFamily | ( | byte[] | address | ) | [protected] |
Checks to see if the family found is in the desired include group.
true
if in include group Reimplemented in DumbAdapter.
abstract void putBit | ( | boolean | bitValue | ) | throws OneWireIOException, OneWireException [pure virtual] |
Sends a bit to the 1-Wire Network.
bitValue | the bit value to send to the 1-Wire Network. |
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void putByte | ( | int | byteValue | ) | throws OneWireIOException, OneWireException [pure virtual] |
Sends a byte to the 1-Wire Network.
byteValue | the byte value to send to the 1-Wire Network. |
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
void registerOneWireContainerClass | ( | int | family, |
Class | OneWireContainerClass | ||
) | throws OneWireException |
Registers a user provided OneWireContainer
class.
Using this method will override the Maxim Integrated Products provided container class when using the getDeviceContainer() method. The registered container state is only stored for the current instance of DSPortAdapter
, and is not statically shared. The OneWireContainerClass
must extend com.dalsemi.onewire.container.OneWireContainer
otherwise a ClassCastException
will be thrown. The older duplicate family will be removed from registration when a collision occurs. Passing null as a parameter for the OneWireContainerClass
will result in the removal of any entry associated with the family.
family | the code of the family type to associate with this class. |
OneWireContainerClass | User provided class |
OneWireException | If OneWireContainerClass is not found. |
ClassCastException | If user supplied OneWireContainer does not extend com.dalsemi.onewire.container.OneWireContainer . |
Reimplemented in DumbAdapter.
abstract int reset | ( | ) | throws OneWireIOException, OneWireException [pure virtual] |
Sends a Reset to the 1-Wire Network.
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean select | ( | byte[] | address | ) | throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address.
This operation is refered to a 'MATCH ROM' operation in the iButton and 1-Wire device data sheets. This does not affect the 'current' device state information used in searches (findNextDevice...).
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.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean select | ( | long | address | ) | throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address.
This operation is refered to a 'MATCH ROM' operation in the iButton and 1-Wire device data sheets. This does not affect the 'current' device state information used in searches (findNextDevice...).
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.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
boolean select | ( | String | address | ) | throws OneWireIOException, OneWireException |
Selects the specified iButton or 1-Wire device by broadcasting its address.
This operation is refered to a 'MATCH ROM' operation in the iButton and 1-Wire device data sheets. This does not affect the 'current' device state information used in searches (findNextDevice...).
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.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter.
abstract boolean selectPort | ( | String | portName | ) | throws OneWireIOException, OneWireException [pure virtual] |
Specifies a platform appropriate port name for this adapter.
Note that even though the port has been selected, it's ownership may be relinquished if it is not currently held in a 'exclusive' block. This class will then try to re-aquire the port when needed. If the port cannot be re-aquired ehen the exception PortInUseException
will be thrown.
portName | name of the target port, retrieved from getPortNames() |
true
if the port was aquired, false
if the port is not available.OneWireIOException | If port does not exist, or unable to communicate with port. |
OneWireException | If port does not exist |
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void setNoResetSearch | ( | ) | [pure virtual] |
Sets the 1-Wire Network search to not perform a 1-Wire reset before a search.
This feature is chiefly used with the DS2409 1-Wire coupler. The normal reset before each search can be restored with the 'setSearchAllDevices()' method.
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
void setPowerDuration | ( | int | timeFactor | ) | throws OneWireIOException, OneWireException |
Sets the duration to supply power to the 1-Wire Network.
This method takes a time parameter that indicates the program pulse length when the method startPowerDelivery().
Note: to avoid getting an exception, use the canDeliverPower() and canDeliverSmartPower() method to check it's availability.
timeFactor |
|
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
void setPowerNormal | ( | ) | throws OneWireIOException, OneWireException |
Sets the 1-Wire Network voltage to normal level.
This method is used to disable 1-Wire conditions created by startPowerDelivery and startProgramPulse. This method will automatically be called if a communication method is called while an outstanding power command is taking place.
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter or the adapter does not support this operation |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
void setProgramPulseDuration | ( | int | timeFactor | ) | throws OneWireIOException, OneWireException |
Sets the duration for providing a program pulse on the 1-Wire Network.
This method takes a time parameter that indicates the program pulse length when the method startProgramPulse().
Note: to avoid getting an exception, use the canDeliverPower() method to check it's availability.
timeFactor |
|
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void setSearchAllDevices | ( | ) | [pure virtual] |
Sets the 1-Wire Network search to find all iButtons and 1-Wire devices whether they are in an 'Alarm' state or not and restores the default setting of providing a 1-Wire reset command before each search.
(see setNoResetSearch() method).
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
abstract void setSearchOnlyAlarmingDevices | ( | ) | [pure virtual] |
Sets the 1-Wire Network search to find only iButtons and 1-Wire devices that are in an 'Alarm' state that signals a need for attention.
Not all iButton types have this feature. Some that do: DS1994, DS1920, DS2407. This selective searching can be canceled with the 'setSearchAllDevices()' method.
Implemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
void setSpeed | ( | int | speed | ) | throws OneWireIOException, OneWireException |
Sets the new speed of data transfer on the 1-Wire Network.
speed |
|
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter or the adapter does not support this operation |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
void startBreak | ( | ) | throws OneWireIOException, OneWireException |
Sets the 1-Wire Network voltage to 0 volts.
This method is used rob all 1-Wire Network devices of parasite power delivery to force them into a hard reset.
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter or the adapter does not support this operation |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean startPowerDelivery | ( | int | changeCondition | ) | throws OneWireIOException, OneWireException |
Sets the 1-Wire Network voltage to supply power to a 1-Wire device.
This method takes a time parameter that indicates whether the power delivery should be done immediately, or after certain conditions have been met.
Note: to avoid getting an exception, use the canDeliverPower() and canDeliverSmartPower() method to check it's availability.
changeCondition |
|
true
if the voltage change was successful, false
otherwise.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
boolean startProgramPulse | ( | int | changeCondition | ) | throws OneWireIOException, OneWireException |
Sets the 1-Wire Network voltage to eprom programming level.
This method takes a time parameter that indicates whether the power delivery should be done immediately, or after certain conditions have been met.
Note: to avoid getting an exception, use the canProgram() method to check it's availability.
changeCondition |
|
true
if the voltage change was successful, false
otherwise.OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter or the adapter does not support this operation |
Reimplemented in DumbAdapter, NetAdapter, DotNetAdapterx64, and DotNetAdapterx86.
void targetAllFamilies | ( | ) |
Removes any selectivity during a search for iButtons or 1-Wire devices by family type.
The unique address for each iButton and 1-Wire device contains a family descriptor that indicates the capabilities of the device.
Reimplemented in DumbAdapter, and NetAdapter.
void targetFamily | ( | int | family | ) |
Takes an integer to selectively search for this desired family type.
If this method is used, then no devices of other families will be found by any of the search methods.
family | the code of the family type to target for searches |
Reimplemented in DumbAdapter, and NetAdapter.
void targetFamily | ( | byte | family[] | ) |
Takes an array of bytes to use for selectively searching for acceptable family codes.
If used, only devices with family codes in this array will be found by any of the search methods.
family | array of the family types to target for searches |
Reimplemented in DumbAdapter, and NetAdapter.
String toString | ( | ) |
Returns a string representation of this DSPortAdapter, in the format of "<adapter name> <port name>".