Skip to content

Commit 3913864

Browse files
alxelaxnordicjm
authored andcommitted
nrf: rpc: move serializer and callback proxy to nrf rpc
Commit moves serialize and callback proxy functionality from bluetooth rpc to nrf rpc to make it available for the other. Signed-off-by: Aleksandr Khromykh <[email protected]>
1 parent 257c99a commit 3913864

22 files changed

+1918
-1969
lines changed

doc/nrf/libraries/bluetooth_services/rpc.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Set the following options in the same way for the :ref:`ble_rpc_host` or :ref:`i
8181
* :kconfig:option:`CONFIG_BT_PER_ADV_SYNC_MAX`
8282
* :kconfig:option:`CONFIG_BT_DEVICE_APPEARANCE`
8383
* :kconfig:option:`CONFIG_BT_DEVICE_NAME`
84-
* :kconfig:option:`CONFIG_CBKPROXY_OUT_SLOTS` on one core must be equal to :kconfig:option:`CONFIG_CBKPROXY_IN_SLOTS` on the other.
84+
* :kconfig:option:`CONFIG_NRF_RPC_CBKPROXY_OUT_SLOTS` on one core must be equal to :kconfig:option:`CONFIG_NRF_RPC_CBKPROXY_IN_SLOTS` on the other.
8585

8686
To keep all the above configuration options in sync, create an overlay file that is shared between the application and network core.
8787
Then, you can invoke build command like this:
@@ -111,8 +111,8 @@ Additionally, you can use the following options:
111111
* :kconfig:option:`CONFIG_BT_RPC_GATT_SRV_MAX`
112112
* :kconfig:option:`CONFIG_BT_RPC_GATT_BUFFER_SIZE`
113113
* :kconfig:option:`CONFIG_BT_RPC_INTERNAL_FUNCTIONS`
114-
* :kconfig:option:`CONFIG_CBKPROXY_OUT_SLOTS`
115-
* :kconfig:option:`CONFIG_CBKPROXY_IN_SLOTS`
114+
* :kconfig:option:`CONFIG_NRF_RPC_CBKPROXY_OUT_SLOTS`
115+
* :kconfig:option:`CONFIG_NRF_RPC_CBKPROXY_IN_SLOTS`
116116

117117
For more details, see the Kconfig option description.
118118

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ Libraries for NFC
478478
nRF RPC libraries
479479
-----------------
480480

481-
|no_changes_yet_note|
481+
* Updated the internal Bluetooth serialization API and Bluetooth callback proxy API to become part of the public NRF RPC API.
482482

483483
Other libraries
484484
---------------

subsys/bluetooth/rpc/common/cbkproxy.h renamed to include/nrf_rpc/nrf_rpc_cbkproxy.h

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,56 @@
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(...) \
@@ -94,9 +101,9 @@
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)
@@ -121,14 +128,14 @@
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

Comments
 (0)