MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtRtiAssistantClient Class Reference

Manages the client connection to the RTI Assistant. More...

+ Inheritance diagram for DtRtiAssistantClient:
+ Collaboration diagram for DtRtiAssistantClient:

Public Member Functions

 DtRtiAssistantClient (DtAssistantComponentType type, int port=DtASSISTANT_DEFAULT_PORT)
 Constructor. More...
 
virtual ~DtRtiAssistantClient ()
 Destructor. More...
 
virtual bool tick (unsigned int timeout=0)
 Do the actual message processing. More...
 
virtual bool isConnected ()
 Returns true if the socket is connected. More...
 
virtual bool isDisabled ()
 Returns true if the socket is disabled. More...
 
virtual void addMsgCallback (DtAssistantMsgKind msgKind, DtAssistantMsgCbMgr::DtCallbackFcn fcn, void *usr)
 Message Callbacks These callback functions operate on all of the connections. More...
 
virtual void removeMsgCallback (DtAssistantMsgKind msgKind, DtAssistantMsgCbMgr::DtCallbackFcn fcn, void *usr)
 
virtual void addWildcardMsgCallback (DtAssistantMsgCbMgr::DtCallbackFcn fcn, void *usr)
 
virtual void removeWildcardMsgCallback (DtAssistantMsgCbMgr::DtCallbackFcn fcn, void *usr)
 
virtual void addDisconnectCallback (DtAssistantDisconnectCb cb, void *usr)
 These functions add callbacks for notification of a socket disconnect. More...
 
virtual void removeDisconnectCallback (DtAssistantDisconnectCb cb, void *usr)
 
virtual bool sendLRCConnQueryMsg (bool error, MAKRti::DtString &connectionName, bool &ridIsPreconfigured, MAKRti::DtString &ridConfig, MAKRti::DtInetAddr &tcpAddr, int &tcpPort, MAKRti::DtInetAddr &tcpIntf, MAKRti::DtInetAddr &udpAddr, int &udpPort, MAKRti::DtInetAddr &udpIntf, int &forwarderPort, bool &useRtiexec, bool &forceFullCompliance)
 Send a message querying for the connection parameters. More...
 
virtual bool sendForwardingComponentConnQueryMsg (bool error, MAKRti::DtString &connectionName, bool &ridIsPreconfigured, MAKRti::DtString &ridConfig, MAKRti::DtInetAddr &tcpAddr, int &tcpPort, MAKRti::DtInetAddr &tcpIntf, MAKRti::DtInetAddr &udpAddr, int &udpPort, MAKRti::DtInetAddr &udpIntf, MAKRti::DtInetAddr &forwarderToConnectTo, int &forwarderPort, bool &forceFullCompliance)
 Send a message querying for the rtiexec connection parameters. More...
 
virtual void sendLatencyTestMsg (const DtAssistantLatencyReportMsg &msg)
 Send a message to the assistant with latency test measurements. More...
 
virtual void sendLatencyTestStatusMsg (const DtAssistantTestMgrStatusMsg &msg)
 Send an updated latency test status message to the assistant. More...
 
virtual bool getNewLicenseServerFromAssistant (bool allowUnlicensed, bool &runUnlicensed, MAKRti::DtString &serverName, const MAKRti::DtString &featToCheck)
 Send a message to the assistant to query the user for an alternate license server. More...
 
virtual void sendNotifyMsg (const MAKRti::DtString &text, DtNotifyLevelType notifyLevel)
 Send a message to display a pop up notification above the tray icon. More...
 
virtual void sendSignalTickedMsg ()
 Send a signal ticked message to the assistant. More...
 
virtual void sendDialogBoxMsg (const MAKRti::DtString &text, const MAKRti::DtString &advancedText)
 Send a message to display a dialog notification. More...
 
virtual void sendClose ()
 Send connection closed message to Assistant. More...
 
virtual void sendRidParamsMsg (const MAKRti::DtString &params, const MAKRti::DtFilename &filename, const MAKRti::DtString &federation=MAKRti::DtString::nullString(), unsigned federateHdl=0)
 Send the RID parameters. More...
 
virtual void setMsgFactory (DtAssistantMessageFactory *fact)
 Get/Set the message factory. More...
 
virtual DtAssistantMessageFactorymsgFactory () const
 
virtual void shutDownConnection ()
 AssistantClientOwner should call this function when it processes an assistantExitMsg. More...
 
virtual MAKRti::DtString getProcessName () const
 get the process name More...
 
virtual int getPID () const
 get the PID More...
 
virtual MAKRti::DtString getCommandArgs () const
 get the command args More...
 
bool testConnectionStatus ()
 test the connection More...
 
virtual int componentId () const
 Returns the component ID assigned by the assistant. More...
 

Protected Member Functions

virtual bool initialize ()
 Attempts to connect to the RTI Assistant. More...
 
virtual DtAssistantConnectionStatus connectToAssistant ()
 Attempt to open a connection and handshake with the Assistant. More...
 
virtual DtAssistantConnectionStatus makeSingleConnectionAttempt ()
 
virtual bool startAssistant ()
 Attempt to start a new Assistant. More...
 
virtual bool readAndProcess (MAKRti::DtTime maxTime)
 Read and process any messages on the socket for up to the maxTime. More...
 
virtual bool sendMsg (const DtAssistantMsg &msg)
 Send a message to the RTI Assistant. More...
 
virtual DtAssistantMsgsendMsgAndWait (const DtAssistantMsg &msg, DtAssistantMsgKind respKind, unsigned int waitSecs=0)
 Send a message to the RTI Assistant and wait for response of the specified kind. More...
 
virtual DtAssistantConnectionStatus sendConnectMsg ()
 Send basic component information to the Assistant for a new connection. More...
 
virtual void processRespMsg (const DtAssistantMsg &respMsg)
 
virtual void processNtfyLvlUpdateMsg (const DtAssistantNtfyLvlUpdateMsg &updateMsg)
 
virtual void processAssistantExitMsg (const DtAssistantExitMsg &inter)
 
virtual void processDisconnect ()
 Process Assistant socket disconnect. More...
 
virtual std::auto_ptr
< DtAssistantMsg
netRead (int *retCode) const
 Attempt to read a new message from the socket. More...
 
virtual bool sendLicQueryMsg (bool allowUnlicensed, bool &runUnlicensed, MAKRti::DtString &licServer)
 Send a message querying for the license server. More...
 
virtual void sendClientInfo ()
 intended to be over-ridden by subclasses. More...
 

Static Protected Member Functions

static void processRespMsg (const DtAssistantMsg &respMsg, void *usr)
 Response message callback. More...
 
static void processNtfyLvlUpdateMsg (const DtAssistantNtfyLvlUpdateMsg &updateMsg, void *usr)
 Notify level update message callback. More...
 
static void processAssistantExitMsg (const DtAssistantExitMsg &inter, void *usr)
 Process the assistant exit message. The assistant is commanding us to exit. More...
 

Protected Attributes

bool myAssistantDisabled
 Set to true if the Assistant is disabled. More...
 
MAKRti::DtInetAddr myAssistantAddr
 The IP address of the Assistant. More...
 
unsigned int myAssistantPort
 The port on which the RTI Assistant listens for connections. More...
 
DtTcpMsgSocketmySocket
 The socket to the RTI Assistant. More...
 
bool myCreateIfConnectFails
 Indicates whether an Assistant should be created if a connection cannot be established. More...
 
DtAssistantConnectionStatus myConnStatus
 The current connection status. More...
 
bool myInitializingConnection
 Is connection being initialized. More...
 
MAKRti::DtU32 mySockOpts
 The socket options to be used when connecting to the Assistant. More...
 
DtAssistantMessageFactorymyMessageFactory
 The message factory. More...
 
DtAssistantDfltMsgFactory myDefaultMessageFactory
 Default message factory. More...
 
DtAssistantComponentType myComponentType
 The component type. (LRC, rtiexec, etc.) More...
 
MAKRti::DtClock myClock
 Clock for timeouts. More...
 
MAKRti::DtTime myConnTestInterval
 Interval at which connection should be tested. More...
 
MAKRti::DtTime myTimeToTestConnection
 Next time to test connection. More...
 
DtAssistantMsgCbMgr myMsgCbMgr
 Message callback manager. More...
 
std::auto_ptr< DtAssistantMsgmyRespMsg
 The last response message to be received. More...
 
std::list
< DtAssistantDisconnectCbInfo * > 
myDisconnectCallbacks
 Lists of pointers to socket disconnect callbacks. More...
 
MAKRti::DtMutex * mySocketMutex
 locks access to the socket connection. More...
 
bool myShouldShutdown
 should be set when assistant exit msg has been received. More...
 
int myNumFailedAssistantConnects
 How many assistant restarts have we attempted. More...
 
int myNumSuccessfulAssistantConnects
 How many assistant reconnects occurred. More...
 
int myPID
 the Process ID ( PID ) More...
 
MAKRti::DtString myProcessName
 the Process Name More...
 
MAKRti::DtString myCommandArgs
 the command line arguments More...
 
int myAssistantCompId
 The assistant assigned component ID. More...
 
unsigned long mySequence
 Message sequence number. More...
 

Static Protected Attributes

static const int theMaxNumberOfAssistantConnectAttempts
 either starting up or reconnecting, how many assistant restarts do we tolerate before giving up. More...
 
static const MAKRti::DtTime theSleepBetweenAssistantConnectAttempts
 When attempting to connect, this is the number of seconds. More...
 
static const MAKRti::DtInetAddr theFirstHostInetAddr
 The first InetAddr when the federate was launched. More...
 

Private Member Functions

 DtRtiAssistantClient (const DtRtiAssistantClient &)
 Copy constructor not implemented. More...
 
DtRtiAssistantClientoperator= (const DtRtiAssistantClient &)
 Assignment operator not implemented. More...
 

Detailed Description

Manages the client connection to the RTI Assistant.

DtRtiAssistantClient manages the connection to the RTI Assistant. It also provides methods for packaging and sending common messages to the RTI Assistant.

Constructor & Destructor Documentation

DtRtiAssistantClient::DtRtiAssistantClient ( DtAssistantComponentType  type,
int  port = DtASSISTANT_DEFAULT_PORT 
)

Constructor.

virtual DtRtiAssistantClient::~DtRtiAssistantClient ( )
virtual

Destructor.

DtRtiAssistantClient::DtRtiAssistantClient ( const DtRtiAssistantClient )
private

Copy constructor not implemented.

Member Function Documentation

virtual void DtRtiAssistantClient::addDisconnectCallback ( DtAssistantDisconnectCb  cb,
void *  usr 
)
virtual

These functions add callbacks for notification of a socket disconnect.

virtual void DtRtiAssistantClient::addMsgCallback ( DtAssistantMsgKind  msgKind,
DtAssistantMsgCbMgr::DtCallbackFcn  fcn,
void *  usr 
)
virtual

Message Callbacks These callback functions operate on all of the connections.

virtual void DtRtiAssistantClient::addWildcardMsgCallback ( DtAssistantMsgCbMgr::DtCallbackFcn  fcn,
void *  usr 
)
virtual
virtual int DtRtiAssistantClient::componentId ( ) const
virtual

Returns the component ID assigned by the assistant.

virtual DtAssistantConnectionStatus DtRtiAssistantClient::connectToAssistant ( )
protectedvirtual

Attempt to open a connection and handshake with the Assistant.

Returns the connection status. Does not block, so

virtual MAKRti::DtString DtRtiAssistantClient::getCommandArgs ( ) const
virtual

get the command args

virtual bool DtRtiAssistantClient::getNewLicenseServerFromAssistant ( bool  allowUnlicensed,
bool &  runUnlicensed,
MAKRti::DtString &  serverName,
const MAKRti::DtString &  featToCheck 
)
virtual

Send a message to the assistant to query the user for an alternate license server.

Returns true unless user cancels dialog.

virtual int DtRtiAssistantClient::getPID ( ) const
virtual

get the PID

virtual MAKRti::DtString DtRtiAssistantClient::getProcessName ( ) const
virtual

get the process name

virtual bool DtRtiAssistantClient::initialize ( )
protectedvirtual

Attempts to connect to the RTI Assistant.

Will create one if none is present.

virtual bool DtRtiAssistantClient::isConnected ( )
virtual

Returns true if the socket is connected.

virtual bool DtRtiAssistantClient::isDisabled ( )
virtual

Returns true if the socket is disabled.

virtual DtAssistantConnectionStatus DtRtiAssistantClient::makeSingleConnectionAttempt ( )
protectedvirtual
virtual DtAssistantMessageFactory* DtRtiAssistantClient::msgFactory ( ) const
virtual
virtual std::auto_ptr<DtAssistantMsg> DtRtiAssistantClient::netRead ( int *  retCode) const
protectedvirtual

Attempt to read a new message from the socket.

DtRtiAssistantClient& DtRtiAssistantClient::operator= ( const DtRtiAssistantClient )
private

Assignment operator not implemented.

static void DtRtiAssistantClient::processAssistantExitMsg ( const DtAssistantExitMsg inter,
void *  usr 
)
staticprotected

Process the assistant exit message. The assistant is commanding us to exit.

virtual void DtRtiAssistantClient::processAssistantExitMsg ( const DtAssistantExitMsg inter)
protectedvirtual
virtual void DtRtiAssistantClient::processDisconnect ( )
protectedvirtual

Process Assistant socket disconnect.

static void DtRtiAssistantClient::processNtfyLvlUpdateMsg ( const DtAssistantNtfyLvlUpdateMsg updateMsg,
void *  usr 
)
staticprotected

Notify level update message callback.

virtual void DtRtiAssistantClient::processNtfyLvlUpdateMsg ( const DtAssistantNtfyLvlUpdateMsg updateMsg)
protectedvirtual
static void DtRtiAssistantClient::processRespMsg ( const DtAssistantMsg respMsg,
void *  usr 
)
staticprotected

Response message callback.

virtual void DtRtiAssistantClient::processRespMsg ( const DtAssistantMsg respMsg)
protectedvirtual
virtual bool DtRtiAssistantClient::readAndProcess ( MAKRti::DtTime  maxTime)
protectedvirtual

Read and process any messages on the socket for up to the maxTime.

virtual void DtRtiAssistantClient::removeDisconnectCallback ( DtAssistantDisconnectCb  cb,
void *  usr 
)
virtual
virtual void DtRtiAssistantClient::removeMsgCallback ( DtAssistantMsgKind  msgKind,
DtAssistantMsgCbMgr::DtCallbackFcn  fcn,
void *  usr 
)
virtual
virtual void DtRtiAssistantClient::removeWildcardMsgCallback ( DtAssistantMsgCbMgr::DtCallbackFcn  fcn,
void *  usr 
)
virtual
virtual void DtRtiAssistantClient::sendClientInfo ( )
protectedvirtual

intended to be over-ridden by subclasses.

Sends subclass specific data to the assistant.

Reimplemented in DtRtiAssistantLrcClient, DtRtiAssistantForwarderClient, DtRtiAssistantToAssistantClient, DtRtiAssistantExecClient, and DtRtiAssistantShmExecClient.

virtual void DtRtiAssistantClient::sendClose ( )
virtual

Send connection closed message to Assistant.

This should be called prior to a normal shutdown of the client.

virtual DtAssistantConnectionStatus DtRtiAssistantClient::sendConnectMsg ( )
protectedvirtual

Send basic component information to the Assistant for a new connection.

Returns false if the Assistant rejects this connection.

virtual void DtRtiAssistantClient::sendDialogBoxMsg ( const MAKRti::DtString &  text,
const MAKRti::DtString &  advancedText 
)
virtual

Send a message to display a dialog notification.

virtual bool DtRtiAssistantClient::sendForwardingComponentConnQueryMsg ( bool  error,
MAKRti::DtString &  connectionName,
bool &  ridIsPreconfigured,
MAKRti::DtString &  ridConfig,
MAKRti::DtInetAddr &  tcpAddr,
int &  tcpPort,
MAKRti::DtInetAddr &  tcpIntf,
MAKRti::DtInetAddr &  udpAddr,
int &  udpPort,
MAKRti::DtInetAddr &  udpIntf,
MAKRti::DtInetAddr &  forwarderToConnectTo,
int &  forwarderPort,
bool &  forceFullCompliance 
)
virtual

Send a message querying for the rtiexec connection parameters.

virtual void DtRtiAssistantClient::sendLatencyTestMsg ( const DtAssistantLatencyReportMsg msg)
virtual

Send a message to the assistant with latency test measurements.

virtual void DtRtiAssistantClient::sendLatencyTestStatusMsg ( const DtAssistantTestMgrStatusMsg msg)
virtual

Send an updated latency test status message to the assistant.

virtual bool DtRtiAssistantClient::sendLicQueryMsg ( bool  allowUnlicensed,
bool &  runUnlicensed,
MAKRti::DtString &  licServer 
)
protectedvirtual

Send a message querying for the license server.

virtual bool DtRtiAssistantClient::sendLRCConnQueryMsg ( bool  error,
MAKRti::DtString &  connectionName,
bool &  ridIsPreconfigured,
MAKRti::DtString &  ridConfig,
MAKRti::DtInetAddr &  tcpAddr,
int &  tcpPort,
MAKRti::DtInetAddr &  tcpIntf,
MAKRti::DtInetAddr &  udpAddr,
int &  udpPort,
MAKRti::DtInetAddr &  udpIntf,
int &  forwarderPort,
bool &  useRtiexec,
bool &  forceFullCompliance 
)
virtual

Send a message querying for the connection parameters.

virtual bool DtRtiAssistantClient::sendMsg ( const DtAssistantMsg msg)
protectedvirtual

Send a message to the RTI Assistant.

returns true if no error.

virtual DtAssistantMsg* DtRtiAssistantClient::sendMsgAndWait ( const DtAssistantMsg msg,
DtAssistantMsgKind  respKind,
unsigned int  waitSecs = 0 
)
protectedvirtual

Send a message to the RTI Assistant and wait for response of the specified kind.

A pointer to the response message will be returned. Ownership of the message is passed to the calling function who must delete it when finished. Optional parameter waitSecs specifies how long we should wait for the response. If 0 is specified, wait is indefinite. Returns null pointer if timeout occurred.

virtual void DtRtiAssistantClient::sendNotifyMsg ( const MAKRti::DtString &  text,
DtNotifyLevelType  notifyLevel 
)
virtual

Send a message to display a pop up notification above the tray icon.

virtual void DtRtiAssistantClient::sendRidParamsMsg ( const MAKRti::DtString &  params,
const MAKRti::DtFilename &  filename,
const MAKRti::DtString &  federation = MAKRti::DtString::nullString(),
unsigned  federateHdl = 0 
)
virtual

Send the RID parameters.

virtual void DtRtiAssistantClient::sendSignalTickedMsg ( )
virtual

Send a signal ticked message to the assistant.

virtual void DtRtiAssistantClient::setMsgFactory ( DtAssistantMessageFactory fact)
virtual

Get/Set the message factory.

virtual void DtRtiAssistantClient::shutDownConnection ( )
virtual

AssistantClientOwner should call this function when it processes an assistantExitMsg.

virtual bool DtRtiAssistantClient::startAssistant ( )
protectedvirtual

Attempt to start a new Assistant.

bool DtRtiAssistantClient::testConnectionStatus ( )

test the connection

virtual bool DtRtiAssistantClient::tick ( unsigned int  timeout = 0)
virtual

Do the actual message processing.

  • RTI connections are treated as synchronous in main thread

Member Data Documentation

MAKRti::DtInetAddr DtRtiAssistantClient::myAssistantAddr
protected

The IP address of the Assistant.

int DtRtiAssistantClient::myAssistantCompId
protected

The assistant assigned component ID.

bool DtRtiAssistantClient::myAssistantDisabled
protected

Set to true if the Assistant is disabled.

unsigned int DtRtiAssistantClient::myAssistantPort
protected

The port on which the RTI Assistant listens for connections.

MAKRti::DtClock DtRtiAssistantClient::myClock
protected

Clock for timeouts.

MAKRti::DtString DtRtiAssistantClient::myCommandArgs
protected

the command line arguments

DtAssistantComponentType DtRtiAssistantClient::myComponentType
protected

The component type. (LRC, rtiexec, etc.)

DtAssistantConnectionStatus DtRtiAssistantClient::myConnStatus
protected

The current connection status.

MAKRti::DtTime DtRtiAssistantClient::myConnTestInterval
protected

Interval at which connection should be tested.

bool DtRtiAssistantClient::myCreateIfConnectFails
protected

Indicates whether an Assistant should be created if a connection cannot be established.

DtAssistantDfltMsgFactory DtRtiAssistantClient::myDefaultMessageFactory
protected

Default message factory.

std::list<DtAssistantDisconnectCbInfo*> DtRtiAssistantClient::myDisconnectCallbacks
protected

Lists of pointers to socket disconnect callbacks.

bool DtRtiAssistantClient::myInitializingConnection
protected

Is connection being initialized.

DtAssistantMessageFactory* DtRtiAssistantClient::myMessageFactory
protected

The message factory.

DtAssistantMsgCbMgr DtRtiAssistantClient::myMsgCbMgr
protected

Message callback manager.

int DtRtiAssistantClient::myNumFailedAssistantConnects
protected

How many assistant restarts have we attempted.

int DtRtiAssistantClient::myNumSuccessfulAssistantConnects
protected

How many assistant reconnects occurred.

int DtRtiAssistantClient::myPID
protected

the Process ID ( PID )

MAKRti::DtString DtRtiAssistantClient::myProcessName
protected

the Process Name

std::auto_ptr<DtAssistantMsg> DtRtiAssistantClient::myRespMsg
protected

The last response message to be received.

unsigned long DtRtiAssistantClient::mySequence
protected

Message sequence number.

bool DtRtiAssistantClient::myShouldShutdown
protected

should be set when assistant exit msg has been received.

DtTcpMsgSocket* DtRtiAssistantClient::mySocket
protected

The socket to the RTI Assistant.

MAKRti::DtMutex* DtRtiAssistantClient::mySocketMutex
protected

locks access to the socket connection.

MAKRti::DtU32 DtRtiAssistantClient::mySockOpts
protected

The socket options to be used when connecting to the Assistant.

MAKRti::DtTime DtRtiAssistantClient::myTimeToTestConnection
protected

Next time to test connection.

const MAKRti::DtInetAddr DtRtiAssistantClient::theFirstHostInetAddr
staticprotected

The first InetAddr when the federate was launched.

const int DtRtiAssistantClient::theMaxNumberOfAssistantConnectAttempts
staticprotected

either starting up or reconnecting, how many assistant restarts do we tolerate before giving up.

const MAKRti::DtTime DtRtiAssistantClient::theSleepBetweenAssistantConnectAttempts
staticprotected

When attempting to connect, this is the number of seconds.


The documentation for this class was generated from the following file:

Document ID: Generated on Mon Sep 7 15:40:32 EDT 2020 from SVN revision 217499
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)