Debian Codegraph @

bindings/glib/gpiod-glib/request-config.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_REQUEST_CONFIG_H__
5 #define __GPIODGLIB_REQUEST_CONFIG_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 G_BEGIN_DECLS
15
16 G_DECLARE_FINAL_TYPE(GpiodglibRequestConfig, gpiodglib_request_config,
17 GPIODGLIB, REQUEST_CONFIG, GObject);
18
19 #define GPIODGLIB_REQUEST_CONFIG_TYPE (gpiodglib_request_config_get_type())
20 #define GPIODGLIB_REQUEST_CONFIG_OBJ(obj) \
21 (G_TYPE_CHECK_INSTANCE_CAST((obj), GPIODGLIB_REQUEST_CONFIG_TYPE, \
22 GpiodglibRequestConfig))
23
24 /**
25 * gpiodglib_request_config_new:
26 * @first_prop: Name of the first property to set.
27 *
28 * Create a new request config object.
29 *
30 * Returns: New #GpiodglibRequestConfig.
31 *
32 * The constructor allows to set object's properties when it's first created
33 * instead of having to build an empty object and then call mutators separately.
34 *
35 * Currently supported properties are: `consumer` and `event-buffer-size`.
36 */
37 GpiodglibRequestConfig *
38 gpiodglib_request_config_new(const gchar *first_prop, ...);
39
40 /**
41 * gpiodglib_request_config_set_consumer:
42 * @self: #GpiodglibRequestConfig object to manipulate.
43 * @consumer: Consumer name.
44 *
45 * Set the consumer name for the request.
46 *
47 * If the consumer string is too long, it will be truncated to the max
48 * accepted length.
49 */
50 void gpiodglib_request_config_set_consumer(GpiodglibRequestConfig *self,
51 const gchar *consumer);
52
53 /**
54 * gpiodglib_request_config_dup_consumer:
55 * @self: #GpiodglibRequestConfig object to manipulate.
56 *
57 * Get the consumer name configured in the request config.
58 *
59 * Returns: Consumer name stored in the request config. The returned string is
60 * a copy and must be freed by the caller using g_free().
61 */
62 gchar * G_GNUC_WARN_UNUSED_RESULT
63 gpiodglib_request_config_dup_consumer(GpiodglibRequestConfig *self);
64
65 /**
66 * gpiodglib_request_config_set_event_buffer_size:
67 * @self: #GpiodglibRequestConfig object to manipulate.
68 * @event_buffer_size: New event buffer size.
69 *
70 * Set the size of the kernel event buffer for the request.
71 *
72 * The kernel may adjust the value if it's too high. If set to 0, the default
73 * value will be used.
74 */
75 void
76 gpiodglib_request_config_set_event_buffer_size(GpiodglibRequestConfig *self,
77 guint event_buffer_size);
78
79
80 /**
81 * gpiodglib_request_config_get_event_buffer_size:
82 * @self: #GpiodglibRequestConfig object to manipulate.
83 *
84 * Get the edge event buffer size for the request config.
85 *
86 * Returns: Edge event buffer size setting from the request config.
87 */
88 guint
89 gpiodglib_request_config_get_event_buffer_size(GpiodglibRequestConfig *self);
90
91 G_END_DECLS
92
93 #endif /* __GPIODGLIB_REQUEST_CONFIG_H__ */