eRPC API Reference  Rev. 1.7.0
NXP Semiconductors
erpc_simple_server.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2014, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  *
8  * Redistribution and use in source and binary forms, with or without modification,
9  * are permitted (subject to the limitations in the disclaimer below) provided
10  * that the following conditions are met:
11  *
12  * o Redistributions of source code must retain the above copyright notice, this list
13  * of conditions and the following disclaimer.
14  *
15  * o Redistributions in binary form must reproduce the above copyright notice, this
16  * list of conditions and the following disclaimer in the documentation and/or
17  * other materials provided with the distribution.
18  *
19  * o Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef _EMBEDDED_RPC__SIMPLE_SERVER_H_
37 #define _EMBEDDED_RPC__SIMPLE_SERVER_H_
38 
39 #include "erpc_server.h"
40 
47 // Classes
50 
51 namespace erpc {
57 class SimpleServer : public Server
58 {
59 public:
66  : m_isServerOn(true)
67  {
68  }
69 
73  virtual ~SimpleServer(void);
74 
80  virtual erpc_status_t run(void);
81 
91  virtual erpc_status_t poll(void);
92 
96  virtual void stop(void);
97 
98 protected:
111  erpc_status_t runInternalBegin(Codec **codec, MessageBuffer &buff, message_type_t &msgType, uint32_t &serviceId,
112  uint32_t &methodId, uint32_t &sequence);
113 
125  erpc_status_t runInternalEnd(Codec *codec, message_type_t msgType, uint32_t serviceId, uint32_t methodId,
126  uint32_t sequence);
127 
128 #if ERPC_NESTED_CALLS
129 
134  virtual erpc_status_t run(RequestContext &request);
135 #endif
136 
144 
150  void disposeBufferAndCodec(Codec *codec);
151 
153 };
154 
155 } // namespace erpc
156 
159 #endif // _EMBEDDED_RPC__SIMPLE_SERVER_H_
virtual ~SimpleServer(void)
SimpleServer destructor.
Definition: erpc_simple_server.cpp:44
int32_t erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:112
message_type_t
Types of messages that can be encoded.
Definition: erpc_codec.h:59
erpc_status_t runInternal(void)
Run server implementation.
Definition: erpc_simple_server.cpp:66
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.
Definition: erpc_simple_server.cpp:141
virtual erpc_status_t poll(void)
Run server implementation only if exist message to process.
Definition: erpc_simple_server.cpp:235
Abstract serialization encoder/decoder interface.
Definition: erpc_codec.h:76
virtual void stop(void)
This function sets server from ON to OFF.
Definition: erpc_simple_server.cpp:251
SimpleServer(void)
Constructor.
Definition: erpc_simple_server.h:65
bool m_isServerOn
Definition: erpc_simple_server.h:152
virtual erpc_status_t run(void)
Run server in infinite loop.
Definition: erpc_simple_server.cpp:174
Based server functionality.
Definition: erpc_server.h:133
Represents a memory buffer containing a message.
Definition: erpc_message_buffer.h:62
Definition: erpc_arbitrated_client_manager.h:51
void disposeBufferAndCodec(Codec *codec)
Disposing message buffers and codecs.
Definition: erpc_simple_server.cpp:54
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.
Definition: erpc_simple_server.cpp:86
Based server implementation.
Definition: erpc_simple_server.h:57
Encapsulates all information about a request.
Definition: erpc_client_manager.h:245