|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.nasa.gsfc.irc.library.ports.connections.ni.daq.NiDaq
public class NiDaq
NiDaq is a Java interface to a subset of the National Instruments NI-DAQ driver. NI-DAQ is a set of functions that control all of the National Instruments plug-in DAQ devices for analog I/O, digital I/O, timing I/O, SCXI signal conditioning, and RTSI multiboard synchronization. Refer to the documents: NI-DAQ User Manual and NI-DAQ Function Reference Manual available from National Instruments.
You must call one of the loadLibrary
methods before
using any of the NI-DAQ methods.
This code was developed for NASA, Goddard Space Flight Center, Code 580 for the Instrument Remote Control (IRC) project.
Field Summary | |
---|---|
static String |
sNiDaqLibrary
Name of the NI-DAG Java Native Interface library. |
Method Summary | |
---|---|
static long |
digBlockCheck(short deviceNumber,
short group)
Returns the number of items remaining to be transferred after a DIG_Block_In or DIG_Block_Out call. |
static void |
digBlockClear(short deviceNumber,
short group)
Halts any ongoing asynchronous transfer, allowing another transfer to be initiated. |
static void |
digBlockIn(short deviceNumber,
short group,
Buffer buffer,
long offset,
long count)
Initiates an asynchronous data transfer from the specified group to memory. |
static void |
digBlockIn(short deviceNumber,
short group,
byte[] buffer,
long offset,
long count)
Initiates an asynchronous data transfer from the specified group to memory. |
static void |
digBlockOut(short deviceNumber,
short group,
Buffer buffer,
long offset,
long count)
Initiates an asynchronous transfer of data from memory to the specified group. |
static void |
digBlockOut(short deviceNumber,
short group,
byte[] buffer,
long offset,
long count)
Initiates an asynchronous transfer of data from memory to the specified group. |
static void |
digGroupConfig(short deviceNumber,
short group,
short groupSize,
short port,
short direction)
Configures the specified group for port assignment, direction (input or output), and size. |
static void |
digGroupMode(short deviceNumber,
short group,
short protocol,
short edge,
short reqpol,
short ackpol,
short delayTime)
Configures the specified group for handshake signal modes. |
static short |
digInGrp(short deviceNumber,
short group)
Reads digital input data from the specified digital group. |
static short |
digInLine(short deviceNumber,
short port,
short line)
Returns the digital logic state of the specified digital line in the specified port. |
static int |
digInPrt(short deviceNumber,
short port)
Returns digital input data from the specified digital I/O port. |
static void |
digOutGroup(short deviceNumber,
short group,
short groupPattern)
Writes digital output data to the specified digital group on the specified device. |
static void |
digOutLine(short deviceNumber,
short port,
short line,
short state)
Sets or clears the specified digital output line in the specified digital port. |
static void |
digOutPrt(short deviceNumber,
short port,
short pattern)
Writes digital output data to the specified digital port. |
static void |
digPrtConfig(short deviceNumber,
short port,
short mode,
short dir)
Configures the specified port for direction (input or output) and output type (standard or wired-OR). |
static short |
initDaBoards(short deviceNumber)
Initializes the hardware and software states of a National Instruments DAQ device to its default state, and then returns a numeric device code that corresponds to the type of device initialized. |
static void |
loadLibrary()
Loads the NI-DAG Java Native Interface library specified by the sNiDaqLibrary field. |
static void |
loadLibrary(String libname)
Loads the NI-DAG Java Native Interface library specified by the libname
argument. |
static void |
main(String[] args)
Main method for testing. |
static void |
setDaqDeviceInfo(short deviceNumber,
int infoType,
int infoValue)
Selects parameters pertaining to the device operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String sNiDaqLibrary
loadLibrary
method. The default is
"NiDaqAdapter".
Method Detail |
---|
public static void loadLibrary()
sNiDaqLibrary
field.
The manner in which a library name is mapped to the
actual library is system dependent.
SecurityException
- if a security manager exists and its
checkLink
method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError
- if the library does not exist.loadLibrary(java.lang.String)
,
SecurityManager.checkLink(java.lang.String)
public static void loadLibrary(String libname) throws UnsatisfiedLinkError
libname
argument. The manner in which a library name is mapped to the
actual library is system dependent.
Uses the System.loadLibrary(name)
method call.
libname
- the name of the library.
SecurityException
- if a security manager exists and its
checkLink
method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError
- if the library does not exist.System.loadLibrary(java.lang.String)
,
SecurityManager.checkLink(java.lang.String)
public static long digBlockCheck(short deviceNumber, short group) throws NiDaqException
DIG_Block_Check
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- the group to be configured
NiDaqException
- If a NI DAQ error occurred.public static void digBlockClear(short deviceNumber, short group) throws NiDaqException
DIG_Block_Clear
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- the group involved in the asynchronous transfer
NiDaqException
- If a NI DAQ error occurred.public static void digBlockIn(short deviceNumber, short group, byte[] buffer, long offset, long count) throws NiDaqException
count
is the number of
items (for example, 8-bit items for a group of size 1, 16-bit items for
a group of size 2, and 32-bit items for a group of size 4) to be
transferred to the area of memory specified by buffer
from the group indicated by group
.
Refer to the DIG_Block_In
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- the group to be read frombuffer
- conversion samples returnedoffset
- index at which to start storing items.count
- number of items to be transferred
NiDaqException
- If a NI DAQ error occurred.public static void digBlockIn(short deviceNumber, short group, Buffer buffer, long offset, long count) throws NiDaqException
count
is the number of
items (for example, 8-bit items for a group of size 1, 16-bit items for
a group of size 2, and 32-bit items for a group of size 4) to be
transferred to the area of memory specified by buffer
from the group indicated by group
.
Refer to the DIG_Block_In
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- the group to be read frombuffer
- conversion samples returnedoffset
- index at which to start storing items.count
- number of items to be transferred
NiDaqException
- If a NI DAQ error occurred.public static void digBlockOut(short deviceNumber, short group, byte[] buffer, long offset, long count) throws NiDaqException
count
is the number of
items (for example, 8-bit items for a group of size 1, 16-bit items for
a group of size 2, and 32-bit items for a group of size 4) to be
transferred from the area of memory specified by buffer
to the group indicated by group
.
Refer to the DIG_Block_In
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- the group to be written tobuffer
- array containing the user’s dataoffset
- index where items to be transferred starts.count
- number of items to be transferred
NiDaqException
- If a NI DAQ error occurred.public static void digBlockOut(short deviceNumber, short group, Buffer buffer, long offset, long count) throws NiDaqException
count
is the number of
items (for example, 8-bit items for a group of size 1, 16-bit items for
a group of size 2, and 32-bit items for a group of size 4) to be
transferred from the area of memory specified by buffer
to the group indicated by group
.
Refer to the DIG_Block_In
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- the group to be written tobuffer
- array containing the user’s dataoffset
- index where items to be transferred starts.count
- number of items to be transferred
NiDaqException
- If a NI DAQ error occurred.public static void digGroupConfig(short deviceNumber, short group, short groupSize, short port, short direction) throws NiDaqException
DIG_Grp_Config
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- the group to be configuredgroupSize
- size of the groupport
- digital I/O port assigned to the groupdirection
- input or output
NiDaqException
- If a NI DAQ error occurred.public static void digGroupMode(short deviceNumber, short group, short protocol, short edge, short reqpol, short ackpol, short delayTime) throws NiDaqException
DIG_Grp_Mode
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- the group to be configuredprotocol
- basic handshaking systemedge
- rising-edge or falling-edge pulsed signalsreqpol
- request signal is to be active high or active lowackpol
- acknowledge handshake signal is to be active
high or active lowdelayTime
- data settling time allowed
NiDaqException
- If a NI DAQ error occurred.public static short digInLine(short deviceNumber, short port, short line) throws NiDaqException
DIG_In_Line
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilityport
- the digital I/O port numberline
- the digital line to be read
NiDaqException
- If a NI DAQ error occurred.public static int digInPrt(short deviceNumber, short port) throws NiDaqException
DIG_In_Prt
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilityport
- the digital I/O port number
NiDaqException
- If a NI DAQ error occurred.public static short digInGrp(short deviceNumber, short group) throws NiDaqException
DIG_In_Grp
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- group to read from
NiDaqException
- If a NI DAQ error occurred.public static void digPrtConfig(short deviceNumber, short port, short mode, short dir) throws NiDaqException
DIG_Prt_Config
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilityport
- digital I/O port number of the port to write tomode
- handshake mode the port usesdir
- direction, input, or output
NiDaqException
- If a NI DAQ error occurred.public static void digOutGroup(short deviceNumber, short group, short groupPattern) throws NiDaqException
DIG_Out_Grp
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilitygroup
- group to write togroupPattern
- digital data to be written
NiDaqException
- If a NI DAQ error occurred.public static void digOutLine(short deviceNumber, short port, short line, short state) throws NiDaqException
DIG_Out_Line
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilityport
- digital I/O port numberline
- digital output linestate
- new digital logic state
NiDaqException
- If a NI DAQ error occurred.public static void digOutPrt(short deviceNumber, short port, short pattern) throws NiDaqException
DIG_Out_Prt
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilityport
- digital I/O port number of the port to write topattern
- 8-bit digital pattern for the data written
NiDaqException
- If a NI DAQ error occurred.public static short initDaBoards(short deviceNumber) throws NiDaqException
Init_DA_Brds
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utility
NiDaqException
- If a NI DAQ error occurred.public static void setDaqDeviceInfo(short deviceNumber, int infoType, int infoValue) throws NiDaqException
set_DAQ_Device_Info
function in the
NI-DAQ Function Reference Manual.
deviceNumber
- number assigned by configuration utilityinfoType
- parameter you want to modifyinfoValue
- new value you want to assign to the parameter
specified by infoType
NiDaqException
- If a NI DAQ error occurred.public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |