com.dalsemi.onewire.utils
Class OneWireMonitor
java.lang.Object
|
+--java.lang.Thread
|
+--com.dalsemi.onewire.utils.OneWireMonitor
- All Implemented Interfaces:
- Runnable
- public class OneWireMonitor
- extends Thread
This class allows an application to be notified of arriving
and departing 1-Wire devices on a 1-Wire network. Once a
class implementing OneWireMonitorEventListener is
registered, the monitor will fire off events whenever a 1-Wire
device arrives or departs from the 1-Wire network.
- See Also:
OneWireMonitorEventListener
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
OneWireMonitor
public OneWireMonitor(DSPortAdapter adapter)
- Creates a 1-Wire monitoring object attached to the specified
adapter.
- Parameters:
adapter - 1-Wire adapter the monitor should use to scan
for arrivals and departures of 1-Wire devices.
killMonitor
public void killMonitor(boolean free)
- Causes the
OneWireMonitor to exit gracefully and
allows the release of resources.
- Parameters:
free - if true, the freePort() method will
be called on the underlying DSPortAdapter
killMonitor
public void killMonitor()
- Causes the
OneWireMonitor to exit gracefully. Note
that the port will not be freed. This method calls the killMonitor(boolean)
method with an argument of false.
- Parameters:
free - if true, the freePort() method will
be called on the underlying DSPortAdapter- See Also:
killMonitor(boolean)
addEventListener
public void addEventListener(OneWireMonitorEventListener owmel)
- Adds an event listener that should be notified in case of 1-Wire
event.
- Parameters:
owmel - Event listener to add
removeEventListener
public void removeEventListener(OneWireMonitorEventListener owmel)
- Removes an event listener.
NOTE: If all event listeners are removed, 1-Wire network scanning
will cease until at least one listener is in the list.
- Parameters:
owmel - Event listener to remove
removeAllListeners
public void removeAllListeners()
- Removes all event listeners.
1-Wire network scanning will cease until at least one listener is in the list.
run
public void run()
- Monitor will run when at least one listener is registered.
- Overrides:
run in class Thread