microui  2.0.0
microui
microui_event_decoder.h
1 /*
2  * C
3  *
4  * Copyright 2021-2022 MicroEJ Corp. All rights reserved.
5  * Use of this source code is governed by a BSD-style license that can be found with this software.
6  */
7 
8 /*
9  * @file
10  * @brief See microui_event_decoder.c.
11  * @author MicroEJ Developer Team
12  * @version 2.0.0
13  * @date 31 August 2022
14  * @since MicroEJ UI Pack 13.1.0
15  */
16 
17 #if !defined MICROUI_EVENT_DECODER_H
18 # define MICROUI_EVENT_DECODER_H
19 
20 // -----------------------------------------------------------------------------
21 // Includes
22 // -----------------------------------------------------------------------------
23 
24 #include <stdlib.h>
25 #include <stdint.h>
26 #include <stdbool.h>
27 
28 #include "microui_event_decoder_conf.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #ifdef MICROUIEVENTDECODER_ENABLED
35 
36 // -----------------------------------------------------------------------------
37 // Types
38 // -----------------------------------------------------------------------------
39 
40 /*
41  * @brief Function to decode the data of an event.
42  *
43  * @param[in] event the event that requires the data.
44  * @param[in] data the event data.
45  * @param[in] index the data index in queue.
46  */
47 typedef void (* MICROUI_EVENT_DECODER_decode_event_data) (uint32_t event, uint32_t data, uint32_t index);
48 
49 // -----------------------------------------------------------------------------
50 // API
51 // -----------------------------------------------------------------------------
52 
53 /*
54  * @brief Notifies the start of MicroUI FIFO dump.
55  */
56 void MICROUI_EVENT_DECODER_describe_dump_start(void);
57 
58 /*
59  * @brief Notifies the next logs are already consumed.
60  */
61 void MICROUI_EVENT_DECODER_describe_dump_past(void);
62 
63 /*
64  * @brief Notifies the next logs are not consumed yet.
65  */
66 void MICROUI_EVENT_DECODER_describe_dump_future(void);
67 
68 /*
69  * @brief Notifies the dump will log the Java objects associated with the events
70  * that are not consumed yet.
71  */
72 void MICROUI_EVENT_DECODER_describe_dump_events_objects(void);
73 
74 /*
75  * @brief Notifies the end of MicroUI FIFO dump.
76  */
77 void MICROUI_EVENT_DECODER_describe_dump_end(void);
78 
79 /*
80  * @brief Drops a data. This is an orphaned data of an old event already executed.
81  */
82 void MICROUI_EVENT_DECODER_drop_data(uint32_t data, uint32_t index);
83 
84 /*
85  * @brief Decodes an event.
86  *
87  * @param[in] event the 32-bit event.
88  * @param[in] index the event's index in queue.
89  * @param[out] fct_data_decoder function to decode the data of the event.
90  */
91 void MICROUI_EVENT_DECODER_decode_event(uint32_t event, uint32_t index, MICROUI_EVENT_DECODER_decode_event_data* fct_data_decoder);
92 
93 #endif // MICROUIEVENTDECODER_ENABLED
94 
95 // -----------------------------------------------------------------------------
96 // EOF
97 // -----------------------------------------------------------------------------
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 #endif // MICROUI_EVENT_DECODER_H