1 /*
2  * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef __ESP_BT_HCI_LOG_H__
8 #define __ESP_BT_HCI_LOG_H__
9 
10 #include "esp_err.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 
17 #define    HCI_LOG_DATA_TYPE_COMMAND         (1)
18 #define    HCI_LOG_DATA_TYPE_H2C_ACL         (2)
19 #define    HCI_LOG_DATA_TYPE_SCO             (3)
20 #define    HCI_LOG_DATA_TYPE_EVENT           (4)
21 #define    HCI_LOG_DATA_TYPE_ADV             (5)
22 #define    HCI_LOG_DATA_TYPE_SELF_DEFINE     (6)
23 #define    HCI_LOG_DATA_TYPE_C2H_ACL         (7)
24 
25 /**
26  *
27  * @brief            This function is called to record self-defining data
28  * @param string :   data identification
29  * @param data :     data
30  * @param data_len : the length of data
31  *
32  * @return          ESP_OK - success, other - failed
33  *
34  */
35 esp_err_t bt_hci_log_record_custom_data(char *string, uint8_t *data, uint8_t data_len);
36 /**
37  *
38  * @brief           This function is called to print all hci data record
39  *
40  *
41  * @return          None
42  *
43  */
44 void bt_hci_log_hci_data_show(void);
45 
46 /**
47  *
48  * @brief           This function is called to print all adv report
49  *
50  *
51  * @return          None
52  *
53  */
54 void bt_hci_log_hci_adv_show(void);
55 
56 /**
57  *
58  * @brief           This function is called to init hci log env
59  *
60  *
61  * @return          ESP_OK - success, other - failed
62  *
63  */
64 esp_err_t bt_hci_log_init(void);
65 
66 /**
67  *
68  * @brief           This function is called to deinit hci debug mode,
69  *                  and can only be called internally by Bluetooth
70  *
71  *
72  * @return          ESP_OK - success, other - failed
73  *
74  */
75 esp_err_t bt_hci_log_deinit(void);
76 
77 /**
78  *
79  * @brief           This function is called to record hci data without adv report event,
80  *                  and can only be called internally by Bluetooth
81  *
82  * @param str :     data type, define in bt_data_type_to_str()
83  * @param data :    data
84  * @param data_len : the length of data
85  *
86  * @return          ESP_OK - success, other - failed
87  *
88  */
89 esp_err_t bt_hci_log_record_hci_data(uint8_t data_type, uint8_t *data, uint8_t data_len);
90 
91 /**
92  *
93  * @brief           This function is called to record hci adv report event only
94  *                  and can only be called internally by Bluetooth
95  *
96  * @param str :     data type, define in bt_data_type_to_str()
97  * @param data :    data
98  * @param data_len : the length of data
99  * @return          ESP_OK - success, other - failed
100  *
101  */
102 esp_err_t bt_hci_log_record_hci_adv(uint8_t data_type, uint8_t *data, uint8_t data_len);
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /* _ESP_BT_HCI_LOG_H__ */
109