Class ChainMonitor
java.lang.Object
com.dalsemi.onewire.application.monitor.AbstractDeviceMonitor
com.dalsemi.onewire.application.monitor.ChainMonitor
- All Implemented Interfaces:
Runnable
Class ChainMonitor represents the monitor that searches the 1-Wire net for Chain Mode devices, otherwise known as "Sequence Detect". Chain Mode devices have two PIO pins (PIOA and PIOB). You can chain multiple devices together by connecting PIOA of one part to PIOB of the next device. The first device in the chain has its PIOB grounded. This monitor performs a simple search. If a branch is activated/deactivated between search cycles, this monitor will see the arrival/departure of new devices without reference to the branch which they lie on.
-
Field Summary
Fields inherited from class com.dalsemi.onewire.application.monitor.AbstractDeviceMonitor
adapter, deviceAddressHash, deviceContainerHash, hasCompletelyStopped, isRunning, keepRunning, listeners, max_error_count, max_state_count, startRunning, sync_flag
-
Constructor Summary
ConstructorDescriptionChainMonitor
(DSPortAdapter adapter) Create a simple monitor that does not search branches -
Method Summary
Modifier and TypeMethodDescriptionboolean
chainConditionalReadRom
(byte[] chainDeviceAddress) chainConditionalReadRom sends the chain mode "DONE" command sequence to current chain device.boolean
chainDone sends the chain mode "DONE" command sequence to current chain device.boolean
chainOff()
chainOff sends the chain mode "OFF" command sequence to all chain devices.boolean
chainOn()
chainOn sends the chain mode "ON" command sequence to all chain devices.getDevicePath
(Long address) Returns the OWPath of the device with the given address.void
Performs a search of the 1-Wire network without searching branchesvoid
setAdapter
(DSPortAdapter adapter) Sets this monitor to search a new DSPortAdaptertoContainerVector
(Vector<Long> arrivals) A helper method that takes the arrivals Vector from the search method and returns a Vector of OneWireContainersMethods inherited from class com.dalsemi.onewire.application.monitor.AbstractDeviceMonitor
addDeviceMonitorEventListener, cleanUpStaleContainerReferences, cleanUpStalePathReferences, fireArrivalEvent, fireDepartureEvent, getAdapter, getAllAddresses, getDeviceContainer, getDeviceContainer, getDeviceContainer, getDeviceContainer, getDevicePath, getDevicePath, getDevicePath, getMaxErrorCount, getMaxStateCount, isMonitorRunning, killMonitor, msSleep, pauseMonitor, putDeviceContainer, putDeviceContainer, putDeviceContainer, putDeviceContainer, resetSearch, resumeMonitor, run, setMaxErrorCount, setMaxStateCount
-
Constructor Details
-
ChainMonitor
Create a simple monitor that does not search branches- Parameters:
adapter
- the DSPortAdapter this monitor should search
-
-
Method Details
-
setAdapter
Sets this monitor to search a new DSPortAdapter- Specified by:
setAdapter
in classAbstractDeviceMonitor
- Parameters:
adapter
- the DSPortAdapter this monitor should search
-
getDevicePath
Returns the OWPath of the device with the given address.- Specified by:
getDevicePath
in classAbstractDeviceMonitor
- Parameters:
address
- a Long object representing the address of the device- Returns:
- The OWPath representing the network path to the device.
-
chainOn
chainOn sends the chain mode "ON" command sequence to all chain devices.- Returns:
- true if successful, false otherwise
- Throws:
OneWireException
OneWireIOException
-
chainConditionalReadRom
public boolean chainConditionalReadRom(byte[] chainDeviceAddress) throws OneWireException, OneWireIOException chainConditionalReadRom sends the chain mode "DONE" command sequence to current chain device.- Parameters:
chainDeviceAddress
- 8-byte array for chain 1-Wire net address- Returns:
- true if successful, false otherwise
- Throws:
OneWireException
OneWireIOException
-
chainDone
chainDone sends the chain mode "DONE" command sequence to current chain device.- Returns:
- true if successful, false otherwise
- Throws:
OneWireException
OneWireIOException
-
chainOff
chainOff sends the chain mode "OFF" command sequence to all chain devices.- Returns:
- true if successful, false otherwise
- Throws:
OneWireException
OneWireIOException
-
search
public void search(Vector<Long> arrivals, Vector<Long> departures) throws OneWireException, OneWireIOException Performs a search of the 1-Wire network without searching branches- Specified by:
search
in classAbstractDeviceMonitor
- Parameters:
arrivals
- A vector of Long objects, represent new arrival addresses.departures
- A vector of Long objects, represent departed addresses.- Throws:
OneWireException
OneWireIOException
-
toContainerVector
public Vector<OneWireContainer> toContainerVector(Vector<Long> arrivals) throws OneWireException, OneWireIOException A helper method that takes the arrivals Vector from the search method and returns a Vector of OneWireContainers- Parameters:
arrivals
- A vector of Long objects, represent new arrival addresses.- Returns:
- A vector of OneWireContainer objects
- Throws:
OneWireException
OneWireIOException
-