Quantex GmbH
DE RU EN

PassThruConnect Creating a protocol connection

Description

The function establishes communication according to the specified protocol. To protect your program and also to share access to the program functionality, the PassThruSecurityConnect command.

long PassThruConnect (unsigned long DeviceID, unsigned long ProtocolID, unsigned long Flags, unsigned long BaudRate, unsigned long *pChannelID)

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_DEVICE_ID Set a non-existent adapter ID DeviceID
ERR_NOT_SUPPORTED SCI protocols on 04/04/16 are not yet supported by the adapter. This error also occurs if incompatible protocols are specified. For example, VPW and PWM are set simultaneously.
ERR_INVALID_PROTOCOL_ID A non-existent ProtocolID is specified.
ERR_NULL_PARAMETER The pDeviceID pointer is not specified.
ERR_INVALID_FLAGS A flag does not exist
ERR_INVALID_BAUDRATE Wrong exchange rate set
ERR_CHANNEL_IN_USE The channel is already in use. Defined by the J2534 standard.
In reality, this error code will never appear. When the PassThruConnect command is called again, the PassThruDisconnect command is automatically called and the channel is reopened.
ERR_FAILED Defined by the J2534 standard. In the adapter, it is not used for this function.

Example

#include "j2534_lib.hpp"

unsigned long DeviceID;
long Ret;
unsigned long ChannelID;
unsigned long Flags = ISO9141_K_LINE_ONLY;

Ret = PassThruConnect(DeviceID, ISO14230, Flags, 10400, &ChannelID);
if (Ret != STATUS_NOERROR)
{	// Error handling
}