#include "j2534_v0404.h"

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

Transmit network protocol messages over an existing logical communication channel. Messages will flow through PassThru device to the vehicle network.

ChannelID - Logical communication channel identifier
pMsg - Pointer to the message structure(s). For sending more than one message, this must be a pointer to an array of PASSTHRU_MSG structures.
pNumMsgs - Pointer to the number of desired pMsg frames. On function completion this variable will contain the actual number of messages sent to the vehicle network. Due to timeouts, the number of transmitted messages may be less than the number requested by the UserApplication.
Timeout - Timeout (in milliseconds) for read completion. A value of zero queues as many transmit messages as possible and returns immediately. A non-zero value blocks (does not return) until the specified number of messages have been transmitted, or until the timeout expires.

See Also: PassThruReadMsgs

See Also: PassThruStartPeriodicMsg


// Mode/PID 0100: Ask an ECU which OBD-II PIDs are supported with 11-bit CAN
Msg.ProtocolID = ISO15765;
Msg.TxFlags = ISO15765_FRAME_PAD;
Msg.Data = {0x00, 0x00, 0x07, 0xDF, 0x01, 0x00};
Msg.DataSize = 6;

// Indicate that the PASSTHRU_MSG array contains just a single message.
NumMsgs = 1;
PassThruWriteMsgs(ChannelID, &Msg, &NumMsgs, 100);