Line data Source code
1 0 : /*
2 : * Copyright (c) 2018-2021 mcumgr authors
3 : * Copyright (c) 2023 Nordic Semiconductor ASA
4 : *
5 : * SPDX-License-Identifier: Apache-2.0
6 : */
7 :
8 : #ifndef H_STAT_MGMT_
9 : #define H_STAT_MGMT_
10 :
11 : /**
12 : * @brief MCUmgr Statistics Management API
13 : * @defgroup mcumgr_stat_mgmt Statistics Management
14 : * @ingroup mcumgr_mgmt_api
15 : * @{
16 : */
17 :
18 : #ifdef __cplusplus
19 : extern "C" {
20 : #endif
21 :
22 : /**
23 : * @name Command IDs for Statistics Management group.
24 : * @{
25 : */
26 1 : #define STAT_MGMT_ID_SHOW 0 /**< Group data */
27 1 : #define STAT_MGMT_ID_LIST 1 /**< List groups */
28 : /** @} */
29 :
30 : /**
31 : * Command result codes for statistics management group.
32 : */
33 1 : enum stat_mgmt_err_code_t {
34 : /** No error, this is implied if there is no ret value in the response */
35 : STAT_MGMT_ERR_OK = 0,
36 :
37 : /** Unknown error occurred. */
38 : STAT_MGMT_ERR_UNKNOWN,
39 :
40 : /** The provided statistic group name was not found. */
41 : STAT_MGMT_ERR_INVALID_GROUP,
42 :
43 : /** The provided statistic name was not found. */
44 : STAT_MGMT_ERR_INVALID_STAT_NAME,
45 :
46 : /** The size of the statistic cannot be handled. */
47 : STAT_MGMT_ERR_INVALID_STAT_SIZE,
48 :
49 : /** Walk through of statistics was aborted. */
50 : STAT_MGMT_ERR_WALK_ABORTED,
51 : };
52 :
53 : /**
54 : * @brief Represents a single value in a statistics group.
55 : */
56 1 : struct stat_mgmt_entry {
57 : /** Name of the statistic */
58 1 : const char *name;
59 :
60 : /** Value of the statistic */
61 1 : uint64_t value;
62 : };
63 :
64 : #ifdef __cplusplus
65 : }
66 : #endif
67 :
68 : /**
69 : * @}
70 : */
71 :
72 : #endif /* H_STAT_MGMT_ */
|