Debian Codegraph @

bindings/glib/gpiod-glib/info-event.h

raw symbols SCIP
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /* SPDX-FileCopyrightText: 2023-2024 Bartosz Golaszewski <[email protected]> */
3
4 #ifndef __GPIODGLIB_INFO_EVENT_H__
5 #define __GPIODGLIB_INFO_EVENT_H__
6
7 #if !defined(__INSIDE_GPIOD_GLIB_H__) && !defined(GPIODGLIB_COMPILATION)
8 #error "Only <gpiod-glib.h> can be included directly."
9 #endif
10
11 #include <glib.h>
12 #include <glib-object.h>
13
14 #include "line-info.h"
15
16 G_BEGIN_DECLS
17
18 G_DECLARE_FINAL_TYPE(GpiodglibInfoEvent, gpiodglib_info_event,
19 GPIODGLIB, INFO_EVENT, GObject);
20
21 #define GPIODGLIB_INFO_EVENT_TYPE (gpiodglib_info_event_get_type())
22 #define GPIODGLIB_INFO_EVENT_OBJ(obj) \
23 (G_TYPE_CHECK_INSTANCE_CAST((obj), GPIODGLIB_INFO_EVENT_TYPE, \
24 GpiodglibInfoEvent))
25
26 /**
27 * GpiodglibInfoEventType:
28 * @GPIODGLIB_INFO_EVENT_LINE_REQUESTED: Line has been requested.
29 * @GPIODGLIB_INFO_EVENT_LINE_RELEASED: Previously requested line has been
30 * released.
31 * @GPIODGLIB_INFO_EVENT_LINE_CONFIG_CHANGED: Line configuration has changed.
32 *
33 * Line status change event types.
34 */
35 typedef enum {
36 GPIODGLIB_INFO_EVENT_LINE_REQUESTED = 1,
37 GPIODGLIB_INFO_EVENT_LINE_RELEASED,
38 GPIODGLIB_INFO_EVENT_LINE_CONFIG_CHANGED,
39 } GpiodglibInfoEventType;
40
41 /**
42 * gpiodglib_info_event_get_event_type:
43 * @self: #GpiodglibInfoEvent to manipulate.
44 *
45 * Get the event type of the status change event.
46 *
47 * Returns: One of @GPIODGLIB_INFO_EVENT_LINE_REQUESTED,
48 * @GPIODGLIB_INFO_EVENT_LINE_RELEASED or
49 * @GPIODGLIB_INFO_EVENT_LINE_CONFIG_CHANGED.
50 */
51 GpiodglibInfoEventType
52 gpiodglib_info_event_get_event_type(GpiodglibInfoEvent *self);
53
54 /**
55 * gpiodglib_info_event_get_timestamp_ns:
56 * @self: #GpiodglibInfoEvent to manipulate.
57 *
58 * Get the timestamp of the event.
59 *
60 * Returns: Timestamp in nanoseconds, read from the monotonic clock.
61 */
62 guint64 gpiodglib_info_event_get_timestamp_ns(GpiodglibInfoEvent *self);
63
64 /**
65 * gpiodglib_info_event_get_line_info:
66 * @self #GpiodglibInfoEvent to manipulate.
67 *
68 * Get the snapshot of line-info associated with the event.
69 *
70 * Returns: (transfer full): New reference to the associated line-info object.
71 */
72 GpiodglibLineInfo *gpiodglib_info_event_get_line_info(GpiodglibInfoEvent *self);
73
74 G_END_DECLS
75
76 #endif /* __GPIODGLIB_INFO_EVENT_H__ */