Package brendes.jna

Class KK_Library

java.lang.Object
brendes.jna.KK_Library

public final class KK_Library
extends java.lang.Object
KK_Library class gives native access to K+K library (kk_fx80e for 32-bit systems, kk_library_64 for 64-bit systems) in Windows and Linux. K+K library must have version 19.3.1 or higher.
Author:
Loryn
  • Field Details

  • Constructor Details

    • KK_Library

      public KK_Library() throws java.lang.IllegalAccessException
      Creates instance of class KK_Library. Checks version number of K+K library.
      Throws:
      java.lang.IllegalAccessException - if found version is less than 19.3.1
  • Method Details

    • getLibName

      public static java.lang.String getLibName()
    • enumerateDevices

      public KK_Library.KK_Result enumerateDevices​(byte enumFlags)
      Enumerates K+K devices that are locally connected to the PC (serial, USB, PCAN-USB), depending on enumFlags. Found serial port names, USB devices names and PCAN-USB are returned in KK_Result.data separated by comma (,) and split into lines in KK_Result.lines. When no names are found KK_Result.data and KK_Result.lines are null. If an error occurs, KK_Result.resultCode is one of KK_Err_Enum_*, KK_Result.data contains error message.
      For details see Multi_EnumerateDevices in K+K library manual.
      Parameters:
      enumFlags - specifies what is to be enumerated: ENUM_FLAG_SERIAL_PORTS, ENUM_FLAG_USB, ENUM_FLAG_LOCAL_DEVICES, ENUM_FLAG_PCAN
      Returns:
      see KK_Result.resultCode
      KK_No_Err: KK_Result.data contains found names separated by comma (,) or null, if no serial ports and/or USB devices were found. KK_Result.lines contains found single names, if at least one name is found. Otherwise KK_Result.lines is null.
      KK_ParamError: Parameter enumFlags has invalid value. KK_Result.data contains error message.
      KK_Err_Enum_Serial, KK_Err_Enum_USB, KK_Err_Enum_Serial_USB, KK_Err_Enum_PCAN: enumeration failed, error occurred on enumeration of serial ports and/or USB devices. KK_Result.data contains error message.
      Since:
      K+K library version 18.0
    • enumerateLocalIPs

      public KK_Library.KK_Result enumerateLocalIPs​(byte[] hostName, byte[] ipAddr)
      Enumerates local IPv4 addresses and host name of local computer and delivers them in hostName and ipAddr. If an error occurs KK_Result.data contains error message and hostName[0] and/or ipAddr[0] contains 0.
      For details see Multi_GetHostAndIPs in K+K library manual.
      Parameters:
      hostName - buffer must have minimum 80 bytes, contains host name of local computer after call
      ipAddr - buffer must have minimum 80 bytes, contains local IPv4 addresses separated by comma after call
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_Err_BufferTooSmall: successful operation, but string in hostName and/or ipAddr is truncated to 80 character
      KK_Err enumeration failed, KK_Result.data contains error message
      Since:
      K+K library version 18.0
    • enumerateLocalIPs

      public KK_Library.KK_Result enumerateLocalIPs()
      Convenience call Enumerates local IPv4 addresses and host name of local computer and delivers them in KK_Result.data (host name) and KK_Result.lines (IPv4 addresses). If an error occurs KK_Result.data contains error message.
      For details see Multi_GetHostAndIPs in K+K library manual.
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation, KK_Result.data contains host name and KK_Result.lines contains IPv4 addresses.
      KK_Err_BufferTooSmall: successful operation, but string in KK_Result.data and/or KK_Result.lines is truncated to 80 character
      KK_Err enumeration failed, KK_Result.data contains error message
      Since:
      K+K library version 18.0
    • createMultiSource

      public int createMultiSource()
      Creates new multi source management object (source) and returns identifier of this object. This identifier must be used with subsequent library calls.
      Hint: All generated management object are released on program end.
      For details see CreateMultiSource in K+K library manual.
      Returns:
      identifier of library internal management object
      Since:
      K+K library version 18.0
    • getOutputPath

      public KK_Library.KK_Result getOutputPath​(int id)
      Get current output path for files generated by K+K library (test data, debug log) for source id.
      For details see Multi_GetOutputPath in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      see KK_Result.resultCode
      KK_No_Err: KK_Result.data contains current output path for source id
      KK_ParamError: invalid id, KK_Result.data contains error message.
      Since:
      K+K library version 18.0
    • setOutputPath

      public KK_Library.KK_Result setOutputPath​(int id, java.lang.String path)
      Set output path for files generated by K+K library (test data, debug log) for source id. New output path is only valid for files generated in future. Still generated files keep their path names.
      For details see Multi_SetOutputPath in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      path - pathname of output directory
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id, KK_Result.data contains error message
      KK_Err: call failed, KK_Result.data contains error message
      Since:
      K+K library version 18.0
    • setDebug

      public KK_Library.KK_Result setDebug​(int id, boolean dbgOn, java.lang.String dbgID)
      Switches on/off debug log outputs of K+K library for source id. If dbgOn is true K+K library generates a debug log in file KK_DLL_LOG_DbgID.txt. The file is located in path set by setOutputPath(int, String) or in application path. A still existing file will be overwritten. Please see setDebugLogLimit(int, DebugLogType, int) for additional debug settings. Every call to a library function generates log outputs to the debug file. If dbgOn is false debug log file is closed.
      Hint: DbgID is used to get unique file names for distinct sources. This is needed in particular, if common output paths are used. dbgID maybe null, if only one source is used.
      For details see Multi_Debug in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      dbgOn - true opens log file, false close log file
      dbgID - source identifier of debug log file, part of file name
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id, KK_Result.data contains error message
      KK_Err: call failed, KK_Result.data contains error message
      Since:
      K+K library version 18.0
    • setDebugFlags

      public KK_Library.KK_Result setDebugFlags​(int id, boolean reportLog, boolean lowLevelLog)
      Sets amount of data which is logged for source id. Changed values take effect immediately.
      For details see Multi_DebugFlags in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      reportLog - generate log output about received reports
      lowLevelLog - generate log output about byte stream received from/send to K+K device or K+K server.
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id
      Since:
      K+K library version 18.0
    • setDebugLogLimit

      public KK_Library.KK_Result setDebugLogLimit​(int id, KK_Library.DebugLogType logType, int aSize)
      Sets limits of debug log file for source id. If aSize = 0 default size of 20 MB is used. Default DebugLogType is logUnlimited.
      For details see Multi_DebugLogLimit in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      logType - specifies debug file management, a value of KK_Library.DebugLogType
      aSize - maximum size of debug log file, when logType != logUnlimited
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id
      Since:
      K+K library version 18.0
    • getDebugFilename

      public KK_Library.KK_Result getDebugFilename​(int id)
      Gets filename of debug log file for source id.
      For details see Multi_DebugGetFilename in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      see KK_Result.resultCode
      KK_No_Err: KK_Result.data contains filename or KK_Result.data = null in case debug log is switched off
      KK_ParamError: invalid id, KK_Result.data contains error message
      Since:
      K+K library version 18.0
    • getDLLVersion

      public java.lang.String getDLLVersion()
      Returns string with native K+K libraries version and date.
      For details see Multi_GetDLLVersion in K+K library manual.
      Returns:
      String with library version and date
      Since:
      K+K library version 18.0
    • getBufferAmount

      public int getBufferAmount​(int id)
      Gets receive buffer fill level for source id in count of bytes.
      For details see Multi_GetBufferAmount in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      0: receive buffer is empty or error (invalid id, no current connection)
      0: count of bytes in receive buffer for source id
      Since:
      K+K library version 18.0
    • getTransmitBufferAmount

      public int getTransmitBufferAmount​(int id)
      Gets transmit buffer fill level of K+K device connected to source id. K+K device can manage up to four users. Every user has its own transmit buffer. The transmit buffer fill level is transmitted by connections via USB and to remote devices.
      For details see Multi_GetTransmitBufferAmount in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:

      0: transmit buffer is empty or error (invalid id, no connection to K+K device)
      0: count of bytes in transmit buffer still not send for source id
      Since:
      K+K library version 18.0
    • getUserID

      public byte getUserID​(int id)
      Returns user id assigned by K+K device of current connection for source id. A K+K device is able to serve up to 4 users simultaneously. The users are numbered from 1 to 4. The user id is transmitted by connections via USB and via network. Newer firmware versions of K+K devices transmit user id within the version string (reaction of command 0x01 or 0x81).
      For details see Multi_GetUserID in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:

      1..4: user id assigned by K+K device
      0xFF: error (invalid id, no connection to K+K device)
      Since:
      K+K library version 18.0
    • isFileDevice

      public java.lang.Boolean isFileDevice​(int id)
      If data is read from file for source id, this function returns true.
      For details see Multi_IsFileDevice in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      data returned by getReport(int) is read from file
      Since:
      K+K library version 18.0
    • isSerialDevice

      public java.lang.Boolean isSerialDevice​(int id)
      If data is read from serial connection for source id, this function returns true.
      For details see Multi_IsSerialDevice in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      data returned by getReport(int) is read from serial connection
      Since:
      K+K library version 19.1.2
    • getFirmwareVersion

      public int getFirmwareVersion​(int id)
      Returns firmware version number of last version report received from K+K device connected to source id. To request a version report, send command 0x01 or 0x81 to K+K device.
      For details see Multi_GetFirmwareVersion in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:

      -1: error (invalid id, no version report received)
      -1: firmware version number
      Since:
      K+K library version 18.1.10
    • hasFRAM

      public java.lang.Boolean hasFRAM​(int id)
      Returns K+K device connected to source id is equipped with F-RAM. This feature is reported by flag F in version report. Therefore a version report must have been received. To request a version report, send command 0x01 or 0x81 to K+K device.
      For details see Multi_HasFRAM in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:

      false: K+K device has no F-RAM, or no version report received, or invalid id
      true: K+K device uses F-RAM to store NSZ calibration data
      Since:
      K+K library version 18.1.10
    • getDeviceStartState

      public int getDeviceStartState​(int id)
      Delivers the state of the K+K device at application start. The start state is determined from the first received timestamp.
      For details see Multi_GetDeviceStartState in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:

      0: Source-ID invalid or no time stamp received
      1: Cold start, K+K device was restarted
      2: Warm start
      Since:
      K+K library version 19.3.1
    • setNSZCalibrationData

      public KK_Library.KK_Result setNSZCalibrationData​(int id, double[] calibrationValues)
      Sets NSZ calibration values calibrationValues in K+K device connected to source id. This needs firmware version 61 or higher. Not approved for serial connections.
      For details see Multi_SetNSZCalibrationData in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      calibrationValues - calibration value per channel (max. 24) in nanoseconds
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_Err: command failed, KK_Result.data contains error message
      KK_ParamError: invalid parameter, KK_Result.data contains error message.
      KK_NotSupported: K+K device does not support this function, KK_Result.data contains error message.
      Since:
      K+K library version 18.1.10
    • getFHRSettings

      public KK_Library.KK_Result getFHRSettings​(int id)
      Requests FHR settings from K+K device connected to source id. K+K device responds with 0x7902-Report including requested data. Needs firmware version 67 or higher. For details see Multi_ReadFHRData in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_Err: command failed, KK_Result.data contains error message
      KK_ParamError: invalid parameter, KK_Result.data contains error message.
      KK_NotSupported: K+K device does not support this function, KK_Result.data contains error message.
      Since:
      K+K library version 19.1.2
    • setFHRSettings

      public KK_Library.KK_Result setFHRSettings​(int id, KK_Library.FHR_Settings fhrSettings)
      Sets FHR settings fhrSettings in K+K device connected to source id. This needs firmware version 67 or higher. Not approved for serial connections.
      For details see Multi_SetFHRnData in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      fhrSettings - described in helper class KK_Library.FHR_Settings
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_Err: command failed, KK_Result.data contains error message
      KK_ParamError: invalid parameter, KK_Result.data contains error message.
      KK_NotSupported: K+K device does not support this function, KK_Result.data contains error message.
      Since:
      K+K library version 19.1.2
    • openConnection

      public KK_Library.KK_Result openConnection​(int id, java.lang.String connectionString, boolean blockingIO, boolean contextMode)
      Opens connection for source id to K+K device or K+K server or read data from file according to connectionString. A previous opened connection for source id will be closed.
      For details see Multi_OpenConnection in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      connectionString - String describes connection to open:

      A) Local device:
      A.1 serial port
      serialPort with
      serialPort: serial port name delivered by enumerateDevices(byte)
      e.g.: (Windows) 'COM1', (Linux) '/dev/ttyS0'
      Linux: Caller must belong to group dialout
      A.2: USB
      deviceName with
      deviceName: USB device name delivered by enumerateDevices(byte)
      Linux: Caller must belong to group root
      A.3 CAN:
      CAN:MENLONode with
      Node: CAN device node number in HEX (0..F), part of CAN-ID, hard coded setting for Menlo-CAN via PCAN-Basic API
      Available only under Windows with PCAN-USB adaptor

      B) Connection to K+K device via network:
      IPaddress:port with
      IPaddress: IPv4 address of K+K device, e.g. 192.168.178.98
      port: port number (16 bit value) of own TCP server socket to receive measurement data
      :port may be missing, system assigns port number

      C) Connection to TCP server:
      TCP:IPaddress:port with
      IPaddress: IPv4 address of K+K TCP server, e.g. 192.168.178.98
      port: port number (16 bit value) of K+K TCP server
      The TCP server must have been started by another K+K application
      Connects to TCP server and receives reports on DLL level

      D) File:
      filename[ LOOP_FOR_EVER] with
      filename: filename of binary file or text file with measurement data
      [ LOOP_FOR_EVER] optional: read data from file in an endless loop, starting again from begin
      For test purposes only. Does not connect to device, but reads measurement data from file.

      User id:
      K+K devices can manage up to 4 connections simultaneously. Every connection has its own user id. This user id can be selected by adding
      USERID=nr with
      nr: specifies user id = 1..4
      USERID takes effect only by connections to K+K device, but not on serial connections.

      blockingIO - open connection with blocking read and write operations
      contextMode - open connection in tools mode: no measurement data is send
      Returns:
      see KK_Result.resultCode
      KK_No_Err: connection successful opened
      KK_ParamError: invalid id, KK_Result.data contains error message.
      KK_Err: open failed, KK_Result.data contains error message.
      Since:
      K+K library version 18.0
    • openConnection

      public KK_Library.KK_Result openConnection​(int id, java.lang.String connectionString)
      Convenience method, same as openConnection(int, String, boolean, boolean) with blockingIO and contextMode = false
      Parameters:
      id - source identifier returned by createMultiSource()
      connectionString - String describes connection to open
      Returns:
      see openConnection(int, String, boolean, boolean)
      Since:
      K+K library version 18.0
    • closeConnection

      public void closeConnection​(int id)
      Closes a previously opened connection (openConnection(int, String, boolean, boolean)) for source id.
      For details see Multi_CloseConnection in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Since:
      K+K library version 18.0
    • setDecimalSeparator

      public KK_Library.KK_Result setDecimalSeparator​(int id, java.lang.String decimalSeparator)
      Library K+K library reports received measurement data (floating point values) as string. Use this function to set decimal separator used to convert floating point numbers into string for source id.
      For details see Multi_SetDecimalSeparator in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      decimalSeparator - new value for decimal separator, must be "." or ",", other values are ignored
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id
      Since:
      K+K library version 18.0
    • setNSZ

      public KK_Library.KK_Result setNSZ​(int id, int nsz)
      Depending on used measurement card, K+K device reports NSZ measurements as single NSZ or double NSZ. Use this function call to set single or double NSZ for source id.
      For details see Multi_SetNSZ in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      nsz - 1 = single NSZ, 2 = double NSZ, other values are ignored
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id
      Since:
      K+K library version 18.0
    • getReport

      public KK_Library.KK_Result getReport​(int id)
      Gets next report for source id received via current connection from K+K device or K+K server and write it to KK_Result.data.
      For details see Multi_GetReport in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      KK_Result.data contains next report or null if no reports available or error message if KK_Result.resultCode != KK_No_Err
      Values for KK_Result.resultCode:
      KK_No_Err: Reading successful
      KK_Err_BufferTooSmall: Reading successful, but String in KK_Result.data is truncated to 1024 characters.
      KK_Err: An error occurred, see error message in KK_Result.data
      KK_Err_Write: Writing to device/server failed. Connection is closed.
      KK_Err_ServerDown: Server is not online. Connection is closed.
      KK_Err_DeviceNotConnected: No connection to K+K device (connection has not been established or usb cable is unplugged)
      KK_HardwareFault: Fault in measurement hardware. Connection to K+K device is closed.
      KK_ParamError: invalid id
      KK_Reconnected: Reconnection of an interrupted connection with data loss
      Since:
      K+K library version 18.0
    • setSend7016

      public KK_Library.KK_Result setSend7016​(int id, boolean value)
      The 100ms timestamps received from the K+K device are passed on to the application by default with Report 7000. Here it is now possible to switch to Report 7016.
      For details see Multi_SetSend7016 in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      value -
      True: send Report 7016
      False: send Report 7000 (Default)
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id
      Since:
      K+K library version 19.3.1
    • getToolsData

      public KK_Library.KK_Result getToolsData​(int id)
      Get response to previous READ command (85 40) for source id via current connection from K+K device and write it to KK_Result.data.
      For details see Multi_GetToolsData in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      KK_Result.data contains read response or null if no response available or error message if KK_Result.resultCode != KK_No_Err
      Values for KK_Result.resultCode:
      KK_No_Err: Reading successful
      KK_Err_BufferTooSmall: Reading successful, but String in KK_Result.data is truncated to 1024 characters.
      KK_Err: An error occurred, see error message in KK_Result.data
      KK_Err_DeviceNotConnected: No connection to K+K device (connection has not been established or usb cable is unplugged)
      KK_ParamError: invalid id
      Since:
      K+K library version 18.0
    • getPendingCmdsCount

      public int getPendingCmdsCount​(int id)
      Gets count of buffered (not yet send) commands for source id.
      For details see Multi_GetPendingCmdsCount in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      0: no waiting commands or error (invalid id, no current connection)
      0: count of waiting commands for source id
      Since:
      K+K library version 18.0
    • setCommandLimit

      public KK_Library.KK_Result setCommandLimit​(int id, int limit)
      Sets limit of command waiting queue for source id to limit. For an unlimited waiting queue set limit to 0. Default = unlimited.
      For details see Multi_SetCommandLimit in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      limit - length of waiting queue, 0=unlimited, default=unlimited
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id
      Since:
      K+K library version 18.0
    • sendCommand

      public KK_Library.KK_Result sendCommand​(int id, byte[] command)
      Adds command to waiting queue of source id. If there is no current connection or waiting queue is full, command is rejected (KK_CmdIgnored).
      Usually command is send with next getReport(int) call and in case of an error an error message (KK_Err_Write) is replied there.
      With network connection, command is send immediately (no waiting queue), in case of an error an error message is returned here.
      Hint: Command is not send if connection is file or connection to TCP server.
      For details see Multi_SendCommand in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      command - command bytes to send
      Returns:
      see KK_Result.resultCode
      KK_No_Err: operation successful
      all other codes are error numbers and KK_Result.data contains error message:
      KK_ParamError: invalid parameter value
      KK_CmdIgnored: command rejected
      KK_Err: an error occurred
      Since:
      K+K library version 18.0
    • remoteLogin

      public KK_Library.KK_Result remoteLogin​(int id, int password)
      Remote login procedure on K+K device connected to source id. Remote login is needed to change flash memory of K+K device with network connections. If source connection is not via network, remote login is ignored without error.
      For details see Multi_RemoteLogin in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      password - remote password
      Returns:
      see KK_Result.resultCode
      KK_No_Err: operation successful
      all other codes are error numbers and KK_Result.data contains error message:
      KK_ParamError: invalid parameter value
      KK_CmdIgnored: command rejected
      KK_Err: invalid password
      Since:
      K+K library version 18.1.10
    • startTcpServer

      public KK_Library.KK_Result startTcpServer​(int id, short aPort)
      Starts local TCP server for source id on port aPort. If aPort = 0, port number is assigned by system and returned in KK_Result.intValue
      For details see Multi_StartTcpServer in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      aPort - port number for TCP server
      Returns:
      see KK_Result.resultCode
      KK_No_Err: TCP server is running
      KK_ParamError: invalid id, KK_Result.data contains error message.
      KK_Err: an error occurred, KK_Result.data contains error message.
      Since:
      K+K library version 18.0
    • stopTcpServer

      public KK_Library.KK_Result stopTcpServer​(int id)
      Stops local TCP server for source id. All client connections are disconnected.
      For details see Multi_SopTcpServer in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      see KK_Result.resultCode
      KK_No_Err: successful operation
      KK_ParamError: invalid id, KK_Result.data contains error message.
      KK_Err: an error occurred, KK_Result.data contains error message.
      Since:
      K+K library version 18.0
    • tcpReportLog

      public void tcpReportLog​(int id, java.lang.String data, KK_Library.TcpLogType logType)
      Transmits log entry data for LOG level type logType to TCP server on source id. TCP server proceeds data to connected TCP receiver clients.
      If an error occurs (id invalid, source without tcp server, data=null), call is ignored.
      For details see Multi_TcpReportLog in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      data - Log entry to transmit to connected clients
      logType - specifies log entry type see KK_Library.TcpLogType
      Since:
      K+K library version 18.0
    • openTcpLog

      public KK_Library.KK_Result openTcpLog​(int id, java.lang.String ipPort, java.lang.String mode)
      Opens connection for source id to K+K TCP server on address ipPort for log level entries.
      For details see Multi_OpenTcpLog in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      ipPort - IPaddress:port with
      IPaddress: IPv4 address of K+K TCP server, e.g. 192.168.178.98 or 127.0.0.1 for local host
      port: port number (16 bit value) of TCP server.
      mode - report mode to receive: LOG_MODE_PHASE, LOG_MODE_FREQ, LOG_MODE_PHASEDIFF, LOG_MODE_NSZ, LOG_MODE_NSZDIFF, LOG_MODE_PHASEPREDECESSOR, LOG_MODE_USER1, LOG_MODE_USER2
      Returns:
      see KK_Result.resultCode
      KK_No_Err: connection successful opened
      KK_ParamError: invalid id, KK_Result.data contains error message.
      KK_Err: open failed, KK_Result.data contains error message.
      Since:
      K+K library version 18.0
    • openTcpLogTime

      public KK_Library.KK_Result openTcpLogTime​(int id, java.lang.String ipPort, java.lang.String mode, java.lang.String formatTime)
      Opens connection for source id to K+K TCP server on address ipPort for log level entries with prepended UTC timestamp.
      For details see Multi_OpenTcpLogTime in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      ipPort - IPaddress:port with
      IPaddress: IPv4 address of K+K TCP server, e.g. 192.168.178.98 or 127.0.0.1 for local host
      port: port number (16 bit value) of TCP server.
      mode - report mode to receive: LOG_MODE_PHASE, LOG_MODE_FREQ, LOG_MODE_PHASEDIFF, LOG_MODE_NSZ, LOG_MODE_NSZDIFF, LOG_MODE_PHASEPREDECESSOR, LOG_MODE_USER1, LOG_MODE_USER2
      formatTime - specifies format of UTC timestamp
      Returns:
      see KK_Result.resultCode
      KK_No_Err: connection successful opened
      KK_ParamError: invalid id, KK_Result.data contains error message.
      KK_Err: open failed, KK_Result.data contains error message.
      Since:
      K+K library version 19.0.2
    • openTcpLogType

      public KK_Library.KK_Result openTcpLogType​(int id, java.lang.String ipPort, int logType, java.lang.String formatTime)
      Opens connection for source id to K+K TCP server on address ipPort for log level entries with or without prepended UTC timestamp, depending on format.
      For details see Multi_OpenTcpLogType in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      ipPort - IPaddress:port with
      IPaddress: IPv4 address of K+K TCP server, e.g. 192.168.178.98 or 127.0.0.1 for local host
      port: port number (16 bit value) of TCP server.
      logType - report mode to receive (0..7)
      formatTime - specifies format of UTC timestamp, if not null
      Returns:
      see KK_Result.resultCode
      KK_No_Err: connection successful opened
      KK_ParamError: invalid id, KK_Result.data contains error message.
      KK_Err: open failed, KK_Result.data contains error message.
      Since:
      K+K library version 19.2.0
    • closeTcpLog

      public void closeTcpLog​(int id)
      Closes previously opened connection (openTcpLog(int, String, String)) for source id to LOG level K+K TCP server.
      If an error occurs (id invalid, no connection), call is ignored.
      For details see Multi_CloseTcpLog in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Since:
      K+K library version 18.0
    • getTcpLog

      public KK_Library.KK_Result getTcpLog​(int id)
      Get next log level entry for source id received from K+K TCP server and write it to KK_Result.data. KK_Result.data = null, if no reports available.
      For details see Multi_GetTcpLog in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      see KK_Result.resultCode
      KK_No_Err: operation successful
      KK_Err_BufferTooSmall: operation successful, but string in KK_Result.data is truncated to 1024 characters.
      all other codes are error numbers and KK_Result.data contains error message:
      KK_ParamError: invalid id
      KK_Err_ServerDown: Server is not online. Connection is closed
      KK_Err_BufferOverflow: Data was lost. App does not read fast enough.
      Since:
      K+K library version 18.0
    • tcpAppData

      public KK_Library.KK_Result tcpAppData​(int id, java.lang.String data)
    • startSaveBinaryData

      public KK_Library.KK_Result startSaveBinaryData​(int id, java.lang.String dbgID)
      Start generating test data for source id in binary file. All received reports are written to binary file Date_Time_dbgID_KK_BinaryData.bin in set output directory setOutputPath(int, String).
      Hint: DbgID is used to get unique file names for distinct sources. This is needed in particular, if common output paths are used. dbgOn maybe null, if only one source is used.
      For details see Multi_StartSaveBinaryData in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      dbgID - source identifier of binary file, part of file name
      Returns:
      see KK_Result.resultCode
      KK_No_Err: operation successful
      KK_ParamError: invalid id
      KK_Err_DeviceNotConnected: no connection
      Since:
      K+K library version 18.0
    • stopSaveBinaryData

      public KK_Library.KK_Result stopSaveBinaryData​(int id)
      Stops generating binary test data for source id, closes binary file. Binary file is closed too, when current connection is closed.
      For details see Multi_StopSaveBinaryData in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      see KK_Result.resultCode
      KK_No_Err: operation successful
      KK_ParamError: invalid id
      KK_Err_DeviceNotConnected: no connection
      Since:
      K+K library version 18.0
    • startSaveReportData

      public KK_Library.KK_Result startSaveReportData​(int id, java.lang.String dbgID)
      Start generating test data for source id in text file. All received reports are written to text file Date_Time_dbgID_KK_ReportData.txt in set output directory setOutputPath(int, String).
      Hint: DbgID is used to get unique file names for distinct sources. This is needed in particular, if common output paths are used. dbgOn maybe null, if only one source is used.
      For details see Multi_StartSaveReportData in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      dbgID - source identifier of text file, part of file name
      Returns:
      see KK_Result.resultCode
      KK_No_Err: operation successful
      KK_ParamError: invalid id
      Since:
      K+K library version 18.0
    • stopSaveReportData

      public KK_Library.KK_Result stopSaveReportData​(int id)
      Stops generating report test data for source id.
      For details see Multi_StopSaveReportData in K+K library manual.
      Parameters:
      id - source identifier returned by createMultiSource()
      Returns:
      see KK_Result.resultCode
      KK_No_Err: operation successful
      KK_ParamError: invalid id
      Since:
      K+K library version 18.0