Class KK_Library
public final class KK_Library
extends java.lang.Object
- Author:
- Loryn
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KK_Library.DebugLogType
Defines debug log types for methodsetDebugLogLimit(int, DebugLogType, int)
Specifies file management of debug output files.static class
KK_Library.ErrorCode
Defines result code values for classKK_Library.KK_Result
class
KK_Library.FHR_Data
Defines FHR setting for one channelclass
KK_Library.FHR_Settings
Defines FHR settings for 24 channelsclass
KK_Library.KK_Result
Return type of most KK_Library methodsstatic class
KK_Library.TcpLogType
Defines log entry type values for methodtcpReportLog(int, String, TcpLogType)
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
dllDate
java.lang.String
dllVersion
static byte
ENUM_FLAG_LOCAL_DEVICES
Flag forenumerateDevices(byte)
: enumerate serial ports and K+K devices on USBstatic byte
ENUM_FLAG_PCAN
Flag forenumerateDevices(byte)
: enumerate CAN devices via PCAN-USB-Adapterstatic byte
ENUM_FLAG_SERIAL_PORTS
Flag forenumerateDevices(byte)
: enumerate serial ports onlystatic byte
ENUM_FLAG_USB
Flag forenumerateDevices(byte)
: enumerate K+K devices found on USBKK_Library.FHR_Settings
fhrData
static java.lang.String
LIB_NAME
static java.lang.String
LOG_MODE_FREQ
Report mode frequency log data (log entries given to TCP server withKK_Library.TcpLogType.FreqData
)static java.lang.String
LOG_MODE_NSZ
Report mode NSZ log data (log entries given to TCP server withKK_Library.TcpLogType.NSZData
)static java.lang.String
LOG_MODE_NSZDIFF
Report mode NSZ difference log data (log entries given to TCP server withKK_Library.TcpLogType.NSZDiffData
)static java.lang.String
LOG_MODE_PHASE
Report mode phase log data (log entries given to TCP server withKK_Library.TcpLogType.PhaseData
)static java.lang.String
LOG_MODE_PHASEDIFF
Report mode phase difference log data (log entries given to TCP server withKK_Library.TcpLogType.PhaseDiffData
)static java.lang.String
LOG_MODE_PHASEPREDECESSOR
Report mode phase difference to predecessor log data (log entries given to TCP server withKK_Library.TcpLogType.PhasePredecessorData
)static java.lang.String
LOG_MODE_USER1
Report mode user defined log data 1 (log entries given to TCP server withKK_Library.TcpLogType.UserData1
)static java.lang.String
LOG_MODE_USER2
Report mode user defined log data 2 (log entries given to TCP server withKK_Library.TcpLogType.UserData2
)static java.lang.String
VERSION
Version number and date of class KK_Library -
Constructor Summary
Constructors Constructor Description KK_Library()
Creates instance of class KK_Library. -
Method Summary
Modifier and Type Method Description void
closeConnection(int id)
Closes a previously opened connection (openConnection(int, String, boolean, boolean)
) for sourceid
.void
closeTcpLog(int id)
Closes previously opened connection (openTcpLog(int, String, String)
) for sourceid
to LOG level K+K TCP server.int
createMultiSource()
Creates new multi source management object (source) and returns identifier of this object.KK_Library.KK_Result
enumerateDevices(byte enumFlags)
Enumerates K+K devices that are locally connected to the PC (serial, USB, PCAN-USB), depending onenumFlags
.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).KK_Library.KK_Result
enumerateLocalIPs(byte[] hostName, byte[] ipAddr)
Enumerates local IPv4 addresses and host name of local computer and delivers them inhostName
andipAddr
.int
getBufferAmount(int id)
Gets receive buffer fill level for sourceid
in count of bytes.KK_Library.KK_Result
getDebugFilename(int id)
Gets filename of debug log file for sourceid
.int
getDeviceStartState(int id)
Delivers the state of the K+K device at application start.java.lang.String
getDLLVersion()
Returns string with native K+K libraries version and date.KK_Library.KK_Result
getFHRSettings(int id)
Requests FHR settings from K+K device connected to sourceid
.int
getFirmwareVersion(int id)
Returns firmware version number of last version report received from K+K device connected to sourceid
.static java.lang.String
getLibName()
KK_Library.KK_Result
getOutputPath(int id)
Get current output path for files generated by K+K library (test data, debug log) for sourceid
.int
getPendingCmdsCount(int id)
Gets count of buffered (not yet send) commands for sourceid
.KK_Library.KK_Result
getReport(int id)
Gets next report for sourceid
received via current connection from K+K device or K+K server and write it to KK_Result.data.KK_Library.KK_Result
getTcpLog(int id)
Get next log level entry for sourceid
received from K+K TCP server and write it to KK_Result.data.KK_Library.KK_Result
getToolsData(int id)
Get response to previous READ command (85 40) for sourceid
via current connection from K+K device and write it to KK_Result.data.int
getTransmitBufferAmount(int id)
Gets transmit buffer fill level of K+K device connected to sourceid
.byte
getUserID(int id)
Returns user id assigned by K+K device of current connection for sourceid
.java.lang.Boolean
hasFRAM(int id)
Returns K+K device connected to sourceid
is equipped with F-RAM.java.lang.Boolean
isFileDevice(int id)
If data is read from file for sourceid
, this function returns true.java.lang.Boolean
isSerialDevice(int id)
If data is read from serial connection for sourceid
, this function returns true.KK_Library.KK_Result
openConnection(int id, java.lang.String connectionString)
Convenience method, same asopenConnection(int, String, boolean, boolean)
with blockingIO and contextMode = falseKK_Library.KK_Result
openConnection(int id, java.lang.String connectionString, boolean blockingIO, boolean contextMode)
Opens connection for sourceid
to K+K device or K+K server or read data from file according toconnectionString
.KK_Library.KK_Result
openTcpLog(int id, java.lang.String ipPort, java.lang.String mode)
Opens connection for sourceid
to K+K TCP server on addressipPort
for log level entries.KK_Library.KK_Result
openTcpLogTime(int id, java.lang.String ipPort, java.lang.String mode, java.lang.String formatTime)
Opens connection for sourceid
to K+K TCP server on addressipPort
for log level entries with prepended UTC timestamp.KK_Library.KK_Result
openTcpLogType(int id, java.lang.String ipPort, int logType, java.lang.String formatTime)
Opens connection for sourceid
to K+K TCP server on addressipPort
for log level entries with or without prepended UTC timestamp, depending onformat
.KK_Library.KK_Result
remoteLogin(int id, int password)
Remote login procedure on K+K device connected to sourceid
.KK_Library.KK_Result
sendCommand(int id, byte[] command)
Addscommand
to waiting queue of sourceid
.KK_Library.KK_Result
setCommandLimit(int id, int limit)
Sets limit of command waiting queue for sourceid
tolimit
.KK_Library.KK_Result
setDebug(int id, boolean dbgOn, java.lang.String dbgID)
Switches on/off debug log outputs of K+K library for sourceid
.KK_Library.KK_Result
setDebugFlags(int id, boolean reportLog, boolean lowLevelLog)
Sets amount of data which is logged for sourceid
.KK_Library.KK_Result
setDebugLogLimit(int id, KK_Library.DebugLogType logType, int aSize)
Sets limits of debug log file for sourceid
.KK_Library.KK_Result
setDecimalSeparator(int id, java.lang.String decimalSeparator)
Library K+K library reports received measurement data (floating point values) as string.KK_Library.KK_Result
setFHRSettings(int id, KK_Library.FHR_Settings fhrSettings)
Sets FHR settingsfhrSettings
in K+K device connected to sourceid
.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.KK_Library.KK_Result
setNSZCalibrationData(int id, double[] calibrationValues)
Sets NSZ calibration valuescalibrationValues
in K+K device connected to sourceid
.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 sourceid
.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.KK_Library.KK_Result
startSaveBinaryData(int id, java.lang.String dbgID)
Start generating test data for sourceid
in binary file.KK_Library.KK_Result
startSaveReportData(int id, java.lang.String dbgID)
Start generating test data for sourceid
in text file.KK_Library.KK_Result
startTcpServer(int id, short aPort)
Starts local TCP server for sourceid
on portaPort
.KK_Library.KK_Result
stopSaveBinaryData(int id)
Stops generating binary test data for sourceid
, closes binary file.KK_Library.KK_Result
stopSaveReportData(int id)
Stops generating report test data for sourceid
.KK_Library.KK_Result
stopTcpServer(int id)
Stops local TCP server for sourceid
.KK_Library.KK_Result
tcpAppData(int id, java.lang.String data)
void
tcpReportLog(int id, java.lang.String data, KK_Library.TcpLogType logType)
Transmits log entrydata
for LOG level typelogType
to TCP server on sourceid
.
-
Field Details
-
dllVersion
public java.lang.String dllVersion -
dllDate
public java.lang.String dllDate -
VERSION
public static final java.lang.String VERSIONVersion number and date of class KK_Library- See Also:
- Constant Field Values
-
LIB_NAME
public static java.lang.String LIB_NAME -
ENUM_FLAG_SERIAL_PORTS
public static final byte ENUM_FLAG_SERIAL_PORTSFlag forenumerateDevices(byte)
: enumerate serial ports only- See Also:
- Constant Field Values
-
ENUM_FLAG_USB
public static final byte ENUM_FLAG_USBFlag forenumerateDevices(byte)
: enumerate K+K devices found on USB- See Also:
- Constant Field Values
-
ENUM_FLAG_LOCAL_DEVICES
public static final byte ENUM_FLAG_LOCAL_DEVICESFlag forenumerateDevices(byte)
: enumerate serial ports and K+K devices on USB- See Also:
- Constant Field Values
-
ENUM_FLAG_PCAN
public static final byte ENUM_FLAG_PCANFlag forenumerateDevices(byte)
: enumerate CAN devices via PCAN-USB-Adapter- Since:
- 18.01.03
- See Also:
- Constant Field Values
-
fhrData
-
LOG_MODE_PHASE
public static final java.lang.String LOG_MODE_PHASEReport mode phase log data (log entries given to TCP server withKK_Library.TcpLogType.PhaseData
)- See Also:
- Constant Field Values
-
LOG_MODE_FREQ
public static final java.lang.String LOG_MODE_FREQReport mode frequency log data (log entries given to TCP server withKK_Library.TcpLogType.FreqData
)- See Also:
- Constant Field Values
-
LOG_MODE_PHASEDIFF
public static final java.lang.String LOG_MODE_PHASEDIFFReport mode phase difference log data (log entries given to TCP server withKK_Library.TcpLogType.PhaseDiffData
)- See Also:
- Constant Field Values
-
LOG_MODE_NSZ
public static final java.lang.String LOG_MODE_NSZReport mode NSZ log data (log entries given to TCP server withKK_Library.TcpLogType.NSZData
)- Since:
- 18.01.10
- See Also:
- Constant Field Values
-
LOG_MODE_NSZDIFF
public static final java.lang.String LOG_MODE_NSZDIFFReport mode NSZ difference log data (log entries given to TCP server withKK_Library.TcpLogType.NSZDiffData
)- Since:
- 18.01.10
- See Also:
- Constant Field Values
-
LOG_MODE_PHASEPREDECESSOR
public static final java.lang.String LOG_MODE_PHASEPREDECESSORReport mode phase difference to predecessor log data (log entries given to TCP server withKK_Library.TcpLogType.PhasePredecessorData
)- Since:
- 18.02.04
- See Also:
- Constant Field Values
-
LOG_MODE_USER1
public static final java.lang.String LOG_MODE_USER1Report mode user defined log data 1 (log entries given to TCP server withKK_Library.TcpLogType.UserData1
)- Since:
- 18.02.04
- See Also:
- Constant Field Values
-
LOG_MODE_USER2
public static final java.lang.String LOG_MODE_USER2Report mode user defined log data 2 (log entries given to TCP server withKK_Library.TcpLogType.UserData2
)- Since:
- 18.02.04
- See Also:
- Constant Field Values
-
-
Constructor Details
-
KK_Library
public KK_Library() throws java.lang.IllegalAccessExceptionCreates 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
Enumerates K+K devices that are locally connected to the PC (serial, USB, PCAN-USB), depending onenumFlags
. 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 arenull
. 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 (,) ornull
, 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 isnull
.
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
Enumerates local IPv4 addresses and host name of local computer and delivers them inhostName
andipAddr
. If an error occurs KK_Result.data contains error message andhostName[0]
and/oripAddr[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 callipAddr
- 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 inhostName
and/oripAddr
is truncated to 80 character
KK_Err enumeration failed, KK_Result.data contains error message - Since:
- K+K library version 18.0
-
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
Get current output path for files generated by K+K library (test data, debug log) for sourceid
.
For details see Multi_GetOutputPath in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- 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
Set output path for files generated by K+K library (test data, debug log) for sourceid
. 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 bycreateMultiSource()
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
Switches on/off debug log outputs of K+K library for sourceid
. IfdbgOn
is true K+K library generates a debug log in file KK_DLL_LOG_DbgID
.txt. The file is located in path set bysetOutputPath(int, String)
or in application path. A still existing file will be overwritten. Please seesetDebugLogLimit(int, DebugLogType, int)
for additional debug settings. Every call to a library function generates log outputs to the debug file. IfdbgOn
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 bycreateMultiSource()
dbgOn
-true
opens log file,false
close log filedbgID
- 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
Sets amount of data which is logged for sourceid
. Changed values take effect immediately.
For details see Multi_DebugFlags in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
reportLog
- generate log output about received reportslowLevelLog
- 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
Sets limits of debug log file for sourceid
. 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 bycreateMultiSource()
logType
- specifies debug file management, a value ofKK_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
Gets filename of debug log file for sourceid
.
For details see Multi_DebugGetFilename in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- 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 sourceid
in count of bytes.
For details see Multi_GetBufferAmount in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- Returns:
- 0: receive buffer is empty or error (invalid id, no current connection)
0: count of bytes in receive buffer for sourceid
- Since:
- K+K library version 18.0
-
getTransmitBufferAmount
public int getTransmitBufferAmount(int id)Gets transmit buffer fill level of K+K device connected to sourceid
. 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 bycreateMultiSource()
- 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 sourceid
- 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 sourceid
. 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 bycreateMultiSource()
- 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 sourceid
, this function returns true.
For details see Multi_IsFileDevice in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- 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 sourceid
, this function returns true.
For details see Multi_IsSerialDevice in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- 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 sourceid
. 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 bycreateMultiSource()
- 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 sourceid
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 bycreateMultiSource()
- 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 bycreateMultiSource()
- 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
Sets NSZ calibration valuescalibrationValues
in K+K device connected to sourceid
. 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 bycreateMultiSource()
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
Requests FHR settings from K+K device connected to sourceid
. 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 bycreateMultiSource()
- 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
Sets FHR settingsfhrSettings
in K+K device connected to sourceid
. 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 bycreateMultiSource()
fhrSettings
- described in helper classKK_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 sourceid
to K+K device or K+K server or read data from file according toconnectionString
. A previous opened connection for sourceid
will be closed.
For details see Multi_OpenConnection in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
connectionString
- String describes connection to open:A) Local device:
A.1 serial port
serialPort with
serialPort: serial port name delivered byenumerateDevices(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 byenumerateDevices(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 adaptorB) 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 numberC) 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 levelD) 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 operationscontextMode
- 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
Convenience method, same asopenConnection(int, String, boolean, boolean)
with blockingIO and contextMode = false- Parameters:
id
- source identifier returned bycreateMultiSource()
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 sourceid
.
For details see Multi_CloseConnection in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- Since:
- K+K library version 18.0
-
setDecimalSeparator
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 sourceid
.
For details see Multi_SetDecimalSeparator in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
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
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 sourceid
.
For details see Multi_SetNSZ in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
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
Gets next report for sourceid
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 bycreateMultiSource()
- 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
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 bycreateMultiSource()
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
Get response to previous READ command (85 40) for sourceid
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 bycreateMultiSource()
- 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 sourceid
.
For details see Multi_GetPendingCmdsCount in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- Returns:
- 0: no waiting commands or error (invalid id, no current connection)
0: count of waiting commands for sourceid
- Since:
- K+K library version 18.0
-
setCommandLimit
Sets limit of command waiting queue for sourceid
tolimit
. 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 bycreateMultiSource()
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
Addscommand
to waiting queue of sourceid
. If there is no current connection or waiting queue is full, command is rejected (KK_CmdIgnored).
Usually command is send with nextgetReport(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 bycreateMultiSource()
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
Remote login procedure on K+K device connected to sourceid
. 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 bycreateMultiSource()
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
Starts local TCP server for sourceid
on portaPort
. 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 bycreateMultiSource()
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
Stops local TCP server for sourceid
. All client connections are disconnected.
For details see Multi_SopTcpServer in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- 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
Transmits log entrydata
for LOG level typelogType
to TCP server on sourceid
. 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 bycreateMultiSource()
data
- Log entry to transmit to connected clientslogType
- specifies log entry type seeKK_Library.TcpLogType
- Since:
- K+K library version 18.0
-
openTcpLog
Opens connection for sourceid
to K+K TCP server on addressipPort
for log level entries.
For details see Multi_OpenTcpLog in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
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 sourceid
to K+K TCP server on addressipPort
for log level entries with prepended UTC timestamp.
For details see Multi_OpenTcpLogTime in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
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 sourceid
to K+K TCP server on addressipPort
for log level entries with or without prepended UTC timestamp, depending onformat
.
For details see Multi_OpenTcpLogType in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
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 notnull
- 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 sourceid
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 bycreateMultiSource()
- Since:
- K+K library version 18.0
-
getTcpLog
Get next log level entry for sourceid
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 bycreateMultiSource()
- 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
-
startSaveBinaryData
Start generating test data for sourceid
in binary file. All received reports are written to binary file Date_Time_dbgID_KK_BinaryData.bin in set output directorysetOutputPath(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 bycreateMultiSource()
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
Stops generating binary test data for sourceid
, 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 bycreateMultiSource()
- 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
Start generating test data for sourceid
in text file. All received reports are written to text file Date_Time_dbgID_KK_ReportData.txt in set output directorysetOutputPath(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 bycreateMultiSource()
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
Stops generating report test data for sourceid
.
For details see Multi_StopSaveReportData in K+K library manual.- Parameters:
id
- source identifier returned bycreateMultiSource()
- Returns:
- see KK_Result.resultCode
KK_No_Err: operation successful
KK_ParamError: invalid id - Since:
- K+K library version 18.0
-