Debian Codegraph @

bindings/glib/gpiod-glib/edge-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_EDGE_EVENT_H__
5 #define __GPIODGLIB_EDGE_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(GpiodglibEdgeEvent, gpiodglib_edge_event,
19 GPIODGLIB, EDGE_EVENT, GObject);
20
21 #define GPIODGLIB_EDGE_EVENT_TYPE (gpiodglib_edge_event_get_type())
22 #define GPIODGLIB_EDGE_EVENT_OBJ(obj) \
23 (G_TYPE_CHECK_INSTANCE_CAST((obj), GPIODGLIB_EDGE_EVENT_TYPE, \
24 GpiodglibEdgeEvent))
25
26 /**
27 * GpiodglibEdgeEventType:
28 * @GPIODGLIB_EDGE_EVENT_RISING_EDGE: Rising edge event.
29 * @GPIODGLIB_EDGE_EVENT_FALLING_EDGE: Falling edge event.
30 *
31 * Edge event types.
32 */
33 typedef enum {
34 GPIODGLIB_EDGE_EVENT_RISING_EDGE = 1,
35 GPIODGLIB_EDGE_EVENT_FALLING_EDGE,
36 } GpiodglibEdgeEventType;
37
38 /**
39 * gpiodglib_edge_event_get_event_type:
40 * @self: #GpiodglibEdgeEvent to manipulate.
41 *
42 * Get the event type.
43 *
44 * Returns: The event type (@GPIODGLIB_EDGE_EVENT_RISING_EDGE or
45 * @GPIODGLIB_EDGE_EVENT_FALLING_EDGE).
46 */
47 GpiodglibEdgeEventType
48 gpiodglib_edge_event_get_event_type(GpiodglibEdgeEvent *self);
49
50 /**
51 * gpiodglib_edge_event_get_timestamp_ns:
52 * @self: #GpiodglibEdgeEvent to manipulate.
53 *
54 * Get the timestamp of the event.
55 *
56 * The source clock for the timestamp depends on the event_clock setting for
57 * the line.
58 *
59 * Returns: Timestamp in nanoseconds.
60 */
61 guint64 gpiodglib_edge_event_get_timestamp_ns(GpiodglibEdgeEvent *self);
62
63 /**
64 * gpiodglib_edge_event_get_line_offset:
65 * @self: #GpiodglibEdgeEvent to manipulate.
66 *
67 * Get the offset of the line which triggered the event.
68 *
69 * Returns: Line offset.
70 */
71 guint gpiodglib_edge_event_get_line_offset(GpiodglibEdgeEvent *self);
72
73 /**
74 * gpiodglib_edge_event_get_global_seqno:
75 * @self: #GpiodglibEdgeEvent to manipulate.
76 *
77 * Get the global sequence number of the event.
78 *
79 * Returns: Sequence number of the event in the series of events for all lines
80 * in the associated line request.
81 */
82 gulong gpiodglib_edge_event_get_global_seqno(GpiodglibEdgeEvent *self);
83
84 /**
85 * gpiodglib_edge_event_get_line_seqno:
86 * @self: #GpiodglibEdgeEvent to manipulate.
87 *
88 * Get the event sequence number specific to the line.
89 *
90 * Returns: Sequence number of the event in the series of events only for this
91 * line within the lifetime of the associated line request.
92 */
93 gulong gpiodglib_edge_event_get_line_seqno(GpiodglibEdgeEvent *self);
94
95 G_END_DECLS
96
97 #endif /* __GPIODGLIB_EDGE_EVENT_H__ */