66
77/**
88 * @file
9- * @defgroup bt_rpc_cbkproxy Bluetooth RPC callback proxy API
9+ * @defgroup nrf_rpc_cbkproxy NRF RPC callback proxy API
1010 * @{
11- * @brief API for the Bluetooth RPC callback proxy.
11+ * @brief API for the NRF RPC callback proxy.
1212 */
1313
1414
15- #ifndef CBKPROXY_H
16- #define CBKPROXY_H
15+ #ifndef NRF_RPC_CBKPROXY_H
16+ #define NRF_RPC_CBKPROXY_H
1717
1818#include <stdint.h>
1919
20+ #ifdef __cplusplus
21+ extern "C" {
22+ #endif
23+
2024/** @brief Creates a handler for output callback proxy.
2125 *
2226 * It is a variadic macro that takes following parameters:
2327 *
24- * ''CBKPROXY_HANDLER (handler_name, callback_name, [return_type,]
28+ * ''NRF_RPC_CBKPROXY_HANDLER (handler_name, callback_name, [return_type,]
2529 * [handler_parameters, callback_arguments])''
2630 *
27- * @param handler_name name of the handler function that can ne passed to @ref
28- * cbkproxy_out_get() function.
29- * @param callback_name Callback that will be called by this handler. Best
30- * approach is to declare it as 'static inline' to make
31- * sure that handler and callback will be combined into
32- * one function during the optimization. This callback
33- * has the same parameters as the original one (provided
34- * in ''handler_parameters'') with following parameter
35- * appended to the end: ''uint32_t callback_slot''.
36- * @param return_type Optional return type of the callback. It must be
37- * convertable to ''uint32_t'' without lost of information.
38- * If it is ''void'' this macro parameter must be skipped.
39- * @param handler_parameters
40- * List of parameters with its types enclosed in
41- * parentheses, e.g. ''(uint8_t *buf, size_t len)''.
42- * This macro parameter is optional and must be skipped
43- * if callback does not take any parameres.
44- * @param callback_arguments
45- * List of arguments with the same names as in
46- * ''handler_parameters'' enclosed in parentheses,
47- * e.g. ''(buf, len)''. This macro parameter is optional
48- * and must be skipped if callback does not take any
49- * parameres.
31+ * @param ... - variadic number of parameters:
32+ *
33+ * handler_name - name of the handler function that can be passed to the
34+ * @ref nrf_rpc_cbkproxy_out_get() function.
35+ *
36+ * callback_name - callback that will be called by this handler. Best
37+ * approach is to declare it as 'static inline' to make
38+ * sure that handler and callback will be combined into
39+ * one function during the optimization. This callback
40+ * has the same parameters as the original one (provided
41+ * in ''handler_parameters'') with the following parameter
42+ * appended to the end: ''uint32_t callback_slot''.
43+ *
44+ * return_type - optional return type of the callback. It must be
45+ * convertible to ''uint32_t'' without a loss of information.
46+ * If it is ''void'' this macro parameter must be skipped.
47+ *
48+ * handler_parameters - list of parameters with its types enclosed in
49+ * parentheses, for example, ''(uint8_t *buf, size_t len)''.
50+ * This macro parameter is optional and must be skipped
51+ * if the callback does not take any parameters.
52+ *
53+ * callback_arguments - list of arguments with the same names as in
54+ * ''handler_parameters'' enclosed in parentheses,
55+ * for example, ''(buf, len)''. This macro parameter is optional
56+ * and must be skipped if the callback does not take any parameters.
5057 */
51- #define CBKPROXY_HANDLER (...) \
58+ #define NRF_RPC_CBKPROXY_HANDLER (...) \
5259 _CBKPROXY_HANDLER_CAT(_CBKPROXY_HANDLER_, _CBKPROXY_HANDLER_CNT(__VA_ARGS__)) (__VA_ARGS__)
5360#define _CBKPROXY_HANDLER_CNT2 (a , b , c , d , e , f , ...) f
5461#define _CBKPROXY_HANDLER_CNT (...) \
94101 * in multiple source files.
95102 *
96103 * All parameter must be the same as in related handler defined by
97- * the CBKPROXY_HANDLER macro except callback_name which should be skipped in this macro.
104+ * the NRF_RPC_CBKPROXY_HANDLER macro except callback_name which should be skipped in this macro.
98105 */
99- #define CBKPROXY_HANDLER_DECL (...) _CBKPROXY_HANDLER_CAT(_CBKPROXY_HANDLER_DECL_, \
106+ #define NRF_RPC_CBKPROXY_HANDLER_DECL (...) _CBKPROXY_HANDLER_CAT(_CBKPROXY_HANDLER_DECL_, \
100107 _CBKPROXY_HANDLER_DECL_CNT(__VA_ARGS__)) (__VA_ARGS__)
101108#define _CBKPROXY_HANDLER_DECL_CNT (...) \
102109 _CBKPROXY_HANDLER_CNT2(_, __VA_ARGS__, RET_PARAM, VOID_PARAM, RET_VOID, VOID_VOID)
121128 *
122129 * @param index Slot index.
123130 * @param handler Pointer to handler function. The function has to be created
124- * by the @ref CBKPROXY_HANDLER macro.
131+ * by the @ref NRF_RPC_CBKPROXY_HANDLER macro.
125132 * @returns Pointer to function that calls provided handler using
126133 * provided slot index. The pointer has to be casted to
127134 * the same type as handler. NULL when index is too high or
128135 * the function was called again with the same index, but
129136 * different handler.
130137 */
131- void * cbkproxy_out_get (int index , void * handler );
138+ void * nrf_rpc_cbkproxy_out_get (int index , void * handler );
132139
133140/** @brief Sets input callback proxy.
134141 *
@@ -139,14 +146,20 @@ void *cbkproxy_out_get(int index, void *handler);
139146 *
140147 * @returns Slot number or -1 if no more slots are available.
141148 */
142- int cbkproxy_in_set (void * callback );
149+ int nrf_rpc_cbkproxy_in_set (void * callback );
143150
144151/** @brief Gets input callback proxy.
145152 *
146153 * @param index Slot index.
147154 *
148155 * @returns Callback function or NULL if slot index is invalid.
149156 */
150- void * cbkproxy_in_get (int index );
157+ void * nrf_rpc_cbkproxy_in_get (int index );
158+
159+ #ifdef __cplusplus
160+ }
161+ #endif
162+
163+ /** @} */
151164
152- #endif /* CBKPROXY_H */
165+ #endif /* NRF_RPC_CBKPROXY_H */
0 commit comments