eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc::SimpleServer Class Reference

Based server implementation. More...

#include <erpc_simple_server.hpp>

+ Inheritance diagram for erpc::SimpleServer:
+ Collaboration diagram for erpc::SimpleServer:

Public Member Functions

 SimpleServer (void)
 Constructor. More...
 
virtual erpc_status_t run (void) override
 Run server in infinite loop. More...
 
virtual erpc_status_t poll (void)
 Run server implementation only if exist message to process. More...
 
virtual void stop (void) override
 This function sets server from ON to OFF.
 
- Public Member Functions inherited from erpc::Server
 Server (void)
 Constructor. More...
 
virtual ~Server (void)
 Server destructor.
 
void addService (Service *service)
 Add service. More...
 
void removeService (Service *service)
 Remove service. More...
 
- Public Member Functions inherited from erpc::ClientServerCommon
 ClientServerCommon (void)
 ClientServerCommon constructor.
 
 ~ClientServerCommon (void)
 ClientServerCommon destructor.
 
void setMessageBufferFactory (MessageBufferFactory *factory)
 This function sets message buffer factory to use. More...
 
void setCodecFactory (CodecFactory *factory)
 This function sets codec factory to use. More...
 
CodecFactorygetCodecFactory (void)
 This function sets codec factory to use. More...
 
void setTransport (Transport *transport)
 This function sets transport layer to use. More...
 
TransportgetTransport (void)
 This function gets transport instance. More...
 

Protected Member Functions

erpc_status_t runInternal (void)
 Run server implementation. More...
 
erpc_status_t runInternalBegin (Codec **codec, MessageBuffer &buff, message_type_t &msgType, uint32_t &serviceId, uint32_t &methodId, uint32_t &sequence)
 This function handle receiving request message and reading base info about message. More...
 
erpc_status_t runInternalEnd (Codec *codec, message_type_t msgType, uint32_t serviceId, uint32_t methodId, uint32_t sequence)
 This function process message and handle sending respond. More...
 
void disposeBufferAndCodec (Codec *codec)
 Disposing message buffers and codecs. More...
 
- Protected Member Functions inherited from erpc::Server
virtual erpc_status_t processMessage (Codec *codec, message_type_t msgType, uint32_t serviceId, uint32_t methodId, uint32_t sequence)
 Process message. More...
 
virtual erpc_status_t readHeadOfMessage (Codec *codec, message_type_t &msgType, uint32_t &serviceId, uint32_t &methodId, uint32_t &sequence)
 Read head of message to identify type of message. More...
 
virtual ServicefindServiceWithId (uint32_t serviceId)
 This function finds service base on service ID. More...
 

Protected Attributes

bool m_isServerOn
 
- Protected Attributes inherited from erpc::Server
Servicem_firstService
 
- Protected Attributes inherited from erpc::ClientServerCommon
MessageBufferFactorym_messageFactory
 Message buffer factory to use.
 
CodecFactorym_codecFactory
 Codec to use.
 
Transportm_transport
 Transport layer to use.
 

Detailed Description

Based server implementation.

Constructor & Destructor Documentation

SimpleServer::SimpleServer ( void  )

Constructor.

This function initializes object attributes.

Member Function Documentation

erpc_status_t SimpleServer::run ( void  )
overridevirtual

Run server in infinite loop.

Will never jump out from this function.

Implements erpc::Server.

erpc_status_t SimpleServer::poll ( void  )
virtual

Run server implementation only if exist message to process.

If is message to process, server process it and jumps out from this function, useful for bare-metal because doesn't block main loop, when are not messages to process.

Returns
Return true when server is ON, else false.
erpc_status_t SimpleServer::runInternal ( void  )
protected

Run server implementation.

This function call functions for receiving data, process this data and if reply exist, send it back.

erpc_status_t SimpleServer::runInternalBegin ( Codec **  codec,
MessageBuffer buff,
message_type_t msgType,
uint32_t &  serviceId,
uint32_t &  methodId,
uint32_t &  sequence 
)
protected

This function handle receiving request message and reading base info about message.

Parameters
[in]codecInout codec to use.
[in]buffInout codec to use.
[out]msgTypeType of received message. Based on message type will be (will be not) sent respond.
[out]serviceIdTo identify interface.
[out]methodIdTo identify function in interface.
[out]sequenceTo connect correct answer with correct request.
Returns
kErpcStatus_Success or based on service handleInvocation.
erpc_status_t SimpleServer::runInternalEnd ( Codec codec,
message_type_t  msgType,
uint32_t  serviceId,
uint32_t  methodId,
uint32_t  sequence 
)
protected

This function process message and handle sending respond.

Parameters
[in]codecInout codec to use.
[in]msgTypeType of received message. Based on message type will be (will be not) sent respond.
[in]serviceIdTo identify interface.
[in]methodIdTo identify function in interface.
[in]sequenceTo connect correct answer with correct request.
Returns
kErpcStatus_Success or based on service handleInvocation.
void SimpleServer::disposeBufferAndCodec ( Codec codec)
protected

Disposing message buffers and codecs.

Parameters
[in]codecPointer to codec to dispose. It contains also message buffer to dispose.

Member Data Documentation

bool erpc::SimpleServer::m_isServerOn
protected

Information if server is ON or OFF.


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