Skip to content

Commit 93c10ee

Browse files
Przemyslaw Bidarlubos
authored andcommitted
nrf_rpc: Add command to obtain version of remote.
Commit adds command to pbtain the remote ncs commit sha version. Signed-off-by: Przemyslaw Bida <[email protected]>
1 parent b7a0d83 commit 93c10ee

File tree

30 files changed

+582
-2
lines changed

30 files changed

+582
-2
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@
802802
/tests/subsys/nfc/rpc/ @nrfconnect/ncs-protocols-serialization
803803
/tests/subsys/nrf_compress/ @nordicjm
804804
/tests/subsys/nrf_profiler/ @nrfconnect/ncs-si-bluebagel
805+
/tests/subsys/nrf_rpc/ @nrfconnect/ncs-protocols-serialization
805806
/tests/subsys/partition_manager/region/ @nordicjm @tejlmand
806807
/tests/subsys/partition_manager/static_pm_file/ @nordicjm @tejlmand
807808
/tests/subsys/pcd/ @nrfconnect/ncs-pluto
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. _nrf_rpc_dev_info:
2+
3+
nRF RPC device information
4+
##########################
5+
6+
.. contents::
7+
:local:
8+
:depth: 2
9+
10+
This library allows you to obtain the device information functions of the :ref:`nrfxlib:nrf_rpc` on a remote server.
11+
12+
Configuration
13+
*************
14+
15+
Use the :kconfig:option:`CONFIG_NRF_RPC_DEV_INFO` Kconfig option to enable this library.
16+
To enable it for the client, use the :kconfig:option:`CONFIG_NRF_RPC_DEV_INFO_CLIENT` Kconfig option and respectively,
17+
:kconfig:option:`CONFIG_NRF_RPC_DEV_INFO_SERVER` for the server.
18+
19+
API documentation
20+
*****************
21+
22+
| Header file: :file:`include/nrf_rpc/nrf_rpc_dev_info.h`
23+
24+
.. doxygengroup:: nrf_rpc_dev_info

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ Libraries for NFC
614614
nRF RPC libraries
615615
-----------------
616616

617-
|no_changes_yet_note|
617+
* Added the :ref:`nrf_rpc_dev_info` library for obtaining information about a device connected through the :ref:`nrfxlib:nrf_rpc`.
618618

619619
Other libraries
620620
---------------

include/nrf_rpc/nrf_rpc_dev_info.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#ifndef UTILS_NRF_RPC_UTILS_H_
8+
#define UTILS_NRF_RPC_UTILS_H_
9+
10+
/**
11+
* @defgroup nrf_rpc_dev_info nRF RPC device information.
12+
* @{
13+
* @brief nRF RPC device information functions.
14+
*
15+
*/
16+
17+
/** @brief Get version of remote server the RPC client is connected to.
18+
*
19+
* @retval version of the remote on success.
20+
* @retval NULL on failure.
21+
*/
22+
const char *nrf_rpc_get_ncs_commit_sha(void);
23+
24+
/**
25+
* @}
26+
*/
27+
28+
#endif /* UTILS_NRF_RPC_UTILS_H_ */

samples/nrf_rpc/protocols_serialization/client/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_RPC src/ot_shell.c)
1818
zephyr_library_sources_ifdef(CONFIG_MPSL_CX_SOFTWARE src/coex_shell.c)
1919
zephyr_library_sources_ifdef(CONFIG_LOG_FORWARDER_RPC src/log_rpc_shell.c)
2020
zephyr_library_sources_ifdef(CONFIG_NFC_RPC src/nfc_shell.c)
21+
zephyr_library_sources_ifdef(CONFIG_NRF_RPC_DEV_INFO src/dev_info_shell.c)
2122
# NORDIC SDK APP START

samples/nrf_rpc/protocols_serialization/client/prj.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ CONFIG_LOG_BUFFER_SIZE=4096
2323
CONFIG_LOG_FUNC_NAME_PREFIX_DBG=n
2424
CONFIG_LOG_BACKEND_RTT=n
2525
CONFIG_SHELL_LOG_BACKEND=y
26+
27+
CONFIG_NRF_RPC_DEV_INFO=y
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <zephyr/shell/shell.h>
8+
#include <nrf_rpc/nrf_rpc_dev_info.h>
9+
10+
static int remote_version_cmd(const struct shell *sh, size_t argc, char *argv[])
11+
{
12+
const char *version = nrf_rpc_get_ncs_commit_sha();
13+
14+
shell_print(sh, "Remote version: %s", version);
15+
16+
return 0;
17+
}
18+
19+
SHELL_STATIC_SUBCMD_SET_CREATE(util_cmds,
20+
SHELL_CMD_ARG(remote_version, NULL, "Get server version",
21+
remote_version_cmd, 1, 0),
22+
SHELL_SUBCMD_SET_END);
23+
24+
SHELL_CMD_ARG_REGISTER(rpc, &util_cmds, "nRF RPC utility commands", NULL, 1, 0);

samples/nrf_rpc/protocols_serialization/server/prj.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ CONFIG_NRF_RPC_UART_RELIABLE=y
1515

1616
CONFIG_UART_LINE_CTRL=y
1717
CONFIG_UART_INTERRUPT_DRIVEN=y
18+
19+
CONFIG_NRF_RPC_DEV_INFO=y
20+
CONFIG_NRF_RPC_DEV_INFO_SERVER=y

subsys/nrf_rpc/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ zephyr_library_sources_ifdef(CONFIG_NRF_RPC_SERIALIZE_API nrf_rpc_serialize.c)
1717
zephyr_library_sources_ifdef(CONFIG_NRF_RPC_CALLBACK_PROXY nrf_rpc_cbkproxy.c)
1818

1919
zephyr_library_sources_ifdef(CONFIG_NRF_RPC_UART_TRANSPORT nrf_rpc_uart.c)
20+
21+
add_subdirectory_ifdef(CONFIG_NRF_RPC_DEV_INFO dev_info)

subsys/nrf_rpc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
187187

188188
endif # NRF_RPC_CBOR
189189

190+
rsource "dev_info/Kconfig"
191+
190192
endif # NRF_RPC
191193

192194
endmenu

0 commit comments

Comments
 (0)