Line data Source code
1 0 : /*
2 : * Copyright (c) 2023 Nordic Semiconductor ASA
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef H_OS_MGMT_CLIENT_
8 : #define H_OS_MGMT_CLIENT_
9 :
10 : #include <inttypes.h>
11 : #include <zephyr/mgmt/mcumgr/smp/smp_client.h>
12 :
13 : /**
14 : * @brief MCUmgr OS Management Client API
15 : * @defgroup mcumgr_os_mgmt_client OS Management Client
16 : * @ingroup mcumgr_os_mgmt
17 : * @{
18 : */
19 :
20 : #ifdef __cplusplus
21 : extern "C" {
22 : #endif
23 :
24 : /**
25 : * @brief OS mgmt client object
26 : */
27 1 : struct os_mgmt_client {
28 : /** SMP client object */
29 1 : struct smp_client_object *smp_client;
30 : /** Command status */
31 1 : int status;
32 : };
33 :
34 : /**
35 : * @brief Initialize OS management client.
36 : *
37 : * @param client OS mgmt client object
38 : * @param smp_client SMP client object
39 : *
40 : */
41 1 : void os_mgmt_client_init(struct os_mgmt_client *client, struct smp_client_object *smp_client);
42 :
43 : /**
44 : * @brief Send SMP message for Echo command.
45 : *
46 : * @param client OS mgmt client object
47 : * @param echo_string Echo string
48 : * @param max_len Max length of @p echo_string
49 : *
50 : * @return 0 on success.
51 : * @return @ref mcumgr_err_t code on failure.
52 : */
53 1 : int os_mgmt_client_echo(struct os_mgmt_client *client, const char *echo_string, size_t max_len);
54 :
55 : /**
56 : * @brief Send SMP Reset command.
57 : *
58 : * @param client OS mgmt client object
59 : *
60 : * @return 0 on success.
61 : * @return @ref mcumgr_err_t code on failure.
62 : */
63 1 : int os_mgmt_client_reset(struct os_mgmt_client *client);
64 :
65 : /**
66 : * @}
67 : */
68 :
69 : #ifdef __cplusplus
70 : }
71 : #endif
72 :
73 : #endif /* H_OS_MGMT_CLIENT_ */
|