Package hfDaqCard

Class SmruDaqJNI

java.lang.Object
hfDaqCard.SmruDaqJNI

public class SmruDaqJNI extends Object
Functions to interface with the SAIL Ltd DAQ card C code via JNI
Author:
Doug Gillespie
  • Field Details

  • Constructor Details

  • 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 number
      gainIndex - gain index
      filterIndex - 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 number
      nSamples - 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 number
      channel - 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 number
      i - number of flashes.
    • getLibrary

      public String getLibrary()
      Get the dll library name.
      Returns:
    • getLibarayVersion

      public int getLibarayVersion()
      Get the version of the dll library.
      Returns: