VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages

networkCallbackManagerAccessory.h

/******************************************************************************
** Copyright (c) 2010 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
/******************************************************************************
** $RCSfile: DtAddAttrGuiAccessory.h,v $ $Revision: 1.1 $ $State: Exp $
******************************************************************************/
//\file DtAddAttrGuiAccessory.h
//\brief Contains DtAddAttrGuiAccessory class. Used to install extensions to the FOM
//for mass
namespace makVrv
{
class DtConnection;
class DtVrlinkDriver;
}
namespace makVrf
{
class DtNetworkMessageInterface;
};
//\brief This class defines an accessory that will install itself
//into DtVrlinkDriver objects and print out the esr of entities
//as they are discovered.
{
public:
//\Default constructor
//\Default destructor
//\brief Called when this accessory is installed into a connector.
virtual void install(makVrv::DtDriver* driver);
//\brief Called when this accessory is uninstalled
virtual void uninstall(makVrv::DtDriver* baseConn);
//\brief Called to find out if this accessory is compatible with a
//particular connector. In this case, it is compatible with any
//DtVrlinkDriver of the correct protocol
virtual bool isCompatible(makVrv::DtDriver* driver);
//\brief Called when an interaction or pdu is received. Will send notification through
//the VRF driver
protected:
//\brief Called when the driver creates a new connection
virtual void slot_onSimCreated(makVrv::DtConnection* connection);
//\brief Called when a sim connection is connected
virtual void slot_onSimConnected(makVrv::DtConnection* connection);
//\brief Called when a sim connection is disconnected
//Sends out a PDU or interaction with hard coded values given a particular protoco;
virtual void slot_onSendPdu(makVrv::DtConnection* connection);
protected:
};

networkCallbackManagerAccessory.cxx

/******************************************************************************
** Copyright (c) 2012 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
//\file DtNetworkCallbackManagerAccessory.inl
//\brief Contains implementation of the accessory that will be used to send
//and receive the DtTestPdu and DtTestInteraction objects. It will show
//how to use the DtNetworkCallbackManager and how to use threaded event
//signalers in order to communicate from the front-end (network independent
//thread) to the network dependent thread
//to
//Use comment interaction as test interaction, however, any pdu/interaction could
//be used
#include <vl/commentInteraction.h>
//Class that will be used to communicate network information to the GUI thread
//Class that is used to signal events from the GUI thread to the network driver accessory
//Class to override remote controller
//Factory to register remote controller in
#include <boost/bind.hpp>
static void DtTestInteractionCb(DtCommentInteraction* pdu, void* usr)
{
DtString message(pdu->comment());
iface.setMessage(message.c_str());
static_cast<DtNetworkCallbackManagerAccessory*>(usr)->received(&iface);
}
using namespace makVrf;
: makVrv::DtBaseAccessory()
, myDriver(0)
{
#ifdef DtHLA
#ifdef DtHLA_1516
#ifdef DtHLA_1516_EVOLVED
myName="DtNetworkCallbackManagerHLA1516eAccessory";
#else
myName="DtNetworkCallbackManagerHLA1516Accessory";
#endif
#else
myName="DtNetworkCallbackManagerHLA13Accessory";
#endif
#elif DtDIS
myName="DtNetworkCallbackManagerDISAccessory";
#endif
}
{
if (myDriver)
{
}
}
{
if(vld)
{
//connect accessory to connection signals.
vld->signal_connectionCreated.connect(
myDriver = vld;
}
}
{
makVrv::DtVrlinkDriver* vld = dynamic_cast<makVrv::DtVrlinkDriver*>(baseConn);
if(vld)
{
//disconnect accessory from connection signals.
vld->signal_connectionCreated.disconnect(
}
myDriver = 0;
}
{
if(dd)
{
return true;
}
return false;
}
{
}
{
connection->signal_connected.connect(
connection->signal_toBeDisconnected.connect(
}
{
(connection);
if(vrlCon)
{
DtCommentInteraction::addCallback(vrlCon->exerciseConn(), DtTestInteractionCb, this);
//Add connection for event signal to send off the pdu or interaction depending on protocol
DtExampleEventSignaler::instance(connection->settingsManager()).signal_sendPdu.connect(
}
}
//Called in response to queued signal, will send interaction or pdu onto the network
{
(connection);
if(vrlCon)
{
DtCommentInteraction testPdu;
std::string message = "Sent from " + myName;
testPdu.setComment(message.c_str(), message.length() + 1);
#if DtHLA
//Needed in HLA to receive interactions sent by us
vrlCon->exerciseConn()->setReflecting();
#endif
vrlCon->exerciseConn()->sendStamped(testPdu);
}
}
{
connection->signal_connected.disconnect(
connection->signal_toBeDisconnected.disconnect(
(connection);
if(vrlCon)
{
DtCommentInteraction::removeCallback(vrlCon->exerciseConn(), DtTestInteractionCb, this);
DtExampleEventSignaler::instance(connection->settingsManager()).signal_sendPdu.disconnect(
}
}

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)