Quantex GmbH
DE RU EN

PassThruReadMsg Read accepted packet

Description

The function subtracts received messages from the channel queue. The adapter can accept a maximum of 100 messages per queue for one channel and has 64 KB of free memory for all queues. When the queue or all free memory is full, message reception is suspended. Reception of messages by protocols is independent of transmission.
For protocols ISO 9141, ISO 14230, ISO 15765, a message indicating the start of reception of a packet is generated for each received packet. It consists only of the header of the receiving flag START_OF_MESSAGE and the timestamp of the start of receiving the message. This message is followed by a normal message with a timestamp of the end of reception of the last bit of the message. This uneconomical technique is designed to determine the start and end times of a packet arrival.

long PassThruReadMsgs(unsigned long ChannelID, PASSTHRU_MSG* pMsg, unsigned long* pNumMsgs, unsigned long Timeout)

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_INVALID_CHANNEL_ID Set a non-existent channel identifier ChannelID.
ERR_NULL_PARAMETER A pointer to the pMsg receive packet buffer has not been specified.
ERR_TIMEOUT In a given time, fewer messages arrived than ordered.
ERR_NOT_SUPPORTED The adapter does not support the requested parameters.
ERR_BUFFER_EMPTY Reception line is empty.
ERR_NO_FLOW_CONTROL The ISO15765 protocol does not have a filter for Flow Control.
ERR_BUFFER_OVERFLOW Indicates that the receiving queue was full and messages were lost. The actual number of messages received will be in NumMsgs.
ERR_FAILED Defined by the J2534 standard. In the adapter, it is not used for this function.

Example

#include "j2534_lib.hpp"

unsigned long ChannelID;
long Ret;

PASSTHRU_MSG Msg[10];
unsigned long NumMsgs;

NumMsgs = 2;

Ret = PassThruReadMsgs(ChannelID, Msg, &NumMsgs, 100);
if (Ret != STATUS_NOERROR)
{	// Error handling
}