Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
PlatiServer_TCP Class Reference

Implements TCP server, that can respond to events, and the FSM. More...

#include <plati_server_tcp.hpp>

Inheritance diagram for PlatiServer_TCP:
Inheritance graph
[legend]
Collaboration diagram for PlatiServer_TCP:
Collaboration graph
[legend]

Public Member Functions

 PlatiServer_TCP (boost::asio::io_service &io_service, const ServerParams &params)
 
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...
 

Detailed Description

Implements TCP server, that can respond to events, and the FSM.

Constructor & Destructor Documentation

◆ PlatiServer_TCP()

PlatiServer_TCP ( boost::asio::io_service &  io_service,
const ServerParams params 
)
inline
Here is the call graph for this function:

Member Function Documentation

◆ assignGraph()

void assignGraph ( const PlatinumData_graph dataGraph)
inline
Here is the caller graph for this function:

◆ buildErrorMessage()

void buildErrorMessage ( En_ErrorType  et,
En_ErrorSeverity  es 
)
private

Helper member function for callback functions, used for errors.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildSimpleMessage()

void buildSimpleMessage ( prot::En_MessageType  mt)
private

Helper member function for callback functions.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_Cancelled()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_def()

void callback_def ( int  )

Default callback, does nothing.

Here is the caller graph for this function:

◆ callback_RDI()

void callback_RDI ( int  )

callback for fsmn::SS_RDI. Read Difference Images from client, and save them

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_S0()

void callback_S0 ( int  )

Initial state callback: fsmn::SS0.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_S1()

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_S2_1()

void callback_S2_1 ( int  )

Callback for state fsmn::SS2_1, fills the response data buffer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_S2_2A()

void callback_S2_2A ( int  )

Callback for state fsmn::SS2_2A, fills the response data buffer.

  • we have received a image-based navigation request
  • we send an Acknowledge message
Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_S2_2B()

void callback_S2_2B ( int  )

Callback for state fsmn::SS2_2B, fills the response data buffer.

  • we have received an image-based navigation request (an image, that we store locally so that it can be used by the place recognition program).
  • we send the path information (nb of spheres, total length). See prot::ND_PathInfo

See callRecognitionProgram()

Todo:
2018-07-19: At present, only the first image is used. Fix this
Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_S3()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_S5()

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)

Here is the caller graph for this function:

◆ callback_SD()

void callback_SD ( int  )

Send the server information (stats) to client. Called on state fsmn::SS_ServerDataRequ. See NetworkRxStats.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_timeOut()

void callback_timeOut ( int  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_TM1()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callback_TO()

void callback_TO ( int  )

◆ callback_TR()

void callback_TR ( int  )

"target reached" callback, state fsmn::SS_TR. See prot::MT_TR and fsmn::ev_TargetReached

Here is the call graph for this function:
Here is the caller graph for this function:

◆ callRecognitionProgram()

bool callRecognitionProgram ( std::string  rootFileName)
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

Todo:
a changer pour utiliser une autre base de données
Here is the caller graph for this function:

◆ cb_ignoredEvents()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeAndSendPath()

void computeAndSendPath ( )
private

Helper member function for the two navigation requests methods.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configureFSM()

void configureFSM ( bool  useTimeOut,
int  timeOutDuration 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getResponseData()

void getResponseData ( int  receptionStatus)
virtual

Concrete implementation of base class virtual function.

This is the place where:

  • the message is analyzed and converted into the corresponding event,
  • the event is processed through the FSM:

    • processing of the received message (through a call to the callback function)
    • filling the transmission buffer with data

    The input argument receptionStatus will have value 0 if everything is okay

Implements TcpServerAsync.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStateInfo()

StateInfo getStateInfo ( ) const
inlineprivate
Here is the caller graph for this function:

◆ startServer()

void startServer ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _dataGraphPtr

const PlatinumData_graph* _dataGraphPtr = nullptr
private

pointer on associated graph

◆ _serverParams

const ServerParams& _serverParams
private

parameters

◆ _transactionData

CurrentTransaction _transactionData
private

holds the data associated to the current navigation transaction, from initial contact to path completion.

◆ fsm

fsm_t fsm

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