#include "j2534_v0404.h"

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

Receive network protocol messages, receive indications, and transmit indications from an existing logical communication channel. Messages will flow through PassThru device to the User Application..

ChannelID - Logical communication channel identifier
pMsg - Pointer to the message structure(s). For reading more than one message, this must be a pointer to an array of PASSTHRU_MSG structures. The API/DLL will fill RxStatus, TxStaus, Timestamp, DataSize, ExtraDataIndex and Data.
pNumMsgs - Pointer to the desired number of pMsg frames. On function completion, this variable contains the actual number of pMsg frames that were read. Due to timeouts, the number of messages returned may be less than the number requested. The pMsg structure must be large enough to contain pNumMsgs worth of frames.
Timeout - Timeout (in milliseconds) for read completion. A value of zero reads buffered messages and returns immediately. A non-zero value blocks (does not return) until the specified number of messages have been read, or until the timeout expires.

See Also: PassThruWriteMsgs

See Also: PassThruStartMsgFilter


unsigned long timeout = 0;

// Initialize the PASSTHRU_MSG structure to all zeroes
memset(&Msg, 0, 2*sizeof(Msg));

// Set the ProtocolID to select protocol frames of interest
Msg[0].ProtocolID = ISO15765;
Msg[1].ProtocolID = ISO15765;

// Attempt to read two messages, immediately return
NumMsgs = 2;
PassThruReadMsgs(ChannelID, &Msg, &NumMsgs, timeout);