eRPC
rpc_types.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <stdint.h>
8 #include <stdlib.h>
9 #include <type_traits>
10 #include "common.h"
11 
12 namespace erpc {
13 
14 // Forward declarations
15 class SSlot;
16 class MsgBuffer;
17 class ReqHandle;
18 
37 typedef void (*erpc_req_func_t)(ReqHandle *req_handle, void *context);
38 
49 typedef void (*erpc_cont_func_t)(void *context, void *tag);
50 
57 enum class ReqFuncType : uint8_t { kForeground, kBackground };
58 
63 class ReqFunc {
64  public:
65  erpc_req_func_t req_func;
66  ReqFuncType req_func_type;
67 
68  inline bool is_background() const {
69  return req_func_type == ReqFuncType::kBackground;
70  }
71 
72  ReqFunc() { req_func = nullptr; }
73 
74  ReqFunc(erpc_req_func_t req_func, ReqFuncType req_func_type)
76  rt_assert(req_func != nullptr, "Invalid Ops with null handler function");
77  }
78 
80  inline bool is_registered() const { return req_func != nullptr; }
81 };
82 } // namespace erpc
ReqFuncType
The possible kinds of request handlers. Foreground-mode handlers run in the thread that calls the eve...
Definition: rpc_types.h:57
The request handler registered by applications.
Definition: rpc_types.h:63
bool is_registered() const
Check if this request handler is registered.
Definition: rpc_types.h:80
ReqFuncType req_func_type
The handlers's mode (foreground/background)
Definition: rpc_types.h:66
erpc_req_func_t req_func
The handler function.
Definition: rpc_types.h:65