public class LucidControlDI4
extends java.lang.Object
This class encapsulates the LucidControl DI4 Digital Input USB Module functionality.
Modifier and Type | Class and Description |
---|---|
static class |
LucidControlDI4.DeviceType
Device type enumeration
|
static class |
LucidControlDI4.LCDI4Mode
DI4 module Operation Modes
|
Constructor and Description |
---|
LucidControlDI4(java.lang.String portName) |
Modifier and Type | Method and Description |
---|---|
boolean |
close() |
java.lang.String |
getDeviceClassName() |
int |
getDeviceSnr() |
java.lang.String |
getDeviceTypeName()
Get Device Type Name as String
|
IoReturn |
getIo(int channel,
ValueCNT2 value)
Get counter value of one digital input channel.
|
IoReturn |
getIo(int channel,
ValueDI1 value)
Get the value or state of one digital input channel.
|
IoReturn |
getIoGroup(boolean[] channels,
ValueCNT2[] values)
Get the counter values of a group of digital input channels.
|
IoReturn |
getIoGroup(boolean[] channels,
ValueDI1[] values)
Get the values or states of a group of digital input channels.
|
IoReturn |
getParamCountTime(int channel,
long[] countTime)
Get the Configuration Parameter "Count Time" of the digital input channel.
|
IoReturn |
getParamFlagAddCounter(int channel,
boolean[] addCounter)
Get the Configuration Parameter Flag "Add Counter".
|
IoReturn |
getParamFlagInverted(int channel,
boolean[] inverted)
Get the Configuration Parameter Flag "Inverted".
|
IoReturn |
getParamFlagResetCounterRead(int channel,
boolean[] resetCounterRead)
Get the Configuration Parameter Flag "Reset Counter on Read".
|
IoReturn |
getParamMode(int channel,
LucidControlDI4.LCDI4Mode[] mode)
Get the Configuration Parameter "Mode" of the digital input channel.
|
IoReturn |
getParamScanTime(int channel,
long[] scanTime)
Get the Configuration Parameter "Scan Time" of the digital input channel.
|
IoReturn |
getParamValue(int channel,
ValueDI1 value)
Get the Configuration Parameter "Value" of a digital input channel.
|
int |
getRevisionFw() |
short |
getRevisionHw() |
IoReturn |
identify(int options) |
boolean |
isOpened() |
boolean |
open() |
IoReturn |
setParamCountTime(int channel,
boolean persistent)
Set the Configuration Parameter "Count Time" of the digital input channel to the
default value.
|
IoReturn |
setParamCountTime(int channel,
boolean persistent,
long countTime)
Set the Configuration Parameter "Count Time" of the digital input channel.
|
IoReturn |
setParamFlagAddCounter(int channel,
boolean persistent,
boolean addCounter)
Set the Configuration Parameter Flag "Add Counter"
This method calls the SetParam function and sets the Configuration Flag "Add Counter".
|
IoReturn |
setParamFlagInverted(int channel,
boolean persistent,
boolean inverted)
Set the Configuration Parameter Flag "Inverted"
This method calls the SetParam function and sets the Configuration Flag "Inverted".
|
IoReturn |
setParamFlagResetCounterRead(int channel,
boolean persistent,
boolean resetCounterRead)
Set the Configuration Parameter Flag "Reset Counter on Read"
This method calls the SetParam function and sets the Configuration Flag
"Reset Counter on Read".
|
IoReturn |
setParamFlags(int channel,
boolean persistent)
Set the Configuration Parameter "Flags" of the digital input channel to the default
value.
|
IoReturn |
setParamMode(int channel,
boolean persistent)
Set the Configuration Parameter "Mode" of the digital input channel to the
default value.
|
IoReturn |
setParamMode(int channel,
boolean persistent,
LucidControlDI4.LCDI4Mode mode)
Set the Configuration Parameter "Mode" of the digital input channel.
|
IoReturn |
setParamScanTime(int channel,
boolean persistent)
Set the Configuration Parameter "Scan Time" of the digital input channel to the
default value.
|
IoReturn |
setParamScanTime(int channel,
boolean persistent,
long scanTime)
Set the Configuration Parameter "Scan Time" of the digital input channel.
|
void |
setPortName(java.lang.String portName) |
public IoReturn getIo(int channel, ValueDI1 value) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the value or state of one digital input channel.
This method calls the GetIo function of the module and returns the value or state of the digital input channel.
channel
- Input channel to read from. Must be in the range 0 ... 3value
- Digital value objectIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn getIo(int channel, ValueCNT2 value) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get counter value of one digital input channel.
This method calls the GetIo function of the module and returns the counter value of the digital input channel.
channel
- Input channel to read from. Must be in the range 0 ... 3value
- Counter value objectIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn getIoGroup(boolean[] channels, ValueDI1[] values) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the values or states of a group of digital input channels.
This method calls the GetIoGroup function of the module and returns the values or states of a group of digital input channels.
channels
- Get channel array.
Boolean array with 4 values (one for each channel). A channel is only read in the case that the corresponding channel array value is true.
values
- Digital value object array.
Empty array prepared for 4 digital value objects. The function fills the array with the read value data.
Value objects are only updated in the case that the corresponding channel in the channel array is set to true.
IoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn getIoGroup(boolean[] channels, ValueCNT2[] values) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the counter values of a group of digital input channels.
This method calls the GetIoGroup function of the module and returns the counter values of a group of digital input channels.
channels
- Get channel array.
Boolean array with 4 values (one for each channel). A channel is only read in the case that the corresponding channel array value is true.
values
- Counter value object array.
Empty array prepared for 4 counter value objects. The function fills the array with the read value data.
Value objects are only updated in the case that the corresponding channel in the channel array is set to true.
IoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn getParamValue(int channel, ValueDI1 value) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the Configuration Parameter "Value" of a digital input channel.
This method calls the GetParam function of the module and returns the value of the Configuration Parameter "Value".
The Configuration Parameter "Value" contains the current digital value of the input channel. It is recommended to call getIo instead of this method.
channel
- Channel to read parameter from. Must be in the range 0 ... 3value
- Digital value objectIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn getParamMode(int channel, LucidControlDI4.LCDI4Mode[] mode) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the Configuration Parameter "Mode" of the digital input channel.
This method calls the GetParam function of the module and returns the Configuration Parameter "Mode".
The Configuration Parameter "Mode" represents the current operation mode of the digital input channel.
channel
- Channel to read parameter from. Must be in the range 0 ... 3mode
- Digital input channel operation modeIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn setParamMode(int channel, boolean persistent) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter "Mode" of the digital input channel to the default value.
This method calls the SetParam function of the module and sets the Configuration Parameter "Mode" to its default value.
channel
- Channel to configure. Must be in the range 0 ... 3persistent
- It this parameter is true the setting is stored permanently.IoReturn
Valuejava.lang.IllegalArgumentException
java.io.IOException
public IoReturn setParamMode(int channel, boolean persistent, LucidControlDI4.LCDI4Mode mode) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter "Mode" of the digital input channel.
This method calls the SetParam function of the module and sets the Configuration Parameter "Mode".
The Configuration Parameter "Mode" represents the current operation mode of the digital input channel.
channel
- Channel to configure. Must be in the range 0 ... 3persistent
- It this parameter is true the setting is stored permanently.mode
- Operation modeIoReturn
Valuejava.lang.IllegalArgumentException
java.io.IOException
public IoReturn setParamFlags(int channel, boolean persistent) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter "Flags" of the digital input channel to the default value.
This method calls the SetParam function of the module and sets the Configuration Parameter "Flags" to its default value.
It is not possible to assign a value to the Configuration Parameter "Flags" directly. Please access this parameter by using one of the flag specific methods:
Calling this method initialized all flag values with its default values.
channel
- Channel to configure. Must be in the range 0 ... 3persistent
- If this parameter is true the setting is stored permanentlyIoReturn
Valuejava.lang.IllegalArgumentException
java.io.IOException
public IoReturn getParamFlagAddCounter(int channel, boolean[] addCounter) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the Configuration Parameter Flag "Add Counter".
This method calls the GetParam function and returns the Configuration Flag "Add Counter".
channel
- Digital input channel. Must be in the range 0 ... 3addCounter
- Digital input "Add Counter" Configuration Parameter FlagIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn setParamFlagAddCounter(int channel, boolean persistent, boolean addCounter) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter Flag "Add Counter"
This method calls the SetParam function and sets the Configuration Flag "Add Counter".
channel
- Digital input channel to configure. Must be in the range 0 ... 3addCounter
- Digital input "Add Counter" Configuration Parameter FlagIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn getParamFlagResetCounterRead(int channel, boolean[] resetCounterRead) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the Configuration Parameter Flag "Reset Counter on Read".
This method calls the GetParam function and returns the Configuration Flag "Reset Counter on Read".
channel
- Digital input channel. Must be in the range 0 ... 3resetCounterRead
- Digital input "Reset Counter on Read"
Configuration Parameter FlagIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn setParamFlagResetCounterRead(int channel, boolean persistent, boolean resetCounterRead) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter Flag "Reset Counter on Read"
This method calls the SetParam function and sets the Configuration Flag "Reset Counter on Read".
channel
- Digital input channel to configure. Must be in the range 0 ... 3resetCounterRead
- Digital input "Reset Counter on Read"
Configuration Parameter FlagIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn getParamFlagInverted(int channel, boolean[] inverted) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the Configuration Parameter Flag "Inverted".
This method calls the GetParam function and returns the Configuration Flag "Inverted".
channel
- Digital input channel. Must be in the range 0 ... 3inverted
- Digital input "Inverted" Configuration Parameter FlagIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn setParamFlagInverted(int channel, boolean persistent, boolean inverted) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter Flag "Inverted"
This method calls the SetParam function and sets the Configuration Flag "Inverted".
channel
- Digital input channel to configure. Must be in the range 0 ... 3inverted
- Digital input "Inverted" Configuration Parameter FlagIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn getParamScanTime(int channel, long[] scanTime) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the Configuration Parameter "Scan Time" of the digital input channel.
This method calls the GetParam function of the module and returns the Configuration Parameter "Scan Time".
channel
- Digital input channel. Must be in the range 0 ... 3scanTime
- Configuration Parameter "Scan Time" in microsecondsIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn setParamScanTime(int channel, boolean persistent) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter "Scan Time" of the digital input channel to the default value.
This method calls the SetParam function of the module and sets the Configuration Parameter "Scan Time" to its default value.
channel
- Digital input channel to configure. Must be in the range 0 ... 3persistent
- If this parameter is true the setting is stored permanently.IoReturn
Valuejava.lang.IllegalArgumentException
java.io.IOException
public IoReturn setParamScanTime(int channel, boolean persistent, long scanTime) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter "Scan Time" of the digital input channel.
This method calls the SetParam function of the module and sets the Configuration Parameter "Scan Time".
channel
- Digital input channel to configure. Must be in the range 0 ... 3persistent
- If this parameter is true the setting is stored permanentlyscanTime
- Configuration parameter "Scan Time" in microsecondsIoReturn
Valuejava.lang.IllegalArgumentException
java.io.IOException
public IoReturn getParamCountTime(int channel, long[] countTime) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.io.IOException
Get the Configuration Parameter "Count Time" of the digital input channel.
This method calls the GetParam function of the module and returns the Configuration Parameter "Count Time".
channel
- Digital input channel. Must be in the range 0 ... 3countTime
- Configuration Parameter "Count Time" in microsecondsIoReturn
Valuejava.lang.IllegalArgumentException
java.lang.NullPointerException
java.io.IOException
public IoReturn setParamCountTime(int channel, boolean persistent) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter "Count Time" of the digital input channel to the default value.
This method calls the SetParam function of the module and sets the Configuration Parameter "Count Time" to its default value.
channel
- Digital input channel to configure. Must be in the range 0 ... 3persistent
- If this parameter is true the setting is stored permanently.IoReturn
Valuejava.lang.IllegalArgumentException
java.io.IOException
public IoReturn setParamCountTime(int channel, boolean persistent, long countTime) throws java.lang.IllegalArgumentException, java.io.IOException
Set the Configuration Parameter "Count Time" of the digital input channel.
This method calls the SetParam function of the module and sets the Configuration Parameter "Count Time".
channel
- Digital input channel to configure. Must be in the range 0 ... 3persistent
- If this parameter is true the setting is stored permanentlycountTime
- Scan Time in microseconds.IoReturn
Valuejava.lang.IllegalArgumentException
java.io.IOException
public java.lang.String getDeviceTypeName() throws java.lang.IllegalStateException
Get Device Type Name as String
java.lang.IllegalStateException
public int getRevisionFw() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public short getRevisionHw() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public java.lang.String getDeviceClassName() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public int getDeviceSnr()
public IoReturn identify(int options) throws java.io.IOException
java.io.IOException
public void setPortName(java.lang.String portName) throws java.lang.IllegalStateException
java.lang.IllegalStateException
public boolean isOpened()
public boolean open() throws java.io.IOException
java.io.IOException
public boolean close() throws java.io.IOException
java.io.IOException