VR-Vantage
Loading...
Searching...
No Matches
rfxServer.h
Go to the documentation of this file.
1/*********************************************************************************
2** Copyright (c) 2016 MAK Technologies, Inc.
3** All rights reserved.
4*********************************************************************************/
5
9
10#pragma once
11
13
16
17#include <map>
18#include <string>
20
21class DtThread;
22class DtInetSocket;
23class DtInetTcpSocket;
24class DtInetSocketMgr;
25
26namespace makVrv
27{
28 class DtDe;
29}
30
31namespace makRadarFx
32{
33 class DtRadarFxDriver;
34
35 //default port
36 const int DtRadarFXPort = 4567;
37
40 {
41 public:
42 //CTOR/DTOR
43 DtRadarFxServer(DtRadarFxDriver& driver, int port = 4567, bool allowMultiple=false);
45
47 virtual void initializeServer();
48 virtual void shutdownServer();
49
52 virtual void setPort(int port);
53
55 virtual int port() const;
56
60 virtual void sendMessage(DtBaseMessage& request);
61
64
65 static double defaultHeartbeatTimeout();
66 static void setDefaultHeatbeatTimeout(double val);
67
68 protected:
70 virtual bool handleSocketAddition(DtInetSocket* socket);
71 virtual bool handleSocketRemoval(DtInetSocket* socket);
72
75 static bool socketAdditionCallback(DtInetSocket* sock, void* usr);
76 static bool socketRemovalCallback(DtInetSocket* sock, void* usr);
77
79
82 DtInetSocketMgr* mySocketManager;
83 int myPort;
84
86
88 static void workerFunction(void* usr, volatile bool* stop);
89 DtThread* myWorkerThread;
91
93
94 typedef std::map<std::string, DtInetTcpSocket*> ClientRequestMap;
96
97 typedef std::list<DtInetTcpSocket*> ClientSocketList;
99 };
100
103 {
104 public:
108
111
114 int port = 4567, bool allowMultiple=false);
115 };
116
117}
Contains makVrv::DtVirtualBaseClass class.
DtBaseMessage is the base class for all messages that can be sent between the server and the client.
Definition rfxMessage.h:26
Definition locklessQueue.h:21
DtRadarFxDriver is the main class that controls the processing flow of the RadarFX Server....
Definition rfxDriver.h:36
DtProcessFactory manages the creation of message processors.
Definition rfxServer.h:103
virtual DtRadarFxServer * create(DtRadarFxDriver &driver, int port=4567, bool allowMultiple=false)
Create a RadarFx Server.
static void registerInstance(makVrv::DtDe &de, DtRadarFxServerCreator *instance)
Register the creator instance with an IG.
static DtRadarFxServerCreator & instance(makVrv::DtDe &de)
Get the RadarFx Server creator instance for this IG object. defaults to returning an instance of this...
the DtRadarFxServer is the network server for receving and sending messages to attached clients.
Definition rfxServer.h:40
std::list< DtInetTcpSocket * > ClientSocketList
Definition rfxServer.h:97
static void workerFunction(void *usr, volatile bool *stop)
Function that will be called when the network worker thread is started.
int myPort
Definition rfxServer.h:83
static double defaultHeartbeatTimeout()
ClientRequestMap myClientRequestMap
Definition rfxServer.h:95
ClientSocketList myClientSockets
Definition rfxServer.h:98
virtual void initializeServer()
initialize and shutdown the TCP server
static double theDefaultHeatbeatTimeout
Definition rfxServer.h:92
virtual void shutdownServer()
virtual void sendMessage(DtBaseMessage &request)
queue a message for sending a message to the client described in the message this function makes a co...
virtual int port() const
Get the port the server has been configured to use.
DtThread * myWorkerThread
Definition rfxServer.h:89
bool myAllowMultipleClients
Definition rfxServer.h:85
virtual void setPort(int port)
Set the port the server will listen on. This will restart the server if the new port value is differe...
virtual bool handleSocketRemoval(DtInetSocket *socket)
bool myShouldQuit
Definition rfxServer.h:90
static bool socketAdditionCallback(DtInetSocket *sock, void *usr)
VR-Link callback when a connection is initiated. Calls handleSocketAddition() and handleSocketRemoval...
virtual DtBaseMessage * nextMessage()
Gets the next message from the connections, returns NULL if there are no more messages.
virtual bool handleSocketAddition(DtInetSocket *socket)
Handle a sockets connecting and disconnecting.
DtLocklessQueue< DtBaseMessage * > myOutgoingQueue
Definition rfxServer.h:80
DtRadarFxServer(DtRadarFxDriver &driver, int port=4567, bool allowMultiple=false)
static void setDefaultHeatbeatTimeout(double val)
static bool socketRemovalCallback(DtInetSocket *sock, void *usr)
std::map< std::string, DtInetTcpSocket * > ClientRequestMap
Definition rfxServer.h:94
DtInetSocketMgr * mySocketManager
Definition rfxServer.h:82
DtRadarFxDriver & myDriver
Definition rfxServer.h:78
DtLocklessQueue< DtBaseMessage * > myIncomingQueue
Definition rfxServer.h:81
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer,...
Definition DtDe.h:77
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators,...
Definition DtVirtualBaseClass.h:20
#define DT_DLL_RFXSERVER
Definition include/radarFxServer/export.h:15
Definition radarFxConnector.h:28
const int DtRadarFXPort
the default port the Radar FX server is listening on
Definition radarFxConnector.h:30
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
Defines the base class for all messages that can be sent between the server and the client.