RadarFX API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
makRadarFx::DtRadarFxConnector Class Reference

The DtRadarFXConnector class manages the connection with the server and provides and interface to send and receive messages with the server. More...

Public Types

typedef DtDelegate< void,
DtRadarFxConnector * > 
DtConnectionDelegate
 Connection callback definition.

Public Member Functions

 DtRadarFxConnector ()
 constructor/destructor
virtual ~DtRadarFxConnector ()
virtual void connect (const std::string &address, int port=DtRadarFXPort, bool attemptRetry=true)
 this establishes a connection to a remote RadarFX server at a given address and port the connection callback will be run when a connection is made.
virtual void disconnect ()
 Disconnects from a RadarFX server.
virtual bool isOk ()
 Returns true of the connection has succeed and is valid.
virtual void tick ()
 Tick must be called periodically to allow message callbacks to be run.
virtual void sendMessage (DtBaseMessage &request)
 Sends a message to the Radar FX server.
virtual DtMessageHandlermessageHandler ()
 Get the message handler the connector is using to dispatch messages when they arrive users will register their delegates with the message handler to execute their code when a message is received.
virtual void addConnectedCallback (const DtConnectionDelegate &delegate)
 Adds a callback for when a connection to a server succeeds.
virtual void removeConnectedCallback (const DtConnectionDelegate &delegate)
 Removes connection callback.
virtual void addDisconnectedCallback (const DtConnectionDelegate &delegate)
 Adds a callback for when disconnected to a server.
virtual void removeDisconnectedCallback (const DtConnectionDelegate &delegate)
 Removes disconnection callback.
virtual DtMessageFactorymessageFactory ()
 Gets the message factory for all messages.
virtual unsigned int nextId ()
 You can use this to get the next id for a message if your callback system needs to keep track of responses if any message being sent leaves the id field as 0, this function will be used to generate an id.
virtual std::string & requesterName ()
 this provides a unique name for the requester.

Static Public Member Functions

static double defaultRetryTimeout ()
 The default timeout for retrying. The default value is 5.
static void setDefaultRetryTimeout (double val)
 Sets the default retry timout. Value is in seconds.
static double defaultHeartbeatTimeout ()
 the default hearbeat timeout. The default is 2.5 seconds.
static void setDefaultHeatbeatTimeout (double val)
 sets the default heartbeat timeout. Value is in seconds.

Protected Member Functions

DtInetAddr findFirstNetworkDeviceAddress (bool &found) const

Static Protected Member Functions

static void workerFunction (void *data, volatile bool *stop)

Protected Attributes

DtMessageHandler myMessageHandler
std::list< DtConnectionDelegatemyConnectionCallbacks
std::list< DtConnectionDelegatemyDisconnectionCallbacks
DtMessageFactory myMessageFactory
unsigned int myNextId
std::string myRequestorName
DtLocklessQueue< DtBaseMessage * > myOutgoingQueue
DtLocklessQueue< DtBaseMessage * > myIncomingQueue
DtThread * myWorkerThread
DtInetTcpSocket * mySocket
bool myShouldRetryConnect
double myRetryTimeout
std::string myAddress
int myPort
bool myShouldQuit

Static Protected Attributes

static double theDefaultHeatbeatTimeout
static double theDefaultRetryTimeout

Detailed Description

The DtRadarFXConnector class manages the connection with the server and provides and interface to send and receive messages with the server.

Member Typedef Documentation

Connection callback definition.

Constructor & Destructor Documentation

makRadarFx::DtRadarFxConnector::DtRadarFxConnector ( )

constructor/destructor

virtual makRadarFx::DtRadarFxConnector::~DtRadarFxConnector ( )
virtual

Member Function Documentation

virtual void makRadarFx::DtRadarFxConnector::connect ( const std::string &  address,
int  port = DtRadarFXPort,
bool  attemptRetry = true 
)
virtual

this establishes a connection to a remote RadarFX server at a given address and port the connection callback will be run when a connection is made.

It will continue to retry if there is a failure to connect or the connector gets disconnected if attemptRetry is true

virtual void makRadarFx::DtRadarFxConnector::disconnect ( )
virtual

Disconnects from a RadarFX server.

virtual bool makRadarFx::DtRadarFxConnector::isOk ( )
virtual

Returns true of the connection has succeed and is valid.

virtual void makRadarFx::DtRadarFxConnector::tick ( )
virtual

Tick must be called periodically to allow message callbacks to be run.

virtual void makRadarFx::DtRadarFxConnector::sendMessage ( DtBaseMessage request)
virtual

Sends a message to the Radar FX server.

A copy of the message is made internally, so the message being sent can go out of scope immediately after sendMessage is called.

virtual DtMessageHandler& makRadarFx::DtRadarFxConnector::messageHandler ( )
inlinevirtual

Get the message handler the connector is using to dispatch messages when they arrive users will register their delegates with the message handler to execute their code when a message is received.

virtual void makRadarFx::DtRadarFxConnector::addConnectedCallback ( const DtConnectionDelegate delegate)
virtual

Adds a callback for when a connection to a server succeeds.

virtual void makRadarFx::DtRadarFxConnector::removeConnectedCallback ( const DtConnectionDelegate delegate)
virtual

Removes connection callback.

virtual void makRadarFx::DtRadarFxConnector::addDisconnectedCallback ( const DtConnectionDelegate delegate)
virtual

Adds a callback for when disconnected to a server.

virtual void makRadarFx::DtRadarFxConnector::removeDisconnectedCallback ( const DtConnectionDelegate delegate)
virtual

Removes disconnection callback.

virtual DtMessageFactory& makRadarFx::DtRadarFxConnector::messageFactory ( )
inlinevirtual

Gets the message factory for all messages.

The user can add new message decoders to this factory

virtual unsigned int makRadarFx::DtRadarFxConnector::nextId ( )
virtual

You can use this to get the next id for a message if your callback system needs to keep track of responses if any message being sent leaves the id field as 0, this function will be used to generate an id.

virtual std::string& makRadarFx::DtRadarFxConnector::requesterName ( )
virtual

this provides a unique name for the requester.

It is generated from the IP address and PID of the running application if any message being sent leaves the requester field blank, this function will be used to generate a requester names

static double makRadarFx::DtRadarFxConnector::defaultRetryTimeout ( )
static

The default timeout for retrying. The default value is 5.

static void makRadarFx::DtRadarFxConnector::setDefaultRetryTimeout ( double  val)
static

Sets the default retry timout. Value is in seconds.

static double makRadarFx::DtRadarFxConnector::defaultHeartbeatTimeout ( )
static

the default hearbeat timeout. The default is 2.5 seconds.

static void makRadarFx::DtRadarFxConnector::setDefaultHeatbeatTimeout ( double  val)
static

sets the default heartbeat timeout. Value is in seconds.

DtInetAddr makRadarFx::DtRadarFxConnector::findFirstNetworkDeviceAddress ( bool &  found) const
protected
static void makRadarFx::DtRadarFxConnector::workerFunction ( void *  data,
volatile bool *  stop 
)
staticprotected

Member Data Documentation

DtMessageHandler makRadarFx::DtRadarFxConnector::myMessageHandler
protected
std::list<DtConnectionDelegate> makRadarFx::DtRadarFxConnector::myConnectionCallbacks
protected
std::list<DtConnectionDelegate> makRadarFx::DtRadarFxConnector::myDisconnectionCallbacks
protected
DtMessageFactory makRadarFx::DtRadarFxConnector::myMessageFactory
protected
unsigned int makRadarFx::DtRadarFxConnector::myNextId
protected
std::string makRadarFx::DtRadarFxConnector::myRequestorName
protected
DtLocklessQueue<DtBaseMessage*> makRadarFx::DtRadarFxConnector::myOutgoingQueue
protected
DtLocklessQueue<DtBaseMessage*> makRadarFx::DtRadarFxConnector::myIncomingQueue
protected
DtThread* makRadarFx::DtRadarFxConnector::myWorkerThread
protected
DtInetTcpSocket* makRadarFx::DtRadarFxConnector::mySocket
protected
bool makRadarFx::DtRadarFxConnector::myShouldRetryConnect
protected
double makRadarFx::DtRadarFxConnector::myRetryTimeout
protected
std::string makRadarFx::DtRadarFxConnector::myAddress
protected
int makRadarFx::DtRadarFxConnector::myPort
protected
bool makRadarFx::DtRadarFxConnector::myShouldQuit
protected
double makRadarFx::DtRadarFxConnector::theDefaultHeatbeatTimeout
staticprotected
double makRadarFx::DtRadarFxConnector::theDefaultRetryTimeout
staticprotected

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

Document ID: 1.0
Copyright © 2017 VT MAK Inc. All Rights Reserved (www.mak.com)