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
74#ifndef PW_RPC_USE_GLOBAL_MUTEX
75#define PW_RPC_USE_GLOBAL_MUTEX 1
102#ifndef PW_RPC_YIELD_MODE
103#if PW_RPC_USE_GLOBAL_MUTEX == 0
104#define PW_RPC_YIELD_MODE PW_RPC_YIELD_MODE_BUSY_LOOP
106#define PW_RPC_YIELD_MODE PW_RPC_YIELD_MODE_SLEEP
116#define PW_RPC_YIELD_MODE_BUSY_LOOP 100
117#define PW_RPC_YIELD_MODE_SLEEP 101
118#define PW_RPC_YIELD_MODE_YIELD 102
125#ifndef PW_RPC_YIELD_SLEEP_DURATION
129#if defined(_WIN32) || defined(__APPLE__) || \
130 defined(__linux__) && !defined(__ZEPHYR__)
131#define PW_RPC_YIELD_SLEEP_DURATION std::chrono::milliseconds(1)
133#define PW_RPC_YIELD_SLEEP_DURATION pw::chrono::SystemClock::duration(1)
140#if PW_RPC_YIELD_MODE != PW_RPC_YIELD_MODE_SLEEP
141#undef PW_RPC_YIELD_SLEEP_DURATION
159#ifndef PW_RPC_CALLBACK_TIMEOUT_TICKS
160#define PW_RPC_CALLBACK_TIMEOUT_TICKS 10000
181#ifndef PW_RPC_DYNAMIC_ALLOCATION
182#define PW_RPC_DYNAMIC_ALLOCATION 0
185#if defined(PW_RPC_DYNAMIC_CONTAINER) || \
186 defined(PW_RPC_DYNAMIC_CONTAINER_INCLUDE)
188 PW_RPC_DYNAMIC_ALLOCATION == 1,
189 "PW_RPC_DYNAMIC_ALLOCATION is disabled, so PW_RPC_DYNAMIC_CONTAINER and "
190 "PW_RPC_DYNAMIC_CONTAINER_INCLUDE have no effect and should not be set.");
207#ifndef PW_RPC_DYNAMIC_CONTAINER
208#define PW_RPC_DYNAMIC_CONTAINER(type) std::vector<type>
216#ifndef PW_RPC_DYNAMIC_CONTAINER_INCLUDE
217#define PW_RPC_DYNAMIC_CONTAINER_INCLUDE <vector>
224#ifndef PW_RPC_MAKE_UNIQUE_PTR
225#define PW_RPC_MAKE_UNIQUE_PTR(type, ...) \
226 std::unique_ptr<type>(new type(__VA_ARGS__))
232#ifndef PW_RPC_MAKE_UNIQUE_PTR_INCLUDE
233#define PW_RPC_MAKE_UNIQUE_PTR_INCLUDE <memory>
239#ifndef PW_RPC_ENCODING_BUFFER_SIZE_BYTES
240#define PW_RPC_ENCODING_BUFFER_SIZE_BYTES 512
244#ifndef PW_RPC_CONFIG_LOG_LEVEL
245#define PW_RPC_CONFIG_LOG_LEVEL PW_LOG_LEVEL_INFO
249#ifndef PW_RPC_CONFIG_LOG_MODULE_NAME
250#define PW_RPC_CONFIG_LOG_MODULE_NAME "PW_RPC"
253namespace pw::rpc::cfg {
255template <
typename...>
256constexpr std::bool_constant<PW_RPC_COMPLETION_REQUEST_CALLBACK>
257 kClientStreamEndCallbackEnabled;
259template <
typename...>
260constexpr std::bool_constant<PW_RPC_METHOD_STORES_TYPE> kMethodStoresType;
262template <
typename...>
263constexpr std::bool_constant<PW_RPC_DYNAMIC_ALLOCATION>
264 kDynamicAllocationEnabled;
266inline constexpr size_t kNanopbStructMinBufferSize =
267 PW_RPC_NANOPB_STRUCT_MIN_BUFFER_SIZE;
269inline constexpr size_t kEncodingBufferSizeBytes =
270 PW_RPC_ENCODING_BUFFER_SIZE_BYTES;
272#undef PW_RPC_NANOPB_STRUCT_MIN_BUFFER_SIZE
273#undef PW_RPC_ENCODING_BUFFER_SIZE_BYTES
281#ifndef PW_RPC_NANOPB_STRUCT_BUFFER_STACK_ALLOCATE
282#define PW_RPC_NANOPB_STRUCT_BUFFER_STACK_ALLOCATE 1
286#if PW_RPC_NANOPB_STRUCT_BUFFER_STACK_ALLOCATE
287#define _PW_RPC_NANOPB_STRUCT_STORAGE_CLASS
289#define _PW_RPC_NANOPB_STRUCT_STORAGE_CLASS static
292#undef PW_RPC_NANOPB_STRUCT_BUFFER_STACK_ALLOCATE