Package hfDaqCard
Class SmruDaqJNI
java.lang.Object
hfDaqCard.SmruDaqJNI
Functions to interface with the SAIL Ltd DAQ card C code via JNI
- Author:
- Doug Gillespie
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
closeCard
(int board) Close the daq cardboolean
flashLEDs
(int board, int nFlashes) Flash board LED's.int
getAvailableSamples
(int device, int channel) Get the number of available samples for a single channel.int
getBoardOrder
(int boardId) Convert a software index to a hardware index.int
Get the buffer size for each channel being read.int
getLED
(int board, int led) Get the led statusint
Get the version of the dll library.Get the dll library name.int
int
Get the number of available devices.long
getSerialNumber
(int boardId) Get a cards serial number.int
getSynchMode
(int board) Get a boards synch modeint
get the verbose level of the jni softwareboolean
isboardOpen
(int boardHardNo) boolean
prepareChannel
(int board, int channel, int gainIndex, int filterIndex) Sets the gain and filters for a channelshort[]
readSamples
(int board, int channel, int nSamples) Read samples from a daq cardint
setChannelBufferSize
(int bufferSamples) Set the buffer size for each channel being read.boolean
setChannelMask
(int board, int channelMask) Set mask of channels to read.int
setLED
(int board, int led, int state) Set the led statusboolean
setSampleRateIndex
(int board, int sampleRateIndex) Set the daq card sample rateint
setSynchMode
(int board, int mode) Set a board synch mode.void
setVerbose
(int verbose) Set the verbose level of the jni softwareboolean
startSystem
(int board) Start the daq cardboolean
stopSystem
(int board) Stop data acquisition on a DAQ card.boolean
systemStopped
(int board) Can be called once the DAQ has been stopped.int
toggleLED
(int board, int led) Swap an led status
-
Field Details
-
SMRU_VAL_STANDALONE
public static final int SMRU_VAL_STANDALONE- See Also:
-
SMRU_VAL_MASTER
public static final int SMRU_VAL_MASTER- See Also:
-
SMRU_VAL_SLAVE
public static final int SMRU_VAL_SLAVE- See Also:
-
SMRU_VAL_SLAVE_MASTERED
public static final int SMRU_VAL_SLAVE_MASTERED- See Also:
-
SMRU_RET_OK
public static final int SMRU_RET_OK- See Also:
-
GREEN_LED
public static final int GREEN_LED- See Also:
-
RED_LED
public static final int RED_LED- See Also:
-
RESET_NONE
public static final int RESET_NONE- See Also:
-
RESET_AUTO
public static final int RESET_AUTO- See Also:
-
RESET_FULL
public static final int RESET_FULL- See Also:
-
ERROR_SUCCESS
public static final int ERROR_SUCCESS- See Also:
-
-
Constructor Details
-
SmruDaqJNI
-
-
Method Details
-
getNumDevices
public int getNumDevices()Get the number of available devices.- Returns:
-
setVerbose
public void setVerbose(int verbose) Set the verbose level of the jni software- Parameters:
verbose
- 0=very little printing, 3 = lots of printing
-
getVerbose
public int getVerbose()get the verbose level of the jni software- Returns:
- 0=very little printing, 3 = lots of printing
-
toggleLED
public int toggleLED(int board, int led) Swap an led status- Parameters:
board
- (software number)led
- 0 or 1- Returns:
- = off, 1 = on
-
setLED
public int setLED(int board, int led, int state) Set the led status- Parameters:
board
- (software number)led
- 0 or 1- Returns:
- = off, 1 = on
-
getLED
public int getLED(int board, int led) Get the led status- Parameters:
board
- (software number)led
- 0 or 1- Returns:
- = off, 1 = on
-
setSynchMode
public int setSynchMode(int board, int mode) Set a board synch mode.- Parameters:
board
- board number (software index)mode
- synch mode (0,1,2,3)- Returns:
- SMRU_RET_OK or -MinVal if an error
-
getSynchMode
public int getSynchMode(int board) Get a boards synch mode- Parameters:
board
- board number (software index)- Returns:
- synch mode or -something if an error
-
closeCard
public int closeCard(int board) Close the daq card- Parameters:
board
- (software index)- Returns:
- 0 on Success
-
isboardOpen
public boolean isboardOpen(int boardHardNo) - Parameters:
boardHardNo
- board hardware number- Returns:
- true if board is open
-
setSampleRateIndex
public boolean setSampleRateIndex(int board, int sampleRateIndex) Set the daq card sample rate- Parameters:
board
- (software index)sampleRateIndex
- sample rate index- Returns:
- true if OK
-
setChannelMask
public boolean setChannelMask(int board, int channelMask) Set mask of channels to read.- Parameters:
board
- (software index)channelMask
- mask of channels to use 0 - F- Returns:
- true if OK
-
prepareChannel
public boolean prepareChannel(int board, int channel, int gainIndex, int filterIndex) Sets the gain and filters for a channel- Parameters:
board
- board number (software index)channel
- channel numbergainIndex
- gain indexfilterIndex
- filter index- Returns:
- true if Ok
-
startSystem
public boolean startSystem(int board) Start the daq card- Parameters:
board
- (software index)- Returns:
-
stopSystem
public boolean stopSystem(int board) Stop data acquisition on a DAQ card.- Parameters:
device
- Device number- Returns:
- true if successful
-
systemStopped
public boolean systemStopped(int board) Can be called once the DAQ has been stopped. Will free allocated memory buffers.
with multi-thread applications ensure that once this has been called, no other thread attempts calls to sailReadSamples or an error will occur.- Parameters:
device
- Device number- Returns:
- always 0.
- See Also:
-
readSamples
public short[] readSamples(int board, int channel, int nSamples) Read samples from a daq card- Parameters:
board
- (software index)channel
- channel numbernSamples
- number of samples to read.- Returns:
-
getnDevices
public int getnDevices()- Returns:
- the number of installed SAIL Daq cards
-
getSerialNumber
public long getSerialNumber(int boardId) Get a cards serial number. This is a 64 bit integer number which is unique to every card.- Parameters:
device
- Device number- Returns:
- serial number or 0 if the card is not present / cannot be initialised.
-
getBoardOrder
public int getBoardOrder(int boardId) Convert a software index to a hardware index. Get the true order of the board in the device LUT from the board order the users sees which was sorted by serial number- Parameters:
boardId
- (software index)- Returns:
- board number (hardware index)
-
getAvailableSamples
public int getAvailableSamples(int device, int channel) Get the number of available samples for a single channel. When acquiring data, this should be periodically called to ensure that the buffers are not over filling, i.e. the value returned from this does not approach the value returned by sailGetChannelBufferSize.- Parameters:
device
- Device numberchannel
- Channel number (0 - 3)- Returns:
- the number of available samples.
- See Also:
-
jniGetChannelBufferSize()
-
getChannelBufferSize
public int getChannelBufferSize()Get the buffer size for each channel being read. This is currently a fixed value.- Returns:
- the size of the data buffer for each channel in samples.
-
setChannelBufferSize
public int setChannelBufferSize(int bufferSamples) Set the buffer size for each channel being read. Note that this call does not actually allocate memory. Memory allocation occurs when sailStartSystem is called- Parameters:
bufferSamples
- the size of the data buffer for each channel in samples.- Returns:
- 0 if successful, 1 if the system is running and the buffer cannot be set.
-
flashLEDs
public boolean flashLEDs(int board, int nFlashes) Flash board LED's.- Parameters:
board
- board software numberi
- number of flashes.
-
getLibrary
Get the dll library name.- Returns:
-
getLibarayVersion
public int getLibarayVersion()Get the version of the dll library.- Returns:
-