MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_event.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_event.h
32 
33  Summary:
34  Defines events that are used in the UI library. Events are created and
35  stored for later processing during a library context's update loop.
36 
37 *******************************************************************************/
38 
46 #ifndef LEGATO_EVENT_H
47 #define LEGATO_EVENT_H
48 
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 // *****************************************************************************
57 // *****************************************************************************
58 // Section: Data Types and Constants
59 // *****************************************************************************
60 // *****************************************************************************
61 
62 // *****************************************************************************
63 
68 typedef enum leEventID
69 {
70  // internal events
77  // widget events
83 } leEventID;
84 
85 
86 // *****************************************************************************
91 typedef struct leEvent
92 {
93  leEventID id;
94 } leEvent;
95 
96 // *****************************************************************************
104 
105 // *****************************************************************************
106 
112 typedef struct leEventState
113 {
114 #ifndef _WIN32
115 #ifdef LEGATO_USE_OSAL
116  OSAL_SEM_HANDLE_TYPE eventCountSem;
117  OSAL_MUTEX_HANDLE_TYPE eventLock;
118 #endif
119 #endif
122 } leEventState;
123 
124 /* internal use only */
129 leEventState* _leGetEventState(void);
130 leResult leEvent_Init(void);
131 void leEvent_Shutdown(void);
137 // *****************************************************************************
138 /* Enumeration:
139  leEventResult
140 
141  Summary:
142  Defines what happened when processing an event
143 */
144 
149 typedef enum leEventResult
150 {
151  // internal events
155 } leEventResult;
156 
157 
158 // *****************************************************************************
159 // *****************************************************************************
160 // Section: Routines
161 // *****************************************************************************
162 // *****************************************************************************
163 
164 // *****************************************************************************
165 /* Function:
166  uint32_t leEvent_GetCount()
167 
168  Summary:
169  Returns the number of events listed in the current context
170 
171  Description:
172  Returns the number of events listed in the current context
173 
174  Parameters:
175  void
176 
177  Returns:
178  uint32_t
179 
180  Remarks:
181 
182 */
183 
192 uint32_t leEvent_GetCount(void);
193 
194 // *****************************************************************************
195 /* Function:
196  leResult leEvent_SetFilter(leEvent_FilterEvent cb)
197 
198  Summary:
199  Set callback pointer for current context filter event
200 
201  Description:
202  Set callback pointer for current context filter event
203  Parameters:
204  leEvent_FilterEvent
205 
206  Returns:
207  leResult
208  Remarks:
209 
210 */
211 
223 
224 // *****************************************************************************
225 /* Function:
226  leResult leEvent_AddEvent(leEvent* evt)
227 
228  Summary:
229  Add the mentioned event callback to the list of events maintained by the current context
230 
231  Description:
232  Add the mentioned event callback to the list of events maintained by the current context
233 
234  Parameters:
235  leEvent*
236 
237  Returns:
238  leResult
239 
240  Remarks:
241 
242 */
243 
255 
256 // *****************************************************************************
257 /* Function:
258  leResult leEvent_ClearList()
259 
260  Summary:
261  Clear the event list maintained by the current context.
262 
263  Description:
264  Clear the event list maintained by the current context.
265 
266  Parameters:
267  void
268 
269  Returns:
270  leResult
271 
272  Remarks:
273 
274 */
275 
285 
286 // *****************************************************************************
287 /* Function:
288  leResult leEvent_ProcessEvents()
289 
290  Summary:
291  Processes any pending events
292 
293  Description:
294  Processes any pending events
295 
296  Parameters:
297  void
298 
299  Returns:
300  leResult
301 
302  Remarks:
303 
304 */
305 
315 
316 #ifdef __cplusplus
317 }
318 #endif
319 
320 #endif /* LEGATO_EVENT_H */
struct leEventState leEventState
This struct represents an event state.
leResult leEvent_AddEvent(leEvent *evt)
Add event.
Definition: legato_event.c:73
Definition: legato_event.h:75
Common macros and definitions used by Legato.
leBool(* leEvent_FilterEvent)(leEvent *)
FilterEvent function pointer.
Definition: legato_event.h:103
This struct represents an event state.
Definition: legato_event.h:112
leResult leEvent_SetFilter(leEvent_FilterEvent cb)
Set filter event callback.
Definition: legato_event.c:66
leEventResult
This enum represents an event result.
Definition: legato_event.h:149
Definition: legato_event.h:71
leEventID
This enum represents valid event IDs.
Definition: legato_event.h:68
leResult leEvent_ClearList(void)
Clear event list.
Definition: legato_event.c:83
leResult
This enum represents function call results.
Definition: legato_common.h:123
Definition: legato_event.h:72
Definition: legato_event.h:152
leEvent_FilterEvent filter
Definition: legato_event.h:121
Definition: legato_event.h:153
Definition: legato_event.h:81
This struct represents a list.
Definition: legato_list.h:94
Definition: legato_event.h:73
uint32_t leEvent_GetCount(void)
Get Event Count.
Definition: legato_event.c:61
A linked list implementation.
Definition: legato_event.h:80
Definition: legato_event.h:79
leList events
Definition: legato_event.h:120
Definition: legato_event.h:82
leBool
This enum represents booleans.
Definition: legato_common.h:146
struct leEvent leEvent
This enum presents a event. An event contains valid event ids.
Definition: legato_event.h:154
This enum presents a event. An event contains valid event ids.
Definition: legato_event.h:91
leResult leEvent_ProcessEvents(void)
Process events.
Definition: legato_event.c:90
Definition: legato_event.h:74
leEventID id
Definition: legato_event.h:93
Definition: legato_event.h:78