1-Wire API for .NET Version 4.00
Public Member Functions

OWPath Class Reference

1-Wire® Network path. More...

List of all members.

Public Member Functions

 OWPath (DSPortAdapter adapter)
 Create a new 1-Wire path with no elemements.
 OWPath (DSPortAdapter adapter, OWPath currentOWPath)
 Create a new path with a starting path.
void copy (OWPath currentOWPath)
 Copy the elements from the provided 1-Wire path into this 1-Wire path.
void add (OneWireContainer owc, int channel)
 Add a 1-Wire path element to this 1-Wire path.
boolean equals (OWPath compareOWPath)
 Compare this 1-Wire path with another.
Enumeration getAllOWPathElements ()
 Get an enumeration of all of the 1-Wire path elements in this 1-Wire path.
String toString ()
 Get a string representation of this 1-Wire path.
void open () throws OneWireException, OneWireIOException
 Open this 1-Wire path so that a remote device can be accessed.
void close () throws OneWireException, OneWireIOException
 Close each element in this 1-Wire path in reverse order.

Detailed Description

1-Wire® Network path.

Large 1-Wire networks can be sub-divided into branches for load, location, or organizational reasons. Once 1-Wire devices are placed on this branches there needs to be a mechanism to reach these devices. The OWPath class was designed to provide a convenient method to open and close 1-Wire paths to reach remote devices.

Usage

Example

Open the path 'path' to the 1-Wire temperature device 'tc' and read the temperature:

 
  // open a path to the temp device
  path.open();
  // read the temp device
  byte[] state = tc.readDevice();
  tc.doTemperatureConvert(state);
  state = tc.readDevice();
  System.out.println("Temperature of " +
           address + " is " +
           tc.getTemperature(state) + " C");
  // close the path to the device
  path.close();
  
See also:
com.dalsemi.onewire.utils.OWPathElement
com.dalsemi.onewire.container.SwitchContainer
com.dalsemi.onewire.container.OneWireContainer05
com.dalsemi.onewire.container.OneWireContainer12
com.dalsemi.onewire.container.OneWireContainer1F
Version:
0.00, 12 September 2000
Author:
DS

Constructor & Destructor Documentation

OWPath ( DSPortAdapter  adapter)

Create a new 1-Wire path with no elemements.

Elements can be added by using copy and/or add .

Parameters:
adapterwhere the path is based
See also:
copy(OWPath) copy
add(OneWireContainer, int) add
OWPath ( DSPortAdapter  adapter,
OWPath  currentOWPath 
)

Create a new path with a starting path.

New elements can be added with add.

Parameters:
adapterwhere the 1-Wire path is based
currentPathstarting value of this 1-Wire path
See also:
add(OneWireContainer, int) add

Member Function Documentation

void add ( OneWireContainer  owc,
int  channel 
)

Add a 1-Wire path element to this 1-Wire path.

Parameters:
owc1-Wire device switch
channelof device that represents this 1-Wire path element
See also:
copy(OWPath) copy
void close ( ) throws OneWireException, OneWireIOException

Close each element in this 1-Wire path in reverse order.

Exceptions:
OneWireIOExceptionon a 1-Wire communication error such as no device present or a CRC read from the device is incorrect. 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter.
void copy ( OWPath  currentOWPath)

Copy the elements from the provided 1-Wire path into this 1-Wire path.

Parameters:
currentOWPathpath to copy from
boolean equals ( OWPath  compareOWPath)

Compare this 1-Wire path with another.

Parameters:
compareOWPath1-Wire path to compare to
Returns:
true if the 1-Wire paths are the same
Enumeration getAllOWPathElements ( )

Get an enumeration of all of the 1-Wire path elements in this 1-Wire path.

Returns:
enumeration of all of the 1-Wire path elements
See also:
com.dalsemi.onewire.utils.OWPathElement
void open ( ) throws OneWireException, OneWireIOException

Open this 1-Wire path so that a remote device can be accessed.

Exceptions:
OneWireIOExceptionon a 1-Wire communication error such as no device present or a CRC read from the device is incorrect. 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'.
OneWireExceptionon a communication or setup error with the 1-Wire adapter.
String toString ( )

Get a string representation of this 1-Wire path.

Returns:
string 1-Wire path as string

The documentation for this class was generated from the following file: