xref: /btstack/src/hci_dump_dispatch.h (revision a6c24dc0b92124f2bedfa45472344c7329fe5305)
1*a6c24dc0SMatthias Ringwald /*
2*a6c24dc0SMatthias Ringwald  * Copyright (C) 2024 BlueKitchen GmbH
3*a6c24dc0SMatthias Ringwald  *
4*a6c24dc0SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*a6c24dc0SMatthias Ringwald  * modification, are permitted provided that the following conditions
6*a6c24dc0SMatthias Ringwald  * are met:
7*a6c24dc0SMatthias Ringwald  *
8*a6c24dc0SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*a6c24dc0SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*a6c24dc0SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*a6c24dc0SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*a6c24dc0SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*a6c24dc0SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*a6c24dc0SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*a6c24dc0SMatthias Ringwald  *    from this software without specific prior written permission.
16*a6c24dc0SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*a6c24dc0SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18*a6c24dc0SMatthias Ringwald  *    monetary gain.
19*a6c24dc0SMatthias Ringwald  *
20*a6c24dc0SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*a6c24dc0SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*a6c24dc0SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*a6c24dc0SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24*a6c24dc0SMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*a6c24dc0SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*a6c24dc0SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*a6c24dc0SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*a6c24dc0SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*a6c24dc0SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*a6c24dc0SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*a6c24dc0SMatthias Ringwald  * SUCH DAMAGE.
32*a6c24dc0SMatthias Ringwald  *
33*a6c24dc0SMatthias Ringwald  * Please inquire about commercial licensing options at
34*a6c24dc0SMatthias Ringwald  * [email protected]
35*a6c24dc0SMatthias Ringwald  *
36*a6c24dc0SMatthias Ringwald  */
37*a6c24dc0SMatthias Ringwald 
38*a6c24dc0SMatthias Ringwald /**
39*a6c24dc0SMatthias Ringwald  *  @brief HCI Dump Implementation that allows to use a set of HCI Dump Implementations
40*a6c24dc0SMatthias Ringwald  */
41*a6c24dc0SMatthias Ringwald 
42*a6c24dc0SMatthias Ringwald #ifndef HCI_DUMP_DISPATCH_H
43*a6c24dc0SMatthias Ringwald #define HCI_DUMP_DISPATCH_H
44*a6c24dc0SMatthias Ringwald 
45*a6c24dc0SMatthias Ringwald #include "hci_dump.h"
46*a6c24dc0SMatthias Ringwald #include "btstack_linked_list.h"
47*a6c24dc0SMatthias Ringwald 
48*a6c24dc0SMatthias Ringwald #if defined __cplusplus
49*a6c24dc0SMatthias Ringwald extern "C" {
50*a6c24dc0SMatthias Ringwald #endif
51*a6c24dc0SMatthias Ringwald 
52*a6c24dc0SMatthias Ringwald // memory provided by caller to keep hci_dump_t implementation in a list
53*a6c24dc0SMatthias Ringwald typedef struct {
54*a6c24dc0SMatthias Ringwald     btstack_linked_item_t item;
55*a6c24dc0SMatthias Ringwald     const hci_dump_t * hci_dump;
56*a6c24dc0SMatthias Ringwald } hci_dump_dispatch_item_t;
57*a6c24dc0SMatthias Ringwald 
58*a6c24dc0SMatthias Ringwald /**
59*a6c24dc0SMatthias Ringwald  * @brief Init HCI Dump Dispatch
60*a6c24dc0SMatthias Ringwald  */
61*a6c24dc0SMatthias Ringwald void hci_dump_dispatch_init(void);
62*a6c24dc0SMatthias Ringwald 
63*a6c24dc0SMatthias Ringwald /**
64*a6c24dc0SMatthias Ringwald  * @brief Register HCI Dump (hci_dump_t *) implementation with dispatcher
65*a6c24dc0SMatthias Ringwald  * @param list_item
66*a6c24dc0SMatthias Ringwald  * @param dump
67*a6c24dc0SMatthias Ringwald  */
68*a6c24dc0SMatthias Ringwald void hci_dump_dispatch_register(hci_dump_dispatch_item_t *list_item, const hci_dump_t *dump);
69*a6c24dc0SMatthias Ringwald 
70*a6c24dc0SMatthias Ringwald /**
71*a6c24dc0SMatthias Ringwald  * @brief Unregister HCI Dump (hci_dump_t *) implementation from dispatcher
72*a6c24dc0SMatthias Ringwald  * @param dump
73*a6c24dc0SMatthias Ringwald  */
74*a6c24dc0SMatthias Ringwald void hci_dump_dispatch_unregister(hci_dump_t *dump);
75*a6c24dc0SMatthias Ringwald 
76*a6c24dc0SMatthias Ringwald /**
77*a6c24dc0SMatthias Ringwald  * @brief De-Init HCI Dump Dispatch
78*a6c24dc0SMatthias Ringwald  */
79*a6c24dc0SMatthias Ringwald void hci_dump_dispatch_deinit(void);
80*a6c24dc0SMatthias Ringwald 
81*a6c24dc0SMatthias Ringwald /**
82*a6c24dc0SMatthias Ringwald  * @brief Get HCI Dump Dispatch instance to be used with hci_dump
83*a6c24dc0SMatthias Ringwald  * @return
84*a6c24dc0SMatthias Ringwald  */
85*a6c24dc0SMatthias Ringwald const hci_dump_t * hci_dump_dispatch_instance(void);
86*a6c24dc0SMatthias Ringwald 
87*a6c24dc0SMatthias Ringwald #if defined __cplusplus
88*a6c24dc0SMatthias Ringwald }
89*a6c24dc0SMatthias Ringwald #endif
90*a6c24dc0SMatthias Ringwald #endif // HCI_DUMP_DISPATCH_H
91