Package mcc.mccjna

Class MCCUtils

java.lang.Object
mcc.mccjna.MCCUtils

public class MCCUtils extends Object
Useful functions that use the JNI but use some PAMGuard specific structures, so don't want them in the JNA class in order that that can be used with other software.

Mostly Static functions.

Author:
Doug Gillespie
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    boardIndexToNumber(int boardIndex)
    Turn a board index (0 to ...) to a board number.
    static Integer
    Go from analog range data to a code understood by MCC.
    getAllRanges(boolean bipolar, boolean unipolar)
    Get all analogue ranges for optionally bipolar and single ended operation.
    getAnalogRangeData(int[] rangeCodes)
    Convert MCC range codes to a list of PAMGuard AnalogRangeData objects.
    static int[]
    getAvailableRanges(int boardNum, int terminalConfig, boolean continuous, boolean unipolar, boolean bipolar)
     
    static int[]
    getAvailableRanges(int boardNum, int terminalConfig, boolean continuous, int[] rangeList)
     
    static int
    Work out where in the list of bipolar ranges a particular range is.
    getRangeData(int rangeCode)
    Get a Range Data object.
    static boolean
    isAvailableRange(int boardNum, int terminalConfig, boolean continuous, int range)
    Test to see if an input range is available for a given board for continuous or single value acquisition
    static double
    readVoltage(int board, int channel, boolean differential, int range)
    Read a single analogue voltage using cbAIn(...)
    static double
    readVoltage(int board, int channel, int range)
    Read a single analogue voltage using cbAIn(...)
    static String
    sayBibolarRange(int range)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MCCUtils

      public MCCUtils()
  • Method Details

    • getAvailableRanges

      public static int[] getAvailableRanges(int boardNum, int terminalConfig, boolean continuous, boolean unipolar, boolean bipolar)
    • getAvailableRanges

      public static int[] getAvailableRanges(int boardNum, int terminalConfig, boolean continuous, int[] rangeList)
    • boardIndexToNumber

      public static int boardIndexToNumber(int boardIndex)
      Turn a board index (0 to ...) to a board number. Board numbers probably start at 1 !
      Parameters:
      boardIndex - board index
      Returns:
      board number or -1 if the board doesn't exist.
    • readVoltage

      public static double readVoltage(int board, int channel, boolean differential, int range) throws MCCException
      Read a single analogue voltage using cbAIn(...)
      Parameters:
      board - board number
      channel - channel number
      differential - true if input is differential.
      range - Analog gain range
      Returns:
      voltage (converted to volts)
      Throws:
      MCCException - thrown if there is any error.
    • readVoltage

      public static double readVoltage(int board, int channel, int range) throws MCCException
      Read a single analogue voltage using cbAIn(...)
      Parameters:
      board - board number
      channel - channel number
      range - Analog gain range
      Returns:
      voltage (converted to volts)
      Throws:
      MCCException - thrown if there is any error.
    • getBipolarRangeIndex

      public static int getBipolarRangeIndex(int range)
      Work out where in the list of bipolar ranges a particular range is. Used for setting combo box list positions.
      Parameters:
      range - bipolar MCC range
      Returns:
      index in bipolarRanges list. or -1 if range not found.
    • findRangeCode

      public static Integer findRangeCode(AnalogRangeData rangeData)
      Go from analog range data to a code understood by MCC.
      Parameters:
      rangeData - PAMGuard range data
      Returns:
      MCC range code.
    • getRangeData

      public static AnalogRangeData getRangeData(int rangeCode)
      Get a Range Data object. Note that unipolar and bipolar are NOT the same as single ended and differential input. i.e you can have single ended bipolar input and differential single ended input if you so wish
      Parameters:
      rangeCode -
      Returns:
      analog Range Data object.
    • sayBibolarRange

      public static String sayBibolarRange(int range)
    • getAnalogRangeData

      public static ArrayList<AnalogRangeData> getAnalogRangeData(int[] rangeCodes)
      Convert MCC range codes to a list of PAMGuard AnalogRangeData objects.
      Parameters:
      rangeCodes - range codes
      Returns:
      list of range data objects.
    • isAvailableRange

      public static boolean isAvailableRange(int boardNum, int terminalConfig, boolean continuous, int range)
      Test to see if an input range is available for a given board for continuous or single value acquisition
      Parameters:
      boardNum - board number
      terminalConfig - single ended or differential (MCCConstants.SINGLE_ENDED or MCCConstatns.DIFFERENTIAL)
      continuous - true for continuous acquisition, false otherwise
      range - MCC range constant
      Returns:
      true if it seems to acquire OK.
    • getAllRanges

      public static ArrayList<AnalogRangeData> getAllRanges(boolean bipolar, boolean unipolar)
      Get all analogue ranges for optionally bipolar and single ended operation.
      Parameters:
      bipolar -
      unipolar -
      Returns:
      list of all available ranges for any board.