1 /** @file
2  *  @brief BLE mesh statistic APIs.
3  */
4 
5 /*
6  * Copyright (c) 2023 Nordic Semiconductor ASA
7  *
8  * SPDX-License-Identifier: Apache-2.0
9  */
10 
11 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_STATISTIC_H_
12 #define ZEPHYR_INCLUDE_BLUETOOTH_MESH_STATISTIC_H_
13 
14 #include <stdint.h>
15 
16 /**
17  * @brief Statistic
18  * @defgroup bt_mesh_stat Statistic
19  * @ingroup bt_mesh
20  * @{
21  */
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /** The structure that keeps statistics of mesh frames handling. */
28 struct bt_mesh_statistic {
29 	/** All received frames passed basic validation and decryption. */
30 	/** Received frames over advertiser. */
31 	uint32_t rx_adv;
32 	/** Received frames over loopback. */
33 	uint32_t rx_loopback;
34 	/** Received frames over proxy. */
35 	uint32_t rx_proxy;
36 	/** Received over unknown interface. */
37 	uint32_t rx_uknown;
38 	/** Counter of frames that were initiated to relay over advertiser bearer. */
39 	uint32_t tx_adv_relay_planned;
40 	/** Counter of frames that succeeded relaying over advertiser bearer. */
41 	uint32_t tx_adv_relay_succeeded;
42 	/** Counter of frames that were initiated to send over advertiser bearer locally. */
43 	uint32_t tx_local_planned;
44 	/** Counter of frames that succeeded to send over advertiser bearer locally. */
45 	uint32_t tx_local_succeeded;
46 	/** Counter of frames that were initiated to send over friend bearer. */
47 	uint32_t tx_friend_planned;
48 	/** Counter of frames that succeeded to send over friend bearer. */
49 	uint32_t tx_friend_succeeded;
50 };
51 
52 /** @brief Get mesh frame handling statistic.
53  *
54  *  @param st   BLE mesh statistic.
55  */
56 void bt_mesh_stat_get(struct bt_mesh_statistic *st);
57 
58 /** @brief Reset mesh frame handling statistic.
59  */
60 void bt_mesh_stat_reset(void);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 /**
66  * @}
67  */
68 
69 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_STATISTIC_H_ */
70