VR-Link API Documentation for DIS
Test PDU Example

The Test PDU example demonstrates how to derive a new PDU from DtPdu.

VR-Link's DtExerciseConn::send() and DtExerciseConn::sendStamped() functions can send any type of PDU, as long as the object passed to it is of a type derived from DtPdu. So, to send user-defined PDUs, you can write a derived class, after which you can immediately use your derived class with these functions.

When DtExerciseConn receives a packet from the network, it creates an object of the appropriate class derived from DtPdu, based on the PDU type in the packet. For instance, a DtEntityStatePdu is created if a packet representing an Entity State PDU is received. For this reason, VR-Link needs to know that your derived class exists. Registration of your class with VR-Link is usually done in your PDU class's addCallback() function.

The Test PDU example creates a variable length PDU. The TestPdu class represents a hypothetical variable-length "Test PDU" - one that has three fields: an integer named "a", a variable-length array of integers named "b" whose cardinality is the value of "a", and a float called c.


The Test PDU example has one major class:

The Test Object example is contained in several major files:


Document ID: Generated on Wed Oct 23 22:25:48 EDT 2013 from SVN revision 132765
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)