Implements TCP server, that can respond to events, and the FSM. More...
#include <plati_server_tcp.hpp>
Public Member Functions | |
PlatiServer_TCP (boost::asio::io_service &io_service, const ServerParams ¶ms) | |
void | startServer () |
void | configureFSM (bool useTimeOut, int timeOutDuration) |
void | getResponseData (int receptionStatus) |
Concrete implementation of base class virtual function. More... | |
void | assignGraph (const PlatinumData_graph &dataGraph) |
void | cb_ignoredEvents (fsmn::En_ServerStatus st, fsmn::En_Events ev) |
Running this means we have received an unexpected command. In response, we send a Cancel message and trigger the "Cancel" Inner Event. More... | |
void | callback_def (int) |
Default callback, does nothing. More... | |
void | callback_S0 (int) |
Initial state callback: fsmn::SS0. More... | |
void | callback_S1 (int) |
Callback for state fsmn::SS1. More... | |
void | callback_S2_1 (int) |
Callback for state fsmn::SS2_1, fills the response data buffer. More... | |
void | callback_S2_2A (int) |
Callback for state fsmn::SS2_2A, fills the response data buffer. More... | |
void | callback_S2_2B (int) |
Callback for state fsmn::SS2_2B, fills the response data buffer. More... | |
void | callback_S3 (int) |
Callback for state fsmn::SS3 We have received a RNS message (see fsmn::ev_RequSph), so we send the requested sphere. More... | |
void | callback_TR (int) |
"target reached" callback, state fsmn::SS_TR. See prot::MT_TR and fsmn::ev_TargetReached More... | |
void | callback_S5 (int) |
Callback for state fsmn::SS5, navigation is done. More... | |
void | callback_RDI (int) |
callback for fsmn::SS_RDI. Read Difference Images from client, and save them More... | |
void | callback_TM1 (int) |
Test Mode 1 callback (WIP) More... | |
void | callback_TO (int) |
void | callback_SD (int) |
Send the server information (stats) to client. Called on state fsmn::SS_ServerDataRequ. See NetworkRxStats. More... | |
void | callback_Cancelled (int) |
Called upon reaching "cancel" state. We build no Tx buffer because this is a "pass-state", the FSM switches right away to Initial state. More... | |
void | callback_timeOut (int) |
Public Member Functions inherited from TcpServerAsync | |
TcpServerAsync (boost::asio::io_service &io_service, int port) | |
void | startAsyncWait () |
Public Attributes | |
fsm_t | fsm |
Private Member Functions | |
void | computeAndSendPath () |
Helper member function for the two navigation requests methods. More... | |
void | buildSimpleMessage (prot::En_MessageType mt) |
Helper member function for callback functions. More... | |
void | buildErrorMessage (En_ErrorType, En_ErrorSeverity) |
Helper member function for callback functions, used for errors. More... | |
bool | callRecognitionProgram (std::string) |
Helper function for callback PlatiServer_TCP::callback_S2_2B() More... | |
StateInfo | getStateInfo () const |
Private Attributes | |
const PlatinumData_graph * | _dataGraphPtr = nullptr |
pointer on associated graph More... | |
CurrentTransaction | _transactionData |
holds the data associated to the current navigation transaction, from initial contact to path completion. More... | |
const ServerParams & | _serverParams |
parameters More... | |
Additional Inherited Members | |
Protected Attributes inherited from TcpServerAsync | |
NetworkRxStats | _rxServerStats |
BufferRx_t | _rx_buff_srv |
received data is stored here More... | |
size_t | _rx_nb_bytes |
nb of bytes read (at each reception operation) More... | |
size_t | _rxCounter =0 |
incremented at each (completely) received frame More... | |
size_t | _txCounter =0 |
incremented at each sent frame More... | |
std::vector< BYTE > | _tx_buff |
output (TX) buffer More... | |
int | _receptionStatus = 0 |
0 if ok, any other value means we were unable to receive the data, so we must respond to the client accordingly More... | |
Implements TCP server, that can respond to events, and the FSM.
|
inline |
|
inline |
|
private |
Helper member function for callback functions, used for errors.
|
private |
Helper member function for callback functions.
void callback_Cancelled | ( | int | ) |
Called upon reaching "cancel" state. We build no Tx buffer because this is a "pass-state", the FSM switches right away to Initial state.
void callback_def | ( | int | ) |
Default callback, does nothing.
void callback_RDI | ( | int | ) |
callback for fsmn::SS_RDI. Read Difference Images from client, and save them
void callback_S0 | ( | int | ) |
Initial state callback: fsmn::SS0.
void callback_S1 | ( | int | ) |
Callback for state fsmn::SS1.
We have received an "Initial Contact" from a client, we send back information on the graph
void callback_S2_1 | ( | int | ) |
Callback for state fsmn::SS2_1, fills the response data buffer.
void callback_S2_2A | ( | int | ) |
Callback for state fsmn::SS2_2A, fills the response data buffer.
void callback_S2_2B | ( | int | ) |
Callback for state fsmn::SS2_2B, fills the response data buffer.
void callback_S3 | ( | int | ) |
Callback for state fsmn::SS3 We have received a RNS message (see fsmn::ev_RequSph), so we send the requested sphere.
void callback_S5 | ( | int | ) |
Callback for state fsmn::SS5, navigation is done.
Switching to this state is done using an internal event, no message received from client, thus we don't send anything (filling the buffer has been done on previous state)
void callback_SD | ( | int | ) |
Send the server information (stats) to client. Called on state fsmn::SS_ServerDataRequ. See NetworkRxStats.
void callback_timeOut | ( | int | ) |
void callback_TM1 | ( | int | ) |
Test Mode 1 callback (WIP)
here, we do NOT use buildImageFromBuffer() because the data send is actually random (or empty), it does not correspond to a "real" image.
void callback_TO | ( | int | ) |
void callback_TR | ( | int | ) |
"target reached" callback, state fsmn::SS_TR. See prot::MT_TR and fsmn::ev_TargetReached
|
private |
Helper function for callback PlatiServer_TCP::callback_S2_2B()
Return false in case of error, nothing is send here!
Results will be stored in _transactionData
Calls code from https://github.com/npiasco/platinum_sphere_request
void cb_ignoredEvents | ( | fsmn::En_ServerStatus | st, |
fsmn::En_Events | ev | ||
) |
Running this means we have received an unexpected command. In response, we send a Cancel message and trigger the "Cancel" Inner Event.
|
private |
Helper member function for the two navigation requests methods.
void configureFSM | ( | bool | useTimeOut, |
int | timeOutDuration | ||
) |
|
virtual |
Concrete implementation of base class virtual function.
This is the place where:
the event is processed through the FSM:
The input argument receptionStatus
will have value 0 if everything is okay
Implements TcpServerAsync.
|
inlineprivate |
|
inline |
|
private |
pointer on associated graph
|
private |
parameters
|
private |
holds the data associated to the current navigation transaction, from initial contact to path completion.
fsm_t fsm |