| 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::Server Class Referenceabstract
Infrastructure » Server

Based server functionality. More...

`#include <erpc_server.h>`

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

## Public Member Functions
| 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...
virtual erpc_status_t | run (void)=0
| This function runs the server.
virtual void | stop (void)=0
| This function stop the server.
Public Member Functions inherited from erpc::ClientServerCommon
| ClientServerCommon (void)
| ClientServerCommon constructor.
| ~ClientServerCommon (void)
| ClientServerCommon destructor.

## Protected Member Functions
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
MessageBufferFactory * | m_messageFactory
CodecFactory * | m_codecFactory
Transport * | m_transport
Service * | m_firstService

## Detailed Description

Based server functionality.

## Constructor & Destructor Documentation

erpc::Server::Server | ( | void |  | ) |
| inline

Constructor.

This function initializes object attributes.

## Member Function Documentation

void erpc::Server::setMessageBufferFactory | ( | MessageBufferFactory * | factory | ) |
| inline

Set MessageBufferFactory to use.

Parameters

  [in] | factory | MessageBufferFactory to use.

void erpc::Server::setCodecFactory | ( | CodecFactory * | factory | ) |
| inline

Set CodecFactory to use.

Parameters

  [in] | factory | CodecFactory to use.

void Server::setTransport | ( | Transport * | transport | ) |

This function sets transport layer to use.

It also set messageBufferFactory to the same as in transport layer.

Parameters

  [in] | transport | Transport layer to use.

void Server::addService | ( | Service * | service | ) |

Add service.

Parameters

  [in] | service | Service to use.

void Server::removeService | ( | Service * | service | ) |

Remove service.

Parameters

  [in] | service | Service to remove.

erpc_status_t Server::processMessage | ( | Codec * | codec,
|  | message_type_t | msgType,
|  | uint32_t | serviceId,
|  | uint32_t | methodId,
|  | uint32_t | sequence
| ) |  |
| protected virtual

Process message.

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 codec startReadMessage.

erpc_status_t Server::readHeadOfMessage | ( | Codec * | codec,
|  | message_type_t & | msgType,
|  | uint32_t & | serviceId,
|  | uint32_t & | methodId,
|  | uint32_t & | sequence
| ) |  |
| protected virtual

Read head of message to identify type of message.

Parameters

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

Service * Server::findServiceWithId | ( | uint32_t | serviceId | ) |
| protected virtual

This function finds service base on service ID.

Parameters

  [in] | serviceId | Service id number.

Returns
  Pointer to service or NULL.

## Member Data Documentation

MessageBufferFactory* erpc::Server::m_messageFactory
| protected

Contains MessageBufferFactory to use.

CodecFactory* erpc::Server::m_codecFactory
| protected

Contains CodecFactory to use.

Transport* erpc::Server::m_transport
| protected

Transport layer used to send and receive data.

Service* erpc::Server::m_firstService
| protected

Contains pointer to first service.

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

- erpc_server.h
- erpc_server.cpp