Skip to content

Commit 667d204

Browse files
Revert "openthread: rpc: support otMessageRegisterTxCallback"
This reverts commit 472e47e. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent e2d0ec1 commit 667d204

File tree

11 files changed

+6
-593
lines changed

11 files changed

+6
-593
lines changed

doc/nrf/libraries/networking/ot_rpc.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ OpenThread RPC currently supports the serialization of the following OpenThread
140140
* :c:func:`otMessageGetOffset`
141141
* :c:func:`otMessageGetThreadLinkInfo`
142142
* :c:func:`otMessageRead`
143-
* :c:func:`otMessageRegisterTxCallback`
144143
* :c:func:`otNetDataGet`
145144
* :c:func:`otNetDataGetNextOnMeshPrefix`
146145
* :c:func:`otNetDataGetNextService`

samples/nrf_rpc/protocols_serialization/client/src/ot_shell.c

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ struct srp_service {
5353
static bool ot_cli_is_initialized;
5454
static otUdpSocket udp_socket;
5555
static const char udp_payload[] = "Hello OpenThread World!";
56-
static bool udp_tx_callback_enabled;
5756
static char srp_client_host_name[OT_DNS_MAX_NAME_SIZE];
5857
static struct srp_service services[SERVICE_NUM];
5958

@@ -2022,13 +2021,6 @@ static int cmd_udp_connect(const struct shell *sh, size_t argc, char *argv[])
20222021
return ot_cli_command_exec(cmd_udp_connect_impl, sh, argc, argv);
20232022
}
20242023

2025-
static void udp_tx_callback(const otMessage *msg, otError error, void *ctx)
2026-
{
2027-
struct shell *sh = ctx;
2028-
2029-
shell_print(sh, "UDP tx result: %d", error);
2030-
}
2031-
20322024
static otError cmd_udp_send_impl(const struct shell *sh, size_t argc, char *argv[])
20332025
{
20342026
otError error;
@@ -2068,10 +2060,6 @@ static otError cmd_udp_send_impl(const struct shell *sh, size_t argc, char *argv
20682060
return error;
20692061
}
20702062

2071-
if (udp_tx_callback_enabled) {
2072-
otMessageRegisterTxCallback(msg, udp_tx_callback, (void *)sh);
2073-
}
2074-
20752063
error = otUdpSend(NULL, &udp_socket, msg, &msg_info);
20762064
if (error != OT_ERROR_NONE) {
20772065
otMessageFree(msg);
@@ -2095,34 +2083,12 @@ static int cmd_udp_close(const struct shell *sh, size_t argc, char *argv[])
20952083
return ot_cli_command_exec(cmd_udp_close_impl, sh, argc, argv);
20962084
}
20972085

2098-
static otError cmd_udp_txcallback_impl(const struct shell *sh, size_t argc, char *argv[])
2099-
{
2100-
if (argc == 1) {
2101-
shell_print(sh, "%s", udp_tx_callback_enabled ? "enabled" : "disabled");
2102-
} else if (strcmp(argv[1], "enable") == 0) {
2103-
udp_tx_callback_enabled = true;
2104-
} else if (strcmp(argv[1], "disable") == 0) {
2105-
udp_tx_callback_enabled = false;
2106-
} else {
2107-
return OT_ERROR_INVALID_ARGS;
2108-
}
2109-
2110-
return OT_ERROR_NONE;
2111-
}
2112-
2113-
static int cmd_udp_txcallback(const struct shell *sh, size_t argc, char *argv[])
2114-
{
2115-
return ot_cli_command_exec(cmd_udp_txcallback_impl, sh, argc, argv);
2116-
}
2117-
21182086
SHELL_STATIC_SUBCMD_SET_CREATE(
21192087
udp_cmds, SHELL_CMD_ARG(open, NULL, "Open socket", cmd_udp_open, 1, 0),
21202088
SHELL_CMD_ARG(bind, NULL, "Bind socket [-u|-b] <addr> <port>", cmd_udp_bind, 3, 1),
21212089
SHELL_CMD_ARG(connect, NULL, "Connect socket <addr> <port>", cmd_udp_connect, 3, 0),
21222090
SHELL_CMD_ARG(send, NULL, "Send message [addr port] <message>", cmd_udp_send, 2, 2),
2123-
SHELL_CMD_ARG(close, NULL, "Close socket", cmd_udp_close, 1, 0),
2124-
SHELL_CMD_ARG(txcallback, NULL, "Enable/disable tx callback", cmd_udp_txcallback, 1, 1),
2125-
SHELL_SUBCMD_SET_END);
2091+
SHELL_CMD_ARG(close, NULL, "Close socket", cmd_udp_close, 1, 0), SHELL_SUBCMD_SET_END);
21262092

21272093
static otError cmd_channel_impl(const struct shell *sh, size_t argc, char *argv[])
21282094
{

subsys/net/openthread/rpc/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ config OPENTHREAD_RPC_CLIENT_NUM_SENT_COAP_REQUESTS
6565
Defines the number of slots for storing a callback along with its context
6666
for ongoing CoAP requests awaiting a response.
6767

68-
config OPENTHREAD_RPC_CLIENT_NUM_TX_CALLBACKS
69-
int "Maximum number of registered message TX callbacks"
70-
default 8
71-
7268
config OPENTHREAD_RPC_CLIENT_RADIO_TIME_REFRESH_PERIOD
7369
int "Radio time sync period [s]"
7470
default 30

subsys/net/openthread/rpc/client/ot_rpc_message.c

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
*/
66

77
#include <nrf_rpc/nrf_rpc_serialize.h>
8-
#include <ot_rpc_callback.h>
9-
#include <ot_rpc_common.h>
108
#include <ot_rpc_ids.h>
11-
#include <ot_rpc_lock.h>
129
#include <ot_rpc_types.h>
10+
#include <ot_rpc_common.h>
1311

1412
#include <nrf_rpc_cbor.h>
1513

@@ -18,9 +16,6 @@
1816

1917
#include <string.h>
2018

21-
OT_RPC_CALLBACK_TABLE_DEFINE(tx_cb, otMessageTxCallback,
22-
CONFIG_OPENTHREAD_RPC_CLIENT_NUM_TX_CALLBACKS);
23-
2419
otError otMessageAppend(otMessage *aMessage, const void *aBuf, uint16_t aLength)
2520
{
2621
struct nrf_rpc_cbor_ctx ctx;
@@ -182,59 +177,3 @@ otError otMessageGetThreadLinkInfo(const otMessage *aMessage, otThreadLinkInfo *
182177

183178
return error;
184179
}
185-
186-
void otMessageRegisterTxCallback(otMessage *aMessage, otMessageTxCallback aCallback, void *aContext)
187-
{
188-
ot_rpc_res_tab_key key = (ot_rpc_res_tab_key)aMessage;
189-
ot_rpc_callback_id cb_id;
190-
struct nrf_rpc_cbor_ctx ctx;
191-
192-
cb_id = ot_rpc_tx_cb_alloc(aCallback, aContext);
193-
194-
if (aCallback != NULL && cb_id == OT_RPC_CALLBACK_ID_NULL) {
195-
/* Failed to allocate a callback entry. */
196-
nrf_rpc_err(-ENOMEM, NRF_RPC_ERR_SRC_SEND, &ot_group,
197-
OT_RPC_CMD_MESSAGE_REGISTER_TX_CALLBACK, NRF_RPC_PACKET_TYPE_CMD);
198-
return;
199-
}
200-
201-
NRF_RPC_CBOR_ALLOC(&ot_group, ctx, 2 + sizeof(key) + sizeof(cb_id));
202-
nrf_rpc_encode_uint(&ctx, key);
203-
nrf_rpc_encode_uint(&ctx, cb_id);
204-
nrf_rpc_cbor_cmd_no_err(&ot_group, OT_RPC_CMD_MESSAGE_REGISTER_TX_CALLBACK, &ctx,
205-
nrf_rpc_rsp_decode_void, NULL);
206-
}
207-
208-
static void ot_rpc_cmd_message_tx_cb(const struct nrf_rpc_group *group,
209-
struct nrf_rpc_cbor_ctx *ctx, void *handler_data)
210-
{
211-
ot_rpc_callback_id cb_id;
212-
ot_rpc_res_tab_key msg_key;
213-
otError error;
214-
otMessageTxCallback cb;
215-
void *context;
216-
217-
cb_id = nrf_rpc_decode_uint(ctx);
218-
msg_key = nrf_rpc_decode_uint(ctx);
219-
error = nrf_rpc_decode_uint(ctx);
220-
221-
if (!nrf_rpc_decoding_done_and_check(group, ctx)) {
222-
ot_rpc_report_cmd_decoding_error(OT_RPC_CMD_MESSAGE_TX_CB);
223-
return;
224-
}
225-
226-
ot_rpc_mutex_lock();
227-
228-
cb = ot_rpc_tx_cb_get(cb_id, &context);
229-
230-
if (cb != NULL) {
231-
ot_rpc_tx_cb_free(cb_id);
232-
cb((const otMessage *)msg_key, error, context);
233-
}
234-
235-
ot_rpc_mutex_unlock();
236-
nrf_rpc_rsp_send_void(group);
237-
}
238-
239-
NRF_RPC_CBOR_CMD_DECODER(ot_group, ot_rpc_cmd_message_tx_cb, OT_RPC_CMD_MESSAGE_TX_CB,
240-
ot_rpc_cmd_message_tx_cb, NULL);

subsys/net/openthread/rpc/common/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
zephyr_library()
88

99
zephyr_library_sources(
10-
ot_rpc_callback.c
1110
ot_rpc_common.c
1211
ot_rpc_group.c
1312
)

subsys/net/openthread/rpc/common/ot_rpc_callback.c

Lines changed: 0 additions & 67 deletions
This file was deleted.

subsys/net/openthread/rpc/common/ot_rpc_callback.h

Lines changed: 0 additions & 85 deletions
This file was deleted.

subsys/net/openthread/rpc/common/ot_rpc_ids.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ enum ot_rpc_cmd_client {
2525
OT_RPC_CMD_DNS_ADDRESS_RESPONSE_CB,
2626
OT_RPC_CMD_DNS_BROWSE_RESPONSE_CB,
2727
OT_RPC_CMD_DNS_SERVICE_RESPONSE_CB,
28-
OT_RPC_CMD_MESSAGE_TX_CB,
2928
};
3029

3130
/** @brief Command IDs accepted by the OpenThread over RPC server.
@@ -107,7 +106,6 @@ enum ot_rpc_cmd_server {
107106
OT_RPC_CMD_MESSAGE_GET_OFFSET,
108107
OT_RPC_CMD_MESSAGE_READ,
109108
OT_RPC_CMD_MESSAGE_GET_THREAD_LINK_INFO,
110-
OT_RPC_CMD_MESSAGE_REGISTER_TX_CALLBACK,
111109
OT_RPC_CMD_UDP_OPEN,
112110
OT_RPC_CMD_UDP_IS_OPEN,
113111
OT_RPC_CMD_UDP_SEND,

subsys/net/openthread/rpc/server/ot_rpc_dataset.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <nrf_rpc/nrf_rpc_serialize.h>
8+
#include <nrf_rpc/nrf_rpc_cbkproxy.h>
89
#include <ot_rpc_ids.h>
910
#include <ot_rpc_types.h>
1011
#include <ot_rpc_common.h>

0 commit comments

Comments
 (0)