Package mcc.mccjna
Class MCCUtils
java.lang.Object
mcc.mccjna.MCCUtils
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
boardIndexToNumber
(int boardIndex) Turn a board index (0 to ...) to a board number.static Integer
findRangeCode
(AnalogRangeData rangeData) Go from analog range data to a code understood by MCC.static ArrayList<AnalogRangeData>
getAllRanges
(boolean bipolar, boolean unipolar) Get all analogue ranges for optionally bipolar and single ended operation.static ArrayList<AnalogRangeData>
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
getBipolarRangeIndex
(int range) Work out where in the list of bipolar ranges a particular range is.static AnalogRangeData
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 acquisitionstatic 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)
-
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 numberchannel
- channel numberdifferential
- true if input is differential.range
- Analog gain range- Returns:
- voltage (converted to volts)
- Throws:
MCCException
- thrown if there is any error.
-
readVoltage
Read a single analogue voltage using cbAIn(...)- Parameters:
board
- board numberchannel
- channel numberrange
- 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
Go from analog range data to a code understood by MCC.- Parameters:
rangeData
- PAMGuard range data- Returns:
- MCC range code.
-
getRangeData
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
-
getAnalogRangeData
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 numberterminalConfig
- single ended or differential (MCCConstants.SINGLE_ENDED or MCCConstatns.DIFFERENTIAL)continuous
- true for continuous acquisition, false otherwiserange
- MCC range constant- Returns:
- true if it seems to acquire OK.
-
getAllRanges
Get all analogue ranges for optionally bipolar and single ended operation.- Parameters:
bipolar
-unipolar
-- Returns:
- list of all available ranges for any board.
-