21#if defined(PW_RPC_CLIENT_STREAM_END_CALLBACK) && \
22 PW_RPC_CLIENT_STREAM_END_CALLBACK
24 "Warning PW_RPC_CLIENT_STREAM_END_CALLBACK is deprecated! " \
25 "Use PW_RPC_COMPLETION_REQUEST_CALLBACK instead.")
26#define PW_RPC_COMPLETION_REQUEST_CALLBACK 1
29#undef PW_RPC_CLIENT_STREAM_END_CALLBACK
42#ifndef PW_RPC_COMPLETION_REQUEST_CALLBACK
43#define PW_RPC_COMPLETION_REQUEST_CALLBACK 0
50#ifndef PW_RPC_METHOD_STORES_TYPE
51#define PW_RPC_METHOD_STORES_TYPE 0
66#ifndef PW_RPC_NANOPB_STRUCT_MIN_BUFFER_SIZE
67#define PW_RPC_NANOPB_STRUCT_MIN_BUFFER_SIZE 64
83#ifndef PW_RPC_USE_GLOBAL_MUTEX
84#define PW_RPC_USE_GLOBAL_MUTEX 1
111#ifndef PW_RPC_YIELD_MODE
112#if PW_RPC_USE_GLOBAL_MUTEX == 0
113#define PW_RPC_YIELD_MODE PW_RPC_YIELD_MODE_BUSY_LOOP
115#define PW_RPC_YIELD_MODE PW_RPC_YIELD_MODE_SLEEP
125#define PW_RPC_YIELD_MODE_BUSY_LOOP 100
126#define PW_RPC_YIELD_MODE_SLEEP 101
127#define PW_RPC_YIELD_MODE_YIELD 102
134#ifndef PW_RPC_YIELD_SLEEP_DURATION
138#if defined(_WIN32) || defined(__APPLE__) || \
139 defined(__linux__) && !defined(__ZEPHYR__)
140#define PW_RPC_YIELD_SLEEP_DURATION std::chrono::milliseconds(1)
142#define PW_RPC_YIELD_SLEEP_DURATION pw::chrono::SystemClock::duration(1)
149#if PW_RPC_YIELD_MODE != PW_RPC_YIELD_MODE_SLEEP
150#undef PW_RPC_YIELD_SLEEP_DURATION
168#ifndef PW_RPC_CALLBACK_TIMEOUT_TICKS
169#define PW_RPC_CALLBACK_TIMEOUT_TICKS 10000
190#ifndef PW_RPC_DYNAMIC_ALLOCATION
191#define PW_RPC_DYNAMIC_ALLOCATION 0
194#if defined(PW_RPC_DYNAMIC_CONTAINER) || \
195 defined(PW_RPC_DYNAMIC_CONTAINER_INCLUDE)
197 PW_RPC_DYNAMIC_ALLOCATION == 1,
198 "PW_RPC_DYNAMIC_ALLOCATION is disabled, so PW_RPC_DYNAMIC_CONTAINER and "
199 "PW_RPC_DYNAMIC_CONTAINER_INCLUDE have no effect and should not be set.");
216#ifndef PW_RPC_DYNAMIC_CONTAINER
217#define PW_RPC_DYNAMIC_CONTAINER(type) std::vector<type>
225#ifndef PW_RPC_DYNAMIC_CONTAINER_INCLUDE
226#define PW_RPC_DYNAMIC_CONTAINER_INCLUDE <vector>
233#ifndef PW_RPC_MAKE_UNIQUE_PTR
234#define PW_RPC_MAKE_UNIQUE_PTR(type, ...) \
235 std::unique_ptr<type>(new type(__VA_ARGS__))
241#ifndef PW_RPC_MAKE_UNIQUE_PTR_INCLUDE
242#define PW_RPC_MAKE_UNIQUE_PTR_INCLUDE <memory>
248#ifndef PW_RPC_ENCODING_BUFFER_SIZE_BYTES
249#define PW_RPC_ENCODING_BUFFER_SIZE_BYTES 512
253#ifndef PW_RPC_CONFIG_LOG_LEVEL
254#define PW_RPC_CONFIG_LOG_LEVEL PW_LOG_LEVEL_INFO
258#ifndef PW_RPC_CONFIG_LOG_MODULE_NAME
259#define PW_RPC_CONFIG_LOG_MODULE_NAME "PW_RPC"
262namespace pw::rpc::cfg {
264template <
typename...>
265constexpr std::bool_constant<PW_RPC_COMPLETION_REQUEST_CALLBACK>
266 kClientStreamEndCallbackEnabled;
268template <
typename...>
269constexpr std::bool_constant<PW_RPC_METHOD_STORES_TYPE> kMethodStoresType;
271template <
typename...>
272constexpr std::bool_constant<PW_RPC_DYNAMIC_ALLOCATION>
273 kDynamicAllocationEnabled;
275inline constexpr size_t kNanopbStructMinBufferSize =
276 PW_RPC_NANOPB_STRUCT_MIN_BUFFER_SIZE;
278inline constexpr size_t kEncodingBufferSizeBytes =
279 PW_RPC_ENCODING_BUFFER_SIZE_BYTES;
281#undef PW_RPC_NANOPB_STRUCT_MIN_BUFFER_SIZE
282#undef PW_RPC_ENCODING_BUFFER_SIZE_BYTES
290#ifndef PW_RPC_NANOPB_STRUCT_BUFFER_STACK_ALLOCATE
291#define PW_RPC_NANOPB_STRUCT_BUFFER_STACK_ALLOCATE 1
295#if PW_RPC_NANOPB_STRUCT_BUFFER_STACK_ALLOCATE
296#define _PW_RPC_NANOPB_STRUCT_STORAGE_CLASS
298#define _PW_RPC_NANOPB_STRUCT_STORAGE_CLASS static
301#undef PW_RPC_NANOPB_STRUCT_BUFFER_STACK_ALLOCATE