com.labjack

## Class LJM

- java.lang.Object
- - com.labjack.LJM

-     public class LJM
      extends java.lang.Object

  LJM is the wrapper class to the LJM library's functions and constants. Refer to the LabJackM.h header file or online User's Guide for functions and constants documentation:
  https://labjack.com/support/software/api/ljm

  LJM library C to Java differences:

  - C functions are implemented in the LJM class as static methods. The function name's "LJM_" prefix have been removed and the first letter have been changed to lowercase.
  - C constants can be found in the LJM.Constants class. The constant name's "LJM_" prefix have been removed.
  - C error code constants can be found in the LJM.Errors enum. The constant name's "LJME_" prefix have been removed.
  - C function parameter names have had the first letter changed to lowercase.
  - If the wrapper method detects an error it will throw a LJMException exception, setting the error and errorAddress values, and exception message.
  - C parameters that are pass by reference are implemented in Java as arrays, or JNA classes IntByReference, DoubleByReference, or LongByReference for single value references.
  - C string parameters are implemented in Java as a String and pass by reference strings are a JNA class Pointer.
  - When using a JNA Pointer for C strings, the JNA Memory class needs to be used to construct the pointer and allocate memory. For example:
    Pointer stringPtr = new Memory(100); //Allocates 100 bytes of memory which is a 100 character C string.

  Version History

  - 1.16
    - Updated functions, constants and error codes to LJM v1.16.
    - Matching version with the LJM version.
  - 0.93
    - Updated functions, constants and error codes to LJM v1.8.
  - 0.92
    - Updated functions, constants and error codes to LJM v1.2.
  - 0.91
    - Added Linux and Mac OS X support.
  - 0.90
    - Initial release tested with LJM v1.1.1. Windows support only.
  Version:
    1.16
  Author:
    LabJack Corporation <support@labjack.com>

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `LJM.Constants` Constants is a class containing the constants from the LJM library.
    `static class` | `LJM.Errors` Errors is an enum containing the error constants from the LJM library.
    `static interface` | `LJM.LabJackM`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LJM()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `addressesToMBFB(int maxBytesPerMBFB, int[] aAddresses, int[] aTypes, int[] aWrites, int[] aNumValues, double[] aValues, com.sun.jna.ptr.IntByReference numFrames, byte[] aMBFBCommand)`
    `static int` | `addressesToTypes(int numAddresses, int[] aAddresses, int[] aTypes)`
    `static int` | `addressToType(int address, com.sun.jna.ptr.IntByReference type)`
    `static void` | `byteArrayToFLOAT32(byte[] aBytes, int registerOffset, int numFLOAT32, float[] aFLOAT32)`
    `static void` | `byteArrayToINT32(byte[] aBytes, int registerOffset, int numINT32, int[] aINT32)`
    `static void` | `byteArrayToUINT16(byte[] aBytes, int registerOffset, int numUINT16, short[] aUINT16)`
    `static void` | `byteArrayToUINT32(byte[] aBytes, int registerOffset, int numUINT32, int[] aUINT32)`
    `static int` | `cleanInfo(int infoHandle)`
    `static int` | `close(int handle)`
    `static int` | `closeAll()`
    `static int` | `eAddresses(int handle, int numFrames, int[] aAddresses, int[] aTypes, int[] aWrites, int[] aNumValues, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eNames(int handle, int numFrames, java.lang.String[] aNames, int[] aWrites, int[] aNumValues, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eReadAddress(int handle, int address, int type, com.sun.jna.ptr.DoubleByReference value)`
    `static int` | `eReadAddressArray(int handle, int address, int type, int numValues, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eReadAddressByteArray(int handle, int address, int numBytes, byte[] aBytes, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eReadAddresses(int handle, int numFrames, int[] aAddresses, int[] aTypes, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eReadAddressString(int handle, int address, com.sun.jna.Pointer string)`
    `static int` | `eReadName(int handle, java.lang.String name, com.sun.jna.ptr.DoubleByReference value)`
    `static int` | `eReadNameArray(int handle, java.lang.String name, int numValues, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eReadNameByteArray(int handle, java.lang.String name, int numBytes, byte[] aBytes, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eReadNames(int handle, int numFrames, java.lang.String[] aNames, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eReadNameString(int handle, java.lang.String name, com.sun.jna.Pointer string)`
    `static void` | `errorToString(int errorCode, com.sun.jna.Pointer errorString)`
    `static int` | `eStreamRead(int handle, double[] aData, com.sun.jna.ptr.IntByReference deviceScanBacklog, com.sun.jna.ptr.IntByReference ljmScanBacklog)`
    `static int` | `eStreamStart(int handle, int scansPerRead, int numAddresses, int[] aScanList, com.sun.jna.ptr.DoubleByReference scanRate)`
    `static int` | `eStreamStop(int handle)`
    `static int` | `eWriteAddress(int handle, int address, int type, double value)`
    `static int` | `eWriteAddressArray(int handle, int address, int type, int numValues, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eWriteAddressByteArray(int handle, int address, int numBytes, byte[] aBytes, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eWriteAddresses(int handle, int numFrames, int[] aAddresses, int[] aTypes, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eWriteAddressString(int handle, int address, java.lang.String string)`
    `static int` | `eWriteName(int handle, java.lang.String name, double value)`
    `static int` | `eWriteNameArray(int handle, java.lang.String name, int numValues, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eWriteNameByteArray(int handle, java.lang.String name, int numBytes, byte[] aBytes, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eWriteNames(int handle, int numFrames, java.lang.String[] aNames, double[] aValues, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `eWriteNameString(int handle, java.lang.String name, java.lang.String string)`
    `static void` | `float32ToByteArray(float[] aFLOAT32, int registerOffset, int numFLOAT32, byte[] aBytes)`
    `static int` | `getHandleInfo(int handle, com.sun.jna.ptr.IntByReference deviceType, com.sun.jna.ptr.IntByReference connectionType, com.sun.jna.ptr.IntByReference serialNumber, com.sun.jna.ptr.IntByReference ipAddress, com.sun.jna.ptr.IntByReference port, com.sun.jna.ptr.IntByReference maxBytesPerMB)`
    `static int` | `getSpecificIPsInfo(com.sun.jna.ptr.IntByReference infoHandle, com.sun.jna.ptr.PointerByReference info)`
    `static void` | `int32ToByteArray(int[] aINT32, int registerOffset, int numINT32, byte[] aBytes)`
    `static int` | `ipToNumber(java.lang.String ipv4String, com.sun.jna.ptr.IntByReference number)`
    `static int` | `listAll(int deviceType, int connectionType, com.sun.jna.ptr.IntByReference numFound, int[] aDeviceTypes, int[] aConnectionTypes, int[] aSerialNumbers, int[] aIPAddresses)`
    `static int` | `listAllExtended(int deviceType, int connectionType, int numAddresses, int[] aAddresses, int[] aNumRegs, int maxNumFound, com.sun.jna.ptr.IntByReference numFound, int[] aDeviceTypes, int[] aConnectionTypes, int[] aSerialNumbers, int[] aIPAddresses, byte[] aBytes)`
    `static int` | `listAllS(java.lang.String deviceType, java.lang.String connectionType, com.sun.jna.ptr.IntByReference numFound, int[] aDeviceTypes, int[] aConnectionTypes, int[] aSerialNumbers, int[] aIPAddresses)`
    `static int` | `loadConfigurationFile(java.lang.String fileName)`
    `static void` | `loadConstants()`
    `static int` | `loadConstantsFromFile(java.lang.String fileName)`
    `static int` | `loadConstantsFromString(java.lang.String jsonString)`
    `static int` | `log(int level, java.lang.String string)`
    `static int` | `lookupConstantName(java.lang.String scope, double constantValue, com.sun.jna.Pointer constantName)`
    `static int` | `lookupConstantValue(java.lang.String scope, java.lang.String constantName, com.sun.jna.ptr.DoubleByReference constantValue)`
    `static int` | `macToNumber(java.lang.String macString, com.sun.jna.ptr.LongByReference number)`
    `static int` | `mbfbComm(int handle, byte unitID, byte[] aMBFB, com.sun.jna.ptr.IntByReference errorAddress)`
    `static int` | `namesToAddresses(int numFrames, java.lang.String[] aNames, int[] aAddresses, int[] aTypes)`
    `static int` | `nameToAddress(java.lang.String name, com.sun.jna.ptr.IntByReference address, com.sun.jna.ptr.IntByReference type)`
    `static int` | `numberToIP(int number, com.sun.jna.Pointer ipv4String)`
    `static int` | `numberToMAC(long number, com.sun.jna.Pointer macString)`
    `static int` | `open(int deviceType, int connectionType, java.lang.String identifier, com.sun.jna.ptr.IntByReference handle)`
    `static int` | `openS(java.lang.String deviceType, java.lang.String connectionType, java.lang.String identifier, com.sun.jna.ptr.IntByReference handle)`
    `static int` | `readLibraryConfigS(java.lang.String parameter, com.sun.jna.ptr.DoubleByReference value)`
    `static int` | `readLibraryConfigStringS(java.lang.String parameter, com.sun.jna.Pointer string)`
    `static int` | `readRaw(int handle, byte[] data, int numBytes)`
    `static int` | `resetLog()`
    `static int` | `streamBurst(int handle, int numAddresses, int[] aScanList, com.sun.jna.ptr.DoubleByReference scanRate, int numScans, double[] aData)`
    `static int` | `tcVoltsToTemp(int tcType, double tcVolts, double cjTempK, com.sun.jna.ptr.DoubleByReference pTCTempK)`
    `static void` | `uint16ToByteArray(short[] aUINT16, int registerOffset, int numUINT16, byte[] aBytes)`
    `static void` | `uint32ToByteArray(int[] aUINT32, int registerOffset, int numUINT32, byte[] aBytes)`
    `static int` | `updateValues(byte[] aMBFBResponse, int[] aTypes, int[] aWrites, int[] aNumValues, int numFrames, double[] aValues)`
    `static int` | `writeLibraryConfigS(java.lang.String parameter, double value)`
    `static int` | `writeLibraryConfigStringS(java.lang.String parameter, java.lang.String string)`
    `static int` | `writeRaw(int handle, byte[] data, int numBytes)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LJM

          public LJM()

  - ### Method Detail

    - #### listAll

          public static int listAll(int deviceType,
                                    int connectionType,
                                    com.sun.jna.ptr.IntByReference numFound,
                                    int[] aDeviceTypes,
                                    int[] aConnectionTypes,
                                    int[] aSerialNumbers,
                                    int[] aIPAddresses)

    - #### listAllS

          public static int listAllS(java.lang.String deviceType,
                                     java.lang.String connectionType,
                                     com.sun.jna.ptr.IntByReference numFound,
                                     int[] aDeviceTypes,
                                     int[] aConnectionTypes,
                                     int[] aSerialNumbers,
                                     int[] aIPAddresses)

    - #### listAllExtended

          public static int listAllExtended(int deviceType,
                                            int connectionType,
                                            int numAddresses,
                                            int[] aAddresses,
                                            int[] aNumRegs,
                                            int maxNumFound,
                                            com.sun.jna.ptr.IntByReference numFound,
                                            int[] aDeviceTypes,
                                            int[] aConnectionTypes,
                                            int[] aSerialNumbers,
                                            int[] aIPAddresses,
                                            byte[] aBytes)

    - #### openS

          public static int openS(java.lang.String deviceType,
                                  java.lang.String connectionType,
                                  java.lang.String identifier,
                                  com.sun.jna.ptr.IntByReference handle)

    - #### open

          public static int open(int deviceType,
                                 int connectionType,
                                 java.lang.String identifier,
                                 com.sun.jna.ptr.IntByReference handle)

    - #### getHandleInfo

          public static int getHandleInfo(int handle,
                                          com.sun.jna.ptr.IntByReference deviceType,
                                          com.sun.jna.ptr.IntByReference connectionType,
                                          com.sun.jna.ptr.IntByReference serialNumber,
                                          com.sun.jna.ptr.IntByReference ipAddress,
                                          com.sun.jna.ptr.IntByReference port,
                                          com.sun.jna.ptr.IntByReference maxBytesPerMB)

    - #### close

          public static int close(int handle)

    - #### closeAll

          public static int closeAll()

    - #### cleanInfo

          public static int cleanInfo(int infoHandle)

    - #### eWriteAddress

          public static int eWriteAddress(int handle,
                                          int address,
                                          int type,
                                          double value)

    - #### eReadAddress

          public static int eReadAddress(int handle,
                                         int address,
                                         int type,
                                         com.sun.jna.ptr.DoubleByReference value)

    - #### eWriteName

          public static int eWriteName(int handle,
                                       java.lang.String name,
                                       double value)

    - #### eReadName

          public static int eReadName(int handle,
                                      java.lang.String name,
                                      com.sun.jna.ptr.DoubleByReference value)

    - #### eReadAddresses

          public static int eReadAddresses(int handle,
                                           int numFrames,
                                           int[] aAddresses,
                                           int[] aTypes,
                                           double[] aValues,
                                           com.sun.jna.ptr.IntByReference errorAddress)

    - #### eReadNames

          public static int eReadNames(int handle,
                                       int numFrames,
                                       java.lang.String[] aNames,
                                       double[] aValues,
                                       com.sun.jna.ptr.IntByReference errorAddress)

    - #### eWriteAddresses

          public static int eWriteAddresses(int handle,
                                            int numFrames,
                                            int[] aAddresses,
                                            int[] aTypes,
                                            double[] aValues,
                                            com.sun.jna.ptr.IntByReference errorAddress)

    - #### eWriteNames

          public static int eWriteNames(int handle,
                                        int numFrames,
                                        java.lang.String[] aNames,
                                        double[] aValues,
                                        com.sun.jna.ptr.IntByReference errorAddress)

    - #### eReadAddressArray

          public static int eReadAddressArray(int handle,
                                              int address,
                                              int type,
                                              int numValues,
                                              double[] aValues,
                                              com.sun.jna.ptr.IntByReference errorAddress)

    - #### eReadNameArray

          public static int eReadNameArray(int handle,
                                           java.lang.String name,
                                           int numValues,
                                           double[] aValues,
                                           com.sun.jna.ptr.IntByReference errorAddress)

    - #### eWriteAddressArray

          public static int eWriteAddressArray(int handle,
                                               int address,
                                               int type,
                                               int numValues,
                                               double[] aValues,
                                               com.sun.jna.ptr.IntByReference errorAddress)

    - #### eWriteNameArray

          public static int eWriteNameArray(int handle,
                                            java.lang.String name,
                                            int numValues,
                                            double[] aValues,
                                            com.sun.jna.ptr.IntByReference errorAddress)

    - #### eReadAddressByteArray

          public static int eReadAddressByteArray(int handle,
                                                  int address,
                                                  int numBytes,
                                                  byte[] aBytes,
                                                  com.sun.jna.ptr.IntByReference errorAddress)

    - #### eReadNameByteArray

          public static int eReadNameByteArray(int handle,
                                               java.lang.String name,
                                               int numBytes,
                                               byte[] aBytes,
                                               com.sun.jna.ptr.IntByReference errorAddress)

    - #### eWriteAddressByteArray

          public static int eWriteAddressByteArray(int handle,
                                                   int address,
                                                   int numBytes,
                                                   byte[] aBytes,
                                                   com.sun.jna.ptr.IntByReference errorAddress)

    - #### eWriteNameByteArray

          public static int eWriteNameByteArray(int handle,
                                                java.lang.String name,
                                                int numBytes,
                                                byte[] aBytes,
                                                com.sun.jna.ptr.IntByReference errorAddress)

    - #### eAddresses

          public static int eAddresses(int handle,
                                       int numFrames,
                                       int[] aAddresses,
                                       int[] aTypes,
                                       int[] aWrites,
                                       int[] aNumValues,
                                       double[] aValues,
                                       com.sun.jna.ptr.IntByReference errorAddress)

    - #### eNames

          public static int eNames(int handle,
                                   int numFrames,
                                   java.lang.String[] aNames,
                                   int[] aWrites,
                                   int[] aNumValues,
                                   double[] aValues,
                                   com.sun.jna.ptr.IntByReference errorAddress)

    - #### eReadNameString

          public static int eReadNameString(int handle,
                                            java.lang.String name,
                                            com.sun.jna.Pointer string)

    - #### eReadAddressString

          public static int eReadAddressString(int handle,
                                               int address,
                                               com.sun.jna.Pointer string)

    - #### eWriteNameString

          public static int eWriteNameString(int handle,
                                             java.lang.String name,
                                             java.lang.String string)

    - #### eWriteAddressString

          public static int eWriteAddressString(int handle,
                                                int address,
                                                java.lang.String string)

    - #### eStreamStart

          public static int eStreamStart(int handle,
                                         int scansPerRead,
                                         int numAddresses,
                                         int[] aScanList,
                                         com.sun.jna.ptr.DoubleByReference scanRate)

    - #### eStreamRead

          public static int eStreamRead(int handle,
                                        double[] aData,
                                        com.sun.jna.ptr.IntByReference deviceScanBacklog,
                                        com.sun.jna.ptr.IntByReference ljmScanBacklog)

    - #### eStreamStop

          public static int eStreamStop(int handle)

    - #### streamBurst

          public static int streamBurst(int handle,
                                        int numAddresses,
                                        int[] aScanList,
                                        com.sun.jna.ptr.DoubleByReference scanRate,
                                        int numScans,
                                        double[] aData)

    - #### writeRaw

          public static int writeRaw(int handle,
                                     byte[] data,
                                     int numBytes)

    - #### readRaw

          public static int readRaw(int handle,
                                    byte[] data,
                                    int numBytes)

    - #### addressesToMBFB

          public static int addressesToMBFB(int maxBytesPerMBFB,
                                            int[] aAddresses,
                                            int[] aTypes,
                                            int[] aWrites,
                                            int[] aNumValues,
                                            double[] aValues,
                                            com.sun.jna.ptr.IntByReference numFrames,
                                            byte[] aMBFBCommand)

    - #### mbfbComm

          public static int mbfbComm(int handle,
                                     byte unitID,
                                     byte[] aMBFB,
                                     com.sun.jna.ptr.IntByReference errorAddress)

    - #### updateValues

          public static int updateValues(byte[] aMBFBResponse,
                                         int[] aTypes,
                                         int[] aWrites,
                                         int[] aNumValues,
                                         int numFrames,
                                         double[] aValues)

    - #### namesToAddresses

          public static int namesToAddresses(int numFrames,
                                             java.lang.String[] aNames,
                                             int[] aAddresses,
                                             int[] aTypes)

    - #### nameToAddress

          public static int nameToAddress(java.lang.String name,
                                          com.sun.jna.ptr.IntByReference address,
                                          com.sun.jna.ptr.IntByReference type)

    - #### addressesToTypes

          public static int addressesToTypes(int numAddresses,
                                             int[] aAddresses,
                                             int[] aTypes)

    - #### addressToType

          public static int addressToType(int address,
                                          com.sun.jna.ptr.IntByReference type)

    - #### lookupConstantValue

          public static int lookupConstantValue(java.lang.String scope,
                                                java.lang.String constantName,
                                                com.sun.jna.ptr.DoubleByReference constantValue)

    - #### lookupConstantName

          public static int lookupConstantName(java.lang.String scope,
                                               double constantValue,
                                               com.sun.jna.Pointer constantName)

    - #### errorToString

          public static void errorToString(int errorCode,
                                           com.sun.jna.Pointer errorString)

    - #### loadConstants

          public static void loadConstants()

    - #### loadConstantsFromFile

          public static int loadConstantsFromFile(java.lang.String fileName)

    - #### loadConstantsFromString

          public static int loadConstantsFromString(java.lang.String jsonString)

    - #### tcVoltsToTemp

          public static int tcVoltsToTemp(int tcType,
                                          double tcVolts,
                                          double cjTempK,
                                          com.sun.jna.ptr.DoubleByReference pTCTempK)

    - #### float32ToByteArray

          public static void float32ToByteArray(float[] aFLOAT32,
                                                int registerOffset,
                                                int numFLOAT32,
                                                byte[] aBytes)

    - #### byteArrayToFLOAT32

          public static void byteArrayToFLOAT32(byte[] aBytes,
                                                int registerOffset,
                                                int numFLOAT32,
                                                float[] aFLOAT32)

    - #### uint16ToByteArray

          public static void uint16ToByteArray(short[] aUINT16,
                                               int registerOffset,
                                               int numUINT16,
                                               byte[] aBytes)

    - #### byteArrayToUINT16

          public static void byteArrayToUINT16(byte[] aBytes,
                                               int registerOffset,
                                               int numUINT16,
                                               short[] aUINT16)

    - #### uint32ToByteArray

          public static void uint32ToByteArray(int[] aUINT32,
                                               int registerOffset,
                                               int numUINT32,
                                               byte[] aBytes)

    - #### byteArrayToUINT32

          public static void byteArrayToUINT32(byte[] aBytes,
                                               int registerOffset,
                                               int numUINT32,
                                               int[] aUINT32)

    - #### int32ToByteArray

          public static void int32ToByteArray(int[] aINT32,
                                              int registerOffset,
                                              int numINT32,
                                              byte[] aBytes)

    - #### byteArrayToINT32

          public static void byteArrayToINT32(byte[] aBytes,
                                              int registerOffset,
                                              int numINT32,
                                              int[] aINT32)

    - #### numberToIP

          public static int numberToIP(int number,
                                       com.sun.jna.Pointer ipv4String)

    - #### ipToNumber

          public static int ipToNumber(java.lang.String ipv4String,
                                       com.sun.jna.ptr.IntByReference number)

    - #### numberToMAC

          public static int numberToMAC(long number,
                                        com.sun.jna.Pointer macString)

    - #### macToNumber

          public static int macToNumber(java.lang.String macString,
                                        com.sun.jna.ptr.LongByReference number)

    - #### writeLibraryConfigS

          public static int writeLibraryConfigS(java.lang.String parameter,
                                                double value)

    - #### writeLibraryConfigStringS

          public static int writeLibraryConfigStringS(java.lang.String parameter,
                                                      java.lang.String string)

    - #### readLibraryConfigS

          public static int readLibraryConfigS(java.lang.String parameter,
                                               com.sun.jna.ptr.DoubleByReference value)

    - #### readLibraryConfigStringS

          public static int readLibraryConfigStringS(java.lang.String parameter,
                                                     com.sun.jna.Pointer string)

    - #### loadConfigurationFile

          public static int loadConfigurationFile(java.lang.String fileName)

    - #### getSpecificIPsInfo

          public static int getSpecificIPsInfo(com.sun.jna.ptr.IntByReference infoHandle,
                                               com.sun.jna.ptr.PointerByReference info)

    - #### log

          public static int log(int level,
                                java.lang.String string)

    - #### resetLog

          public static int resetLog()