| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
erpc::SimpleServer Class Reference
Infrastructure » Server

Based server implementation. More...

`#include <erpc_simple_server.h>`

Inheritance diagram for erpc::SimpleServer:
[legend]
Collaboration diagram for erpc::SimpleServer:
[legend]

## 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)
| ClientManager destructor.
void | setMessageBufferFactory (MessageBufferFactory *factory)
| Set MessageBufferFactory to use. More...
void | setCodecFactory (CodecFactory *factory)
| Set CodecFactory to use. More...
void | setTransport (Transport *transport)
| This function sets transport layer to use. More...
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.

## Protected Member Functions
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...
erpc_status_t | runInternal (void)
| Run server implementation. 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 Service * | findServiceWithId (uint32_t serviceId)
| This function finds service base on service ID. More...

## Protected Attributes
bool | m_isServerOn
Protected Attributes inherited from erpc::Server
MessageBufferFactory * | m_messageFactory
CodecFactory * | m_codecFactory
Transport * | m_transport
Service * | m_firstService

## Detailed Description

Based server implementation.

## Constructor & Destructor Documentation

erpc::SimpleServer::SimpleServer | ( | void |  | ) |
| inline

Constructor.

This function initializes object attributes.

## Member Function Documentation

erpc_status_t SimpleServer::run | ( | void |  | ) |
| override virtual

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::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] | codec | Inout codec to use.
  [in] | buff | Inout codec to use.
  [out] | msgType | Type of received message. Based on message type will be (will be not) sent respond.
  [out] | serviceId | To identify interface.
  [out] | methodId | To identify function in interface.
  [out] | sequence | To 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] | codec | Inout codec to use.
  [in] | msgType | Type of received message. Based on message type will be (will be not) sent respond.
  [in] | serviceId | To identify interface.
  [in] | methodId | To identify function in interface.
  [in] | sequence | To connect correct answer with correct request.

Returns
  kErpcStatus_Success or based on service handleInvocation.

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.

void SimpleServer::disposeBufferAndCodec | ( | Codec * | codec | ) |
| protected

Disposing message buffers and codecs.

Parameters

  [in] | codec | Pointer 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:

- erpc_simple_server.h
- erpc_simple_server.cpp