Quantex GmbH
DE RU EN

PassThruIoctl Input output control

Description

long PassThruIoctl(unsigned long ChannelID, unsigned long IoctlID, void *pInput, void *pOutput)

Options

Returned error codes

Definition Description
STATUS_NOERROR Function completed successfully
ERR_DEVICE_NOT_CONNECTED No connection to adapter. Possible reasons: The adapter is turned off, there is no network, or the IP address is not set correctly.
ERR_INVALID_CHANNEL_ID Set a non-existent channel identifier ChannelID
ERR_INVALID_IOCTL_ID Set non-existent channel identifier IoctlID
ERR_NULL_PARAMETER PMsg pointer not set
ERR_NOT_SUPPORTED The adapter does not support the requested parameters.
ERR_INVALID_MSG Incorrect message structure in pMsg pointer.
ERR_INVALID_IOCTL_VALUE The Ioctl parameter value is not set correctly.
ERR_PIN_INVALID The switch output is not set correctly.
ERR_FAILED Defined by the J2534 standard. In the adapter, it is not used for this function.

SET_CONFIG Recording Protocol Settings

The function writes a list of parameters. The input parameter is a pointer to the SCONFIG_LIST structure. In which the list is given.

Parameter Name Description
LOOPBACK Not implemented in the current adapter version.
J1962_PINS Connects the findings of the OBDII connector to the interface lines. The value is specified by the double-byte number 0xKKLL where KK is the K line, CAN-H, J1850 + and LL is the L line, CAN-L, J1850-. Values can be in the range 0x00 - 0x10 excluding 4, 5, 6, 14 and 16 pins. If 0 is specified, the line is disconnected from the connector.Shematic of Quantex J2534 interface Please note that due to physical limitations, not all combinations for the L line are possible.

Example

#include "j2534_lib.hpp"

unsigned long DeviceID;
SCONFIG Config[10];
SCONFIG_LIST ConfigList;
long Ret;
Config.Parameter = J1962_PINS; Config.Value = PP_3 | SS_11; Config.Parameter = p3min; Config.Value = 500; ConfigList.NumOfParams = 2 ConfigList.ConfigPtr = Config;
Ret = PassThruIoctl(SET_CONFIG, &ConfigList, NULL);
if (Ret != STATUS_NOERROR)
{	// Error handling
}

GET_CONFIG Reading Protocol Settings

The function returns a list of requested parameters set by default or with the SET_CONFIG command.

Example

#include "j2534_lib.hpp"

unsigned long ChannelID;
SCONFIG_LIST ConfigList;
long Ret;

Ret = PassThruIoctl(ChannelID, GET_CONFIG, &ConfigList, NULL);
if (Ret != STATUS_NOERROR)
{	// Error handling
}

READ_VBATT Reading supply voltage

The voltage is calculated by the formula Y = X / 10 V. The command does not require the channel to be opened with the PassThruConnect command, and can be executed immediately after the PassThruOpen command.

Example

#include "j2534_lib.hpp"				unsigned long DeviceID;
unsigned long Vbat;
long Ret;

Ret = PassThruIoctl(SET_CONFIG, NULL, &Vbat);
if (Ret != STATUS_NOERROR)
{	// Error handling
}

FIVE_BAUD_INIT Start 5 Baud Initialization

Starts 5 baud initialization for protocols with K line. Accepts a Keyword from a block. The operation mode depends on the parameter FIVE_BAUD_MOD which is set by the SET_CONFIG command. The command automatically determines the exchange rate and writes it to the datarate parameter.

Example

#include "j2534_lib.hpp"

unsigned long DeviceID;
SBYTE_ARRAY InputMsg;
SBYTE_ARRAY OutputMsg;
long Ret;

unsigned char InitByte[1]; // ECU initialization address
unsigned char KeyWord[2];  // Keyword
EcuAddr[0] = 0x33; // Write down the address


InputMsg.NumOfBytes = 1; // Initialization Address Length
InputMsg.BytePtr = &InitByte[0];
OutputMsg.NumOfBytes = 2; // The length of the buffer for receiving keyword. If set to 2, then an error will be returned.
OutputMsg.BytePtr = &KeyWord[0];

Ret = PassThruIoctl(FIVE_BAUD_INIT, &InputMsg, &OutputMsg);
if (Ret != STATUS_NOERROR)
{	// Error handling
}

FAST_INIT Running Fast Initialization

Starts Fast Initialization for K-Line protocols. Accepts a Keyword from a block.

When broadcasting a request, it must be taken into account that if a functional address was specified in the request, then several ECUs can respond to this request. Only the first ECU will be the answer here. The remaining answers will fall into the receiving queue.

Example

#include "j2534_lib.hpp"

unsigned long DeviceID;
PASSTHRU_MSG InputMsg;
PASSTHRU_MSG OutputMsg;
long Ret;

InputMsg.ProtocolID = ISO14230;
InputMsg.TxFlags = 0;
InputMsg.Data[0] = 0x81; InputMsg.Data[1] = 0x10; InputMsg.Data[2] = 0xF1; InputMsg.Data[3] = 0x81; InputMsg.DataSize = 4;

Ret = PassThruIoctl(ChannelID, FAST_INIT, &InputMsg, &OutputMsg);
if (Ret != STATUS_NOERROR)
{	// Error handling
}

CLEAR_TX_BUFFER Clear Transmission Queue

Deletes all messages from the transmit queue

Example

#include "j2534_lib.hpp"

unsigned long DeviceID;
long Ret;

Ret = PassThruIoctl(CLEAR_TX_BUFFER, NULL, NULL);
if (Ret != STATUS_NOERROR)
{	// Error handling
}

CLEAR_RX_BUFFER Reception Queue Cleaning

Deletes all messages from the receive queue

Example

#include "j2534_lib.hpp"

unsigned long DeviceID;
long Ret;

Ret = PassThruIoctl(CLEAR_RX_BUFFER, NULL, NULL);
if (Ret != STATUS_NOERROR)
{	// Error handling
}

CLEAR_PERIODIC_MSGS Purge Periodic Messages

Deletes all previously set periodic messages.

Example

#include "j2534_lib.hpp"

unsigned long DeviceID;
long Ret;

Ret = PassThruIoctl(CLEAR_PERIODIC_MSGS, NULL, NULL);
if (Ret != STATUS_NOERROR)
{	// Error handling
}

CLEAR_MSG_FILTERS Filter cleaning

Removes all previously installed filters.

Example

#include "j2534_lib.hpp"

unsigned long DeviceID;
long Ret;

Ret = PassThruIoctl(CLEAR_MSG_FILTERS, NULL, NULL);
if (Ret != STATUS_NOERROR)
{	// Error handling
}