VR-Forces 4.1 Class Documentation
11.3 - Receiving Messages

Table of Contents

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.

11.3.1 Message Receipt Callback Member Functions

The signature for the callback member function registered with any of the message receipt callback lists is:

void processMessage(const DtVrfObjectMessage* message, void* usr);

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.

11.3.2 Receiving Specific Types of Messages

Message receipt callbacks can be registered in the following ways:

11.3.3 Receiving Messages from Specific Sources

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 >>]


Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)