![]() |
VR-Forces 4.3.1 Class Documentation
|
Entities receive messages based on callback functions registered with message processing classes.
The message processing class that you register a callback with depends on which message system is being used to transport the message. All message receipt is handled by the DtVrfObjectCommunicationInterface class on the DtVrfObject that is receiving the message.
The signature for the callback member function registered with any of the message receipt callback lists is:
As with other callbacks in VR-Forces, this must be a static function. The void* usr parameter is an arbitrary pointer that can be passed in when registering the callback, and will be returned as a parameter to the callback function. NULL can be passed if no callback pointer is needed. Typical usage is to pass a pointer to a specific instance of a class, and have the static callback member function call a non-static member of that class when it is invoked.
Message receipt callbacks can be registered in the following ways:
To register a callback that will be invoked when any message is received by an entity, register the callback like this:
To register for a particular type of message, such as a text report message, register the callback by type:
To register a callback for all messages of a particular category, such as all task messages or all report messages, use the form:
Messages arrive at an entity through a specific message source. The source will be either the simulation internal message system, or one of the radios. Callbacks that are registered directly with the communication interface of an entity are invoked when a message arrives from any source. This is the most common way to receive messages, and the way that all internal VR-Forces components work. However, it is sometimes useful to register callbacks directly with one of the source systems within the communication interface. You can do this by querying the communication interface for the desired source object, which will be either a DtVrfRadio (vrfRadio.h) or the DtSimInternalCommunicationInterface (simInternalCommunicationInterface.h), and then registering the callback with that object. Callbacks are registered with these objects the same way that they are registered with the DtVrfObjectCommunicationInterface object, as described in 11.3.2 Receiving Specific Types of Messages.
[<< Sending Messages] [Home] [Top of Page] [The VR-Forces Simulation Internal Message System >>]