The function sends messages according to the diagnostic protocol. The transmit queue of the adapter is designed for 50 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, the reception of messages in the transmitting queue is suspended.
long PassThruWriteMsgs(unsigned long ChannelID, PASSTHRU_MSG *pMsg, unsigned long *pNumMsgs, unsigned long Timeout)
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 | PMsg Receive Packet Buffer Pointer Not Set |
ERR_TIMEOUT | For a given time, they could not transmit all the messages. |
ERR_INVALID_MSG | Incorrect message structure specified in pMsg pointer. |
ERR_NULL_PARAMETER | PMsg pointer not set |
ERR_MSG_PROTOCOL_ID | The protocol specified in the parameters of the transmitted message does not match the protocol specified in ChannelID |
ERR_NO_FLOW_CONTROL | The ISO15765 protocol does not have a filter for Flow Control. |
ERR_BUFFER_FULL | The transfer queue is full. |
ERR_FAILED | Defined by the J2534 standard. In the adapter, it is not used for this function. |
#include "j2534_lib.hpp"
unsigned long ChannelID;
unsigned long NumMsgs;
long Ret;
PASSTHRU_MSG Msg[10];
Msg[0].ProtocolID = ISO15765;
Msg[0].TxFlags = FL_ISO15765_FRAME_PAD;
Msg[0].Data[0] = 0x00;
Msg[0].Data[1] = 0x00;
Msg[0].Data[2] = 0x07;
Msg[0].Data[3] = 0xE0;
Msg[0].Data[4] = 0x3E;
Msg[0].DataSize = 5;
NumMsgs = 1;
Ret = PassThruWriteMsgs(ChannelID, Msg, &NumMsgs, 100);
if (Ret != STATUS_NOERROR)
{ // Error handling
}