EasyManua.ls Logo

VTI Instruments EX1629 - Printing Packets

Default Icon
346 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
www.vtiinstruments.com
EX1629 Onboard Memory 339
if (len < MLANBUFLEN)
{
printf("Error, buffer size not large enough to hold MLAN
response");
return -1;
}
result = vtex1629_read_teds_MLAN(vi, channel, MLANBUFLEN,
receive_packet, &data);
if (result != 0)
{
vtex1629_error_message(vi, result, error);
printf("error when receiving from driver: %s\n", error);
}
else
{
printf("got a packet without errors on receive\n");
PrintPacket(receive_packet);
}
// return the length in bytes of the packet including length byte
return receive_packet[0] + 1;
}
void MLanHostPacketSend(uint8_t *send_packet, int channel)
{
int result = 0;
ViChar error[256];
// add platform/protocol specific code here
result = vtex1629_write_teds_MLAN(vi, channel, (send_packet[0]+1),
send_packet);
if(result != 0)
{
vtex1629_error_message(vi,result,error);
printf("Error sending packet to driver: (%s)\n", error);
}
else
{
printf("sent packet without errors\n");
PrintPacket(send_packet);
}
return;
}
These functions are fairly simple and only act as device-specific wrappers around the sending and
receiving of commands.
Printing Packets
The function that prints the packet is called from the sender & receiver, just to make it easier to
determine which (sender vs. receiver) was doing the printing. Here is the code for the PrintPacket
function.
void PrintPacket(uint8_t* pkt)
{
int len = pkt[0]+1;
int i = 0;
printf("Packet length: %i\n", len);
for (i=0 ; i< len ; i++)

Table of Contents

Related product manuals