All FT_DATA messages sent to gusdt from a client are examined to see how many data bytes are present.
If the CAN ID is 0101 or any other user defined ID/Header using extended addressing (see the CMD_USDT_REGISTER command documentation), the first byte of data is assumed to be an extended address and is left in place. The PCI byte is inserted as the second data byte instead of the first byte in that case.
If there are 8 or more data bytes, the message is ignored unless the client has registered with gusdt using the CMD_USDT_REGISTER command. Once registered, a long message sent to SD_USDT is broken down into normal CAN packets with 8 data bytes which are sent to the card specified in the frame header of the long message. The first data byte of each packet is the PCI byte. The CAN ID (address) is left intact. The frame addressing is not changed other than to set the destination to SD_CARD. If the echo option was set in the CMD_USDT_REGISTER registration command, an event (FT_EVENT) message (USDT_EVENT with a data byte of USDT_DONE) is sent to the client after the last packet is sent out.
If the target CAN device does not respond with the first or subsequent flow control messages, an event (FT_EVENT) message (USDT_EVENT with a data byte of USDT_TIMEOUT) is sent to the client.
If the CAN ID is 0101 or any other user defined ID/Header using extended addressing (see the CMD_USDT_REGISTER command documentation), the first byte of data is assumed to be an extended address and is left in place. The PCI byte is inserted as the second data byte instead of the first byte. The number of actual data bytes in each packet is one less than for packets without extended addressing.
When a client registers with gusdt using the
CMD_USDT_REGISTER command, the following steps are performed:
The registration process allows gusdt to handle multiple
clients communicating with different channels simultaneously. Multiple clients
can send USDT messages to the same channel simultaneously as well. However,
only one client at a time may send or receive USDT messages from a given
address on a channel.
When a client unregisters with gusdt (CMD_USDT_REGISTER), the following steps are performed:
The filtering set up when a client registers using the default ranges
allows CAN messages (USDT responses) from a channel to be seen by
gusdt if and only if
FT_DATA messages from the CAN channels that are allowed through
the filters are processed as follows.
A flow status (FS) message (PCI upper nybble of 3) is sent by the remote node after the first packet sent by gusdt and whenever the number of packets sent after the previous FS is equal to the initial block size (BS). Gusdt waits for each expected FS and will abandon the attempt to send the message when an FS message does not arrive. If the wait flag, present in the lower nybble of FS, is set, gusdt waits for up to 2 seconds for another command from the remote node before abandoning the attempt. The separation time (ST) of the first FS messages is saved and used to time the next and all following messages sent out to that remote node. Due to the limitations of the task scheduler, the actual time between packets may be greater than, but never less than that requested.An incoming USDT message is recognized by its first frame (FF) PCI byte. Upon reception of the first frame, a USDT_EVENT with a data byte of USDT_FIRSTFRAME may be sent to the registered client. After the incoming USDT message has been assembled in the input buffer, it is sent to the registered client if that client registered with the assemble option set. Gusdt sends out a FS message saying that it will not use any further FS frames and that it doesn't need any delay between packets. If gusdt detects a sequence error, a single event (FT_EVENT) message (USDT_EVENT with a data byte of USDT_SEQUENCE) is sent to the registered client if the assemble flag was set. If too much time passes between two consecutive frames (CF), an event (FT_EVENT) message (USDT_EVENT with a data byte of USDT_TIMEOUT) is sent to the registered client if the assemble flag was set. All consecutive frame (CF) messages following either error are silently discarded until another first frame (FF) arrives.
The Data Header remains the same with the exception of data length which may be up to 4095.
The CAN Header contains the address of the CAN node to which the data is to be sent. The address in the header is used unchanged for data transmission.
The CAN Data consists of 1 through 4095 bytes of data. Gusdt prepends a PCI byte to the data before sending the data. If 7 or fewer data bytes are present, a single CAN packet is sent. If more than 7 bytes of data are present, the USDT protocol is used to transmit multiple CAN packets.
A default CAN header (ID) of 0101 signals the use
of extended addressing. Extended addressing may be inplemented for other
IDs by specifying them in the configuration command.