Quantex GmbH
Your region: Europe

PassThruReadVersion v4.04 v5.0

Reading DLL and adapter information

Last updated:

Description

The function returns information about the DLL library version, the adapter firmware version, and the supported version of the J2534 API standard. This data is useful for compatibility diagnostics and debugging.

long PassThruReadVersion(unsigned long DeviceID, char* pFirmwareVersion, char* pDllVersion, char* pApiVersion)

Parameters

Return error codes

Code Description Possible causes and solutions
STATUS_NOERROR Function completed successfully
ERR_DEVICE_NOT_CONNECTED No connection to the adapter
  • The adapter is powered off or the connection has been lost
  • Solution: Check the adapter power and the network/BLE connection
  • The IP address or device name is specified incorrectly
  • Solution: Check the connection parameters in PassThruOpen
ERR_INVALID_DEVICE_ID A non-existent adapter identifier DeviceID was specified
  • DeviceID was not obtained from PassThruOpen
  • Solution: Make sure you use the DeviceID returned by the PassThruOpen function
  • The device has already been closed via PassThruClose
  • Solution: Call PassThruOpen to reconnect
ERR_NULL_PARAMETER One of the pointers is NULL
  • NULL was passed instead of a pointer to a buffer
  • Solution: Make sure all three pointers (pFirmwareVersion, pDllVersion, pApiVersion) point to allocated buffers of at least 80 bytes

Examples

C/C++ example

#include "j2534_dll.hpp"

// DeviceID obtained earlier from PassThruOpen
unsigned long DeviceID;
char pFirmwareVersion[80];
char pDllVersion[80];
char pApiVersion[80];

long ret = PassThruReadVersion(DeviceID, pFirmwareVersion, pDllVersion, pApiVersion);
if (ret != STATUS_NOERROR) {
    char error[256];
    PassThruGetLastError(error);
    // Error handling
} else {
    printf("Firmware version: %s\n", pFirmwareVersion);
    printf("DLL version: %s\n", pDllVersion);
    printf("API version: %s\n", pApiVersion);
}

Kotlin example (Android)

// deviceID obtained earlier from ptOpen
val result = j2534.ptReadVersion(deviceID)
if (result.status == STATUS_NOERROR) {
    Log.i("J2534", "Firmware version: ${result.firmwareVersion}")
    Log.i("J2534", "DLL version: ${result.dllVersion}")
    Log.i("J2534", "API version: ${result.apiVersion}")
} else {
    Log.e("J2534", "Error reading versions: ${result.status}")
}

Python example

# device_id obtained earlier from PassThruOpen
firmware_ver = ctypes.create_string_buffer(80)
dll_ver = ctypes.create_string_buffer(80)
api_ver = ctypes.create_string_buffer(80)

ret = j2534.PassThruReadVersion(device_id, firmware_ver, dll_ver, api_ver)
if ret == 0:  # STATUS_NOERROR
    print(f"Firmware version: {firmware_ver.value.decode()}")
    print(f"DLL version: {dll_ver.value.decode()}")
    print(f"API version: {api_ver.value.decode()}")
else:
    print(f"Error reading versions: {ret}")

C# example

// deviceId obtained earlier from PassThruOpen
StringBuilder firmwareVersion = new StringBuilder(80);
StringBuilder dllVersion = new StringBuilder(80);
StringBuilder apiVersion = new StringBuilder(80);

int ret = J2534.PassThruReadVersion(deviceId, firmwareVersion, dllVersion, apiVersion);
if (ret == 0) {
    Console.WriteLine($"Firmware version: {firmwareVersion}");
    Console.WriteLine($"DLL version: {dllVersion}");
    Console.WriteLine($"API version: {apiVersion}");
} else {
    Console.WriteLine($"Error reading versions: {ret}");
}