Reading DLL and adapter information
Last updated:
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)
PassThruOpen command.| Code | Description | Possible causes and solutions |
|---|---|---|
| STATUS_NOERROR | Function completed successfully | — |
| ERR_DEVICE_NOT_CONNECTED | No connection to the adapter |
|
| ERR_INVALID_DEVICE_ID | A non-existent adapter identifier DeviceID was specified |
|
| ERR_NULL_PARAMETER | One of the pointers is NULL |
|
#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);
}
// 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}")
}
# 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}")
// 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}");
}