public class DeviceInterface extends java.util.ArrayList<DeviceOperator> implements java.awt.event.WindowListener
Constructor and Description |
---|
DeviceInterface(int nChannels)
standard constructor for the DeviceInterface class
|
DeviceInterface(int nChannels,
float samplesPerSec)
standard constructor for the DeviceInterface class
|
DeviceInterface(int nChannels,
float samplesPerSec,
java.lang.Object[] settings)
standard constructor for the DeviceInterface class
|
DeviceInterface(int nChannels,
java.lang.Object[] settings)
standard constructor for the DeviceInterface class
|
Modifier and Type | Method and Description |
---|---|
void |
activateUsedChannels()
activates the channels
|
void |
addControlDeviceOperator(ControlDeviceOperator aDevOp)
adds a controller for a device
|
void |
addDeviceOperator(DeviceOperator aDevOp)
adds a controller for a device
|
void |
addSensorDeviceOperator(SensorDeviceOperator aDevOp)
adds a controller for a device
|
void |
autoColorTraces()
reset the sensor traces
|
void |
close()
closes the interfaces
|
void |
closeEventInterface()
close the event interface
|
void |
completeInterface()
complete the interface to a Phidget
|
void |
confirmChannelRange(int theChannelID)
tests for the controller being in the available range of device IDs
|
boolean |
confirmInputCapable()
confirms that the interface contains output channels
|
void |
confirmMinNChannels(int testNChannels)
tests for a minimum number of available channel IDs
|
boolean |
confirmOutputCapable()
confirms that the interface contains output channels
|
void |
controlAllDevices(Capture theCapture)
controls all devices
|
void |
controlDeviceFromSchedule(int theDeviceID,
TimeVariable theSchedule,
boolean turnOn)
controls a device from a schedule
|
void |
finalizeInterface() |
java.lang.Object |
getAnalogOutHardware()
returns a analog out hardware - if it exists
|
java.lang.Object |
getAnalogSensorHardware()
returns the interface's hardware device that does sensor access
|
int |
getChannelAccess()
returns whether the interface is polling or event-driven
|
ControlDeviceOperator |
getControlDeviceOperator(int index)
returns the device controller for a particular position in the ArrayList - if available
|
java.lang.Object |
getControlHardware()
returns the interface's hardware device that switches relays
|
int |
getDataRate()
get the data rate
|
DeviceOperator |
getDeviceOperator(int index)
returns the device operator for a particular position in the ArrayList - if available
|
DeviceOperator |
getDeviceOperatorForChannel(int channel)
returns the device operator for a particular position in the ArrayList - if available
|
int |
getDeviceType()
returns the mode for the DeviceInterface
|
java.lang.Object |
getHardware()
returns the interface's hardware
|
java.util.List<java.awt.Shape> |
getHotShapeList()
returns the hot spaces that trigger the interface
|
java.lang.String |
getItsName()
returns the name for the interface
|
int |
getNControlDeviceOperators()
returns the number of serial device controllers registered with the interface
|
int |
getNDeviceOperators()
returns the number of serial device controllers registered with the interface
|
int |
getNInterfaceChannels()
returns the number of channels for the interface
|
int |
getNSensorDeviceOperators()
returns the number of serial device controllers registered with the interface
|
SensorDeviceOperator |
getSensorDeviceOperator(int index)
returns the device sensor for a particular position in the ArrayList - if available
|
java.lang.Object |
getSensorHardware()
returns the interface's hardware device that switches relays
|
float |
getSensorValue(DataChannelDescriptor dataSource)
starts the device on one channel.
|
float |
getSensorValue(int theChannel)
starts the device on one channel.
|
TrackerEngine |
getTracker()
returns the tracker that controls the interface
|
void |
initializeFromSettings() |
boolean |
isValidControlHardware()
returns whether the device interface is able to control output
|
boolean |
isValidSensorHardware()
returns whether the device interface is able to control output
|
void |
list()
lists the interface
|
void |
listDeviceInterface()
lists info for the device
|
void |
listDeviceOperators()
lists the device controllers
|
static void |
main(java.lang.String[] args)
Main method
|
void |
makeControlDeviceOperator(int channelNum)
makes and adds a controller to the interface
|
void |
makeDeviceOperator(int channelNum)
makes and adds an operator to the interface
|
void |
makeHardwareInterface()
initializes empty interface for the device controller
|
void |
makeInterface()
initializes empty interface for the device controller
|
void |
makeSensorDeviceOperator(int channelNum)
makes and adds a sensor to the interface
|
void |
makeSineWave(int theChannel,
double maxVolts)
makes a sine wave
|
void |
prepareEventInterface()
sets up the event interface
|
void |
resetAllChannels()
resets all channels for the interface
|
void |
resetTraces()
reset the sensor traces
|
java.lang.String |
sendCommand(java.lang.String cmd)
send a command
|
void |
setByteValue(DataChannelDescriptor dataSource,
byte value)
sets the output value on a channel.
|
void |
setByteValue(int channelID,
byte value)
sets the output value on a channel.
|
void |
setChannelAccess(int chAcc)
sets the interface to polling or event-driven
|
void |
setDataRate(int dataRate)
set the data rate
|
void |
setDeviceType(int anInt)
sets the mode for the DeviceInterface
|
void |
setEnabled(int channel,
boolean turnON)
enabling the channel
|
void |
setEngaged(int channel,
boolean turnON)
engaging the channel
|
void |
setInterface(java.lang.Object anInterface)
sets the provided interface for the device controller
|
void |
setItsName(java.lang.String itsName)
sets the name for the interface
|
void |
setNControlInterfaceChannels(int nChans)
sets the number of serial device controllers registered with the interface
|
void |
setTraceTimes(long durationTrace)
start logging analog sensor values
|
void |
setTracker(TrackerEngine aTracker)
installs the tracker that controls the interface
|
java.lang.String |
setupDataLogging()
start logging analog sensor values
|
void |
setValidRange(int low,
int high)
sets the valid range of the interface
|
void |
setValue(int channelID,
float value)
sets the output value on a channel.
|
void |
startDataIn_DirectPolling()
start collecting analog sensor values
|
void |
startDataIn_DirectPolling(long durationToRun)
start collecting analog sensor values
|
void |
startDataIn_EventDriven()
start collecting analog sensor values
|
void |
startDataIn()
start collecting analog sensor values
|
void |
startEventInterface()
start the event interface
|
void |
stopDataIn()
stop collecting analog sensor values
|
void |
stopEventInterface()
stop the event interface
|
java.lang.String |
toString()
returns a summary of the interface as a string
|
void |
turnOff(int theChannel)
stops the device on one channel.
|
void |
turnOn(int theChannel)
starts the device on one channel.
|
void |
updateSamplingRate(float sPS)
updating the sampling rate
|
void |
windowActivated(java.awt.event.WindowEvent e) |
void |
windowClosed(java.awt.event.WindowEvent e) |
void |
windowClosing(java.awt.event.WindowEvent e)
window is closing
|
void |
windowDeactivated(java.awt.event.WindowEvent e) |
void |
windowDeiconified(java.awt.event.WindowEvent e) |
void |
windowIconified(java.awt.event.WindowEvent e) |
void |
windowOpened(java.awt.event.WindowEvent e) |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
public static final int DeviceType_NONE
public static final int DeviceType_OUT
public static final int DeviceType_IN
public static final int DeviceType_INOUT
public static final int ChannelAccess_NONE
public static final int ChannelAccess_DIRECT
public static final int ChannelAccess_EVENTS
public static final double itsOnVoltage
public static final double itsOffVoltage
public static float kSamplesPerSec
public float itsSamplesPerSec
public int itsDeviceType
public java.util.ArrayList<java.lang.Integer> operChannelsInUse
public java.util.ArrayList<java.lang.Integer> sensChannelsInUse
public java.util.ArrayList<java.lang.Integer> contrChannelsInUse
public java.lang.Object itsHardware
public java.lang.String itsType
public int itsSerNum
public int[] validRange
public boolean attached
public ControlDesignType itsControlDesign
public java.util.TimerTask timeDevice
public java.util.Timer itsDeviceTimer
public int itsTimerRowCounter
public boolean isDataLoggingReady
public boolean loggerIsRunning
public boolean isDataInRunning
public DataValue datVal
public boolean listValues
public java.lang.String logFileName
public java.io.FileWriter fw
public long currSampleTime
public long lastSampleTime
public InstrumentEngine itsEngine
public XYPresenterPanel itsInstrumentPanel
public long startTimeDataIn
public long itsRunTime
public Group sensorTraces
public long itsStartTraceTime
public double itsDurationTraceTime
public boolean isActive
public java.io.PrintWriter itsWriter
public java.io.BufferedReader itsReader
public java.lang.Object[] itsSettings
public DeviceInterface(int nChannels)
nChannels
- the number of channelspublic DeviceInterface(int nChannels, java.lang.Object[] settings)
nChannels
- the number of channelssettings
- the settings to usepublic DeviceInterface(int nChannels, float samplesPerSec)
nChannels
- the number of channelssamplesPerSec
- the number of samples per secondpublic DeviceInterface(int nChannels, float samplesPerSec, java.lang.Object[] settings)
nChannels
- the number of channelssamplesPerSec
- the number of samples per secondsettings
- the settingspublic void finalizeInterface()
public java.lang.String getItsName()
public void setItsName(java.lang.String itsName)
itsName
- the name af the interfacepublic int getChannelAccess()
public void setChannelAccess(int chAcc) throws java.lang.Exception
chAcc
- the constant designating polling or event-drivemjava.lang.Exception
- ...public int getNDeviceOperators()
public int getNControlDeviceOperators() throws java.lang.Exception
java.lang.Exception
- ...public int getNSensorDeviceOperators() throws java.lang.Exception
java.lang.Exception
- ...public void setNControlInterfaceChannels(int nChans)
nChans
- the number of devices availablepublic int getNInterfaceChannels()
public void makeDeviceOperator(int channelNum) throws java.lang.Exception
channelNum
- the channel to usejava.lang.Exception
- ...public void makeSensorDeviceOperator(int channelNum) throws java.lang.Exception
channelNum
- the channel to usejava.lang.Exception
- ...public void makeControlDeviceOperator(int channelNum) throws java.lang.Exception
channelNum
- the channel to usejava.lang.Exception
- ...public void addDeviceOperator(DeviceOperator aDevOp) throws java.lang.Exception
aDevOp
- the controller for a serial devicejava.lang.Exception
- ...public void addSensorDeviceOperator(SensorDeviceOperator aDevOp) throws java.lang.Exception
aDevOp
- the sensor device operatorjava.lang.Exception
- ...public void addControlDeviceOperator(ControlDeviceOperator aDevOp) throws java.lang.Exception
aDevOp
- the controller for a serial devicejava.lang.Exception
- ...public DeviceOperator getDeviceOperator(int index) throws java.lang.Exception
index
- index of the device sensorjava.lang.Exception
- ...public SensorDeviceOperator getSensorDeviceOperator(int index) throws java.lang.Exception
index
- index of the device sensorjava.lang.Exception
- ...public ControlDeviceOperator getControlDeviceOperator(int index) throws java.lang.Exception
index
- index of the device controllerjava.lang.Exception
- ...public DeviceOperator getDeviceOperatorForChannel(int channel) throws java.lang.Exception
channel
- index of the device operatorjava.lang.Exception
- ...public int getDataRate()
public void setDataRate(int dataRate)
dataRate
- the data rate for the devicepublic void updateSamplingRate(float sPS) throws java.lang.Exception
sPS
- the sampling rate for the devicejava.lang.Exception
- ...public void setTracker(TrackerEngine aTracker)
aTracker
- the tracker in controlpublic TrackerEngine getTracker()
public int getDeviceType()
public void setDeviceType(int anInt) throws java.lang.Exception
anInt
- the constant designating input, output, etc.java.lang.Exception
- ...public java.util.List<java.awt.Shape> getHotShapeList() throws java.lang.Exception
java.lang.Exception
- ...public void turnOn(int theChannel) throws java.lang.Exception
theChannel
- index of the devicejava.lang.Exception
- ...public void turnOff(int theChannel) throws java.lang.Exception
theChannel
- index of the devicejava.lang.Exception
- ...public void controlAllDevices(Capture theCapture) throws java.lang.Exception
theCapture
- the capturejava.lang.Exception
- ...public void controlDeviceFromSchedule(int theDeviceID, TimeVariable theSchedule, boolean turnOn) throws java.lang.Exception
theDeviceID
- index of the devicetheSchedule
- the times to scheduleturnOn
- turn device on (true) or off (false)java.lang.Exception
- ...public void completeInterface() throws java.lang.Exception
java.lang.Exception
- ...public void makeHardwareInterface() throws java.lang.Exception
java.lang.Exception
- ...public void makeInterface() throws java.lang.Exception
java.lang.Exception
- ...public void initializeFromSettings() throws java.lang.Exception
java.lang.Exception
public void setInterface(java.lang.Object anInterface)
anInterface
- the interface to setpublic void setValidRange(int low, int high) throws java.lang.Exception
low
- sets the low value of the rangehigh
- sets the high value of the rangejava.lang.Exception
- ...public void listDeviceInterface() throws java.lang.Exception
java.lang.Exception
- ...public void listDeviceOperators()
public void setTraceTimes(long durationTrace) throws java.lang.Exception
durationTrace
- the length of the tracejava.lang.Exception
- ...public java.lang.String setupDataLogging() throws java.lang.Exception
java.lang.Exception
- ...public void autoColorTraces() throws java.lang.Exception
java.lang.Exception
- ...public void resetTraces() throws java.lang.Exception
java.lang.Exception
- ...public void startDataIn() throws java.lang.Exception
java.lang.Exception
- ...public void startDataIn_DirectPolling() throws java.lang.Exception
java.lang.Exception
- ...public void startDataIn_DirectPolling(long durationToRun) throws java.lang.Exception
durationToRun
- pre-defined duration to run, use -1 if finished by clicking stop buttonjava.lang.Exception
- ...public void startDataIn_EventDriven() throws java.lang.Exception
java.lang.Exception
- ...public void stopDataIn() throws java.lang.Exception
java.lang.Exception
- ...public void setEnabled(int channel, boolean turnON) throws java.lang.Exception
channel
- the channelturnON
- to turn on?java.lang.Exception
- ...public void setEngaged(int channel, boolean turnON) throws java.lang.Exception
channel
- the channelturnON
- to turn on?java.lang.Exception
- ...public void setByteValue(int channelID, byte value) throws java.lang.Exception
channelID
- index of the devicevalue
- the voltage to setjava.lang.Exception
- ...public void setByteValue(DataChannelDescriptor dataSource, byte value) throws java.lang.Exception
dataSource
- descriptor of the devicevalue
- the voltage to setjava.lang.Exception
- ...public void setValue(int channelID, float value) throws java.lang.Exception
channelID
- index of the devicevalue
- the voltage to setjava.lang.Exception
- ...public void makeSineWave(int theChannel, double maxVolts)
theChannel
- the channel to usemaxVolts
- the maximum voltagepublic float getSensorValue(int theChannel) throws java.lang.Exception
theChannel
- index of the devicejava.lang.Exception
- ...public float getSensorValue(DataChannelDescriptor dataSource) throws java.lang.Exception
dataSource
- index of the devicejava.lang.Exception
- ...public java.lang.Object getHardware()
public java.lang.Object getAnalogSensorHardware() throws java.lang.Exception
java.lang.Exception
- ...public java.lang.Object getAnalogOutHardware() throws java.lang.Exception
java.lang.Exception
- ...public java.lang.Object getSensorHardware() throws java.lang.Exception
java.lang.Exception
- ...public java.lang.Object getControlHardware() throws java.lang.Exception
java.lang.Exception
- ...public void resetAllChannels() throws java.lang.Exception
java.lang.Exception
- ...public void activateUsedChannels() throws java.lang.Exception
java.lang.Exception
- ...public void prepareEventInterface() throws java.lang.Exception
java.lang.Exception
- ...public void startEventInterface() throws java.lang.Exception
java.lang.Exception
- ...public void stopEventInterface() throws java.lang.Exception
java.lang.Exception
- ...public boolean isValidSensorHardware() throws java.lang.Exception
java.lang.Exception
- ...public boolean isValidControlHardware() throws java.lang.Exception
java.lang.Exception
- ...public void confirmChannelRange(int theChannelID) throws java.lang.Exception
theChannelID
- index of the controllerjava.lang.Exception
- ...public void confirmMinNChannels(int testNChannels) throws java.lang.Exception
testNChannels
- number of channelsjava.lang.Exception
- ...public boolean confirmInputCapable() throws java.lang.Exception
java.lang.Exception
- ...public boolean confirmOutputCapable() throws java.lang.Exception
java.lang.Exception
- ...public void list()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<DeviceOperator>
public void windowClosing(java.awt.event.WindowEvent e)
windowClosing
in interface java.awt.event.WindowListener
e
- the eventpublic void windowOpened(java.awt.event.WindowEvent e)
windowOpened
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent e)
windowClosed
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent e)
windowIconified
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent e)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent e)
windowActivated
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent e)
windowDeactivated
in interface java.awt.event.WindowListener
public void closeEventInterface() throws java.lang.Exception
java.lang.Exception
- ...public void close() throws java.lang.Exception
java.lang.Exception
- ...public java.lang.String sendCommand(java.lang.String cmd)
cmd
- the command stringpublic static void main(java.lang.String[] args)
args
- the argumentsRH, 2017