Macros | Typedefs | Functions | Variables
plati_server_tcp.cpp File Reference

This holds the implementation for all the server code functions (see class PlatiServer_TCP) More...

#include "plati_server_tcp.hpp"
#include "data_conv.hpp"
#include "helper_functions.hpp"
Include dependency graph for plati_server_tcp.cpp:

Macros

#define LOG_CALLBACK
 
#define LOG_FRAME_SERVER(a)
 
#define END_NAV_TRANSACTION(no_value, errval)
 Conveniency macro, called when a navigation transaction ends, for whatever reason. DOES NOT FILL THE BUFFER !!! More...
 

Typedefs

typedef std::function< void()> Callback_t
 

Functions

void callback_NR_ok (int)
 Callback for "Nav Request Done". See fsmn::SS_NRD Just stays there and wait for the event fsmn::ev_RequSph. More...
 

Variables

std::map< prot::En_MessageType, fsmn::En_Eventsg_event_map
 Mapping between messages received from client (prot::En_MessageType) and FSM events (fsmn::En_Events) More...
 
static std::map< fsmn::En_Events, std::string > event_strings
 FSM event strings. Gets assigned to the events, through Spaghetti. More...
 
static std::map< fsmn::En_ServerStatus, std::string > state_strings
 FSM states strings. Gets assigned to the states, through Spaghetti. More...
 

Detailed Description

This holds the implementation for all the server code functions (see class PlatiServer_TCP)

Macro Definition Documentation

◆ END_NAV_TRANSACTION

#define END_NAV_TRANSACTION (   no_value,
  errval 
)
Value:
{ \
LOGV << "Terminating current navigation, cause:" \
<< getString(En_NavOutcome::no_value) << '\n'; \
_transactionData.doneNav( En_NavOutcome::no_value, errval, fsm.getString( fsm.currentState() ), fsm.getString( fsm.previousState() ) ); \
}
std::string getString(En_ImageType en)
Definition: common_header.hpp:242

Conveniency macro, called when a navigation transaction ends, for whatever reason. DOES NOT FILL THE BUFFER !!!

Todo:
20181213: add some string in error message so server can send an explicit message to client

◆ LOG_CALLBACK

#define LOG_CALLBACK

◆ LOG_FRAME_SERVER

#define LOG_FRAME_SERVER (   a)
Value:
std::cout \
<< ( a==FRAME_TX?"-TX":(a==FRAME_RX?"\n-RX":"ERROR") ) \
<< '-' \
<< std::setfill('0') \
<< std::setw(4) \
<< ( a==FRAME_TX ? _txCounter : _rxCounter ) \
<< ": "
Definition: common_header.hpp:197
Definition: common_header.hpp:197

Typedef Documentation

◆ Callback_t

typedef std::function<void()> Callback_t

Function Documentation

◆ callback_NR_ok()

void callback_NR_ok ( int  )

Callback for "Nav Request Done". See fsmn::SS_NRD Just stays there and wait for the event fsmn::ev_RequSph.

Here is the caller graph for this function:

Variable Documentation

◆ event_strings

std::map<fsmn::En_Events,std::string> event_strings
static
Initial value:
= {
{ fsmn::ev_InitialContact, "InitialContact" }
,{ fsmn::ev_NavRequest_1, "NavRequest_1" }
,{ fsmn::ev_NavRequest_2, "NavRequest_2" }
,{ fsmn::ev_NavRequest_2_done, "NavRequest_2_done" }
,{ fsmn::ev_TargetReached, "TargetReached" }
,{ fsmn::ev_RequSph, "RequSph" }
,{ fsmn::ev_DoneTransmitDiff, "TD_Done" }
,{ fsmn::ev_SphImage, "SphImage" }
,{ fsmn::ev_RequImage, "RxQI" }
,{ fsmn::ev_DiffImage, "DiffImage" }
,{ fsmn::ev_Cancel_IE, "Cancel_IE" }
,{ fsmn::ev_CancelMsg, "CancelMsg" }
,{ fsmn::ev_test_mode_1, "TestMode" }
,{ fsmn::ev_ServerStatsRequ, "ServerStatsRequ" }
,{ fsmn::ev_TestModeRequ, "TestModeRequest" }
,{ fsmn::ev_StopServer, "StopServerRequest" }
}
image-based nav request
Definition: fsm_defs.hpp:63
holds Id
Definition: fsm_defs.hpp:60
reception of a query image. See Image Based Navigation request
Definition: fsm_defs.hpp:71
FSM Inner Event.
Definition: fsm_defs.hpp:69
Definition: fsm_defs.hpp:73
coordinates-based nav request
Definition: fsm_defs.hpp:62
Definition: fsm_defs.hpp:72
cancel current operation (message)
Definition: fsm_defs.hpp:76
done reception of images, for image-based nav request (inner event)
Definition: fsm_defs.hpp:64
Definition: fsm_defs.hpp:82
Definition: fsm_defs.hpp:79
sending differences of spheres
Definition: fsm_defs.hpp:67
stop server
Definition: fsm_defs.hpp:77
see prot::MT_ServerStatsRequ
Definition: fsm_defs.hpp:80
"Houston, the eagle has landed"
Definition: fsm_defs.hpp:66
cancel current operation (internal event)
Definition: fsm_defs.hpp:75
Request for Next Sphere.
Definition: fsm_defs.hpp:68

FSM event strings. Gets assigned to the events, through Spaghetti.

◆ g_event_map

std::map<prot::En_MessageType,fsmn::En_Events> g_event_map
Initial value:
= {
}
image-based nav request
Definition: fsm_defs.hpp:63
Request Next Sphere (client -> server). Server will respond with RGB sphere.
Definition: network_data.hpp:68
holds Id
Definition: fsm_defs.hpp:60
reception of a query image. See Image Based Navigation request
Definition: fsm_defs.hpp:71
Difference Image. Related: PlatiClient::loadAndSendDiffImage()
Definition: network_data.hpp:74
can be send either by client or server, to tell the partner that it can&#39;t continue. More information is given in payload, which will be ND_ErrorData
Definition: network_data.hpp:69
Definition: fsm_defs.hpp:73
Target Reached.
Definition: network_data.hpp:77
Definition: network_data.hpp:82
coordinates-based nav request
Definition: fsm_defs.hpp:62
Definition: network_data.hpp:81
Definition: network_data.hpp:72
Definition: fsm_defs.hpp:72
cancel current operation (message)
Definition: fsm_defs.hpp:76
Definition: fsm_defs.hpp:82
Initial Contact (IC)
Definition: network_data.hpp:63
navigation request (using location for "dest" and image for "from")
Definition: network_data.hpp:66
sending differences of spheres
Definition: fsm_defs.hpp:67
stop server
Definition: fsm_defs.hpp:77
see prot::MT_ServerStatsRequ
Definition: fsm_defs.hpp:80
"Houston, the eagle has landed"
Definition: fsm_defs.hpp:66
Definition: network_data.hpp:73
navigation request (using locations)
Definition: network_data.hpp:65
the client wants to get the servers inner data (stats, and so on). See fsmn::ev_ServerStatsRequ ...
Definition: network_data.hpp:78
Request for Next Sphere.
Definition: fsm_defs.hpp:68
Definition: network_data.hpp:76

Mapping between messages received from client (prot::En_MessageType) and FSM events (fsmn::En_Events)

Warning
Different messages can correspond to same transmitted data type

◆ state_strings

std::map<fsmn::En_ServerStatus,std::string> state_strings
static
Initial value:
= {
{ fsmn::SS_Timeout, "Timeout" }
,{ fsmn::SS0, "Init" }
,{ fsmn::SS1, "WaitNavRequ" }
,{ fsmn::SS2_1, "NR_Loc" }
,{ fsmn::SS2_2A, "NR_Im" }
,{ fsmn::SS2_2B, "WaitQI" }
,{ fsmn::SS_NRD, "NavRequDone" }
,{ fsmn::SS3, "SendSphIm" }
,{ fsmn::SS_TR, "TR" }
,{ fsmn::SS5, "DoneNav" }
,{ fsmn::SS_RDI, "SS_RDI" }
,{ fsmn::SS_Cancelled, "Cancelled" }
,{ fsmn::SS_ServerDataRequ, "ServerDataRequ" }
,{ fsmn::SS_TM_1, "testMode_1" }
}
timeout occurred, next state will be SS0
Definition: fsm_defs.hpp:47
WaitNavRequest. Callback: PlatiServer_TCP::callback_S1.
Definition: fsm_defs.hpp:36
compute path, for image-based navigation requests. Callback: PlatiServer_TCP::callback_S2_2A ...
Definition: fsm_defs.hpp:38
received request for server stats, send them. Callback: PlatiServer_TCP::callback_SD ...
Definition: fsm_defs.hpp:49
test mode 1: wait for reception of image, send back stats. Callback: PlatiServer_TCP::callback_TM1 ...
Definition: fsm_defs.hpp:51
Initial waiting state. Callback: PlatiServer_TCP::callback_S0.
Definition: fsm_defs.hpp:35
Target reached, will wait for reception of sphere differences. Callback: PlatiServer_TCP::callback_S4...
Definition: fsm_defs.hpp:43
Read Difference Images from client, and save them. Callback: PlatiServer_TCP::callback_RDI.
Definition: fsm_defs.hpp:45
Done transmission of difference of spheres. Callback: PlatiServer_TCP::callback_S5.
Definition: fsm_defs.hpp:44
Nav Request Done, waiting for sphere Seq request. Callback: callback_NR_ok.
Definition: fsm_defs.hpp:40
compute path, for image-based navigation requests. Callback: PlatiServer_TCP::callback_S2_2B ...
Definition: fsm_defs.hpp:39
compute path, for location-based navigation requests. Callback: PlatiServer_TCP::callback_S2_1 ...
Definition: fsm_defs.hpp:37
send Sphere image, and wait for next message. Callback: PlatiServer_TCP::callback_S3 ...
Definition: fsm_defs.hpp:41
reception of cancel message. Callback: PlatiServer_TCP::callback_Cancelled
Definition: fsm_defs.hpp:48

FSM states strings. Gets assigned to the states, through Spaghetti.