com.dalsemi.onewire.application.monitor
Class NetworkDeviceMonitor

java.lang.Object
  |
  +--com.dalsemi.onewire.application.monitor.AbstractDeviceMonitor
        |
        +--com.dalsemi.onewire.application.monitor.NetworkDeviceMonitor
All Implemented Interfaces:
Runnable

public class NetworkDeviceMonitor
extends AbstractDeviceMonitor

Class NetworkDeviceMonitor represents the monitor that searches the 1-Wire net, including the traversal of branches, looing for new arrivals and departures.

Version:
1.00
Author:
SH

Constructor Summary
NetworkDeviceMonitor(DSPortAdapter adapter)
          Create a complex monitor that does search branches
 
Method Summary
 void addBranch(OWPath path)
          Adds a branch for searching.
 void cleanUpStalePathReferences()
          The device monitor will internally cache OWPath objects for each 1-Wire device.
 boolean getBranchAutoSearching()
          Indicates whether or not branches are automatically traversed.
 OWPath getDevicePath(Long address)
          Returns the OWPath of the device with the given address.
 void search(Vector arrivals, Vector departures)
          Performs a search of the 1-Wire network, with branch searching
 void setAdapter(DSPortAdapter adapter)
          Sets this monitor to search a new DSPortAdapter
 void setBranchAutoSearching(boolean enabled)
          Indicates whether or not branches are automatically traversed.
 
Methods inherited from class com.dalsemi.onewire.application.monitor.AbstractDeviceMonitor
addDeviceMonitorEventListener, cleanUpStaleContainerReferences, getAdapter, getAllAddresses, getDeviceContainer, getDeviceContainer, getDeviceContainer, getDeviceContainer, getDevicePath, getDevicePath, getDevicePath, getMaxErrorCount, getMaxStateCount, isMonitorRunning, killMonitor, pauseMonitor, putDeviceContainer, putDeviceContainer, putDeviceContainer, putDeviceContainer, resetSearch, resumeMonitor, run, setMaxErrorCount, setMaxStateCount
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkDeviceMonitor

public NetworkDeviceMonitor(DSPortAdapter adapter)
Create a complex monitor that does search branches
Parameters:
the - DSPortAdapter this monitor should search
Method Detail

setAdapter

public void setAdapter(DSPortAdapter adapter)
Sets this monitor to search a new DSPortAdapter
Overrides:
setAdapter in class AbstractDeviceMonitor
Parameters:
the - DSPortAdapter this monitor should search

setBranchAutoSearching

public void setBranchAutoSearching(boolean enabled)
Indicates whether or not branches are automatically traversed. If false, new branches must be indicated using the "addBranch" method.
Parameters:
enabled - if true, all branches are automatically traversed during a search operation.

getBranchAutoSearching

public boolean getBranchAutoSearching()
Indicates whether or not branches are automatically traversed. If false, new branches must be indicated using the "addBranch" method.

addBranch

public void addBranch(OWPath path)
Adds a branch for searching. Must be used to traverse branches if auto-searching is disabled.
Parameters:
path - A branch to be searched during the next search routine

getDevicePath

public OWPath getDevicePath(Long address)
Returns the OWPath of the device with the given address.
Overrides:
getDevicePath in class AbstractDeviceMonitor
Parameters:
address - a Long object representing the address of the device
Returns:
The OWPath representing the network path to the device.

cleanUpStalePathReferences

public void cleanUpStalePathReferences()
The device monitor will internally cache OWPath objects for each 1-Wire device. Use this method to clean up all stale OWPath objects. A stale path object is a OWPath which references a branching path to a 1-Wire device address which has not been seen by a recent search. This will be essential in a touch-contact environment which could run for some time and needs to conserve memory.
Overrides:
cleanUpStalePathReferences in class AbstractDeviceMonitor

search

public void search(Vector arrivals,
                   Vector departures)
            throws OneWireException,
                   OneWireIOException
Performs a search of the 1-Wire network, with branch searching
Overrides:
search in class AbstractDeviceMonitor
Parameters:
arrivals - A vector of Long objects, represent new arrival addresses.
departures - A vector of Long objects, represent departed addresses.


Copyright © 1999-2003 Dallas Semiconductor. All Rights Reserved.