blob: a6820ae94966b61cc4f3b9009f3f2400113d1c1f [file] [log] [blame]
Norman Jamese2765102015-08-19 22:00:55 -05001/*
2 * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
3 *
4 * The license of this code is the same as for the source it was derived from.
5 */
6
7#ifdef HAVE_CONFIG_H
8# include "config.h"
9#endif
10
11#include "interfaces/sensor.h"
12
13#include <string.h>
14#ifdef G_OS_UNIX
15# include <gio/gunixfdlist.h>
16#endif
17
18typedef struct
19{
20 GDBusArgInfo parent_struct;
21 gboolean use_gvariant;
22} _ExtendedGDBusArgInfo;
23
24typedef struct
25{
26 GDBusMethodInfo parent_struct;
27 const gchar *signal_name;
28 gboolean pass_fdlist;
29} _ExtendedGDBusMethodInfo;
30
31typedef struct
32{
33 GDBusSignalInfo parent_struct;
34 const gchar *signal_name;
35} _ExtendedGDBusSignalInfo;
36
37typedef struct
38{
39 GDBusPropertyInfo parent_struct;
40 const gchar *hyphen_name;
41 gboolean use_gvariant;
42} _ExtendedGDBusPropertyInfo;
43
44typedef struct
45{
46 GDBusInterfaceInfo parent_struct;
47 const gchar *hyphen_name;
48} _ExtendedGDBusInterfaceInfo;
49
50typedef struct
51{
52 const _ExtendedGDBusPropertyInfo *info;
53 guint prop_id;
54 GValue orig_value; /* the value before the change */
55} ChangedProperty;
56
57static void
58_changed_property_free (ChangedProperty *data)
59{
60 g_value_unset (&data->orig_value);
61 g_free (data);
62}
63
64static gboolean
65_g_strv_equal0 (gchar **a, gchar **b)
66{
67 gboolean ret = FALSE;
68 guint n;
69 if (a == NULL && b == NULL)
70 {
71 ret = TRUE;
72 goto out;
73 }
74 if (a == NULL || b == NULL)
75 goto out;
76 if (g_strv_length (a) != g_strv_length (b))
77 goto out;
78 for (n = 0; a[n] != NULL; n++)
79 if (g_strcmp0 (a[n], b[n]) != 0)
80 goto out;
81 ret = TRUE;
82out:
83 return ret;
84}
85
86static gboolean
87_g_variant_equal0 (GVariant *a, GVariant *b)
88{
89 gboolean ret = FALSE;
90 if (a == NULL && b == NULL)
91 {
92 ret = TRUE;
93 goto out;
94 }
95 if (a == NULL || b == NULL)
96 goto out;
97 ret = g_variant_equal (a, b);
98out:
99 return ret;
100}
101
102G_GNUC_UNUSED static gboolean
103_g_value_equal (const GValue *a, const GValue *b)
104{
105 gboolean ret = FALSE;
106 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
107 switch (G_VALUE_TYPE (a))
108 {
109 case G_TYPE_BOOLEAN:
110 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
111 break;
112 case G_TYPE_UCHAR:
113 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
114 break;
115 case G_TYPE_INT:
116 ret = (g_value_get_int (a) == g_value_get_int (b));
117 break;
118 case G_TYPE_UINT:
119 ret = (g_value_get_uint (a) == g_value_get_uint (b));
120 break;
121 case G_TYPE_INT64:
122 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
123 break;
124 case G_TYPE_UINT64:
125 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
126 break;
127 case G_TYPE_DOUBLE:
128 {
129 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
130 gdouble da = g_value_get_double (a);
131 gdouble db = g_value_get_double (b);
132 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
133 }
134 break;
135 case G_TYPE_STRING:
136 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
137 break;
138 case G_TYPE_VARIANT:
139 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
140 break;
141 default:
142 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
143 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
144 else
145 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
146 break;
147 }
148 return ret;
149}
150
151/* ------------------------------------------------------------------------
152 * Code for interface org.openbmc.SensorInteger
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:SensorInteger
158 * @title: SensorInteger
159 * @short_description: Generated C code for the org.openbmc.SensorInteger D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.SensorInteger ---- */
165
166static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_value_OUT_ARG_value =
167{
168 {
169 -1,
170 (gchar *) "value",
171 (gchar *) "i",
172 NULL
173 },
174 FALSE
175};
176
177static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_value_OUT_ARG_pointers[] =
178{
179 &_sensor_integer_method_info_get_value_OUT_ARG_value,
180 NULL
181};
182
183static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_value =
184{
185 {
186 -1,
187 (gchar *) "getValue",
188 NULL,
189 (GDBusArgInfo **) &_sensor_integer_method_info_get_value_OUT_ARG_pointers,
190 NULL
191 },
192 "handle-get-value",
193 FALSE
194};
195
196static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_units_OUT_ARG_units =
197{
198 {
199 -1,
200 (gchar *) "units",
201 (gchar *) "s",
202 NULL
203 },
204 FALSE
205};
206
207static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_units_OUT_ARG_pointers[] =
208{
209 &_sensor_integer_method_info_get_units_OUT_ARG_units,
210 NULL
211};
212
213static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_units =
214{
215 {
216 -1,
217 (gchar *) "getUnits",
218 NULL,
219 (GDBusArgInfo **) &_sensor_integer_method_info_get_units_OUT_ARG_pointers,
220 NULL
221 },
222 "handle-get-units",
223 FALSE
224};
225
Norman James3f97c5d2015-08-26 17:44:14 -0500226static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_thresholds_IN_ARG_lower_critical =
227{
228 {
229 -1,
230 (gchar *) "lower_critical",
231 (gchar *) "i",
232 NULL
233 },
234 FALSE
235};
236
237static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_thresholds_IN_ARG_lower_warning =
238{
239 {
240 -1,
241 (gchar *) "lower_warning",
242 (gchar *) "i",
243 NULL
244 },
245 FALSE
246};
247
248static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_thresholds_IN_ARG_upper_warning =
249{
250 {
251 -1,
252 (gchar *) "upper_warning",
253 (gchar *) "i",
254 NULL
255 },
256 FALSE
257};
258
259static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_thresholds_IN_ARG_upper_critical =
260{
261 {
262 -1,
263 (gchar *) "upper_critical",
264 (gchar *) "i",
265 NULL
266 },
267 FALSE
268};
269
270static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_thresholds_IN_ARG_pointers[] =
271{
272 &_sensor_integer_method_info_set_thresholds_IN_ARG_lower_critical,
273 &_sensor_integer_method_info_set_thresholds_IN_ARG_lower_warning,
274 &_sensor_integer_method_info_set_thresholds_IN_ARG_upper_warning,
275 &_sensor_integer_method_info_set_thresholds_IN_ARG_upper_critical,
276 NULL
277};
278
279static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_thresholds =
280{
281 {
282 -1,
283 (gchar *) "setThresholds",
284 (GDBusArgInfo **) &_sensor_integer_method_info_set_thresholds_IN_ARG_pointers,
285 NULL,
286 NULL
287 },
288 "handle-set-thresholds",
289 FALSE
290};
291
Norman Jamescc7ae122015-08-24 14:26:09 -0500292static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_poll_interval_IN_ARG_poll_interval =
293{
294 {
295 -1,
296 (gchar *) "poll_interval",
297 (gchar *) "i",
298 NULL
299 },
300 FALSE
301};
302
303static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_poll_interval_IN_ARG_pointers[] =
304{
305 &_sensor_integer_method_info_set_poll_interval_IN_ARG_poll_interval,
306 NULL
307};
308
309static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_poll_interval =
310{
311 {
312 -1,
313 (gchar *) "setPollInterval",
314 (GDBusArgInfo **) &_sensor_integer_method_info_set_poll_interval_IN_ARG_pointers,
315 NULL,
316 NULL
317 },
318 "handle-set-poll-interval",
319 FALSE
320};
321
322static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_config_data_IN_ARG_config =
323{
324 {
325 -1,
326 (gchar *) "config",
327 (gchar *) "as",
328 NULL
329 },
330 FALSE
331};
332
333static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_config_data_IN_ARG_pointers[] =
334{
335 &_sensor_integer_method_info_set_config_data_IN_ARG_config,
336 NULL
337};
338
339static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_config_data =
340{
341 {
342 -1,
343 (gchar *) "setConfigData",
344 (GDBusArgInfo **) &_sensor_integer_method_info_set_config_data_IN_ARG_pointers,
345 NULL,
346 NULL
347 },
348 "handle-set-config-data",
349 FALSE
350};
351
Norman James3f97c5d2015-08-26 17:44:14 -0500352static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_threshold_state_OUT_ARG_threshold_state =
Norman Jamescc7ae122015-08-24 14:26:09 -0500353{
354 {
355 -1,
Norman James3f97c5d2015-08-26 17:44:14 -0500356 (gchar *) "threshold_state",
357 (gchar *) "i",
Norman Jamescc7ae122015-08-24 14:26:09 -0500358 NULL
359 },
Norman James3f97c5d2015-08-26 17:44:14 -0500360 FALSE
361};
362
363static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_threshold_state_OUT_ARG_pointers[] =
364{
365 &_sensor_integer_method_info_get_threshold_state_OUT_ARG_threshold_state,
366 NULL
367};
368
369static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_threshold_state =
370{
371 {
372 -1,
373 (gchar *) "getThresholdState",
374 NULL,
375 (GDBusArgInfo **) &_sensor_integer_method_info_get_threshold_state_OUT_ARG_pointers,
376 NULL
377 },
378 "handle-get-threshold-state",
Norman Jamescc7ae122015-08-24 14:26:09 -0500379 FALSE
380};
381
Norman Jamese7594922015-08-27 14:25:24 -0500382static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_watchdog_OUT_ARG_watchdog =
383{
384 {
385 -1,
386 (gchar *) "watchdog",
387 (gchar *) "i",
388 NULL
389 },
390 FALSE
391};
392
393static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_watchdog_OUT_ARG_pointers[] =
394{
395 &_sensor_integer_method_info_get_watchdog_OUT_ARG_watchdog,
396 NULL
397};
398
399static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_watchdog =
400{
401 {
402 -1,
403 (gchar *) "getWatchdog",
404 NULL,
405 (GDBusArgInfo **) &_sensor_integer_method_info_get_watchdog_OUT_ARG_pointers,
406 NULL
407 },
408 "handle-get-watchdog",
409 FALSE
410};
411
Norman Jamese2765102015-08-19 22:00:55 -0500412static const _ExtendedGDBusMethodInfo * const _sensor_integer_method_info_pointers[] =
413{
414 &_sensor_integer_method_info_get_value,
415 &_sensor_integer_method_info_get_units,
Norman James3f97c5d2015-08-26 17:44:14 -0500416 &_sensor_integer_method_info_set_thresholds,
Norman Jamescc7ae122015-08-24 14:26:09 -0500417 &_sensor_integer_method_info_set_poll_interval,
418 &_sensor_integer_method_info_set_config_data,
Norman James3f97c5d2015-08-26 17:44:14 -0500419 &_sensor_integer_method_info_get_threshold_state,
Norman Jamese7594922015-08-27 14:25:24 -0500420 &_sensor_integer_method_info_get_watchdog,
Norman Jamese2765102015-08-19 22:00:55 -0500421 NULL
422};
423
424static const _ExtendedGDBusArgInfo _sensor_integer_signal_info_changed_ARG_value =
425{
426 {
427 -1,
428 (gchar *) "value",
429 (gchar *) "i",
430 NULL
431 },
432 FALSE
433};
434
435static const _ExtendedGDBusArgInfo * const _sensor_integer_signal_info_changed_ARG_pointers[] =
436{
437 &_sensor_integer_signal_info_changed_ARG_value,
438 NULL
439};
440
441static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_changed =
442{
443 {
444 -1,
445 (gchar *) "Changed",
446 (GDBusArgInfo **) &_sensor_integer_signal_info_changed_ARG_pointers,
447 NULL
448 },
449 "changed"
450};
451
Norman James3f97c5d2015-08-26 17:44:14 -0500452static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_warning =
453{
454 {
455 -1,
456 (gchar *) "Warning",
457 NULL,
458 NULL
459 },
460 "warning"
461};
462
463static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_critical =
464{
465 {
466 -1,
467 (gchar *) "Critical",
468 NULL,
469 NULL
470 },
471 "critical"
472};
473
Norman Jamese2765102015-08-19 22:00:55 -0500474static const _ExtendedGDBusSignalInfo * const _sensor_integer_signal_info_pointers[] =
475{
476 &_sensor_integer_signal_info_changed,
Norman James3f97c5d2015-08-26 17:44:14 -0500477 &_sensor_integer_signal_info_warning,
478 &_sensor_integer_signal_info_critical,
Norman Jamese2765102015-08-19 22:00:55 -0500479 NULL
480};
481
482static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_value =
483{
484 {
485 -1,
486 (gchar *) "value",
487 (gchar *) "i",
488 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
489 NULL
490 },
491 "value",
492 FALSE
493};
494
495static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_units =
496{
497 {
498 -1,
499 (gchar *) "units",
500 (gchar *) "s",
501 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
502 NULL
503 },
504 "units",
505 FALSE
506};
507
Norman James3f97c5d2015-08-26 17:44:14 -0500508static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_lower_critical =
509{
510 {
511 -1,
512 (gchar *) "threshold_lower_critical",
513 (gchar *) "i",
514 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
515 NULL
516 },
517 "threshold-lower-critical",
518 FALSE
519};
520
521static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_lower_warning =
522{
523 {
524 -1,
525 (gchar *) "threshold_lower_warning",
526 (gchar *) "i",
527 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
528 NULL
529 },
530 "threshold-lower-warning",
531 FALSE
532};
533
534static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_upper_warning =
535{
536 {
537 -1,
538 (gchar *) "threshold_upper_warning",
539 (gchar *) "i",
540 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
541 NULL
542 },
543 "threshold-upper-warning",
544 FALSE
545};
546
547static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_upper_critical =
548{
549 {
550 -1,
551 (gchar *) "threshold_upper_critical",
552 (gchar *) "i",
553 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
554 NULL
555 },
556 "threshold-upper-critical",
557 FALSE
558};
559
560static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_threshold_state =
561{
562 {
563 -1,
564 (gchar *) "threshold_state",
565 (gchar *) "i",
566 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
567 NULL
568 },
569 "threshold-state",
570 FALSE
571};
572
Norman Jamescc7ae122015-08-24 14:26:09 -0500573static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_poll_interval =
574{
575 {
576 -1,
577 (gchar *) "poll_interval",
578 (gchar *) "i",
579 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
580 NULL
581 },
582 "poll-interval",
583 FALSE
584};
585
586static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_config_data =
587{
588 {
589 -1,
590 (gchar *) "config_data",
591 (gchar *) "as",
592 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
593 NULL
594 },
595 "config-data",
596 FALSE
597};
598
Norman Jamese7594922015-08-27 14:25:24 -0500599static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_watchdog =
Norman Jamescc7ae122015-08-24 14:26:09 -0500600{
601 {
602 -1,
Norman Jamese7594922015-08-27 14:25:24 -0500603 (gchar *) "watchdog",
Norman Jamescc7ae122015-08-24 14:26:09 -0500604 (gchar *) "i",
605 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
606 NULL
607 },
Norman Jamese7594922015-08-27 14:25:24 -0500608 "watchdog",
Norman Jamescc7ae122015-08-24 14:26:09 -0500609 FALSE
610};
611
Norman Jamese2765102015-08-19 22:00:55 -0500612static const _ExtendedGDBusPropertyInfo * const _sensor_integer_property_info_pointers[] =
613{
614 &_sensor_integer_property_info_value,
615 &_sensor_integer_property_info_units,
Norman James3f97c5d2015-08-26 17:44:14 -0500616 &_sensor_integer_property_info_threshold_lower_critical,
617 &_sensor_integer_property_info_threshold_lower_warning,
618 &_sensor_integer_property_info_threshold_upper_warning,
619 &_sensor_integer_property_info_threshold_upper_critical,
620 &_sensor_integer_property_info_threshold_state,
Norman Jamescc7ae122015-08-24 14:26:09 -0500621 &_sensor_integer_property_info_poll_interval,
622 &_sensor_integer_property_info_config_data,
Norman Jamese7594922015-08-27 14:25:24 -0500623 &_sensor_integer_property_info_watchdog,
Norman Jamese2765102015-08-19 22:00:55 -0500624 NULL
625};
626
627static const _ExtendedGDBusInterfaceInfo _sensor_integer_interface_info =
628{
629 {
630 -1,
631 (gchar *) "org.openbmc.SensorInteger",
632 (GDBusMethodInfo **) &_sensor_integer_method_info_pointers,
633 (GDBusSignalInfo **) &_sensor_integer_signal_info_pointers,
634 (GDBusPropertyInfo **) &_sensor_integer_property_info_pointers,
635 NULL
636 },
637 "sensor-integer",
638};
639
640
641/**
642 * sensor_integer_interface_info:
643 *
644 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> D-Bus interface.
645 *
646 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
647 */
648GDBusInterfaceInfo *
649sensor_integer_interface_info (void)
650{
651 return (GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct;
652}
653
654/**
655 * sensor_integer_override_properties:
656 * @klass: The class structure for a #GObject<!-- -->-derived class.
657 * @property_id_begin: The property id to assign to the first overridden property.
658 *
659 * Overrides all #GObject properties in the #SensorInteger interface for a concrete class.
660 * The properties are overridden in the order they are defined.
661 *
662 * Returns: The last property id.
663 */
664guint
665sensor_integer_override_properties (GObjectClass *klass, guint property_id_begin)
666{
667 g_object_class_override_property (klass, property_id_begin++, "value");
668 g_object_class_override_property (klass, property_id_begin++, "units");
Norman James3f97c5d2015-08-26 17:44:14 -0500669 g_object_class_override_property (klass, property_id_begin++, "threshold-lower-critical");
670 g_object_class_override_property (klass, property_id_begin++, "threshold-lower-warning");
671 g_object_class_override_property (klass, property_id_begin++, "threshold-upper-warning");
672 g_object_class_override_property (klass, property_id_begin++, "threshold-upper-critical");
673 g_object_class_override_property (klass, property_id_begin++, "threshold-state");
Norman Jamescc7ae122015-08-24 14:26:09 -0500674 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
675 g_object_class_override_property (klass, property_id_begin++, "config-data");
Norman Jamese7594922015-08-27 14:25:24 -0500676 g_object_class_override_property (klass, property_id_begin++, "watchdog");
Norman Jamese2765102015-08-19 22:00:55 -0500677 return property_id_begin - 1;
678}
679
680
681
682/**
683 * SensorInteger:
684 *
685 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
686 */
687
688/**
689 * SensorIntegerIface:
690 * @parent_iface: The parent interface.
Norman James3f97c5d2015-08-26 17:44:14 -0500691 * @handle_get_threshold_state: Handler for the #SensorInteger::handle-get-threshold-state signal.
Norman Jamese2765102015-08-19 22:00:55 -0500692 * @handle_get_units: Handler for the #SensorInteger::handle-get-units signal.
693 * @handle_get_value: Handler for the #SensorInteger::handle-get-value signal.
Norman Jamese7594922015-08-27 14:25:24 -0500694 * @handle_get_watchdog: Handler for the #SensorInteger::handle-get-watchdog signal.
Norman Jamescc7ae122015-08-24 14:26:09 -0500695 * @handle_set_config_data: Handler for the #SensorInteger::handle-set-config-data signal.
696 * @handle_set_poll_interval: Handler for the #SensorInteger::handle-set-poll-interval signal.
Norman James3f97c5d2015-08-26 17:44:14 -0500697 * @handle_set_thresholds: Handler for the #SensorInteger::handle-set-thresholds signal.
Norman Jamescc7ae122015-08-24 14:26:09 -0500698 * @get_config_data: Getter for the #SensorInteger:config-data property.
699 * @get_poll_interval: Getter for the #SensorInteger:poll-interval property.
Norman James3f97c5d2015-08-26 17:44:14 -0500700 * @get_threshold_lower_critical: Getter for the #SensorInteger:threshold-lower-critical property.
701 * @get_threshold_lower_warning: Getter for the #SensorInteger:threshold-lower-warning property.
702 * @get_threshold_state: Getter for the #SensorInteger:threshold-state property.
703 * @get_threshold_upper_critical: Getter for the #SensorInteger:threshold-upper-critical property.
704 * @get_threshold_upper_warning: Getter for the #SensorInteger:threshold-upper-warning property.
Norman Jamese2765102015-08-19 22:00:55 -0500705 * @get_units: Getter for the #SensorInteger:units property.
706 * @get_value: Getter for the #SensorInteger:value property.
Norman Jamese7594922015-08-27 14:25:24 -0500707 * @get_watchdog: Getter for the #SensorInteger:watchdog property.
Norman Jamese2765102015-08-19 22:00:55 -0500708 * @changed: Handler for the #SensorInteger::changed signal.
Norman James3f97c5d2015-08-26 17:44:14 -0500709 * @critical: Handler for the #SensorInteger::critical signal.
710 * @warning: Handler for the #SensorInteger::warning signal.
Norman Jamese2765102015-08-19 22:00:55 -0500711 *
712 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
713 */
714
715typedef SensorIntegerIface SensorIntegerInterface;
716G_DEFINE_INTERFACE (SensorInteger, sensor_integer, G_TYPE_OBJECT);
717
718static void
719sensor_integer_default_init (SensorIntegerIface *iface)
720{
721 /* GObject signals for incoming D-Bus method calls: */
722 /**
723 * SensorInteger::handle-get-value:
724 * @object: A #SensorInteger.
725 * @invocation: A #GDBusMethodInvocation.
726 *
727 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method.
728 *
729 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
730 *
731 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
732 */
733 g_signal_new ("handle-get-value",
734 G_TYPE_FROM_INTERFACE (iface),
735 G_SIGNAL_RUN_LAST,
736 G_STRUCT_OFFSET (SensorIntegerIface, handle_get_value),
737 g_signal_accumulator_true_handled,
738 NULL,
739 g_cclosure_marshal_generic,
740 G_TYPE_BOOLEAN,
741 1,
742 G_TYPE_DBUS_METHOD_INVOCATION);
743
744 /**
745 * SensorInteger::handle-get-units:
746 * @object: A #SensorInteger.
747 * @invocation: A #GDBusMethodInvocation.
748 *
749 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method.
750 *
751 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_get_units() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
752 *
753 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
754 */
755 g_signal_new ("handle-get-units",
756 G_TYPE_FROM_INTERFACE (iface),
757 G_SIGNAL_RUN_LAST,
758 G_STRUCT_OFFSET (SensorIntegerIface, handle_get_units),
759 g_signal_accumulator_true_handled,
760 NULL,
761 g_cclosure_marshal_generic,
762 G_TYPE_BOOLEAN,
763 1,
764 G_TYPE_DBUS_METHOD_INVOCATION);
765
Norman Jamescc7ae122015-08-24 14:26:09 -0500766 /**
Norman James3f97c5d2015-08-26 17:44:14 -0500767 * SensorInteger::handle-set-thresholds:
768 * @object: A #SensorInteger.
769 * @invocation: A #GDBusMethodInvocation.
770 * @arg_lower_critical: Argument passed by remote caller.
771 * @arg_lower_warning: Argument passed by remote caller.
772 * @arg_upper_warning: Argument passed by remote caller.
773 * @arg_upper_critical: Argument passed by remote caller.
774 *
775 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setThresholds">setThresholds()</link> D-Bus method.
776 *
777 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_set_thresholds() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
778 *
779 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
780 */
781 g_signal_new ("handle-set-thresholds",
782 G_TYPE_FROM_INTERFACE (iface),
783 G_SIGNAL_RUN_LAST,
784 G_STRUCT_OFFSET (SensorIntegerIface, handle_set_thresholds),
785 g_signal_accumulator_true_handled,
786 NULL,
787 g_cclosure_marshal_generic,
788 G_TYPE_BOOLEAN,
789 5,
790 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
791
792 /**
Norman Jamescc7ae122015-08-24 14:26:09 -0500793 * SensorInteger::handle-set-poll-interval:
794 * @object: A #SensorInteger.
795 * @invocation: A #GDBusMethodInvocation.
796 * @arg_poll_interval: Argument passed by remote caller.
797 *
798 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method.
799 *
800 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_set_poll_interval() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
801 *
802 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
803 */
804 g_signal_new ("handle-set-poll-interval",
805 G_TYPE_FROM_INTERFACE (iface),
806 G_SIGNAL_RUN_LAST,
807 G_STRUCT_OFFSET (SensorIntegerIface, handle_set_poll_interval),
808 g_signal_accumulator_true_handled,
809 NULL,
810 g_cclosure_marshal_generic,
811 G_TYPE_BOOLEAN,
812 2,
813 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
814
815 /**
816 * SensorInteger::handle-set-config-data:
817 * @object: A #SensorInteger.
818 * @invocation: A #GDBusMethodInvocation.
819 * @arg_config: Argument passed by remote caller.
820 *
821 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method.
822 *
823 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_set_config_data() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
824 *
825 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
826 */
827 g_signal_new ("handle-set-config-data",
828 G_TYPE_FROM_INTERFACE (iface),
829 G_SIGNAL_RUN_LAST,
830 G_STRUCT_OFFSET (SensorIntegerIface, handle_set_config_data),
831 g_signal_accumulator_true_handled,
832 NULL,
833 g_cclosure_marshal_generic,
834 G_TYPE_BOOLEAN,
835 2,
836 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRV);
837
838 /**
Norman James3f97c5d2015-08-26 17:44:14 -0500839 * SensorInteger::handle-get-threshold-state:
Norman Jamescc7ae122015-08-24 14:26:09 -0500840 * @object: A #SensorInteger.
841 * @invocation: A #GDBusMethodInvocation.
842 *
Norman James3f97c5d2015-08-26 17:44:14 -0500843 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getThresholdState">getThresholdState()</link> D-Bus method.
Norman Jamescc7ae122015-08-24 14:26:09 -0500844 *
Norman James3f97c5d2015-08-26 17:44:14 -0500845 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_get_threshold_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
Norman Jamescc7ae122015-08-24 14:26:09 -0500846 *
847 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
848 */
Norman James3f97c5d2015-08-26 17:44:14 -0500849 g_signal_new ("handle-get-threshold-state",
Norman Jamescc7ae122015-08-24 14:26:09 -0500850 G_TYPE_FROM_INTERFACE (iface),
851 G_SIGNAL_RUN_LAST,
Norman James3f97c5d2015-08-26 17:44:14 -0500852 G_STRUCT_OFFSET (SensorIntegerIface, handle_get_threshold_state),
Norman Jamescc7ae122015-08-24 14:26:09 -0500853 g_signal_accumulator_true_handled,
854 NULL,
855 g_cclosure_marshal_generic,
856 G_TYPE_BOOLEAN,
857 1,
858 G_TYPE_DBUS_METHOD_INVOCATION);
859
Norman Jamese7594922015-08-27 14:25:24 -0500860 /**
861 * SensorInteger::handle-get-watchdog:
862 * @object: A #SensorInteger.
863 * @invocation: A #GDBusMethodInvocation.
864 *
865 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getWatchdog">getWatchdog()</link> D-Bus method.
866 *
867 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_get_watchdog() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
868 *
869 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
870 */
871 g_signal_new ("handle-get-watchdog",
872 G_TYPE_FROM_INTERFACE (iface),
873 G_SIGNAL_RUN_LAST,
874 G_STRUCT_OFFSET (SensorIntegerIface, handle_get_watchdog),
875 g_signal_accumulator_true_handled,
876 NULL,
877 g_cclosure_marshal_generic,
878 G_TYPE_BOOLEAN,
879 1,
880 G_TYPE_DBUS_METHOD_INVOCATION);
881
Norman Jamese2765102015-08-19 22:00:55 -0500882 /* GObject signals for received D-Bus signals: */
883 /**
884 * SensorInteger::changed:
885 * @object: A #SensorInteger.
886 * @arg_value: Argument.
887 *
888 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorInteger.Changed">"Changed"</link> is received.
889 *
890 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
891 */
892 g_signal_new ("changed",
893 G_TYPE_FROM_INTERFACE (iface),
894 G_SIGNAL_RUN_LAST,
895 G_STRUCT_OFFSET (SensorIntegerIface, changed),
896 NULL,
897 NULL,
898 g_cclosure_marshal_generic,
899 G_TYPE_NONE,
900 1, G_TYPE_INT);
901
Norman James3f97c5d2015-08-26 17:44:14 -0500902 /**
903 * SensorInteger::warning:
904 * @object: A #SensorInteger.
905 *
906 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorInteger.Warning">"Warning"</link> is received.
907 *
908 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
909 */
910 g_signal_new ("warning",
911 G_TYPE_FROM_INTERFACE (iface),
912 G_SIGNAL_RUN_LAST,
913 G_STRUCT_OFFSET (SensorIntegerIface, warning),
914 NULL,
915 NULL,
916 g_cclosure_marshal_generic,
917 G_TYPE_NONE,
918 0);
919
920 /**
921 * SensorInteger::critical:
922 * @object: A #SensorInteger.
923 *
924 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorInteger.Critical">"Critical"</link> is received.
925 *
926 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
927 */
928 g_signal_new ("critical",
929 G_TYPE_FROM_INTERFACE (iface),
930 G_SIGNAL_RUN_LAST,
931 G_STRUCT_OFFSET (SensorIntegerIface, critical),
932 NULL,
933 NULL,
934 g_cclosure_marshal_generic,
935 G_TYPE_NONE,
936 0);
937
Norman Jamese2765102015-08-19 22:00:55 -0500938 /* GObject properties for D-Bus properties: */
939 /**
940 * SensorInteger:value:
941 *
942 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link>.
943 *
944 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
945 */
946 g_object_interface_install_property (iface,
947 g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
948 /**
949 * SensorInteger:units:
950 *
951 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link>.
952 *
953 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
954 */
955 g_object_interface_install_property (iface,
956 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -0500957 /**
Norman James3f97c5d2015-08-26 17:44:14 -0500958 * SensorInteger:threshold-lower-critical:
959 *
960 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_critical">"threshold_lower_critical"</link>.
961 *
962 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
963 */
964 g_object_interface_install_property (iface,
965 g_param_spec_int ("threshold-lower-critical", "threshold_lower_critical", "threshold_lower_critical", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
966 /**
967 * SensorInteger:threshold-lower-warning:
968 *
969 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_warning">"threshold_lower_warning"</link>.
970 *
971 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
972 */
973 g_object_interface_install_property (iface,
974 g_param_spec_int ("threshold-lower-warning", "threshold_lower_warning", "threshold_lower_warning", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
975 /**
976 * SensorInteger:threshold-upper-warning:
977 *
978 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_warning">"threshold_upper_warning"</link>.
979 *
980 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
981 */
982 g_object_interface_install_property (iface,
983 g_param_spec_int ("threshold-upper-warning", "threshold_upper_warning", "threshold_upper_warning", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
984 /**
985 * SensorInteger:threshold-upper-critical:
986 *
987 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_critical">"threshold_upper_critical"</link>.
988 *
989 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
990 */
991 g_object_interface_install_property (iface,
992 g_param_spec_int ("threshold-upper-critical", "threshold_upper_critical", "threshold_upper_critical", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
993 /**
994 * SensorInteger:threshold-state:
995 *
996 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_state">"threshold_state"</link>.
997 *
998 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
999 */
1000 g_object_interface_install_property (iface,
1001 g_param_spec_int ("threshold-state", "threshold_state", "threshold_state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1002 /**
Norman Jamescc7ae122015-08-24 14:26:09 -05001003 * SensorInteger:poll-interval:
1004 *
1005 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link>.
1006 *
1007 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
1008 */
1009 g_object_interface_install_property (iface,
1010 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1011 /**
1012 * SensorInteger:config-data:
1013 *
1014 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link>.
1015 *
1016 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
1017 */
1018 g_object_interface_install_property (iface,
1019 g_param_spec_boxed ("config-data", "config_data", "config_data", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1020 /**
Norman Jamese7594922015-08-27 14:25:24 -05001021 * SensorInteger:watchdog:
Norman Jamescc7ae122015-08-24 14:26:09 -05001022 *
Norman Jamese7594922015-08-27 14:25:24 -05001023 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.watchdog">"watchdog"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05001024 *
1025 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
1026 */
1027 g_object_interface_install_property (iface,
Norman Jamese7594922015-08-27 14:25:24 -05001028 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamese2765102015-08-19 22:00:55 -05001029}
1030
1031/**
1032 * sensor_integer_get_value: (skip)
1033 * @object: A #SensorInteger.
1034 *
1035 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link> D-Bus property.
1036 *
1037 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1038 *
1039 * Returns: The property value.
1040 */
1041gint
1042sensor_integer_get_value (SensorInteger *object)
1043{
1044 return SENSOR_INTEGER_GET_IFACE (object)->get_value (object);
1045}
1046
1047/**
1048 * sensor_integer_set_value: (skip)
1049 * @object: A #SensorInteger.
1050 * @value: The value to set.
1051 *
1052 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link> D-Bus property to @value.
1053 *
1054 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1055 */
1056void
1057sensor_integer_set_value (SensorInteger *object, gint value)
1058{
1059 g_object_set (G_OBJECT (object), "value", value, NULL);
1060}
1061
1062/**
1063 * sensor_integer_get_units: (skip)
1064 * @object: A #SensorInteger.
1065 *
1066 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property.
1067 *
1068 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1069 *
1070 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_integer_dup_units() if on another thread.</warning>
1071 *
1072 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
1073 */
1074const gchar *
1075sensor_integer_get_units (SensorInteger *object)
1076{
1077 return SENSOR_INTEGER_GET_IFACE (object)->get_units (object);
1078}
1079
1080/**
1081 * sensor_integer_dup_units: (skip)
1082 * @object: A #SensorInteger.
1083 *
1084 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property.
1085 *
1086 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1087 *
1088 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1089 */
1090gchar *
1091sensor_integer_dup_units (SensorInteger *object)
1092{
1093 gchar *value;
1094 g_object_get (G_OBJECT (object), "units", &value, NULL);
1095 return value;
1096}
1097
1098/**
1099 * sensor_integer_set_units: (skip)
1100 * @object: A #SensorInteger.
1101 * @value: The value to set.
1102 *
1103 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property to @value.
1104 *
1105 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1106 */
1107void
1108sensor_integer_set_units (SensorInteger *object, const gchar *value)
1109{
1110 g_object_set (G_OBJECT (object), "units", value, NULL);
1111}
1112
1113/**
Norman James3f97c5d2015-08-26 17:44:14 -05001114 * sensor_integer_get_threshold_lower_critical: (skip)
1115 * @object: A #SensorInteger.
1116 *
1117 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_critical">"threshold_lower_critical"</link> D-Bus property.
1118 *
1119 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1120 *
1121 * Returns: The property value.
1122 */
1123gint
1124sensor_integer_get_threshold_lower_critical (SensorInteger *object)
1125{
1126 return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_lower_critical (object);
1127}
1128
1129/**
1130 * sensor_integer_set_threshold_lower_critical: (skip)
1131 * @object: A #SensorInteger.
1132 * @value: The value to set.
1133 *
1134 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_critical">"threshold_lower_critical"</link> D-Bus property to @value.
1135 *
1136 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1137 */
1138void
1139sensor_integer_set_threshold_lower_critical (SensorInteger *object, gint value)
1140{
1141 g_object_set (G_OBJECT (object), "threshold-lower-critical", value, NULL);
1142}
1143
1144/**
1145 * sensor_integer_get_threshold_lower_warning: (skip)
1146 * @object: A #SensorInteger.
1147 *
1148 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_warning">"threshold_lower_warning"</link> D-Bus property.
1149 *
1150 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1151 *
1152 * Returns: The property value.
1153 */
1154gint
1155sensor_integer_get_threshold_lower_warning (SensorInteger *object)
1156{
1157 return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_lower_warning (object);
1158}
1159
1160/**
1161 * sensor_integer_set_threshold_lower_warning: (skip)
1162 * @object: A #SensorInteger.
1163 * @value: The value to set.
1164 *
1165 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_lower_warning">"threshold_lower_warning"</link> D-Bus property to @value.
1166 *
1167 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1168 */
1169void
1170sensor_integer_set_threshold_lower_warning (SensorInteger *object, gint value)
1171{
1172 g_object_set (G_OBJECT (object), "threshold-lower-warning", value, NULL);
1173}
1174
1175/**
1176 * sensor_integer_get_threshold_upper_warning: (skip)
1177 * @object: A #SensorInteger.
1178 *
1179 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_warning">"threshold_upper_warning"</link> D-Bus property.
1180 *
1181 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1182 *
1183 * Returns: The property value.
1184 */
1185gint
1186sensor_integer_get_threshold_upper_warning (SensorInteger *object)
1187{
1188 return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_upper_warning (object);
1189}
1190
1191/**
1192 * sensor_integer_set_threshold_upper_warning: (skip)
1193 * @object: A #SensorInteger.
1194 * @value: The value to set.
1195 *
1196 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_warning">"threshold_upper_warning"</link> D-Bus property to @value.
1197 *
1198 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1199 */
1200void
1201sensor_integer_set_threshold_upper_warning (SensorInteger *object, gint value)
1202{
1203 g_object_set (G_OBJECT (object), "threshold-upper-warning", value, NULL);
1204}
1205
1206/**
1207 * sensor_integer_get_threshold_upper_critical: (skip)
1208 * @object: A #SensorInteger.
1209 *
1210 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_critical">"threshold_upper_critical"</link> D-Bus property.
1211 *
1212 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1213 *
1214 * Returns: The property value.
1215 */
1216gint
1217sensor_integer_get_threshold_upper_critical (SensorInteger *object)
1218{
1219 return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_upper_critical (object);
1220}
1221
1222/**
1223 * sensor_integer_set_threshold_upper_critical: (skip)
1224 * @object: A #SensorInteger.
1225 * @value: The value to set.
1226 *
1227 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_upper_critical">"threshold_upper_critical"</link> D-Bus property to @value.
1228 *
1229 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1230 */
1231void
1232sensor_integer_set_threshold_upper_critical (SensorInteger *object, gint value)
1233{
1234 g_object_set (G_OBJECT (object), "threshold-upper-critical", value, NULL);
1235}
1236
1237/**
1238 * sensor_integer_get_threshold_state: (skip)
1239 * @object: A #SensorInteger.
1240 *
1241 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_state">"threshold_state"</link> D-Bus property.
1242 *
1243 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1244 *
1245 * Returns: The property value.
1246 */
1247gint
1248sensor_integer_get_threshold_state (SensorInteger *object)
1249{
1250 return SENSOR_INTEGER_GET_IFACE (object)->get_threshold_state (object);
1251}
1252
1253/**
1254 * sensor_integer_set_threshold_state: (skip)
1255 * @object: A #SensorInteger.
1256 * @value: The value to set.
1257 *
1258 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.threshold_state">"threshold_state"</link> D-Bus property to @value.
1259 *
1260 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1261 */
1262void
1263sensor_integer_set_threshold_state (SensorInteger *object, gint value)
1264{
1265 g_object_set (G_OBJECT (object), "threshold-state", value, NULL);
1266}
1267
1268/**
Norman Jamescc7ae122015-08-24 14:26:09 -05001269 * sensor_integer_get_poll_interval: (skip)
1270 * @object: A #SensorInteger.
1271 *
1272 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link> D-Bus property.
1273 *
1274 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1275 *
1276 * Returns: The property value.
1277 */
1278gint
1279sensor_integer_get_poll_interval (SensorInteger *object)
1280{
1281 return SENSOR_INTEGER_GET_IFACE (object)->get_poll_interval (object);
1282}
1283
1284/**
1285 * sensor_integer_set_poll_interval: (skip)
1286 * @object: A #SensorInteger.
1287 * @value: The value to set.
1288 *
1289 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link> D-Bus property to @value.
1290 *
1291 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1292 */
1293void
1294sensor_integer_set_poll_interval (SensorInteger *object, gint value)
1295{
1296 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
1297}
1298
1299/**
1300 * sensor_integer_get_config_data: (skip)
1301 * @object: A #SensorInteger.
1302 *
1303 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property.
1304 *
1305 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1306 *
1307 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_integer_dup_config_data() if on another thread.</warning>
1308 *
1309 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
1310 */
1311const gchar *const *
1312sensor_integer_get_config_data (SensorInteger *object)
1313{
1314 return SENSOR_INTEGER_GET_IFACE (object)->get_config_data (object);
1315}
1316
1317/**
1318 * sensor_integer_dup_config_data: (skip)
1319 * @object: A #SensorInteger.
1320 *
1321 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property.
1322 *
1323 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1324 *
1325 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev().
1326 */
1327gchar **
1328sensor_integer_dup_config_data (SensorInteger *object)
1329{
1330 gchar **value;
1331 g_object_get (G_OBJECT (object), "config-data", &value, NULL);
1332 return value;
1333}
1334
1335/**
1336 * sensor_integer_set_config_data: (skip)
1337 * @object: A #SensorInteger.
1338 * @value: The value to set.
1339 *
1340 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property to @value.
1341 *
1342 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1343 */
1344void
1345sensor_integer_set_config_data (SensorInteger *object, const gchar *const *value)
1346{
1347 g_object_set (G_OBJECT (object), "config-data", value, NULL);
1348}
1349
1350/**
Norman Jamese7594922015-08-27 14:25:24 -05001351 * sensor_integer_get_watchdog: (skip)
Norman Jamescc7ae122015-08-24 14:26:09 -05001352 * @object: A #SensorInteger.
1353 *
Norman Jamese7594922015-08-27 14:25:24 -05001354 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.watchdog">"watchdog"</link> D-Bus property.
Norman Jamescc7ae122015-08-24 14:26:09 -05001355 *
1356 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1357 *
1358 * Returns: The property value.
1359 */
1360gint
Norman Jamese7594922015-08-27 14:25:24 -05001361sensor_integer_get_watchdog (SensorInteger *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05001362{
Norman Jamese7594922015-08-27 14:25:24 -05001363 return SENSOR_INTEGER_GET_IFACE (object)->get_watchdog (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05001364}
1365
1366/**
Norman Jamese7594922015-08-27 14:25:24 -05001367 * sensor_integer_set_watchdog: (skip)
Norman Jamescc7ae122015-08-24 14:26:09 -05001368 * @object: A #SensorInteger.
1369 * @value: The value to set.
1370 *
Norman Jamese7594922015-08-27 14:25:24 -05001371 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.watchdog">"watchdog"</link> D-Bus property to @value.
Norman Jamescc7ae122015-08-24 14:26:09 -05001372 *
1373 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1374 */
1375void
Norman Jamese7594922015-08-27 14:25:24 -05001376sensor_integer_set_watchdog (SensorInteger *object, gint value)
Norman Jamescc7ae122015-08-24 14:26:09 -05001377{
Norman Jamese7594922015-08-27 14:25:24 -05001378 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
Norman Jamescc7ae122015-08-24 14:26:09 -05001379}
1380
1381/**
Norman Jamese2765102015-08-19 22:00:55 -05001382 * sensor_integer_emit_changed:
1383 * @object: A #SensorInteger.
1384 * @arg_value: Argument to pass with the signal.
1385 *
1386 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Changed">"Changed"</link> D-Bus signal.
1387 */
1388void
1389sensor_integer_emit_changed (
1390 SensorInteger *object,
1391 gint arg_value)
1392{
1393 g_signal_emit_by_name (object, "changed", arg_value);
1394}
1395
1396/**
Norman James3f97c5d2015-08-26 17:44:14 -05001397 * sensor_integer_emit_warning:
1398 * @object: A #SensorInteger.
1399 *
1400 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Warning">"Warning"</link> D-Bus signal.
1401 */
1402void
1403sensor_integer_emit_warning (
1404 SensorInteger *object)
1405{
1406 g_signal_emit_by_name (object, "warning");
1407}
1408
1409/**
1410 * sensor_integer_emit_critical:
1411 * @object: A #SensorInteger.
1412 *
1413 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Critical">"Critical"</link> D-Bus signal.
1414 */
1415void
1416sensor_integer_emit_critical (
1417 SensorInteger *object)
1418{
1419 g_signal_emit_by_name (object, "critical");
1420}
1421
1422/**
Norman Jamese2765102015-08-19 22:00:55 -05001423 * sensor_integer_call_get_value:
1424 * @proxy: A #SensorIntegerProxy.
1425 * @cancellable: (allow-none): A #GCancellable or %NULL.
1426 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1427 * @user_data: User data to pass to @callback.
1428 *
1429 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method on @proxy.
1430 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1431 * You can then call sensor_integer_call_get_value_finish() to get the result of the operation.
1432 *
1433 * See sensor_integer_call_get_value_sync() for the synchronous, blocking version of this method.
1434 */
1435void
1436sensor_integer_call_get_value (
1437 SensorInteger *proxy,
1438 GCancellable *cancellable,
1439 GAsyncReadyCallback callback,
1440 gpointer user_data)
1441{
1442 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1443 "getValue",
1444 g_variant_new ("()"),
1445 G_DBUS_CALL_FLAGS_NONE,
1446 -1,
1447 cancellable,
1448 callback,
1449 user_data);
1450}
1451
1452/**
1453 * sensor_integer_call_get_value_finish:
1454 * @proxy: A #SensorIntegerProxy.
1455 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1456 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_value().
1457 * @error: Return location for error or %NULL.
1458 *
1459 * Finishes an operation started with sensor_integer_call_get_value().
1460 *
1461 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1462 */
1463gboolean
1464sensor_integer_call_get_value_finish (
1465 SensorInteger *proxy,
1466 gint *out_value,
1467 GAsyncResult *res,
1468 GError **error)
1469{
1470 GVariant *_ret;
1471 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1472 if (_ret == NULL)
1473 goto _out;
1474 g_variant_get (_ret,
1475 "(i)",
1476 out_value);
1477 g_variant_unref (_ret);
1478_out:
1479 return _ret != NULL;
1480}
1481
1482/**
1483 * sensor_integer_call_get_value_sync:
1484 * @proxy: A #SensorIntegerProxy.
1485 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1486 * @cancellable: (allow-none): A #GCancellable or %NULL.
1487 * @error: Return location for error or %NULL.
1488 *
1489 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1490 *
1491 * See sensor_integer_call_get_value() for the asynchronous version of this method.
1492 *
1493 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1494 */
1495gboolean
1496sensor_integer_call_get_value_sync (
1497 SensorInteger *proxy,
1498 gint *out_value,
1499 GCancellable *cancellable,
1500 GError **error)
1501{
1502 GVariant *_ret;
1503 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1504 "getValue",
1505 g_variant_new ("()"),
1506 G_DBUS_CALL_FLAGS_NONE,
1507 -1,
1508 cancellable,
1509 error);
1510 if (_ret == NULL)
1511 goto _out;
1512 g_variant_get (_ret,
1513 "(i)",
1514 out_value);
1515 g_variant_unref (_ret);
1516_out:
1517 return _ret != NULL;
1518}
1519
1520/**
1521 * sensor_integer_call_get_units:
1522 * @proxy: A #SensorIntegerProxy.
1523 * @cancellable: (allow-none): A #GCancellable or %NULL.
1524 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1525 * @user_data: User data to pass to @callback.
1526 *
1527 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method on @proxy.
1528 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1529 * You can then call sensor_integer_call_get_units_finish() to get the result of the operation.
1530 *
1531 * See sensor_integer_call_get_units_sync() for the synchronous, blocking version of this method.
1532 */
1533void
1534sensor_integer_call_get_units (
1535 SensorInteger *proxy,
1536 GCancellable *cancellable,
1537 GAsyncReadyCallback callback,
1538 gpointer user_data)
1539{
1540 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1541 "getUnits",
1542 g_variant_new ("()"),
1543 G_DBUS_CALL_FLAGS_NONE,
1544 -1,
1545 cancellable,
1546 callback,
1547 user_data);
1548}
1549
1550/**
1551 * sensor_integer_call_get_units_finish:
1552 * @proxy: A #SensorIntegerProxy.
1553 * @out_units: (out): Return location for return parameter or %NULL to ignore.
1554 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_units().
1555 * @error: Return location for error or %NULL.
1556 *
1557 * Finishes an operation started with sensor_integer_call_get_units().
1558 *
1559 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1560 */
1561gboolean
1562sensor_integer_call_get_units_finish (
1563 SensorInteger *proxy,
1564 gchar **out_units,
1565 GAsyncResult *res,
1566 GError **error)
1567{
1568 GVariant *_ret;
1569 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1570 if (_ret == NULL)
1571 goto _out;
1572 g_variant_get (_ret,
1573 "(s)",
1574 out_units);
1575 g_variant_unref (_ret);
1576_out:
1577 return _ret != NULL;
1578}
1579
1580/**
1581 * sensor_integer_call_get_units_sync:
1582 * @proxy: A #SensorIntegerProxy.
1583 * @out_units: (out): Return location for return parameter or %NULL to ignore.
1584 * @cancellable: (allow-none): A #GCancellable or %NULL.
1585 * @error: Return location for error or %NULL.
1586 *
1587 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1588 *
1589 * See sensor_integer_call_get_units() for the asynchronous version of this method.
1590 *
1591 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1592 */
1593gboolean
1594sensor_integer_call_get_units_sync (
1595 SensorInteger *proxy,
1596 gchar **out_units,
1597 GCancellable *cancellable,
1598 GError **error)
1599{
1600 GVariant *_ret;
1601 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1602 "getUnits",
1603 g_variant_new ("()"),
1604 G_DBUS_CALL_FLAGS_NONE,
1605 -1,
1606 cancellable,
1607 error);
1608 if (_ret == NULL)
1609 goto _out;
1610 g_variant_get (_ret,
1611 "(s)",
1612 out_units);
1613 g_variant_unref (_ret);
1614_out:
1615 return _ret != NULL;
1616}
1617
1618/**
Norman James3f97c5d2015-08-26 17:44:14 -05001619 * sensor_integer_call_set_thresholds:
1620 * @proxy: A #SensorIntegerProxy.
1621 * @arg_lower_critical: Argument to pass with the method invocation.
1622 * @arg_lower_warning: Argument to pass with the method invocation.
1623 * @arg_upper_warning: Argument to pass with the method invocation.
1624 * @arg_upper_critical: Argument to pass with the method invocation.
1625 * @cancellable: (allow-none): A #GCancellable or %NULL.
1626 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1627 * @user_data: User data to pass to @callback.
1628 *
1629 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setThresholds">setThresholds()</link> D-Bus method on @proxy.
1630 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1631 * You can then call sensor_integer_call_set_thresholds_finish() to get the result of the operation.
1632 *
1633 * See sensor_integer_call_set_thresholds_sync() for the synchronous, blocking version of this method.
1634 */
1635void
1636sensor_integer_call_set_thresholds (
1637 SensorInteger *proxy,
1638 gint arg_lower_critical,
1639 gint arg_lower_warning,
1640 gint arg_upper_warning,
1641 gint arg_upper_critical,
1642 GCancellable *cancellable,
1643 GAsyncReadyCallback callback,
1644 gpointer user_data)
1645{
1646 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1647 "setThresholds",
1648 g_variant_new ("(iiii)",
1649 arg_lower_critical,
1650 arg_lower_warning,
1651 arg_upper_warning,
1652 arg_upper_critical),
1653 G_DBUS_CALL_FLAGS_NONE,
1654 -1,
1655 cancellable,
1656 callback,
1657 user_data);
1658}
1659
1660/**
1661 * sensor_integer_call_set_thresholds_finish:
1662 * @proxy: A #SensorIntegerProxy.
1663 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_thresholds().
1664 * @error: Return location for error or %NULL.
1665 *
1666 * Finishes an operation started with sensor_integer_call_set_thresholds().
1667 *
1668 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1669 */
1670gboolean
1671sensor_integer_call_set_thresholds_finish (
1672 SensorInteger *proxy,
1673 GAsyncResult *res,
1674 GError **error)
1675{
1676 GVariant *_ret;
1677 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1678 if (_ret == NULL)
1679 goto _out;
1680 g_variant_get (_ret,
1681 "()");
1682 g_variant_unref (_ret);
1683_out:
1684 return _ret != NULL;
1685}
1686
1687/**
1688 * sensor_integer_call_set_thresholds_sync:
1689 * @proxy: A #SensorIntegerProxy.
1690 * @arg_lower_critical: Argument to pass with the method invocation.
1691 * @arg_lower_warning: Argument to pass with the method invocation.
1692 * @arg_upper_warning: Argument to pass with the method invocation.
1693 * @arg_upper_critical: Argument to pass with the method invocation.
1694 * @cancellable: (allow-none): A #GCancellable or %NULL.
1695 * @error: Return location for error or %NULL.
1696 *
1697 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setThresholds">setThresholds()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1698 *
1699 * See sensor_integer_call_set_thresholds() for the asynchronous version of this method.
1700 *
1701 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1702 */
1703gboolean
1704sensor_integer_call_set_thresholds_sync (
1705 SensorInteger *proxy,
1706 gint arg_lower_critical,
1707 gint arg_lower_warning,
1708 gint arg_upper_warning,
1709 gint arg_upper_critical,
1710 GCancellable *cancellable,
1711 GError **error)
1712{
1713 GVariant *_ret;
1714 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1715 "setThresholds",
1716 g_variant_new ("(iiii)",
1717 arg_lower_critical,
1718 arg_lower_warning,
1719 arg_upper_warning,
1720 arg_upper_critical),
1721 G_DBUS_CALL_FLAGS_NONE,
1722 -1,
1723 cancellable,
1724 error);
1725 if (_ret == NULL)
1726 goto _out;
1727 g_variant_get (_ret,
1728 "()");
1729 g_variant_unref (_ret);
1730_out:
1731 return _ret != NULL;
1732}
1733
1734/**
Norman Jamescc7ae122015-08-24 14:26:09 -05001735 * sensor_integer_call_set_poll_interval:
1736 * @proxy: A #SensorIntegerProxy.
1737 * @arg_poll_interval: Argument to pass with the method invocation.
1738 * @cancellable: (allow-none): A #GCancellable or %NULL.
1739 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1740 * @user_data: User data to pass to @callback.
1741 *
1742 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method on @proxy.
1743 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1744 * You can then call sensor_integer_call_set_poll_interval_finish() to get the result of the operation.
1745 *
1746 * See sensor_integer_call_set_poll_interval_sync() for the synchronous, blocking version of this method.
1747 */
1748void
1749sensor_integer_call_set_poll_interval (
1750 SensorInteger *proxy,
1751 gint arg_poll_interval,
1752 GCancellable *cancellable,
1753 GAsyncReadyCallback callback,
1754 gpointer user_data)
1755{
1756 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1757 "setPollInterval",
1758 g_variant_new ("(i)",
1759 arg_poll_interval),
1760 G_DBUS_CALL_FLAGS_NONE,
1761 -1,
1762 cancellable,
1763 callback,
1764 user_data);
1765}
1766
1767/**
1768 * sensor_integer_call_set_poll_interval_finish:
1769 * @proxy: A #SensorIntegerProxy.
1770 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_poll_interval().
1771 * @error: Return location for error or %NULL.
1772 *
1773 * Finishes an operation started with sensor_integer_call_set_poll_interval().
1774 *
1775 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1776 */
1777gboolean
1778sensor_integer_call_set_poll_interval_finish (
1779 SensorInteger *proxy,
1780 GAsyncResult *res,
1781 GError **error)
1782{
1783 GVariant *_ret;
1784 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1785 if (_ret == NULL)
1786 goto _out;
1787 g_variant_get (_ret,
1788 "()");
1789 g_variant_unref (_ret);
1790_out:
1791 return _ret != NULL;
1792}
1793
1794/**
1795 * sensor_integer_call_set_poll_interval_sync:
1796 * @proxy: A #SensorIntegerProxy.
1797 * @arg_poll_interval: Argument to pass with the method invocation.
1798 * @cancellable: (allow-none): A #GCancellable or %NULL.
1799 * @error: Return location for error or %NULL.
1800 *
1801 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1802 *
1803 * See sensor_integer_call_set_poll_interval() for the asynchronous version of this method.
1804 *
1805 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1806 */
1807gboolean
1808sensor_integer_call_set_poll_interval_sync (
1809 SensorInteger *proxy,
1810 gint arg_poll_interval,
1811 GCancellable *cancellable,
1812 GError **error)
1813{
1814 GVariant *_ret;
1815 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1816 "setPollInterval",
1817 g_variant_new ("(i)",
1818 arg_poll_interval),
1819 G_DBUS_CALL_FLAGS_NONE,
1820 -1,
1821 cancellable,
1822 error);
1823 if (_ret == NULL)
1824 goto _out;
1825 g_variant_get (_ret,
1826 "()");
1827 g_variant_unref (_ret);
1828_out:
1829 return _ret != NULL;
1830}
1831
1832/**
1833 * sensor_integer_call_set_config_data:
1834 * @proxy: A #SensorIntegerProxy.
1835 * @arg_config: Argument to pass with the method invocation.
1836 * @cancellable: (allow-none): A #GCancellable or %NULL.
1837 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1838 * @user_data: User data to pass to @callback.
1839 *
1840 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method on @proxy.
1841 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1842 * You can then call sensor_integer_call_set_config_data_finish() to get the result of the operation.
1843 *
1844 * See sensor_integer_call_set_config_data_sync() for the synchronous, blocking version of this method.
1845 */
1846void
1847sensor_integer_call_set_config_data (
1848 SensorInteger *proxy,
1849 const gchar *const *arg_config,
1850 GCancellable *cancellable,
1851 GAsyncReadyCallback callback,
1852 gpointer user_data)
1853{
1854 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1855 "setConfigData",
1856 g_variant_new ("(^as)",
1857 arg_config),
1858 G_DBUS_CALL_FLAGS_NONE,
1859 -1,
1860 cancellable,
1861 callback,
1862 user_data);
1863}
1864
1865/**
1866 * sensor_integer_call_set_config_data_finish:
1867 * @proxy: A #SensorIntegerProxy.
1868 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_config_data().
1869 * @error: Return location for error or %NULL.
1870 *
1871 * Finishes an operation started with sensor_integer_call_set_config_data().
1872 *
1873 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1874 */
1875gboolean
1876sensor_integer_call_set_config_data_finish (
1877 SensorInteger *proxy,
1878 GAsyncResult *res,
1879 GError **error)
1880{
1881 GVariant *_ret;
1882 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1883 if (_ret == NULL)
1884 goto _out;
1885 g_variant_get (_ret,
1886 "()");
1887 g_variant_unref (_ret);
1888_out:
1889 return _ret != NULL;
1890}
1891
1892/**
1893 * sensor_integer_call_set_config_data_sync:
1894 * @proxy: A #SensorIntegerProxy.
1895 * @arg_config: Argument to pass with the method invocation.
1896 * @cancellable: (allow-none): A #GCancellable or %NULL.
1897 * @error: Return location for error or %NULL.
1898 *
1899 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1900 *
1901 * See sensor_integer_call_set_config_data() for the asynchronous version of this method.
1902 *
1903 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1904 */
1905gboolean
1906sensor_integer_call_set_config_data_sync (
1907 SensorInteger *proxy,
1908 const gchar *const *arg_config,
1909 GCancellable *cancellable,
1910 GError **error)
1911{
1912 GVariant *_ret;
1913 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1914 "setConfigData",
1915 g_variant_new ("(^as)",
1916 arg_config),
1917 G_DBUS_CALL_FLAGS_NONE,
1918 -1,
1919 cancellable,
1920 error);
1921 if (_ret == NULL)
1922 goto _out;
1923 g_variant_get (_ret,
1924 "()");
1925 g_variant_unref (_ret);
1926_out:
1927 return _ret != NULL;
1928}
1929
1930/**
Norman James3f97c5d2015-08-26 17:44:14 -05001931 * sensor_integer_call_get_threshold_state:
Norman Jamescc7ae122015-08-24 14:26:09 -05001932 * @proxy: A #SensorIntegerProxy.
1933 * @cancellable: (allow-none): A #GCancellable or %NULL.
1934 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1935 * @user_data: User data to pass to @callback.
1936 *
Norman James3f97c5d2015-08-26 17:44:14 -05001937 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getThresholdState">getThresholdState()</link> D-Bus method on @proxy.
Norman Jamescc7ae122015-08-24 14:26:09 -05001938 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James3f97c5d2015-08-26 17:44:14 -05001939 * You can then call sensor_integer_call_get_threshold_state_finish() to get the result of the operation.
Norman Jamescc7ae122015-08-24 14:26:09 -05001940 *
Norman James3f97c5d2015-08-26 17:44:14 -05001941 * See sensor_integer_call_get_threshold_state_sync() for the synchronous, blocking version of this method.
Norman Jamescc7ae122015-08-24 14:26:09 -05001942 */
1943void
Norman James3f97c5d2015-08-26 17:44:14 -05001944sensor_integer_call_get_threshold_state (
Norman Jamescc7ae122015-08-24 14:26:09 -05001945 SensorInteger *proxy,
1946 GCancellable *cancellable,
1947 GAsyncReadyCallback callback,
1948 gpointer user_data)
1949{
1950 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James3f97c5d2015-08-26 17:44:14 -05001951 "getThresholdState",
Norman Jamescc7ae122015-08-24 14:26:09 -05001952 g_variant_new ("()"),
1953 G_DBUS_CALL_FLAGS_NONE,
1954 -1,
1955 cancellable,
1956 callback,
1957 user_data);
1958}
1959
1960/**
Norman James3f97c5d2015-08-26 17:44:14 -05001961 * sensor_integer_call_get_threshold_state_finish:
Norman Jamescc7ae122015-08-24 14:26:09 -05001962 * @proxy: A #SensorIntegerProxy.
Norman James3f97c5d2015-08-26 17:44:14 -05001963 * @out_threshold_state: (out): Return location for return parameter or %NULL to ignore.
1964 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_threshold_state().
Norman Jamescc7ae122015-08-24 14:26:09 -05001965 * @error: Return location for error or %NULL.
1966 *
Norman James3f97c5d2015-08-26 17:44:14 -05001967 * Finishes an operation started with sensor_integer_call_get_threshold_state().
Norman Jamescc7ae122015-08-24 14:26:09 -05001968 *
1969 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1970 */
1971gboolean
Norman James3f97c5d2015-08-26 17:44:14 -05001972sensor_integer_call_get_threshold_state_finish (
Norman Jamescc7ae122015-08-24 14:26:09 -05001973 SensorInteger *proxy,
Norman James3f97c5d2015-08-26 17:44:14 -05001974 gint *out_threshold_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05001975 GAsyncResult *res,
1976 GError **error)
1977{
1978 GVariant *_ret;
1979 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1980 if (_ret == NULL)
1981 goto _out;
1982 g_variant_get (_ret,
Norman James3f97c5d2015-08-26 17:44:14 -05001983 "(i)",
1984 out_threshold_state);
Norman Jamescc7ae122015-08-24 14:26:09 -05001985 g_variant_unref (_ret);
1986_out:
1987 return _ret != NULL;
1988}
1989
1990/**
Norman James3f97c5d2015-08-26 17:44:14 -05001991 * sensor_integer_call_get_threshold_state_sync:
Norman Jamescc7ae122015-08-24 14:26:09 -05001992 * @proxy: A #SensorIntegerProxy.
Norman James3f97c5d2015-08-26 17:44:14 -05001993 * @out_threshold_state: (out): Return location for return parameter or %NULL to ignore.
Norman Jamescc7ae122015-08-24 14:26:09 -05001994 * @cancellable: (allow-none): A #GCancellable or %NULL.
1995 * @error: Return location for error or %NULL.
1996 *
Norman James3f97c5d2015-08-26 17:44:14 -05001997 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getThresholdState">getThresholdState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman Jamescc7ae122015-08-24 14:26:09 -05001998 *
Norman James3f97c5d2015-08-26 17:44:14 -05001999 * See sensor_integer_call_get_threshold_state() for the asynchronous version of this method.
Norman Jamescc7ae122015-08-24 14:26:09 -05002000 *
2001 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2002 */
2003gboolean
Norman James3f97c5d2015-08-26 17:44:14 -05002004sensor_integer_call_get_threshold_state_sync (
Norman Jamescc7ae122015-08-24 14:26:09 -05002005 SensorInteger *proxy,
Norman James3f97c5d2015-08-26 17:44:14 -05002006 gint *out_threshold_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05002007 GCancellable *cancellable,
2008 GError **error)
2009{
2010 GVariant *_ret;
2011 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James3f97c5d2015-08-26 17:44:14 -05002012 "getThresholdState",
Norman Jamescc7ae122015-08-24 14:26:09 -05002013 g_variant_new ("()"),
2014 G_DBUS_CALL_FLAGS_NONE,
2015 -1,
2016 cancellable,
2017 error);
2018 if (_ret == NULL)
2019 goto _out;
2020 g_variant_get (_ret,
Norman James3f97c5d2015-08-26 17:44:14 -05002021 "(i)",
2022 out_threshold_state);
Norman Jamescc7ae122015-08-24 14:26:09 -05002023 g_variant_unref (_ret);
2024_out:
2025 return _ret != NULL;
2026}
2027
2028/**
Norman Jamese7594922015-08-27 14:25:24 -05002029 * sensor_integer_call_get_watchdog:
2030 * @proxy: A #SensorIntegerProxy.
2031 * @cancellable: (allow-none): A #GCancellable or %NULL.
2032 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2033 * @user_data: User data to pass to @callback.
2034 *
2035 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getWatchdog">getWatchdog()</link> D-Bus method on @proxy.
2036 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2037 * You can then call sensor_integer_call_get_watchdog_finish() to get the result of the operation.
2038 *
2039 * See sensor_integer_call_get_watchdog_sync() for the synchronous, blocking version of this method.
2040 */
2041void
2042sensor_integer_call_get_watchdog (
2043 SensorInteger *proxy,
2044 GCancellable *cancellable,
2045 GAsyncReadyCallback callback,
2046 gpointer user_data)
2047{
2048 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2049 "getWatchdog",
2050 g_variant_new ("()"),
2051 G_DBUS_CALL_FLAGS_NONE,
2052 -1,
2053 cancellable,
2054 callback,
2055 user_data);
2056}
2057
2058/**
2059 * sensor_integer_call_get_watchdog_finish:
2060 * @proxy: A #SensorIntegerProxy.
2061 * @out_watchdog: (out): Return location for return parameter or %NULL to ignore.
2062 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_watchdog().
2063 * @error: Return location for error or %NULL.
2064 *
2065 * Finishes an operation started with sensor_integer_call_get_watchdog().
2066 *
2067 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2068 */
2069gboolean
2070sensor_integer_call_get_watchdog_finish (
2071 SensorInteger *proxy,
2072 gint *out_watchdog,
2073 GAsyncResult *res,
2074 GError **error)
2075{
2076 GVariant *_ret;
2077 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2078 if (_ret == NULL)
2079 goto _out;
2080 g_variant_get (_ret,
2081 "(i)",
2082 out_watchdog);
2083 g_variant_unref (_ret);
2084_out:
2085 return _ret != NULL;
2086}
2087
2088/**
2089 * sensor_integer_call_get_watchdog_sync:
2090 * @proxy: A #SensorIntegerProxy.
2091 * @out_watchdog: (out): Return location for return parameter or %NULL to ignore.
2092 * @cancellable: (allow-none): A #GCancellable or %NULL.
2093 * @error: Return location for error or %NULL.
2094 *
2095 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getWatchdog">getWatchdog()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2096 *
2097 * See sensor_integer_call_get_watchdog() for the asynchronous version of this method.
2098 *
2099 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2100 */
2101gboolean
2102sensor_integer_call_get_watchdog_sync (
2103 SensorInteger *proxy,
2104 gint *out_watchdog,
2105 GCancellable *cancellable,
2106 GError **error)
2107{
2108 GVariant *_ret;
2109 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2110 "getWatchdog",
2111 g_variant_new ("()"),
2112 G_DBUS_CALL_FLAGS_NONE,
2113 -1,
2114 cancellable,
2115 error);
2116 if (_ret == NULL)
2117 goto _out;
2118 g_variant_get (_ret,
2119 "(i)",
2120 out_watchdog);
2121 g_variant_unref (_ret);
2122_out:
2123 return _ret != NULL;
2124}
2125
2126/**
Norman Jamese2765102015-08-19 22:00:55 -05002127 * sensor_integer_complete_get_value:
2128 * @object: A #SensorInteger.
2129 * @invocation: (transfer full): A #GDBusMethodInvocation.
2130 * @value: Parameter to return.
2131 *
2132 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2133 *
2134 * This method will free @invocation, you cannot use it afterwards.
2135 */
2136void
2137sensor_integer_complete_get_value (
2138 SensorInteger *object,
2139 GDBusMethodInvocation *invocation,
2140 gint value)
2141{
2142 g_dbus_method_invocation_return_value (invocation,
2143 g_variant_new ("(i)",
2144 value));
2145}
2146
2147/**
2148 * sensor_integer_complete_get_units:
2149 * @object: A #SensorInteger.
2150 * @invocation: (transfer full): A #GDBusMethodInvocation.
2151 * @units: Parameter to return.
2152 *
2153 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2154 *
2155 * This method will free @invocation, you cannot use it afterwards.
2156 */
2157void
2158sensor_integer_complete_get_units (
2159 SensorInteger *object,
2160 GDBusMethodInvocation *invocation,
2161 const gchar *units)
2162{
2163 g_dbus_method_invocation_return_value (invocation,
2164 g_variant_new ("(s)",
2165 units));
2166}
2167
Norman Jamescc7ae122015-08-24 14:26:09 -05002168/**
Norman James3f97c5d2015-08-26 17:44:14 -05002169 * sensor_integer_complete_set_thresholds:
2170 * @object: A #SensorInteger.
2171 * @invocation: (transfer full): A #GDBusMethodInvocation.
2172 *
2173 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.setThresholds">setThresholds()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2174 *
2175 * This method will free @invocation, you cannot use it afterwards.
2176 */
2177void
2178sensor_integer_complete_set_thresholds (
2179 SensorInteger *object,
2180 GDBusMethodInvocation *invocation)
2181{
2182 g_dbus_method_invocation_return_value (invocation,
2183 g_variant_new ("()"));
2184}
2185
2186/**
Norman Jamescc7ae122015-08-24 14:26:09 -05002187 * sensor_integer_complete_set_poll_interval:
2188 * @object: A #SensorInteger.
2189 * @invocation: (transfer full): A #GDBusMethodInvocation.
2190 *
2191 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2192 *
2193 * This method will free @invocation, you cannot use it afterwards.
2194 */
2195void
2196sensor_integer_complete_set_poll_interval (
2197 SensorInteger *object,
2198 GDBusMethodInvocation *invocation)
2199{
2200 g_dbus_method_invocation_return_value (invocation,
2201 g_variant_new ("()"));
2202}
2203
2204/**
2205 * sensor_integer_complete_set_config_data:
2206 * @object: A #SensorInteger.
2207 * @invocation: (transfer full): A #GDBusMethodInvocation.
2208 *
2209 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2210 *
2211 * This method will free @invocation, you cannot use it afterwards.
2212 */
2213void
2214sensor_integer_complete_set_config_data (
2215 SensorInteger *object,
2216 GDBusMethodInvocation *invocation)
2217{
2218 g_dbus_method_invocation_return_value (invocation,
2219 g_variant_new ("()"));
2220}
2221
2222/**
Norman James3f97c5d2015-08-26 17:44:14 -05002223 * sensor_integer_complete_get_threshold_state:
Norman Jamescc7ae122015-08-24 14:26:09 -05002224 * @object: A #SensorInteger.
2225 * @invocation: (transfer full): A #GDBusMethodInvocation.
Norman James3f97c5d2015-08-26 17:44:14 -05002226 * @threshold_state: Parameter to return.
Norman Jamescc7ae122015-08-24 14:26:09 -05002227 *
Norman James3f97c5d2015-08-26 17:44:14 -05002228 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.getThresholdState">getThresholdState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman Jamescc7ae122015-08-24 14:26:09 -05002229 *
2230 * This method will free @invocation, you cannot use it afterwards.
2231 */
2232void
Norman James3f97c5d2015-08-26 17:44:14 -05002233sensor_integer_complete_get_threshold_state (
Norman Jamescc7ae122015-08-24 14:26:09 -05002234 SensorInteger *object,
Norman James3f97c5d2015-08-26 17:44:14 -05002235 GDBusMethodInvocation *invocation,
2236 gint threshold_state)
Norman Jamescc7ae122015-08-24 14:26:09 -05002237{
2238 g_dbus_method_invocation_return_value (invocation,
Norman James3f97c5d2015-08-26 17:44:14 -05002239 g_variant_new ("(i)",
2240 threshold_state));
Norman Jamescc7ae122015-08-24 14:26:09 -05002241}
2242
Norman Jamese7594922015-08-27 14:25:24 -05002243/**
2244 * sensor_integer_complete_get_watchdog:
2245 * @object: A #SensorInteger.
2246 * @invocation: (transfer full): A #GDBusMethodInvocation.
2247 * @watchdog: Parameter to return.
2248 *
2249 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.getWatchdog">getWatchdog()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2250 *
2251 * This method will free @invocation, you cannot use it afterwards.
2252 */
2253void
2254sensor_integer_complete_get_watchdog (
2255 SensorInteger *object,
2256 GDBusMethodInvocation *invocation,
2257 gint watchdog)
2258{
2259 g_dbus_method_invocation_return_value (invocation,
2260 g_variant_new ("(i)",
2261 watchdog));
2262}
2263
Norman Jamese2765102015-08-19 22:00:55 -05002264/* ------------------------------------------------------------------------ */
2265
2266/**
2267 * SensorIntegerProxy:
2268 *
2269 * The #SensorIntegerProxy structure contains only private data and should only be accessed using the provided API.
2270 */
2271
2272/**
2273 * SensorIntegerProxyClass:
2274 * @parent_class: The parent class.
2275 *
2276 * Class structure for #SensorIntegerProxy.
2277 */
2278
2279struct _SensorIntegerProxyPrivate
2280{
2281 GData *qdata;
2282};
2283
2284static void sensor_integer_proxy_iface_init (SensorIntegerIface *iface);
2285
2286#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2287G_DEFINE_TYPE_WITH_CODE (SensorIntegerProxy, sensor_integer_proxy, G_TYPE_DBUS_PROXY,
2288 G_ADD_PRIVATE (SensorIntegerProxy)
2289 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_proxy_iface_init));
2290
2291#else
2292G_DEFINE_TYPE_WITH_CODE (SensorIntegerProxy, sensor_integer_proxy, G_TYPE_DBUS_PROXY,
2293 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_proxy_iface_init));
2294
2295#endif
2296static void
2297sensor_integer_proxy_finalize (GObject *object)
2298{
2299 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2300 g_datalist_clear (&proxy->priv->qdata);
2301 G_OBJECT_CLASS (sensor_integer_proxy_parent_class)->finalize (object);
2302}
2303
2304static void
2305sensor_integer_proxy_get_property (GObject *object,
2306 guint prop_id,
2307 GValue *value,
2308 GParamSpec *pspec G_GNUC_UNUSED)
2309{
2310 const _ExtendedGDBusPropertyInfo *info;
2311 GVariant *variant;
Norman James3f97c5d2015-08-26 17:44:14 -05002312 g_assert (prop_id != 0 && prop_id - 1 < 10);
Norman Jamese2765102015-08-19 22:00:55 -05002313 info = _sensor_integer_property_info_pointers[prop_id - 1];
2314 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2315 if (info->use_gvariant)
2316 {
2317 g_value_set_variant (value, variant);
2318 }
2319 else
2320 {
2321 if (variant != NULL)
2322 g_dbus_gvariant_to_gvalue (variant, value);
2323 }
2324 if (variant != NULL)
2325 g_variant_unref (variant);
2326}
2327
2328static void
2329sensor_integer_proxy_set_property_cb (GDBusProxy *proxy,
2330 GAsyncResult *res,
2331 gpointer user_data)
2332{
2333 const _ExtendedGDBusPropertyInfo *info = user_data;
2334 GError *error;
2335 GVariant *_ret;
2336 error = NULL;
2337 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2338 if (!_ret)
2339 {
2340 g_warning ("Error setting property '%s' on interface org.openbmc.SensorInteger: %s (%s, %d)",
2341 info->parent_struct.name,
2342 error->message, g_quark_to_string (error->domain), error->code);
2343 g_error_free (error);
2344 }
2345 else
2346 {
2347 g_variant_unref (_ret);
2348 }
2349}
2350
2351static void
2352sensor_integer_proxy_set_property (GObject *object,
2353 guint prop_id,
2354 const GValue *value,
2355 GParamSpec *pspec G_GNUC_UNUSED)
2356{
2357 const _ExtendedGDBusPropertyInfo *info;
2358 GVariant *variant;
Norman James3f97c5d2015-08-26 17:44:14 -05002359 g_assert (prop_id != 0 && prop_id - 1 < 10);
Norman Jamese2765102015-08-19 22:00:55 -05002360 info = _sensor_integer_property_info_pointers[prop_id - 1];
2361 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2362 g_dbus_proxy_call (G_DBUS_PROXY (object),
2363 "org.freedesktop.DBus.Properties.Set",
2364 g_variant_new ("(ssv)", "org.openbmc.SensorInteger", info->parent_struct.name, variant),
2365 G_DBUS_CALL_FLAGS_NONE,
2366 -1,
2367 NULL, (GAsyncReadyCallback) sensor_integer_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2368 g_variant_unref (variant);
2369}
2370
2371static void
2372sensor_integer_proxy_g_signal (GDBusProxy *proxy,
2373 const gchar *sender_name G_GNUC_UNUSED,
2374 const gchar *signal_name,
2375 GVariant *parameters)
2376{
2377 _ExtendedGDBusSignalInfo *info;
2378 GVariantIter iter;
2379 GVariant *child;
2380 GValue *paramv;
2381 guint num_params;
2382 guint n;
2383 guint signal_id;
2384 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, signal_name);
2385 if (info == NULL)
2386 return;
2387 num_params = g_variant_n_children (parameters);
2388 paramv = g_new0 (GValue, num_params + 1);
2389 g_value_init (&paramv[0], TYPE_SENSOR_INTEGER);
2390 g_value_set_object (&paramv[0], proxy);
2391 g_variant_iter_init (&iter, parameters);
2392 n = 1;
2393 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2394 {
2395 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2396 if (arg_info->use_gvariant)
2397 {
2398 g_value_init (&paramv[n], G_TYPE_VARIANT);
2399 g_value_set_variant (&paramv[n], child);
2400 n++;
2401 }
2402 else
2403 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2404 g_variant_unref (child);
2405 }
2406 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER);
2407 g_signal_emitv (paramv, signal_id, 0, NULL);
2408 for (n = 0; n < num_params + 1; n++)
2409 g_value_unset (&paramv[n]);
2410 g_free (paramv);
2411}
2412
2413static void
2414sensor_integer_proxy_g_properties_changed (GDBusProxy *_proxy,
2415 GVariant *changed_properties,
2416 const gchar *const *invalidated_properties)
2417{
2418 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (_proxy);
2419 guint n;
2420 const gchar *key;
2421 GVariantIter *iter;
2422 _ExtendedGDBusPropertyInfo *info;
2423 g_variant_get (changed_properties, "a{sv}", &iter);
2424 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2425 {
2426 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, key);
2427 g_datalist_remove_data (&proxy->priv->qdata, key);
2428 if (info != NULL)
2429 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2430 }
2431 g_variant_iter_free (iter);
2432 for (n = 0; invalidated_properties[n] != NULL; n++)
2433 {
2434 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, invalidated_properties[n]);
2435 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2436 if (info != NULL)
2437 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2438 }
2439}
2440
2441static gint
2442sensor_integer_proxy_get_value (SensorInteger *object)
2443{
2444 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2445 GVariant *variant;
2446 gint value = 0;
2447 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
2448 if (variant != NULL)
2449 {
2450 value = g_variant_get_int32 (variant);
2451 g_variant_unref (variant);
2452 }
2453 return value;
2454}
2455
2456static const gchar *
2457sensor_integer_proxy_get_units (SensorInteger *object)
2458{
2459 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2460 GVariant *variant;
2461 const gchar *value = NULL;
2462 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
2463 if (variant != NULL)
2464 {
2465 value = g_variant_get_string (variant, NULL);
2466 g_variant_unref (variant);
2467 }
2468 return value;
2469}
2470
Norman Jamescc7ae122015-08-24 14:26:09 -05002471static gint
Norman James3f97c5d2015-08-26 17:44:14 -05002472sensor_integer_proxy_get_threshold_lower_critical (SensorInteger *object)
2473{
2474 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2475 GVariant *variant;
2476 gint value = 0;
2477 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_lower_critical");
2478 if (variant != NULL)
2479 {
2480 value = g_variant_get_int32 (variant);
2481 g_variant_unref (variant);
2482 }
2483 return value;
2484}
2485
2486static gint
2487sensor_integer_proxy_get_threshold_lower_warning (SensorInteger *object)
2488{
2489 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2490 GVariant *variant;
2491 gint value = 0;
2492 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_lower_warning");
2493 if (variant != NULL)
2494 {
2495 value = g_variant_get_int32 (variant);
2496 g_variant_unref (variant);
2497 }
2498 return value;
2499}
2500
2501static gint
2502sensor_integer_proxy_get_threshold_upper_warning (SensorInteger *object)
2503{
2504 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2505 GVariant *variant;
2506 gint value = 0;
2507 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_upper_warning");
2508 if (variant != NULL)
2509 {
2510 value = g_variant_get_int32 (variant);
2511 g_variant_unref (variant);
2512 }
2513 return value;
2514}
2515
2516static gint
2517sensor_integer_proxy_get_threshold_upper_critical (SensorInteger *object)
2518{
2519 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2520 GVariant *variant;
2521 gint value = 0;
2522 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_upper_critical");
2523 if (variant != NULL)
2524 {
2525 value = g_variant_get_int32 (variant);
2526 g_variant_unref (variant);
2527 }
2528 return value;
2529}
2530
2531static gint
2532sensor_integer_proxy_get_threshold_state (SensorInteger *object)
2533{
2534 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2535 GVariant *variant;
2536 gint value = 0;
2537 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "threshold_state");
2538 if (variant != NULL)
2539 {
2540 value = g_variant_get_int32 (variant);
2541 g_variant_unref (variant);
2542 }
2543 return value;
2544}
2545
2546static gint
Norman Jamescc7ae122015-08-24 14:26:09 -05002547sensor_integer_proxy_get_poll_interval (SensorInteger *object)
2548{
2549 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2550 GVariant *variant;
2551 gint value = 0;
2552 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
2553 if (variant != NULL)
2554 {
2555 value = g_variant_get_int32 (variant);
2556 g_variant_unref (variant);
2557 }
2558 return value;
2559}
2560
2561static const gchar *const *
2562sensor_integer_proxy_get_config_data (SensorInteger *object)
2563{
2564 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2565 GVariant *variant;
2566 const gchar *const *value = NULL;
2567 value = g_datalist_get_data (&proxy->priv->qdata, "config_data");
2568 if (value != NULL)
2569 return value;
2570 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "config_data");
2571 if (variant != NULL)
2572 {
2573 value = g_variant_get_strv (variant, NULL);
2574 g_datalist_set_data_full (&proxy->priv->qdata, "config_data", (gpointer) value, g_free);
2575 g_variant_unref (variant);
2576 }
2577 return value;
2578}
2579
2580static gint
Norman Jamese7594922015-08-27 14:25:24 -05002581sensor_integer_proxy_get_watchdog (SensorInteger *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05002582{
2583 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
2584 GVariant *variant;
2585 gint value = 0;
Norman Jamese7594922015-08-27 14:25:24 -05002586 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
Norman Jamescc7ae122015-08-24 14:26:09 -05002587 if (variant != NULL)
2588 {
2589 value = g_variant_get_int32 (variant);
2590 g_variant_unref (variant);
2591 }
2592 return value;
2593}
2594
Norman Jamese2765102015-08-19 22:00:55 -05002595static void
2596sensor_integer_proxy_init (SensorIntegerProxy *proxy)
2597{
2598#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2599 proxy->priv = sensor_integer_proxy_get_instance_private (proxy);
2600#else
2601 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_PROXY, SensorIntegerProxyPrivate);
2602#endif
2603
2604 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_interface_info ());
2605}
2606
2607static void
2608sensor_integer_proxy_class_init (SensorIntegerProxyClass *klass)
2609{
2610 GObjectClass *gobject_class;
2611 GDBusProxyClass *proxy_class;
2612
2613 gobject_class = G_OBJECT_CLASS (klass);
2614 gobject_class->finalize = sensor_integer_proxy_finalize;
2615 gobject_class->get_property = sensor_integer_proxy_get_property;
2616 gobject_class->set_property = sensor_integer_proxy_set_property;
2617
2618 proxy_class = G_DBUS_PROXY_CLASS (klass);
2619 proxy_class->g_signal = sensor_integer_proxy_g_signal;
2620 proxy_class->g_properties_changed = sensor_integer_proxy_g_properties_changed;
2621
2622 sensor_integer_override_properties (gobject_class, 1);
2623
2624#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2625 g_type_class_add_private (klass, sizeof (SensorIntegerProxyPrivate));
2626#endif
2627}
2628
2629static void
2630sensor_integer_proxy_iface_init (SensorIntegerIface *iface)
2631{
2632 iface->get_value = sensor_integer_proxy_get_value;
2633 iface->get_units = sensor_integer_proxy_get_units;
Norman James3f97c5d2015-08-26 17:44:14 -05002634 iface->get_threshold_lower_critical = sensor_integer_proxy_get_threshold_lower_critical;
2635 iface->get_threshold_lower_warning = sensor_integer_proxy_get_threshold_lower_warning;
2636 iface->get_threshold_upper_warning = sensor_integer_proxy_get_threshold_upper_warning;
2637 iface->get_threshold_upper_critical = sensor_integer_proxy_get_threshold_upper_critical;
2638 iface->get_threshold_state = sensor_integer_proxy_get_threshold_state;
Norman Jamescc7ae122015-08-24 14:26:09 -05002639 iface->get_poll_interval = sensor_integer_proxy_get_poll_interval;
2640 iface->get_config_data = sensor_integer_proxy_get_config_data;
Norman Jamese7594922015-08-27 14:25:24 -05002641 iface->get_watchdog = sensor_integer_proxy_get_watchdog;
Norman Jamese2765102015-08-19 22:00:55 -05002642}
2643
2644/**
2645 * sensor_integer_proxy_new:
2646 * @connection: A #GDBusConnection.
2647 * @flags: Flags from the #GDBusProxyFlags enumeration.
2648 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2649 * @object_path: An object path.
2650 * @cancellable: (allow-none): A #GCancellable or %NULL.
2651 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2652 * @user_data: User data to pass to @callback.
2653 *
2654 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>. See g_dbus_proxy_new() for more details.
2655 *
2656 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2657 * You can then call sensor_integer_proxy_new_finish() to get the result of the operation.
2658 *
2659 * See sensor_integer_proxy_new_sync() for the synchronous, blocking version of this constructor.
2660 */
2661void
2662sensor_integer_proxy_new (
2663 GDBusConnection *connection,
2664 GDBusProxyFlags flags,
2665 const gchar *name,
2666 const gchar *object_path,
2667 GCancellable *cancellable,
2668 GAsyncReadyCallback callback,
2669 gpointer user_data)
2670{
2671 g_async_initable_new_async (TYPE_SENSOR_INTEGER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorInteger", NULL);
2672}
2673
2674/**
2675 * sensor_integer_proxy_new_finish:
2676 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_proxy_new().
2677 * @error: Return location for error or %NULL
2678 *
2679 * Finishes an operation started with sensor_integer_proxy_new().
2680 *
2681 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
2682 */
2683SensorInteger *
2684sensor_integer_proxy_new_finish (
2685 GAsyncResult *res,
2686 GError **error)
2687{
2688 GObject *ret;
2689 GObject *source_object;
2690 source_object = g_async_result_get_source_object (res);
2691 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2692 g_object_unref (source_object);
2693 if (ret != NULL)
2694 return SENSOR_INTEGER (ret);
2695 else
2696 return NULL;
2697}
2698
2699/**
2700 * sensor_integer_proxy_new_sync:
2701 * @connection: A #GDBusConnection.
2702 * @flags: Flags from the #GDBusProxyFlags enumeration.
2703 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2704 * @object_path: An object path.
2705 * @cancellable: (allow-none): A #GCancellable or %NULL.
2706 * @error: Return location for error or %NULL
2707 *
2708 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>. See g_dbus_proxy_new_sync() for more details.
2709 *
2710 * The calling thread is blocked until a reply is received.
2711 *
2712 * See sensor_integer_proxy_new() for the asynchronous version of this constructor.
2713 *
2714 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
2715 */
2716SensorInteger *
2717sensor_integer_proxy_new_sync (
2718 GDBusConnection *connection,
2719 GDBusProxyFlags flags,
2720 const gchar *name,
2721 const gchar *object_path,
2722 GCancellable *cancellable,
2723 GError **error)
2724{
2725 GInitable *ret;
2726 ret = g_initable_new (TYPE_SENSOR_INTEGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorInteger", NULL);
2727 if (ret != NULL)
2728 return SENSOR_INTEGER (ret);
2729 else
2730 return NULL;
2731}
2732
2733
2734/**
2735 * sensor_integer_proxy_new_for_bus:
2736 * @bus_type: A #GBusType.
2737 * @flags: Flags from the #GDBusProxyFlags enumeration.
2738 * @name: A bus name (well-known or unique).
2739 * @object_path: An object path.
2740 * @cancellable: (allow-none): A #GCancellable or %NULL.
2741 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2742 * @user_data: User data to pass to @callback.
2743 *
2744 * Like sensor_integer_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2745 *
2746 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2747 * You can then call sensor_integer_proxy_new_for_bus_finish() to get the result of the operation.
2748 *
2749 * See sensor_integer_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2750 */
2751void
2752sensor_integer_proxy_new_for_bus (
2753 GBusType bus_type,
2754 GDBusProxyFlags flags,
2755 const gchar *name,
2756 const gchar *object_path,
2757 GCancellable *cancellable,
2758 GAsyncReadyCallback callback,
2759 gpointer user_data)
2760{
2761 g_async_initable_new_async (TYPE_SENSOR_INTEGER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorInteger", NULL);
2762}
2763
2764/**
2765 * sensor_integer_proxy_new_for_bus_finish:
2766 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_proxy_new_for_bus().
2767 * @error: Return location for error or %NULL
2768 *
2769 * Finishes an operation started with sensor_integer_proxy_new_for_bus().
2770 *
2771 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
2772 */
2773SensorInteger *
2774sensor_integer_proxy_new_for_bus_finish (
2775 GAsyncResult *res,
2776 GError **error)
2777{
2778 GObject *ret;
2779 GObject *source_object;
2780 source_object = g_async_result_get_source_object (res);
2781 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2782 g_object_unref (source_object);
2783 if (ret != NULL)
2784 return SENSOR_INTEGER (ret);
2785 else
2786 return NULL;
2787}
2788
2789/**
2790 * sensor_integer_proxy_new_for_bus_sync:
2791 * @bus_type: A #GBusType.
2792 * @flags: Flags from the #GDBusProxyFlags enumeration.
2793 * @name: A bus name (well-known or unique).
2794 * @object_path: An object path.
2795 * @cancellable: (allow-none): A #GCancellable or %NULL.
2796 * @error: Return location for error or %NULL
2797 *
2798 * Like sensor_integer_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2799 *
2800 * The calling thread is blocked until a reply is received.
2801 *
2802 * See sensor_integer_proxy_new_for_bus() for the asynchronous version of this constructor.
2803 *
2804 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
2805 */
2806SensorInteger *
2807sensor_integer_proxy_new_for_bus_sync (
2808 GBusType bus_type,
2809 GDBusProxyFlags flags,
2810 const gchar *name,
2811 const gchar *object_path,
2812 GCancellable *cancellable,
2813 GError **error)
2814{
2815 GInitable *ret;
2816 ret = g_initable_new (TYPE_SENSOR_INTEGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorInteger", NULL);
2817 if (ret != NULL)
2818 return SENSOR_INTEGER (ret);
2819 else
2820 return NULL;
2821}
2822
2823
2824/* ------------------------------------------------------------------------ */
2825
2826/**
2827 * SensorIntegerSkeleton:
2828 *
2829 * The #SensorIntegerSkeleton structure contains only private data and should only be accessed using the provided API.
2830 */
2831
2832/**
2833 * SensorIntegerSkeletonClass:
2834 * @parent_class: The parent class.
2835 *
2836 * Class structure for #SensorIntegerSkeleton.
2837 */
2838
2839struct _SensorIntegerSkeletonPrivate
2840{
2841 GValue *properties;
2842 GList *changed_properties;
2843 GSource *changed_properties_idle_source;
2844 GMainContext *context;
2845 GMutex lock;
2846};
2847
2848static void
2849_sensor_integer_skeleton_handle_method_call (
2850 GDBusConnection *connection G_GNUC_UNUSED,
2851 const gchar *sender G_GNUC_UNUSED,
2852 const gchar *object_path G_GNUC_UNUSED,
2853 const gchar *interface_name,
2854 const gchar *method_name,
2855 GVariant *parameters,
2856 GDBusMethodInvocation *invocation,
2857 gpointer user_data)
2858{
2859 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2860 _ExtendedGDBusMethodInfo *info;
2861 GVariantIter iter;
2862 GVariant *child;
2863 GValue *paramv;
2864 guint num_params;
2865 guint num_extra;
2866 guint n;
2867 guint signal_id;
2868 GValue return_value = G_VALUE_INIT;
2869 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2870 g_assert (info != NULL);
2871 num_params = g_variant_n_children (parameters);
2872 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
2873 n = 0;
2874 g_value_init (&paramv[n], TYPE_SENSOR_INTEGER);
2875 g_value_set_object (&paramv[n++], skeleton);
2876 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
2877 g_value_set_object (&paramv[n++], invocation);
2878 if (info->pass_fdlist)
2879 {
2880#ifdef G_OS_UNIX
2881 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
2882 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
2883#else
2884 g_assert_not_reached ();
2885#endif
2886 }
2887 g_variant_iter_init (&iter, parameters);
2888 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2889 {
2890 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
2891 if (arg_info->use_gvariant)
2892 {
2893 g_value_init (&paramv[n], G_TYPE_VARIANT);
2894 g_value_set_variant (&paramv[n], child);
2895 n++;
2896 }
2897 else
2898 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2899 g_variant_unref (child);
2900 }
2901 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER);
2902 g_value_init (&return_value, G_TYPE_BOOLEAN);
2903 g_signal_emitv (paramv, signal_id, 0, &return_value);
2904 if (!g_value_get_boolean (&return_value))
2905 g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
2906 g_value_unset (&return_value);
2907 for (n = 0; n < num_params + num_extra; n++)
2908 g_value_unset (&paramv[n]);
2909 g_free (paramv);
2910}
2911
2912static GVariant *
2913_sensor_integer_skeleton_handle_get_property (
2914 GDBusConnection *connection G_GNUC_UNUSED,
2915 const gchar *sender G_GNUC_UNUSED,
2916 const gchar *object_path G_GNUC_UNUSED,
2917 const gchar *interface_name G_GNUC_UNUSED,
2918 const gchar *property_name,
2919 GError **error,
2920 gpointer user_data)
2921{
2922 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2923 GValue value = G_VALUE_INIT;
2924 GParamSpec *pspec;
2925 _ExtendedGDBusPropertyInfo *info;
2926 GVariant *ret;
2927 ret = NULL;
2928 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, property_name);
2929 g_assert (info != NULL);
2930 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2931 if (pspec == NULL)
2932 {
2933 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2934 }
2935 else
2936 {
2937 g_value_init (&value, pspec->value_type);
2938 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2939 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2940 g_value_unset (&value);
2941 }
2942 return ret;
2943}
2944
2945static gboolean
2946_sensor_integer_skeleton_handle_set_property (
2947 GDBusConnection *connection G_GNUC_UNUSED,
2948 const gchar *sender G_GNUC_UNUSED,
2949 const gchar *object_path G_GNUC_UNUSED,
2950 const gchar *interface_name G_GNUC_UNUSED,
2951 const gchar *property_name,
2952 GVariant *variant,
2953 GError **error,
2954 gpointer user_data)
2955{
2956 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2957 GValue value = G_VALUE_INIT;
2958 GParamSpec *pspec;
2959 _ExtendedGDBusPropertyInfo *info;
2960 gboolean ret;
2961 ret = FALSE;
2962 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, property_name);
2963 g_assert (info != NULL);
2964 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2965 if (pspec == NULL)
2966 {
2967 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2968 }
2969 else
2970 {
2971 if (info->use_gvariant)
2972 g_value_set_variant (&value, variant);
2973 else
2974 g_dbus_gvariant_to_gvalue (variant, &value);
2975 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2976 g_value_unset (&value);
2977 ret = TRUE;
2978 }
2979 return ret;
2980}
2981
2982static const GDBusInterfaceVTable _sensor_integer_skeleton_vtable =
2983{
2984 _sensor_integer_skeleton_handle_method_call,
2985 _sensor_integer_skeleton_handle_get_property,
2986 _sensor_integer_skeleton_handle_set_property,
2987 {NULL}
2988};
2989
2990static GDBusInterfaceInfo *
2991sensor_integer_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2992{
2993 return sensor_integer_interface_info ();
2994}
2995
2996static GDBusInterfaceVTable *
2997sensor_integer_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2998{
2999 return (GDBusInterfaceVTable *) &_sensor_integer_skeleton_vtable;
3000}
3001
3002static GVariant *
3003sensor_integer_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3004{
3005 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (_skeleton);
3006
3007 GVariantBuilder builder;
3008 guint n;
3009 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3010 if (_sensor_integer_interface_info.parent_struct.properties == NULL)
3011 goto out;
3012 for (n = 0; _sensor_integer_interface_info.parent_struct.properties[n] != NULL; n++)
3013 {
3014 GDBusPropertyInfo *info = _sensor_integer_interface_info.parent_struct.properties[n];
3015 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3016 {
3017 GVariant *value;
3018 value = _sensor_integer_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", info->name, NULL, skeleton);
3019 if (value != NULL)
3020 {
3021 g_variant_take_ref (value);
3022 g_variant_builder_add (&builder, "{sv}", info->name, value);
3023 g_variant_unref (value);
3024 }
3025 }
3026 }
3027out:
3028 return g_variant_builder_end (&builder);
3029}
3030
3031static gboolean _sensor_integer_emit_changed (gpointer user_data);
3032
3033static void
3034sensor_integer_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3035{
3036 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (_skeleton);
3037 gboolean emit_changed = FALSE;
3038
3039 g_mutex_lock (&skeleton->priv->lock);
3040 if (skeleton->priv->changed_properties_idle_source != NULL)
3041 {
3042 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3043 skeleton->priv->changed_properties_idle_source = NULL;
3044 emit_changed = TRUE;
3045 }
3046 g_mutex_unlock (&skeleton->priv->lock);
3047
3048 if (emit_changed)
3049 _sensor_integer_emit_changed (skeleton);
3050}
3051
3052static void
3053_sensor_integer_on_signal_changed (
3054 SensorInteger *object,
3055 gint arg_value)
3056{
3057 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3058
3059 GList *connections, *l;
3060 GVariant *signal_variant;
3061 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3062
3063 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3064 arg_value));
3065 for (l = connections; l != NULL; l = l->next)
3066 {
3067 GDBusConnection *connection = l->data;
3068 g_dbus_connection_emit_signal (connection,
3069 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Changed",
3070 signal_variant, NULL);
3071 }
3072 g_variant_unref (signal_variant);
3073 g_list_free_full (connections, g_object_unref);
3074}
3075
Norman James3f97c5d2015-08-26 17:44:14 -05003076static void
3077_sensor_integer_on_signal_warning (
3078 SensorInteger *object)
3079{
3080 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3081
3082 GList *connections, *l;
3083 GVariant *signal_variant;
3084 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3085
3086 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3087 for (l = connections; l != NULL; l = l->next)
3088 {
3089 GDBusConnection *connection = l->data;
3090 g_dbus_connection_emit_signal (connection,
3091 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Warning",
3092 signal_variant, NULL);
3093 }
3094 g_variant_unref (signal_variant);
3095 g_list_free_full (connections, g_object_unref);
3096}
3097
3098static void
3099_sensor_integer_on_signal_critical (
3100 SensorInteger *object)
3101{
3102 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3103
3104 GList *connections, *l;
3105 GVariant *signal_variant;
3106 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3107
3108 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3109 for (l = connections; l != NULL; l = l->next)
3110 {
3111 GDBusConnection *connection = l->data;
3112 g_dbus_connection_emit_signal (connection,
3113 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Critical",
3114 signal_variant, NULL);
3115 }
3116 g_variant_unref (signal_variant);
3117 g_list_free_full (connections, g_object_unref);
3118}
3119
Norman Jamese2765102015-08-19 22:00:55 -05003120static void sensor_integer_skeleton_iface_init (SensorIntegerIface *iface);
3121#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3122G_DEFINE_TYPE_WITH_CODE (SensorIntegerSkeleton, sensor_integer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3123 G_ADD_PRIVATE (SensorIntegerSkeleton)
3124 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_skeleton_iface_init));
3125
3126#else
3127G_DEFINE_TYPE_WITH_CODE (SensorIntegerSkeleton, sensor_integer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3128 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_skeleton_iface_init));
3129
3130#endif
3131static void
3132sensor_integer_skeleton_finalize (GObject *object)
3133{
3134 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3135 guint n;
Norman James3f97c5d2015-08-26 17:44:14 -05003136 for (n = 0; n < 10; n++)
Norman Jamese2765102015-08-19 22:00:55 -05003137 g_value_unset (&skeleton->priv->properties[n]);
3138 g_free (skeleton->priv->properties);
3139 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3140 if (skeleton->priv->changed_properties_idle_source != NULL)
3141 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3142 g_main_context_unref (skeleton->priv->context);
3143 g_mutex_clear (&skeleton->priv->lock);
3144 G_OBJECT_CLASS (sensor_integer_skeleton_parent_class)->finalize (object);
3145}
3146
3147static void
3148sensor_integer_skeleton_get_property (GObject *object,
3149 guint prop_id,
3150 GValue *value,
3151 GParamSpec *pspec G_GNUC_UNUSED)
3152{
3153 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
Norman James3f97c5d2015-08-26 17:44:14 -05003154 g_assert (prop_id != 0 && prop_id - 1 < 10);
Norman Jamese2765102015-08-19 22:00:55 -05003155 g_mutex_lock (&skeleton->priv->lock);
3156 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3157 g_mutex_unlock (&skeleton->priv->lock);
3158}
3159
3160static gboolean
3161_sensor_integer_emit_changed (gpointer user_data)
3162{
3163 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
3164 GList *l;
3165 GVariantBuilder builder;
3166 GVariantBuilder invalidated_builder;
3167 guint num_changes;
3168
3169 g_mutex_lock (&skeleton->priv->lock);
3170 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3171 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3172 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3173 {
3174 ChangedProperty *cp = l->data;
3175 GVariant *variant;
3176 const GValue *cur_value;
3177
3178 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3179 if (!_g_value_equal (cur_value, &cp->orig_value))
3180 {
3181 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3182 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3183 g_variant_unref (variant);
3184 num_changes++;
3185 }
3186 }
3187 if (num_changes > 0)
3188 {
3189 GList *connections, *ll;
3190 GVariant *signal_variant;
3191 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorInteger",
3192 &builder, &invalidated_builder));
3193 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3194 for (ll = connections; ll != NULL; ll = ll->next)
3195 {
3196 GDBusConnection *connection = ll->data;
3197
3198 g_dbus_connection_emit_signal (connection,
3199 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3200 "org.freedesktop.DBus.Properties",
3201 "PropertiesChanged",
3202 signal_variant,
3203 NULL);
3204 }
3205 g_variant_unref (signal_variant);
3206 g_list_free_full (connections, g_object_unref);
3207 }
3208 else
3209 {
3210 g_variant_builder_clear (&builder);
3211 g_variant_builder_clear (&invalidated_builder);
3212 }
3213 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3214 skeleton->priv->changed_properties = NULL;
3215 skeleton->priv->changed_properties_idle_source = NULL;
3216 g_mutex_unlock (&skeleton->priv->lock);
3217 return FALSE;
3218}
3219
3220static void
3221_sensor_integer_schedule_emit_changed (SensorIntegerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3222{
3223 ChangedProperty *cp;
3224 GList *l;
3225 cp = NULL;
3226 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3227 {
3228 ChangedProperty *i_cp = l->data;
3229 if (i_cp->info == info)
3230 {
3231 cp = i_cp;
3232 break;
3233 }
3234 }
3235 if (cp == NULL)
3236 {
3237 cp = g_new0 (ChangedProperty, 1);
3238 cp->prop_id = prop_id;
3239 cp->info = info;
3240 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3241 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3242 g_value_copy (orig_value, &cp->orig_value);
3243 }
3244}
3245
3246static void
3247sensor_integer_skeleton_notify (GObject *object,
3248 GParamSpec *pspec G_GNUC_UNUSED)
3249{
3250 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3251 g_mutex_lock (&skeleton->priv->lock);
3252 if (skeleton->priv->changed_properties != NULL &&
3253 skeleton->priv->changed_properties_idle_source == NULL)
3254 {
3255 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3256 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3257 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3258 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3259 g_source_unref (skeleton->priv->changed_properties_idle_source);
3260 }
3261 g_mutex_unlock (&skeleton->priv->lock);
3262}
3263
3264static void
3265sensor_integer_skeleton_set_property (GObject *object,
3266 guint prop_id,
3267 const GValue *value,
3268 GParamSpec *pspec)
3269{
3270 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
Norman James3f97c5d2015-08-26 17:44:14 -05003271 g_assert (prop_id != 0 && prop_id - 1 < 10);
Norman Jamese2765102015-08-19 22:00:55 -05003272 g_mutex_lock (&skeleton->priv->lock);
3273 g_object_freeze_notify (object);
3274 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3275 {
3276 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3277 _sensor_integer_schedule_emit_changed (skeleton, _sensor_integer_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3278 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3279 g_object_notify_by_pspec (object, pspec);
3280 }
3281 g_mutex_unlock (&skeleton->priv->lock);
3282 g_object_thaw_notify (object);
3283}
3284
3285static void
3286sensor_integer_skeleton_init (SensorIntegerSkeleton *skeleton)
3287{
3288#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3289 skeleton->priv = sensor_integer_skeleton_get_instance_private (skeleton);
3290#else
3291 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_SKELETON, SensorIntegerSkeletonPrivate);
3292#endif
3293
3294 g_mutex_init (&skeleton->priv->lock);
3295 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James3f97c5d2015-08-26 17:44:14 -05003296 skeleton->priv->properties = g_new0 (GValue, 10);
Norman Jamese2765102015-08-19 22:00:55 -05003297 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3298 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman Jamescc7ae122015-08-24 14:26:09 -05003299 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James3f97c5d2015-08-26 17:44:14 -05003300 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
Norman Jamescc7ae122015-08-24 14:26:09 -05003301 g_value_init (&skeleton->priv->properties[4], G_TYPE_INT);
Norman James3f97c5d2015-08-26 17:44:14 -05003302 g_value_init (&skeleton->priv->properties[5], G_TYPE_INT);
3303 g_value_init (&skeleton->priv->properties[6], G_TYPE_INT);
3304 g_value_init (&skeleton->priv->properties[7], G_TYPE_INT);
3305 g_value_init (&skeleton->priv->properties[8], G_TYPE_STRV);
3306 g_value_init (&skeleton->priv->properties[9], G_TYPE_INT);
Norman Jamese2765102015-08-19 22:00:55 -05003307}
3308
3309static gint
3310sensor_integer_skeleton_get_value (SensorInteger *object)
3311{
3312 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3313 gint value;
3314 g_mutex_lock (&skeleton->priv->lock);
3315 value = g_value_get_int (&(skeleton->priv->properties[0]));
3316 g_mutex_unlock (&skeleton->priv->lock);
3317 return value;
3318}
3319
3320static const gchar *
3321sensor_integer_skeleton_get_units (SensorInteger *object)
3322{
3323 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3324 const gchar *value;
3325 g_mutex_lock (&skeleton->priv->lock);
3326 value = g_value_get_string (&(skeleton->priv->properties[1]));
3327 g_mutex_unlock (&skeleton->priv->lock);
3328 return value;
3329}
3330
Norman Jamescc7ae122015-08-24 14:26:09 -05003331static gint
Norman James3f97c5d2015-08-26 17:44:14 -05003332sensor_integer_skeleton_get_threshold_lower_critical (SensorInteger *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003333{
3334 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3335 gint value;
3336 g_mutex_lock (&skeleton->priv->lock);
3337 value = g_value_get_int (&(skeleton->priv->properties[2]));
3338 g_mutex_unlock (&skeleton->priv->lock);
3339 return value;
3340}
3341
Norman James3f97c5d2015-08-26 17:44:14 -05003342static gint
3343sensor_integer_skeleton_get_threshold_lower_warning (SensorInteger *object)
3344{
3345 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3346 gint value;
3347 g_mutex_lock (&skeleton->priv->lock);
3348 value = g_value_get_int (&(skeleton->priv->properties[3]));
3349 g_mutex_unlock (&skeleton->priv->lock);
3350 return value;
3351}
3352
3353static gint
3354sensor_integer_skeleton_get_threshold_upper_warning (SensorInteger *object)
3355{
3356 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3357 gint value;
3358 g_mutex_lock (&skeleton->priv->lock);
3359 value = g_value_get_int (&(skeleton->priv->properties[4]));
3360 g_mutex_unlock (&skeleton->priv->lock);
3361 return value;
3362}
3363
3364static gint
3365sensor_integer_skeleton_get_threshold_upper_critical (SensorInteger *object)
3366{
3367 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3368 gint value;
3369 g_mutex_lock (&skeleton->priv->lock);
3370 value = g_value_get_int (&(skeleton->priv->properties[5]));
3371 g_mutex_unlock (&skeleton->priv->lock);
3372 return value;
3373}
3374
3375static gint
3376sensor_integer_skeleton_get_threshold_state (SensorInteger *object)
3377{
3378 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3379 gint value;
3380 g_mutex_lock (&skeleton->priv->lock);
3381 value = g_value_get_int (&(skeleton->priv->properties[6]));
3382 g_mutex_unlock (&skeleton->priv->lock);
3383 return value;
3384}
3385
3386static gint
3387sensor_integer_skeleton_get_poll_interval (SensorInteger *object)
3388{
3389 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3390 gint value;
3391 g_mutex_lock (&skeleton->priv->lock);
3392 value = g_value_get_int (&(skeleton->priv->properties[7]));
3393 g_mutex_unlock (&skeleton->priv->lock);
3394 return value;
3395}
3396
Norman Jamescc7ae122015-08-24 14:26:09 -05003397static const gchar *const *
3398sensor_integer_skeleton_get_config_data (SensorInteger *object)
3399{
3400 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3401 const gchar *const *value;
3402 g_mutex_lock (&skeleton->priv->lock);
Norman James3f97c5d2015-08-26 17:44:14 -05003403 value = g_value_get_boxed (&(skeleton->priv->properties[8]));
Norman Jamescc7ae122015-08-24 14:26:09 -05003404 g_mutex_unlock (&skeleton->priv->lock);
3405 return value;
3406}
3407
3408static gint
Norman Jamese7594922015-08-27 14:25:24 -05003409sensor_integer_skeleton_get_watchdog (SensorInteger *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05003410{
3411 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
3412 gint value;
3413 g_mutex_lock (&skeleton->priv->lock);
Norman James3f97c5d2015-08-26 17:44:14 -05003414 value = g_value_get_int (&(skeleton->priv->properties[9]));
Norman Jamescc7ae122015-08-24 14:26:09 -05003415 g_mutex_unlock (&skeleton->priv->lock);
3416 return value;
3417}
3418
Norman Jamese2765102015-08-19 22:00:55 -05003419static void
3420sensor_integer_skeleton_class_init (SensorIntegerSkeletonClass *klass)
3421{
3422 GObjectClass *gobject_class;
3423 GDBusInterfaceSkeletonClass *skeleton_class;
3424
3425 gobject_class = G_OBJECT_CLASS (klass);
3426 gobject_class->finalize = sensor_integer_skeleton_finalize;
3427 gobject_class->get_property = sensor_integer_skeleton_get_property;
3428 gobject_class->set_property = sensor_integer_skeleton_set_property;
3429 gobject_class->notify = sensor_integer_skeleton_notify;
3430
3431
3432 sensor_integer_override_properties (gobject_class, 1);
3433
3434 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3435 skeleton_class->get_info = sensor_integer_skeleton_dbus_interface_get_info;
3436 skeleton_class->get_properties = sensor_integer_skeleton_dbus_interface_get_properties;
3437 skeleton_class->flush = sensor_integer_skeleton_dbus_interface_flush;
3438 skeleton_class->get_vtable = sensor_integer_skeleton_dbus_interface_get_vtable;
3439
3440#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3441 g_type_class_add_private (klass, sizeof (SensorIntegerSkeletonPrivate));
3442#endif
3443}
3444
3445static void
3446sensor_integer_skeleton_iface_init (SensorIntegerIface *iface)
3447{
3448 iface->changed = _sensor_integer_on_signal_changed;
Norman James3f97c5d2015-08-26 17:44:14 -05003449 iface->warning = _sensor_integer_on_signal_warning;
3450 iface->critical = _sensor_integer_on_signal_critical;
Norman Jamese2765102015-08-19 22:00:55 -05003451 iface->get_value = sensor_integer_skeleton_get_value;
3452 iface->get_units = sensor_integer_skeleton_get_units;
Norman James3f97c5d2015-08-26 17:44:14 -05003453 iface->get_threshold_lower_critical = sensor_integer_skeleton_get_threshold_lower_critical;
3454 iface->get_threshold_lower_warning = sensor_integer_skeleton_get_threshold_lower_warning;
3455 iface->get_threshold_upper_warning = sensor_integer_skeleton_get_threshold_upper_warning;
3456 iface->get_threshold_upper_critical = sensor_integer_skeleton_get_threshold_upper_critical;
3457 iface->get_threshold_state = sensor_integer_skeleton_get_threshold_state;
Norman Jamescc7ae122015-08-24 14:26:09 -05003458 iface->get_poll_interval = sensor_integer_skeleton_get_poll_interval;
3459 iface->get_config_data = sensor_integer_skeleton_get_config_data;
Norman Jamese7594922015-08-27 14:25:24 -05003460 iface->get_watchdog = sensor_integer_skeleton_get_watchdog;
Norman Jamese2765102015-08-19 22:00:55 -05003461}
3462
3463/**
3464 * sensor_integer_skeleton_new:
3465 *
3466 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
3467 *
3468 * Returns: (transfer full) (type SensorIntegerSkeleton): The skeleton object.
3469 */
3470SensorInteger *
3471sensor_integer_skeleton_new (void)
3472{
3473 return SENSOR_INTEGER (g_object_new (TYPE_SENSOR_INTEGER_SKELETON, NULL));
3474}
3475
3476/* ------------------------------------------------------------------------
3477 * Code for interface org.openbmc.SensorString
3478 * ------------------------------------------------------------------------
3479 */
3480
3481/**
3482 * SECTION:SensorString
3483 * @title: SensorString
3484 * @short_description: Generated C code for the org.openbmc.SensorString D-Bus interface
3485 *
3486 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> D-Bus interface in C.
3487 */
3488
3489/* ---- Introspection data for org.openbmc.SensorString ---- */
3490
3491static const _ExtendedGDBusArgInfo _sensor_string_method_info_get_value_OUT_ARG_value =
3492{
3493 {
3494 -1,
3495 (gchar *) "value",
3496 (gchar *) "s",
3497 NULL
3498 },
3499 FALSE
3500};
3501
3502static const _ExtendedGDBusArgInfo * const _sensor_string_method_info_get_value_OUT_ARG_pointers[] =
3503{
3504 &_sensor_string_method_info_get_value_OUT_ARG_value,
3505 NULL
3506};
3507
3508static const _ExtendedGDBusMethodInfo _sensor_string_method_info_get_value =
3509{
3510 {
3511 -1,
3512 (gchar *) "getValue",
3513 NULL,
3514 (GDBusArgInfo **) &_sensor_string_method_info_get_value_OUT_ARG_pointers,
3515 NULL
3516 },
3517 "handle-get-value",
3518 FALSE
3519};
3520
3521static const _ExtendedGDBusArgInfo _sensor_string_method_info_get_units_OUT_ARG_units =
3522{
3523 {
3524 -1,
3525 (gchar *) "units",
3526 (gchar *) "s",
3527 NULL
3528 },
3529 FALSE
3530};
3531
3532static const _ExtendedGDBusArgInfo * const _sensor_string_method_info_get_units_OUT_ARG_pointers[] =
3533{
3534 &_sensor_string_method_info_get_units_OUT_ARG_units,
3535 NULL
3536};
3537
3538static const _ExtendedGDBusMethodInfo _sensor_string_method_info_get_units =
3539{
3540 {
3541 -1,
3542 (gchar *) "getUnits",
3543 NULL,
3544 (GDBusArgInfo **) &_sensor_string_method_info_get_units_OUT_ARG_pointers,
3545 NULL
3546 },
3547 "handle-get-units",
3548 FALSE
3549};
3550
3551static const _ExtendedGDBusMethodInfo * const _sensor_string_method_info_pointers[] =
3552{
3553 &_sensor_string_method_info_get_value,
3554 &_sensor_string_method_info_get_units,
3555 NULL
3556};
3557
3558static const _ExtendedGDBusArgInfo _sensor_string_signal_info_changed_ARG_value =
3559{
3560 {
3561 -1,
3562 (gchar *) "value",
3563 (gchar *) "s",
3564 NULL
3565 },
3566 FALSE
3567};
3568
3569static const _ExtendedGDBusArgInfo * const _sensor_string_signal_info_changed_ARG_pointers[] =
3570{
3571 &_sensor_string_signal_info_changed_ARG_value,
3572 NULL
3573};
3574
3575static const _ExtendedGDBusSignalInfo _sensor_string_signal_info_changed =
3576{
3577 {
3578 -1,
3579 (gchar *) "Changed",
3580 (GDBusArgInfo **) &_sensor_string_signal_info_changed_ARG_pointers,
3581 NULL
3582 },
3583 "changed"
3584};
3585
3586static const _ExtendedGDBusSignalInfo * const _sensor_string_signal_info_pointers[] =
3587{
3588 &_sensor_string_signal_info_changed,
3589 NULL
3590};
3591
3592static const _ExtendedGDBusPropertyInfo _sensor_string_property_info_value =
3593{
3594 {
3595 -1,
3596 (gchar *) "value",
3597 (gchar *) "i",
3598 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3599 NULL
3600 },
3601 "value",
3602 FALSE
3603};
3604
3605static const _ExtendedGDBusPropertyInfo _sensor_string_property_info_units =
3606{
3607 {
3608 -1,
3609 (gchar *) "units",
3610 (gchar *) "s",
3611 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3612 NULL
3613 },
3614 "units",
3615 FALSE
3616};
3617
3618static const _ExtendedGDBusPropertyInfo * const _sensor_string_property_info_pointers[] =
3619{
3620 &_sensor_string_property_info_value,
3621 &_sensor_string_property_info_units,
3622 NULL
3623};
3624
3625static const _ExtendedGDBusInterfaceInfo _sensor_string_interface_info =
3626{
3627 {
3628 -1,
3629 (gchar *) "org.openbmc.SensorString",
3630 (GDBusMethodInfo **) &_sensor_string_method_info_pointers,
3631 (GDBusSignalInfo **) &_sensor_string_signal_info_pointers,
3632 (GDBusPropertyInfo **) &_sensor_string_property_info_pointers,
3633 NULL
3634 },
3635 "sensor-string",
3636};
3637
3638
3639/**
3640 * sensor_string_interface_info:
3641 *
3642 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> D-Bus interface.
3643 *
3644 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3645 */
3646GDBusInterfaceInfo *
3647sensor_string_interface_info (void)
3648{
3649 return (GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct;
3650}
3651
3652/**
3653 * sensor_string_override_properties:
3654 * @klass: The class structure for a #GObject<!-- -->-derived class.
3655 * @property_id_begin: The property id to assign to the first overridden property.
3656 *
3657 * Overrides all #GObject properties in the #SensorString interface for a concrete class.
3658 * The properties are overridden in the order they are defined.
3659 *
3660 * Returns: The last property id.
3661 */
3662guint
3663sensor_string_override_properties (GObjectClass *klass, guint property_id_begin)
3664{
3665 g_object_class_override_property (klass, property_id_begin++, "value");
3666 g_object_class_override_property (klass, property_id_begin++, "units");
3667 return property_id_begin - 1;
3668}
3669
3670
3671
3672/**
3673 * SensorString:
3674 *
3675 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
3676 */
3677
3678/**
3679 * SensorStringIface:
3680 * @parent_iface: The parent interface.
3681 * @handle_get_units: Handler for the #SensorString::handle-get-units signal.
3682 * @handle_get_value: Handler for the #SensorString::handle-get-value signal.
3683 * @get_units: Getter for the #SensorString:units property.
3684 * @get_value: Getter for the #SensorString:value property.
3685 * @changed: Handler for the #SensorString::changed signal.
3686 *
3687 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
3688 */
3689
3690typedef SensorStringIface SensorStringInterface;
3691G_DEFINE_INTERFACE (SensorString, sensor_string, G_TYPE_OBJECT);
3692
3693static void
3694sensor_string_default_init (SensorStringIface *iface)
3695{
3696 /* GObject signals for incoming D-Bus method calls: */
3697 /**
3698 * SensorString::handle-get-value:
3699 * @object: A #SensorString.
3700 * @invocation: A #GDBusMethodInvocation.
3701 *
3702 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method.
3703 *
3704 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_string_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
3705 *
3706 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3707 */
3708 g_signal_new ("handle-get-value",
3709 G_TYPE_FROM_INTERFACE (iface),
3710 G_SIGNAL_RUN_LAST,
3711 G_STRUCT_OFFSET (SensorStringIface, handle_get_value),
3712 g_signal_accumulator_true_handled,
3713 NULL,
3714 g_cclosure_marshal_generic,
3715 G_TYPE_BOOLEAN,
3716 1,
3717 G_TYPE_DBUS_METHOD_INVOCATION);
3718
3719 /**
3720 * SensorString::handle-get-units:
3721 * @object: A #SensorString.
3722 * @invocation: A #GDBusMethodInvocation.
3723 *
3724 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method.
3725 *
3726 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_string_complete_get_units() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
3727 *
3728 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3729 */
3730 g_signal_new ("handle-get-units",
3731 G_TYPE_FROM_INTERFACE (iface),
3732 G_SIGNAL_RUN_LAST,
3733 G_STRUCT_OFFSET (SensorStringIface, handle_get_units),
3734 g_signal_accumulator_true_handled,
3735 NULL,
3736 g_cclosure_marshal_generic,
3737 G_TYPE_BOOLEAN,
3738 1,
3739 G_TYPE_DBUS_METHOD_INVOCATION);
3740
3741 /* GObject signals for received D-Bus signals: */
3742 /**
3743 * SensorString::changed:
3744 * @object: A #SensorString.
3745 * @arg_value: Argument.
3746 *
3747 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorString.Changed">"Changed"</link> is received.
3748 *
3749 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
3750 */
3751 g_signal_new ("changed",
3752 G_TYPE_FROM_INTERFACE (iface),
3753 G_SIGNAL_RUN_LAST,
3754 G_STRUCT_OFFSET (SensorStringIface, changed),
3755 NULL,
3756 NULL,
3757 g_cclosure_marshal_generic,
3758 G_TYPE_NONE,
3759 1, G_TYPE_STRING);
3760
3761 /* GObject properties for D-Bus properties: */
3762 /**
3763 * SensorString:value:
3764 *
3765 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link>.
3766 *
3767 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3768 */
3769 g_object_interface_install_property (iface,
3770 g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3771 /**
3772 * SensorString:units:
3773 *
3774 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link>.
3775 *
3776 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3777 */
3778 g_object_interface_install_property (iface,
3779 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3780}
3781
3782/**
3783 * sensor_string_get_value: (skip)
3784 * @object: A #SensorString.
3785 *
3786 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link> D-Bus property.
3787 *
3788 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3789 *
3790 * Returns: The property value.
3791 */
3792gint
3793sensor_string_get_value (SensorString *object)
3794{
3795 return SENSOR_STRING_GET_IFACE (object)->get_value (object);
3796}
3797
3798/**
3799 * sensor_string_set_value: (skip)
3800 * @object: A #SensorString.
3801 * @value: The value to set.
3802 *
3803 * Sets the <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link> D-Bus property to @value.
3804 *
3805 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3806 */
3807void
3808sensor_string_set_value (SensorString *object, gint value)
3809{
3810 g_object_set (G_OBJECT (object), "value", value, NULL);
3811}
3812
3813/**
3814 * sensor_string_get_units: (skip)
3815 * @object: A #SensorString.
3816 *
3817 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property.
3818 *
3819 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3820 *
3821 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_string_dup_units() if on another thread.</warning>
3822 *
3823 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
3824 */
3825const gchar *
3826sensor_string_get_units (SensorString *object)
3827{
3828 return SENSOR_STRING_GET_IFACE (object)->get_units (object);
3829}
3830
3831/**
3832 * sensor_string_dup_units: (skip)
3833 * @object: A #SensorString.
3834 *
3835 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property.
3836 *
3837 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3838 *
3839 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
3840 */
3841gchar *
3842sensor_string_dup_units (SensorString *object)
3843{
3844 gchar *value;
3845 g_object_get (G_OBJECT (object), "units", &value, NULL);
3846 return value;
3847}
3848
3849/**
3850 * sensor_string_set_units: (skip)
3851 * @object: A #SensorString.
3852 * @value: The value to set.
3853 *
3854 * Sets the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property to @value.
3855 *
3856 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3857 */
3858void
3859sensor_string_set_units (SensorString *object, const gchar *value)
3860{
3861 g_object_set (G_OBJECT (object), "units", value, NULL);
3862}
3863
3864/**
3865 * sensor_string_emit_changed:
3866 * @object: A #SensorString.
3867 * @arg_value: Argument to pass with the signal.
3868 *
3869 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorString.Changed">"Changed"</link> D-Bus signal.
3870 */
3871void
3872sensor_string_emit_changed (
3873 SensorString *object,
3874 const gchar *arg_value)
3875{
3876 g_signal_emit_by_name (object, "changed", arg_value);
3877}
3878
3879/**
3880 * sensor_string_call_get_value:
3881 * @proxy: A #SensorStringProxy.
3882 * @cancellable: (allow-none): A #GCancellable or %NULL.
3883 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3884 * @user_data: User data to pass to @callback.
3885 *
3886 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method on @proxy.
3887 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3888 * You can then call sensor_string_call_get_value_finish() to get the result of the operation.
3889 *
3890 * See sensor_string_call_get_value_sync() for the synchronous, blocking version of this method.
3891 */
3892void
3893sensor_string_call_get_value (
3894 SensorString *proxy,
3895 GCancellable *cancellable,
3896 GAsyncReadyCallback callback,
3897 gpointer user_data)
3898{
3899 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3900 "getValue",
3901 g_variant_new ("()"),
3902 G_DBUS_CALL_FLAGS_NONE,
3903 -1,
3904 cancellable,
3905 callback,
3906 user_data);
3907}
3908
3909/**
3910 * sensor_string_call_get_value_finish:
3911 * @proxy: A #SensorStringProxy.
3912 * @out_value: (out): Return location for return parameter or %NULL to ignore.
3913 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_call_get_value().
3914 * @error: Return location for error or %NULL.
3915 *
3916 * Finishes an operation started with sensor_string_call_get_value().
3917 *
3918 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3919 */
3920gboolean
3921sensor_string_call_get_value_finish (
3922 SensorString *proxy,
3923 gchar **out_value,
3924 GAsyncResult *res,
3925 GError **error)
3926{
3927 GVariant *_ret;
3928 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3929 if (_ret == NULL)
3930 goto _out;
3931 g_variant_get (_ret,
3932 "(s)",
3933 out_value);
3934 g_variant_unref (_ret);
3935_out:
3936 return _ret != NULL;
3937}
3938
3939/**
3940 * sensor_string_call_get_value_sync:
3941 * @proxy: A #SensorStringProxy.
3942 * @out_value: (out): Return location for return parameter or %NULL to ignore.
3943 * @cancellable: (allow-none): A #GCancellable or %NULL.
3944 * @error: Return location for error or %NULL.
3945 *
3946 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
3947 *
3948 * See sensor_string_call_get_value() for the asynchronous version of this method.
3949 *
3950 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3951 */
3952gboolean
3953sensor_string_call_get_value_sync (
3954 SensorString *proxy,
3955 gchar **out_value,
3956 GCancellable *cancellable,
3957 GError **error)
3958{
3959 GVariant *_ret;
3960 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3961 "getValue",
3962 g_variant_new ("()"),
3963 G_DBUS_CALL_FLAGS_NONE,
3964 -1,
3965 cancellable,
3966 error);
3967 if (_ret == NULL)
3968 goto _out;
3969 g_variant_get (_ret,
3970 "(s)",
3971 out_value);
3972 g_variant_unref (_ret);
3973_out:
3974 return _ret != NULL;
3975}
3976
3977/**
3978 * sensor_string_call_get_units:
3979 * @proxy: A #SensorStringProxy.
3980 * @cancellable: (allow-none): A #GCancellable or %NULL.
3981 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3982 * @user_data: User data to pass to @callback.
3983 *
3984 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method on @proxy.
3985 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3986 * You can then call sensor_string_call_get_units_finish() to get the result of the operation.
3987 *
3988 * See sensor_string_call_get_units_sync() for the synchronous, blocking version of this method.
3989 */
3990void
3991sensor_string_call_get_units (
3992 SensorString *proxy,
3993 GCancellable *cancellable,
3994 GAsyncReadyCallback callback,
3995 gpointer user_data)
3996{
3997 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3998 "getUnits",
3999 g_variant_new ("()"),
4000 G_DBUS_CALL_FLAGS_NONE,
4001 -1,
4002 cancellable,
4003 callback,
4004 user_data);
4005}
4006
4007/**
4008 * sensor_string_call_get_units_finish:
4009 * @proxy: A #SensorStringProxy.
4010 * @out_units: (out): Return location for return parameter or %NULL to ignore.
4011 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_call_get_units().
4012 * @error: Return location for error or %NULL.
4013 *
4014 * Finishes an operation started with sensor_string_call_get_units().
4015 *
4016 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4017 */
4018gboolean
4019sensor_string_call_get_units_finish (
4020 SensorString *proxy,
4021 gchar **out_units,
4022 GAsyncResult *res,
4023 GError **error)
4024{
4025 GVariant *_ret;
4026 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4027 if (_ret == NULL)
4028 goto _out;
4029 g_variant_get (_ret,
4030 "(s)",
4031 out_units);
4032 g_variant_unref (_ret);
4033_out:
4034 return _ret != NULL;
4035}
4036
4037/**
4038 * sensor_string_call_get_units_sync:
4039 * @proxy: A #SensorStringProxy.
4040 * @out_units: (out): Return location for return parameter or %NULL to ignore.
4041 * @cancellable: (allow-none): A #GCancellable or %NULL.
4042 * @error: Return location for error or %NULL.
4043 *
4044 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4045 *
4046 * See sensor_string_call_get_units() for the asynchronous version of this method.
4047 *
4048 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4049 */
4050gboolean
4051sensor_string_call_get_units_sync (
4052 SensorString *proxy,
4053 gchar **out_units,
4054 GCancellable *cancellable,
4055 GError **error)
4056{
4057 GVariant *_ret;
4058 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4059 "getUnits",
4060 g_variant_new ("()"),
4061 G_DBUS_CALL_FLAGS_NONE,
4062 -1,
4063 cancellable,
4064 error);
4065 if (_ret == NULL)
4066 goto _out;
4067 g_variant_get (_ret,
4068 "(s)",
4069 out_units);
4070 g_variant_unref (_ret);
4071_out:
4072 return _ret != NULL;
4073}
4074
4075/**
4076 * sensor_string_complete_get_value:
4077 * @object: A #SensorString.
4078 * @invocation: (transfer full): A #GDBusMethodInvocation.
4079 * @value: Parameter to return.
4080 *
4081 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
4082 *
4083 * This method will free @invocation, you cannot use it afterwards.
4084 */
4085void
4086sensor_string_complete_get_value (
4087 SensorString *object,
4088 GDBusMethodInvocation *invocation,
4089 const gchar *value)
4090{
4091 g_dbus_method_invocation_return_value (invocation,
4092 g_variant_new ("(s)",
4093 value));
4094}
4095
4096/**
4097 * sensor_string_complete_get_units:
4098 * @object: A #SensorString.
4099 * @invocation: (transfer full): A #GDBusMethodInvocation.
4100 * @units: Parameter to return.
4101 *
4102 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
4103 *
4104 * This method will free @invocation, you cannot use it afterwards.
4105 */
4106void
4107sensor_string_complete_get_units (
4108 SensorString *object,
4109 GDBusMethodInvocation *invocation,
4110 const gchar *units)
4111{
4112 g_dbus_method_invocation_return_value (invocation,
4113 g_variant_new ("(s)",
4114 units));
4115}
4116
4117/* ------------------------------------------------------------------------ */
4118
4119/**
4120 * SensorStringProxy:
4121 *
4122 * The #SensorStringProxy structure contains only private data and should only be accessed using the provided API.
4123 */
4124
4125/**
4126 * SensorStringProxyClass:
4127 * @parent_class: The parent class.
4128 *
4129 * Class structure for #SensorStringProxy.
4130 */
4131
4132struct _SensorStringProxyPrivate
4133{
4134 GData *qdata;
4135};
4136
4137static void sensor_string_proxy_iface_init (SensorStringIface *iface);
4138
4139#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4140G_DEFINE_TYPE_WITH_CODE (SensorStringProxy, sensor_string_proxy, G_TYPE_DBUS_PROXY,
4141 G_ADD_PRIVATE (SensorStringProxy)
4142 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_proxy_iface_init));
4143
4144#else
4145G_DEFINE_TYPE_WITH_CODE (SensorStringProxy, sensor_string_proxy, G_TYPE_DBUS_PROXY,
4146 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_proxy_iface_init));
4147
4148#endif
4149static void
4150sensor_string_proxy_finalize (GObject *object)
4151{
4152 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
4153 g_datalist_clear (&proxy->priv->qdata);
4154 G_OBJECT_CLASS (sensor_string_proxy_parent_class)->finalize (object);
4155}
4156
4157static void
4158sensor_string_proxy_get_property (GObject *object,
4159 guint prop_id,
4160 GValue *value,
4161 GParamSpec *pspec G_GNUC_UNUSED)
4162{
4163 const _ExtendedGDBusPropertyInfo *info;
4164 GVariant *variant;
4165 g_assert (prop_id != 0 && prop_id - 1 < 2);
4166 info = _sensor_string_property_info_pointers[prop_id - 1];
4167 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4168 if (info->use_gvariant)
4169 {
4170 g_value_set_variant (value, variant);
4171 }
4172 else
4173 {
4174 if (variant != NULL)
4175 g_dbus_gvariant_to_gvalue (variant, value);
4176 }
4177 if (variant != NULL)
4178 g_variant_unref (variant);
4179}
4180
4181static void
4182sensor_string_proxy_set_property_cb (GDBusProxy *proxy,
4183 GAsyncResult *res,
4184 gpointer user_data)
4185{
4186 const _ExtendedGDBusPropertyInfo *info = user_data;
4187 GError *error;
4188 GVariant *_ret;
4189 error = NULL;
4190 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4191 if (!_ret)
4192 {
4193 g_warning ("Error setting property '%s' on interface org.openbmc.SensorString: %s (%s, %d)",
4194 info->parent_struct.name,
4195 error->message, g_quark_to_string (error->domain), error->code);
4196 g_error_free (error);
4197 }
4198 else
4199 {
4200 g_variant_unref (_ret);
4201 }
4202}
4203
4204static void
4205sensor_string_proxy_set_property (GObject *object,
4206 guint prop_id,
4207 const GValue *value,
4208 GParamSpec *pspec G_GNUC_UNUSED)
4209{
4210 const _ExtendedGDBusPropertyInfo *info;
4211 GVariant *variant;
4212 g_assert (prop_id != 0 && prop_id - 1 < 2);
4213 info = _sensor_string_property_info_pointers[prop_id - 1];
4214 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4215 g_dbus_proxy_call (G_DBUS_PROXY (object),
4216 "org.freedesktop.DBus.Properties.Set",
4217 g_variant_new ("(ssv)", "org.openbmc.SensorString", info->parent_struct.name, variant),
4218 G_DBUS_CALL_FLAGS_NONE,
4219 -1,
4220 NULL, (GAsyncReadyCallback) sensor_string_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4221 g_variant_unref (variant);
4222}
4223
4224static void
4225sensor_string_proxy_g_signal (GDBusProxy *proxy,
4226 const gchar *sender_name G_GNUC_UNUSED,
4227 const gchar *signal_name,
4228 GVariant *parameters)
4229{
4230 _ExtendedGDBusSignalInfo *info;
4231 GVariantIter iter;
4232 GVariant *child;
4233 GValue *paramv;
4234 guint num_params;
4235 guint n;
4236 guint signal_id;
4237 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, signal_name);
4238 if (info == NULL)
4239 return;
4240 num_params = g_variant_n_children (parameters);
4241 paramv = g_new0 (GValue, num_params + 1);
4242 g_value_init (&paramv[0], TYPE_SENSOR_STRING);
4243 g_value_set_object (&paramv[0], proxy);
4244 g_variant_iter_init (&iter, parameters);
4245 n = 1;
4246 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4247 {
4248 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4249 if (arg_info->use_gvariant)
4250 {
4251 g_value_init (&paramv[n], G_TYPE_VARIANT);
4252 g_value_set_variant (&paramv[n], child);
4253 n++;
4254 }
4255 else
4256 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4257 g_variant_unref (child);
4258 }
4259 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_STRING);
4260 g_signal_emitv (paramv, signal_id, 0, NULL);
4261 for (n = 0; n < num_params + 1; n++)
4262 g_value_unset (&paramv[n]);
4263 g_free (paramv);
4264}
4265
4266static void
4267sensor_string_proxy_g_properties_changed (GDBusProxy *_proxy,
4268 GVariant *changed_properties,
4269 const gchar *const *invalidated_properties)
4270{
4271 SensorStringProxy *proxy = SENSOR_STRING_PROXY (_proxy);
4272 guint n;
4273 const gchar *key;
4274 GVariantIter *iter;
4275 _ExtendedGDBusPropertyInfo *info;
4276 g_variant_get (changed_properties, "a{sv}", &iter);
4277 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4278 {
4279 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, key);
4280 g_datalist_remove_data (&proxy->priv->qdata, key);
4281 if (info != NULL)
4282 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4283 }
4284 g_variant_iter_free (iter);
4285 for (n = 0; invalidated_properties[n] != NULL; n++)
4286 {
4287 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, invalidated_properties[n]);
4288 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4289 if (info != NULL)
4290 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4291 }
4292}
4293
4294static gint
4295sensor_string_proxy_get_value (SensorString *object)
4296{
4297 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
4298 GVariant *variant;
4299 gint value = 0;
4300 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4301 if (variant != NULL)
4302 {
4303 value = g_variant_get_int32 (variant);
4304 g_variant_unref (variant);
4305 }
4306 return value;
4307}
4308
4309static const gchar *
4310sensor_string_proxy_get_units (SensorString *object)
4311{
4312 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
4313 GVariant *variant;
4314 const gchar *value = NULL;
4315 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4316 if (variant != NULL)
4317 {
4318 value = g_variant_get_string (variant, NULL);
4319 g_variant_unref (variant);
4320 }
4321 return value;
4322}
4323
4324static void
4325sensor_string_proxy_init (SensorStringProxy *proxy)
4326{
4327#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4328 proxy->priv = sensor_string_proxy_get_instance_private (proxy);
4329#else
4330 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_STRING_PROXY, SensorStringProxyPrivate);
4331#endif
4332
4333 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_string_interface_info ());
4334}
4335
4336static void
4337sensor_string_proxy_class_init (SensorStringProxyClass *klass)
4338{
4339 GObjectClass *gobject_class;
4340 GDBusProxyClass *proxy_class;
4341
4342 gobject_class = G_OBJECT_CLASS (klass);
4343 gobject_class->finalize = sensor_string_proxy_finalize;
4344 gobject_class->get_property = sensor_string_proxy_get_property;
4345 gobject_class->set_property = sensor_string_proxy_set_property;
4346
4347 proxy_class = G_DBUS_PROXY_CLASS (klass);
4348 proxy_class->g_signal = sensor_string_proxy_g_signal;
4349 proxy_class->g_properties_changed = sensor_string_proxy_g_properties_changed;
4350
4351 sensor_string_override_properties (gobject_class, 1);
4352
4353#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4354 g_type_class_add_private (klass, sizeof (SensorStringProxyPrivate));
4355#endif
4356}
4357
4358static void
4359sensor_string_proxy_iface_init (SensorStringIface *iface)
4360{
4361 iface->get_value = sensor_string_proxy_get_value;
4362 iface->get_units = sensor_string_proxy_get_units;
4363}
4364
4365/**
4366 * sensor_string_proxy_new:
4367 * @connection: A #GDBusConnection.
4368 * @flags: Flags from the #GDBusProxyFlags enumeration.
4369 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4370 * @object_path: An object path.
4371 * @cancellable: (allow-none): A #GCancellable or %NULL.
4372 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4373 * @user_data: User data to pass to @callback.
4374 *
4375 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>. See g_dbus_proxy_new() for more details.
4376 *
4377 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4378 * You can then call sensor_string_proxy_new_finish() to get the result of the operation.
4379 *
4380 * See sensor_string_proxy_new_sync() for the synchronous, blocking version of this constructor.
4381 */
4382void
4383sensor_string_proxy_new (
4384 GDBusConnection *connection,
4385 GDBusProxyFlags flags,
4386 const gchar *name,
4387 const gchar *object_path,
4388 GCancellable *cancellable,
4389 GAsyncReadyCallback callback,
4390 gpointer user_data)
4391{
4392 g_async_initable_new_async (TYPE_SENSOR_STRING_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorString", NULL);
4393}
4394
4395/**
4396 * sensor_string_proxy_new_finish:
4397 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_proxy_new().
4398 * @error: Return location for error or %NULL
4399 *
4400 * Finishes an operation started with sensor_string_proxy_new().
4401 *
4402 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
4403 */
4404SensorString *
4405sensor_string_proxy_new_finish (
4406 GAsyncResult *res,
4407 GError **error)
4408{
4409 GObject *ret;
4410 GObject *source_object;
4411 source_object = g_async_result_get_source_object (res);
4412 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4413 g_object_unref (source_object);
4414 if (ret != NULL)
4415 return SENSOR_STRING (ret);
4416 else
4417 return NULL;
4418}
4419
4420/**
4421 * sensor_string_proxy_new_sync:
4422 * @connection: A #GDBusConnection.
4423 * @flags: Flags from the #GDBusProxyFlags enumeration.
4424 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4425 * @object_path: An object path.
4426 * @cancellable: (allow-none): A #GCancellable or %NULL.
4427 * @error: Return location for error or %NULL
4428 *
4429 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>. See g_dbus_proxy_new_sync() for more details.
4430 *
4431 * The calling thread is blocked until a reply is received.
4432 *
4433 * See sensor_string_proxy_new() for the asynchronous version of this constructor.
4434 *
4435 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
4436 */
4437SensorString *
4438sensor_string_proxy_new_sync (
4439 GDBusConnection *connection,
4440 GDBusProxyFlags flags,
4441 const gchar *name,
4442 const gchar *object_path,
4443 GCancellable *cancellable,
4444 GError **error)
4445{
4446 GInitable *ret;
4447 ret = g_initable_new (TYPE_SENSOR_STRING_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorString", NULL);
4448 if (ret != NULL)
4449 return SENSOR_STRING (ret);
4450 else
4451 return NULL;
4452}
4453
4454
4455/**
4456 * sensor_string_proxy_new_for_bus:
4457 * @bus_type: A #GBusType.
4458 * @flags: Flags from the #GDBusProxyFlags enumeration.
4459 * @name: A bus name (well-known or unique).
4460 * @object_path: An object path.
4461 * @cancellable: (allow-none): A #GCancellable or %NULL.
4462 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4463 * @user_data: User data to pass to @callback.
4464 *
4465 * Like sensor_string_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
4466 *
4467 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4468 * You can then call sensor_string_proxy_new_for_bus_finish() to get the result of the operation.
4469 *
4470 * See sensor_string_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4471 */
4472void
4473sensor_string_proxy_new_for_bus (
4474 GBusType bus_type,
4475 GDBusProxyFlags flags,
4476 const gchar *name,
4477 const gchar *object_path,
4478 GCancellable *cancellable,
4479 GAsyncReadyCallback callback,
4480 gpointer user_data)
4481{
4482 g_async_initable_new_async (TYPE_SENSOR_STRING_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorString", NULL);
4483}
4484
4485/**
4486 * sensor_string_proxy_new_for_bus_finish:
4487 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_proxy_new_for_bus().
4488 * @error: Return location for error or %NULL
4489 *
4490 * Finishes an operation started with sensor_string_proxy_new_for_bus().
4491 *
4492 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
4493 */
4494SensorString *
4495sensor_string_proxy_new_for_bus_finish (
4496 GAsyncResult *res,
4497 GError **error)
4498{
4499 GObject *ret;
4500 GObject *source_object;
4501 source_object = g_async_result_get_source_object (res);
4502 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4503 g_object_unref (source_object);
4504 if (ret != NULL)
4505 return SENSOR_STRING (ret);
4506 else
4507 return NULL;
4508}
4509
4510/**
4511 * sensor_string_proxy_new_for_bus_sync:
4512 * @bus_type: A #GBusType.
4513 * @flags: Flags from the #GDBusProxyFlags enumeration.
4514 * @name: A bus name (well-known or unique).
4515 * @object_path: An object path.
4516 * @cancellable: (allow-none): A #GCancellable or %NULL.
4517 * @error: Return location for error or %NULL
4518 *
4519 * Like sensor_string_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4520 *
4521 * The calling thread is blocked until a reply is received.
4522 *
4523 * See sensor_string_proxy_new_for_bus() for the asynchronous version of this constructor.
4524 *
4525 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
4526 */
4527SensorString *
4528sensor_string_proxy_new_for_bus_sync (
4529 GBusType bus_type,
4530 GDBusProxyFlags flags,
4531 const gchar *name,
4532 const gchar *object_path,
4533 GCancellable *cancellable,
4534 GError **error)
4535{
4536 GInitable *ret;
4537 ret = g_initable_new (TYPE_SENSOR_STRING_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorString", NULL);
4538 if (ret != NULL)
4539 return SENSOR_STRING (ret);
4540 else
4541 return NULL;
4542}
4543
4544
4545/* ------------------------------------------------------------------------ */
4546
4547/**
4548 * SensorStringSkeleton:
4549 *
4550 * The #SensorStringSkeleton structure contains only private data and should only be accessed using the provided API.
4551 */
4552
4553/**
4554 * SensorStringSkeletonClass:
4555 * @parent_class: The parent class.
4556 *
4557 * Class structure for #SensorStringSkeleton.
4558 */
4559
4560struct _SensorStringSkeletonPrivate
4561{
4562 GValue *properties;
4563 GList *changed_properties;
4564 GSource *changed_properties_idle_source;
4565 GMainContext *context;
4566 GMutex lock;
4567};
4568
4569static void
4570_sensor_string_skeleton_handle_method_call (
4571 GDBusConnection *connection G_GNUC_UNUSED,
4572 const gchar *sender G_GNUC_UNUSED,
4573 const gchar *object_path G_GNUC_UNUSED,
4574 const gchar *interface_name,
4575 const gchar *method_name,
4576 GVariant *parameters,
4577 GDBusMethodInvocation *invocation,
4578 gpointer user_data)
4579{
4580 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
4581 _ExtendedGDBusMethodInfo *info;
4582 GVariantIter iter;
4583 GVariant *child;
4584 GValue *paramv;
4585 guint num_params;
4586 guint num_extra;
4587 guint n;
4588 guint signal_id;
4589 GValue return_value = G_VALUE_INIT;
4590 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
4591 g_assert (info != NULL);
4592 num_params = g_variant_n_children (parameters);
4593 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
4594 n = 0;
4595 g_value_init (&paramv[n], TYPE_SENSOR_STRING);
4596 g_value_set_object (&paramv[n++], skeleton);
4597 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
4598 g_value_set_object (&paramv[n++], invocation);
4599 if (info->pass_fdlist)
4600 {
4601#ifdef G_OS_UNIX
4602 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
4603 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
4604#else
4605 g_assert_not_reached ();
4606#endif
4607 }
4608 g_variant_iter_init (&iter, parameters);
4609 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4610 {
4611 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
4612 if (arg_info->use_gvariant)
4613 {
4614 g_value_init (&paramv[n], G_TYPE_VARIANT);
4615 g_value_set_variant (&paramv[n], child);
4616 n++;
4617 }
4618 else
4619 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4620 g_variant_unref (child);
4621 }
4622 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_STRING);
4623 g_value_init (&return_value, G_TYPE_BOOLEAN);
4624 g_signal_emitv (paramv, signal_id, 0, &return_value);
4625 if (!g_value_get_boolean (&return_value))
4626 g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
4627 g_value_unset (&return_value);
4628 for (n = 0; n < num_params + num_extra; n++)
4629 g_value_unset (&paramv[n]);
4630 g_free (paramv);
4631}
4632
4633static GVariant *
4634_sensor_string_skeleton_handle_get_property (
4635 GDBusConnection *connection G_GNUC_UNUSED,
4636 const gchar *sender G_GNUC_UNUSED,
4637 const gchar *object_path G_GNUC_UNUSED,
4638 const gchar *interface_name G_GNUC_UNUSED,
4639 const gchar *property_name,
4640 GError **error,
4641 gpointer user_data)
4642{
4643 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
4644 GValue value = G_VALUE_INIT;
4645 GParamSpec *pspec;
4646 _ExtendedGDBusPropertyInfo *info;
4647 GVariant *ret;
4648 ret = NULL;
4649 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, property_name);
4650 g_assert (info != NULL);
4651 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4652 if (pspec == NULL)
4653 {
4654 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4655 }
4656 else
4657 {
4658 g_value_init (&value, pspec->value_type);
4659 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4660 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
4661 g_value_unset (&value);
4662 }
4663 return ret;
4664}
4665
4666static gboolean
4667_sensor_string_skeleton_handle_set_property (
4668 GDBusConnection *connection G_GNUC_UNUSED,
4669 const gchar *sender G_GNUC_UNUSED,
4670 const gchar *object_path G_GNUC_UNUSED,
4671 const gchar *interface_name G_GNUC_UNUSED,
4672 const gchar *property_name,
4673 GVariant *variant,
4674 GError **error,
4675 gpointer user_data)
4676{
4677 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
4678 GValue value = G_VALUE_INIT;
4679 GParamSpec *pspec;
4680 _ExtendedGDBusPropertyInfo *info;
4681 gboolean ret;
4682 ret = FALSE;
4683 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, property_name);
4684 g_assert (info != NULL);
4685 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4686 if (pspec == NULL)
4687 {
4688 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4689 }
4690 else
4691 {
4692 if (info->use_gvariant)
4693 g_value_set_variant (&value, variant);
4694 else
4695 g_dbus_gvariant_to_gvalue (variant, &value);
4696 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4697 g_value_unset (&value);
4698 ret = TRUE;
4699 }
4700 return ret;
4701}
4702
4703static const GDBusInterfaceVTable _sensor_string_skeleton_vtable =
4704{
4705 _sensor_string_skeleton_handle_method_call,
4706 _sensor_string_skeleton_handle_get_property,
4707 _sensor_string_skeleton_handle_set_property,
4708 {NULL}
4709};
4710
4711static GDBusInterfaceInfo *
4712sensor_string_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4713{
4714 return sensor_string_interface_info ();
4715}
4716
4717static GDBusInterfaceVTable *
4718sensor_string_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4719{
4720 return (GDBusInterfaceVTable *) &_sensor_string_skeleton_vtable;
4721}
4722
4723static GVariant *
4724sensor_string_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
4725{
4726 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (_skeleton);
4727
4728 GVariantBuilder builder;
4729 guint n;
4730 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4731 if (_sensor_string_interface_info.parent_struct.properties == NULL)
4732 goto out;
4733 for (n = 0; _sensor_string_interface_info.parent_struct.properties[n] != NULL; n++)
4734 {
4735 GDBusPropertyInfo *info = _sensor_string_interface_info.parent_struct.properties[n];
4736 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
4737 {
4738 GVariant *value;
4739 value = _sensor_string_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorString", info->name, NULL, skeleton);
4740 if (value != NULL)
4741 {
4742 g_variant_take_ref (value);
4743 g_variant_builder_add (&builder, "{sv}", info->name, value);
4744 g_variant_unref (value);
4745 }
4746 }
4747 }
4748out:
4749 return g_variant_builder_end (&builder);
4750}
4751
4752static gboolean _sensor_string_emit_changed (gpointer user_data);
4753
4754static void
4755sensor_string_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
4756{
4757 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (_skeleton);
4758 gboolean emit_changed = FALSE;
4759
4760 g_mutex_lock (&skeleton->priv->lock);
4761 if (skeleton->priv->changed_properties_idle_source != NULL)
4762 {
4763 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4764 skeleton->priv->changed_properties_idle_source = NULL;
4765 emit_changed = TRUE;
4766 }
4767 g_mutex_unlock (&skeleton->priv->lock);
4768
4769 if (emit_changed)
4770 _sensor_string_emit_changed (skeleton);
4771}
4772
4773static void
4774_sensor_string_on_signal_changed (
4775 SensorString *object,
4776 const gchar *arg_value)
4777{
4778 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4779
4780 GList *connections, *l;
4781 GVariant *signal_variant;
4782 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4783
4784 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
4785 arg_value));
4786 for (l = connections; l != NULL; l = l->next)
4787 {
4788 GDBusConnection *connection = l->data;
4789 g_dbus_connection_emit_signal (connection,
4790 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorString", "Changed",
4791 signal_variant, NULL);
4792 }
4793 g_variant_unref (signal_variant);
4794 g_list_free_full (connections, g_object_unref);
4795}
4796
4797static void sensor_string_skeleton_iface_init (SensorStringIface *iface);
4798#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4799G_DEFINE_TYPE_WITH_CODE (SensorStringSkeleton, sensor_string_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4800 G_ADD_PRIVATE (SensorStringSkeleton)
4801 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_skeleton_iface_init));
4802
4803#else
4804G_DEFINE_TYPE_WITH_CODE (SensorStringSkeleton, sensor_string_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4805 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_skeleton_iface_init));
4806
4807#endif
4808static void
4809sensor_string_skeleton_finalize (GObject *object)
4810{
4811 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4812 guint n;
4813 for (n = 0; n < 2; n++)
4814 g_value_unset (&skeleton->priv->properties[n]);
4815 g_free (skeleton->priv->properties);
4816 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4817 if (skeleton->priv->changed_properties_idle_source != NULL)
4818 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4819 g_main_context_unref (skeleton->priv->context);
4820 g_mutex_clear (&skeleton->priv->lock);
4821 G_OBJECT_CLASS (sensor_string_skeleton_parent_class)->finalize (object);
4822}
4823
4824static void
4825sensor_string_skeleton_get_property (GObject *object,
4826 guint prop_id,
4827 GValue *value,
4828 GParamSpec *pspec G_GNUC_UNUSED)
4829{
4830 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4831 g_assert (prop_id != 0 && prop_id - 1 < 2);
4832 g_mutex_lock (&skeleton->priv->lock);
4833 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
4834 g_mutex_unlock (&skeleton->priv->lock);
4835}
4836
4837static gboolean
4838_sensor_string_emit_changed (gpointer user_data)
4839{
4840 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
4841 GList *l;
4842 GVariantBuilder builder;
4843 GVariantBuilder invalidated_builder;
4844 guint num_changes;
4845
4846 g_mutex_lock (&skeleton->priv->lock);
4847 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4848 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
4849 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
4850 {
4851 ChangedProperty *cp = l->data;
4852 GVariant *variant;
4853 const GValue *cur_value;
4854
4855 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
4856 if (!_g_value_equal (cur_value, &cp->orig_value))
4857 {
4858 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
4859 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
4860 g_variant_unref (variant);
4861 num_changes++;
4862 }
4863 }
4864 if (num_changes > 0)
4865 {
4866 GList *connections, *ll;
4867 GVariant *signal_variant;
4868 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorString",
4869 &builder, &invalidated_builder));
4870 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4871 for (ll = connections; ll != NULL; ll = ll->next)
4872 {
4873 GDBusConnection *connection = ll->data;
4874
4875 g_dbus_connection_emit_signal (connection,
4876 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
4877 "org.freedesktop.DBus.Properties",
4878 "PropertiesChanged",
4879 signal_variant,
4880 NULL);
4881 }
4882 g_variant_unref (signal_variant);
4883 g_list_free_full (connections, g_object_unref);
4884 }
4885 else
4886 {
4887 g_variant_builder_clear (&builder);
4888 g_variant_builder_clear (&invalidated_builder);
4889 }
4890 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4891 skeleton->priv->changed_properties = NULL;
4892 skeleton->priv->changed_properties_idle_source = NULL;
4893 g_mutex_unlock (&skeleton->priv->lock);
4894 return FALSE;
4895}
4896
4897static void
4898_sensor_string_schedule_emit_changed (SensorStringSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
4899{
4900 ChangedProperty *cp;
4901 GList *l;
4902 cp = NULL;
4903 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
4904 {
4905 ChangedProperty *i_cp = l->data;
4906 if (i_cp->info == info)
4907 {
4908 cp = i_cp;
4909 break;
4910 }
4911 }
4912 if (cp == NULL)
4913 {
4914 cp = g_new0 (ChangedProperty, 1);
4915 cp->prop_id = prop_id;
4916 cp->info = info;
4917 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
4918 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
4919 g_value_copy (orig_value, &cp->orig_value);
4920 }
4921}
4922
4923static void
4924sensor_string_skeleton_notify (GObject *object,
4925 GParamSpec *pspec G_GNUC_UNUSED)
4926{
4927 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4928 g_mutex_lock (&skeleton->priv->lock);
4929 if (skeleton->priv->changed_properties != NULL &&
4930 skeleton->priv->changed_properties_idle_source == NULL)
4931 {
4932 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
4933 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
4934 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_string_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
4935 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
4936 g_source_unref (skeleton->priv->changed_properties_idle_source);
4937 }
4938 g_mutex_unlock (&skeleton->priv->lock);
4939}
4940
4941static void
4942sensor_string_skeleton_set_property (GObject *object,
4943 guint prop_id,
4944 const GValue *value,
4945 GParamSpec *pspec)
4946{
4947 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4948 g_assert (prop_id != 0 && prop_id - 1 < 2);
4949 g_mutex_lock (&skeleton->priv->lock);
4950 g_object_freeze_notify (object);
4951 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
4952 {
4953 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
4954 _sensor_string_schedule_emit_changed (skeleton, _sensor_string_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
4955 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
4956 g_object_notify_by_pspec (object, pspec);
4957 }
4958 g_mutex_unlock (&skeleton->priv->lock);
4959 g_object_thaw_notify (object);
4960}
4961
4962static void
4963sensor_string_skeleton_init (SensorStringSkeleton *skeleton)
4964{
4965#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4966 skeleton->priv = sensor_string_skeleton_get_instance_private (skeleton);
4967#else
4968 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_STRING_SKELETON, SensorStringSkeletonPrivate);
4969#endif
4970
4971 g_mutex_init (&skeleton->priv->lock);
4972 skeleton->priv->context = g_main_context_ref_thread_default ();
4973 skeleton->priv->properties = g_new0 (GValue, 2);
4974 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
4975 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
4976}
4977
4978static gint
4979sensor_string_skeleton_get_value (SensorString *object)
4980{
4981 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4982 gint value;
4983 g_mutex_lock (&skeleton->priv->lock);
4984 value = g_value_get_int (&(skeleton->priv->properties[0]));
4985 g_mutex_unlock (&skeleton->priv->lock);
4986 return value;
4987}
4988
4989static const gchar *
4990sensor_string_skeleton_get_units (SensorString *object)
4991{
4992 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4993 const gchar *value;
4994 g_mutex_lock (&skeleton->priv->lock);
4995 value = g_value_get_string (&(skeleton->priv->properties[1]));
4996 g_mutex_unlock (&skeleton->priv->lock);
4997 return value;
4998}
4999
5000static void
5001sensor_string_skeleton_class_init (SensorStringSkeletonClass *klass)
5002{
5003 GObjectClass *gobject_class;
5004 GDBusInterfaceSkeletonClass *skeleton_class;
5005
5006 gobject_class = G_OBJECT_CLASS (klass);
5007 gobject_class->finalize = sensor_string_skeleton_finalize;
5008 gobject_class->get_property = sensor_string_skeleton_get_property;
5009 gobject_class->set_property = sensor_string_skeleton_set_property;
5010 gobject_class->notify = sensor_string_skeleton_notify;
5011
5012
5013 sensor_string_override_properties (gobject_class, 1);
5014
5015 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5016 skeleton_class->get_info = sensor_string_skeleton_dbus_interface_get_info;
5017 skeleton_class->get_properties = sensor_string_skeleton_dbus_interface_get_properties;
5018 skeleton_class->flush = sensor_string_skeleton_dbus_interface_flush;
5019 skeleton_class->get_vtable = sensor_string_skeleton_dbus_interface_get_vtable;
5020
5021#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5022 g_type_class_add_private (klass, sizeof (SensorStringSkeletonPrivate));
5023#endif
5024}
5025
5026static void
5027sensor_string_skeleton_iface_init (SensorStringIface *iface)
5028{
5029 iface->changed = _sensor_string_on_signal_changed;
5030 iface->get_value = sensor_string_skeleton_get_value;
5031 iface->get_units = sensor_string_skeleton_get_units;
5032}
5033
5034/**
5035 * sensor_string_skeleton_new:
5036 *
5037 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
5038 *
5039 * Returns: (transfer full) (type SensorStringSkeleton): The skeleton object.
5040 */
5041SensorString *
5042sensor_string_skeleton_new (void)
5043{
5044 return SENSOR_STRING (g_object_new (TYPE_SENSOR_STRING_SKELETON, NULL));
5045}
5046
5047/* ------------------------------------------------------------------------
5048 * Code for interface org.openbmc.SensorIntegerSettable
5049 * ------------------------------------------------------------------------
5050 */
5051
5052/**
5053 * SECTION:SensorIntegerSettable
5054 * @title: SensorIntegerSettable
5055 * @short_description: Generated C code for the org.openbmc.SensorIntegerSettable D-Bus interface
5056 *
5057 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link> D-Bus interface in C.
5058 */
5059
5060/* ---- Introspection data for org.openbmc.SensorIntegerSettable ---- */
5061
5062static const _ExtendedGDBusArgInfo _sensor_integer_settable_method_info_get_value_OUT_ARG_value =
5063{
5064 {
5065 -1,
5066 (gchar *) "value",
5067 (gchar *) "i",
5068 NULL
5069 },
5070 FALSE
5071};
5072
5073static const _ExtendedGDBusArgInfo * const _sensor_integer_settable_method_info_get_value_OUT_ARG_pointers[] =
5074{
5075 &_sensor_integer_settable_method_info_get_value_OUT_ARG_value,
5076 NULL
5077};
5078
5079static const _ExtendedGDBusMethodInfo _sensor_integer_settable_method_info_get_value =
5080{
5081 {
5082 -1,
5083 (gchar *) "getValue",
5084 NULL,
5085 (GDBusArgInfo **) &_sensor_integer_settable_method_info_get_value_OUT_ARG_pointers,
5086 NULL
5087 },
5088 "handle-get-value",
5089 FALSE
5090};
5091
5092static const _ExtendedGDBusArgInfo _sensor_integer_settable_method_info_set_value_IN_ARG_value =
5093{
5094 {
5095 -1,
5096 (gchar *) "value",
5097 (gchar *) "i",
5098 NULL
5099 },
5100 FALSE
5101};
5102
5103static const _ExtendedGDBusArgInfo * const _sensor_integer_settable_method_info_set_value_IN_ARG_pointers[] =
5104{
5105 &_sensor_integer_settable_method_info_set_value_IN_ARG_value,
5106 NULL
5107};
5108
5109static const _ExtendedGDBusMethodInfo _sensor_integer_settable_method_info_set_value =
5110{
5111 {
5112 -1,
5113 (gchar *) "setValue",
5114 (GDBusArgInfo **) &_sensor_integer_settable_method_info_set_value_IN_ARG_pointers,
5115 NULL,
5116 NULL
5117 },
5118 "handle-set-value",
5119 FALSE
5120};
5121
5122static const _ExtendedGDBusArgInfo _sensor_integer_settable_method_info_get_units_OUT_ARG_units =
5123{
5124 {
5125 -1,
5126 (gchar *) "units",
5127 (gchar *) "s",
5128 NULL
5129 },
5130 FALSE
5131};
5132
5133static const _ExtendedGDBusArgInfo * const _sensor_integer_settable_method_info_get_units_OUT_ARG_pointers[] =
5134{
5135 &_sensor_integer_settable_method_info_get_units_OUT_ARG_units,
5136 NULL
5137};
5138
5139static const _ExtendedGDBusMethodInfo _sensor_integer_settable_method_info_get_units =
5140{
5141 {
5142 -1,
5143 (gchar *) "getUnits",
5144 NULL,
5145 (GDBusArgInfo **) &_sensor_integer_settable_method_info_get_units_OUT_ARG_pointers,
5146 NULL
5147 },
5148 "handle-get-units",
5149 FALSE
5150};
5151
5152static const _ExtendedGDBusMethodInfo * const _sensor_integer_settable_method_info_pointers[] =
5153{
5154 &_sensor_integer_settable_method_info_get_value,
5155 &_sensor_integer_settable_method_info_set_value,
5156 &_sensor_integer_settable_method_info_get_units,
5157 NULL
5158};
5159
5160static const _ExtendedGDBusArgInfo _sensor_integer_settable_signal_info_changed_ARG_value =
5161{
5162 {
5163 -1,
5164 (gchar *) "value",
5165 (gchar *) "i",
5166 NULL
5167 },
5168 FALSE
5169};
5170
5171static const _ExtendedGDBusArgInfo * const _sensor_integer_settable_signal_info_changed_ARG_pointers[] =
5172{
5173 &_sensor_integer_settable_signal_info_changed_ARG_value,
5174 NULL
5175};
5176
5177static const _ExtendedGDBusSignalInfo _sensor_integer_settable_signal_info_changed =
5178{
5179 {
5180 -1,
5181 (gchar *) "Changed",
5182 (GDBusArgInfo **) &_sensor_integer_settable_signal_info_changed_ARG_pointers,
5183 NULL
5184 },
5185 "changed"
5186};
5187
5188static const _ExtendedGDBusSignalInfo * const _sensor_integer_settable_signal_info_pointers[] =
5189{
5190 &_sensor_integer_settable_signal_info_changed,
5191 NULL
5192};
5193
5194static const _ExtendedGDBusPropertyInfo _sensor_integer_settable_property_info_value =
5195{
5196 {
5197 -1,
5198 (gchar *) "value",
5199 (gchar *) "i",
5200 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5201 NULL
5202 },
5203 "value",
5204 FALSE
5205};
5206
5207static const _ExtendedGDBusPropertyInfo _sensor_integer_settable_property_info_units =
5208{
5209 {
5210 -1,
5211 (gchar *) "units",
5212 (gchar *) "s",
5213 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5214 NULL
5215 },
5216 "units",
5217 FALSE
5218};
5219
5220static const _ExtendedGDBusPropertyInfo * const _sensor_integer_settable_property_info_pointers[] =
5221{
5222 &_sensor_integer_settable_property_info_value,
5223 &_sensor_integer_settable_property_info_units,
5224 NULL
5225};
5226
5227static const _ExtendedGDBusInterfaceInfo _sensor_integer_settable_interface_info =
5228{
5229 {
5230 -1,
5231 (gchar *) "org.openbmc.SensorIntegerSettable",
5232 (GDBusMethodInfo **) &_sensor_integer_settable_method_info_pointers,
5233 (GDBusSignalInfo **) &_sensor_integer_settable_signal_info_pointers,
5234 (GDBusPropertyInfo **) &_sensor_integer_settable_property_info_pointers,
5235 NULL
5236 },
5237 "sensor-integer-settable",
5238};
5239
5240
5241/**
5242 * sensor_integer_settable_interface_info:
5243 *
5244 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link> D-Bus interface.
5245 *
5246 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5247 */
5248GDBusInterfaceInfo *
5249sensor_integer_settable_interface_info (void)
5250{
5251 return (GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct;
5252}
5253
5254/**
5255 * sensor_integer_settable_override_properties:
5256 * @klass: The class structure for a #GObject<!-- -->-derived class.
5257 * @property_id_begin: The property id to assign to the first overridden property.
5258 *
5259 * Overrides all #GObject properties in the #SensorIntegerSettable interface for a concrete class.
5260 * The properties are overridden in the order they are defined.
5261 *
5262 * Returns: The last property id.
5263 */
5264guint
5265sensor_integer_settable_override_properties (GObjectClass *klass, guint property_id_begin)
5266{
5267 g_object_class_override_property (klass, property_id_begin++, "value");
5268 g_object_class_override_property (klass, property_id_begin++, "units");
5269 return property_id_begin - 1;
5270}
5271
5272
5273
5274/**
5275 * SensorIntegerSettable:
5276 *
5277 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>.
5278 */
5279
5280/**
5281 * SensorIntegerSettableIface:
5282 * @parent_iface: The parent interface.
5283 * @handle_get_units: Handler for the #SensorIntegerSettable::handle-get-units signal.
5284 * @handle_get_value: Handler for the #SensorIntegerSettable::handle-get-value signal.
5285 * @handle_set_value: Handler for the #SensorIntegerSettable::handle-set-value signal.
5286 * @get_units: Getter for the #SensorIntegerSettable:units property.
5287 * @get_value: Getter for the #SensorIntegerSettable:value property.
5288 * @changed: Handler for the #SensorIntegerSettable::changed signal.
5289 *
5290 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>.
5291 */
5292
5293typedef SensorIntegerSettableIface SensorIntegerSettableInterface;
5294G_DEFINE_INTERFACE (SensorIntegerSettable, sensor_integer_settable, G_TYPE_OBJECT);
5295
5296static void
5297sensor_integer_settable_default_init (SensorIntegerSettableIface *iface)
5298{
5299 /* GObject signals for incoming D-Bus method calls: */
5300 /**
5301 * SensorIntegerSettable::handle-get-value:
5302 * @object: A #SensorIntegerSettable.
5303 * @invocation: A #GDBusMethodInvocation.
5304 *
5305 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getValue">getValue()</link> D-Bus method.
5306 *
5307 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_settable_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
5308 *
5309 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5310 */
5311 g_signal_new ("handle-get-value",
5312 G_TYPE_FROM_INTERFACE (iface),
5313 G_SIGNAL_RUN_LAST,
5314 G_STRUCT_OFFSET (SensorIntegerSettableIface, handle_get_value),
5315 g_signal_accumulator_true_handled,
5316 NULL,
5317 g_cclosure_marshal_generic,
5318 G_TYPE_BOOLEAN,
5319 1,
5320 G_TYPE_DBUS_METHOD_INVOCATION);
5321
5322 /**
5323 * SensorIntegerSettable::handle-set-value:
5324 * @object: A #SensorIntegerSettable.
5325 * @invocation: A #GDBusMethodInvocation.
5326 * @arg_value: Argument passed by remote caller.
5327 *
5328 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.setValue">setValue()</link> D-Bus method.
5329 *
5330 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_settable_complete_set_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
5331 *
5332 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5333 */
5334 g_signal_new ("handle-set-value",
5335 G_TYPE_FROM_INTERFACE (iface),
5336 G_SIGNAL_RUN_LAST,
5337 G_STRUCT_OFFSET (SensorIntegerSettableIface, handle_set_value),
5338 g_signal_accumulator_true_handled,
5339 NULL,
5340 g_cclosure_marshal_generic,
5341 G_TYPE_BOOLEAN,
5342 2,
5343 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
5344
5345 /**
5346 * SensorIntegerSettable::handle-get-units:
5347 * @object: A #SensorIntegerSettable.
5348 * @invocation: A #GDBusMethodInvocation.
5349 *
5350 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getUnits">getUnits()</link> D-Bus method.
5351 *
5352 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_settable_complete_get_units() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
5353 *
5354 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5355 */
5356 g_signal_new ("handle-get-units",
5357 G_TYPE_FROM_INTERFACE (iface),
5358 G_SIGNAL_RUN_LAST,
5359 G_STRUCT_OFFSET (SensorIntegerSettableIface, handle_get_units),
5360 g_signal_accumulator_true_handled,
5361 NULL,
5362 g_cclosure_marshal_generic,
5363 G_TYPE_BOOLEAN,
5364 1,
5365 G_TYPE_DBUS_METHOD_INVOCATION);
5366
5367 /* GObject signals for received D-Bus signals: */
5368 /**
5369 * SensorIntegerSettable::changed:
5370 * @object: A #SensorIntegerSettable.
5371 * @arg_value: Argument.
5372 *
5373 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorIntegerSettable.Changed">"Changed"</link> is received.
5374 *
5375 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
5376 */
5377 g_signal_new ("changed",
5378 G_TYPE_FROM_INTERFACE (iface),
5379 G_SIGNAL_RUN_LAST,
5380 G_STRUCT_OFFSET (SensorIntegerSettableIface, changed),
5381 NULL,
5382 NULL,
5383 g_cclosure_marshal_generic,
5384 G_TYPE_NONE,
5385 1, G_TYPE_INT);
5386
5387 /* GObject properties for D-Bus properties: */
5388 /**
5389 * SensorIntegerSettable:value:
5390 *
5391 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.value">"value"</link>.
5392 *
5393 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
5394 */
5395 g_object_interface_install_property (iface,
5396 g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5397 /**
5398 * SensorIntegerSettable:units:
5399 *
5400 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.units">"units"</link>.
5401 *
5402 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
5403 */
5404 g_object_interface_install_property (iface,
5405 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5406}
5407
5408/**
5409 * sensor_integer_settable_get_value: (skip)
5410 * @object: A #SensorIntegerSettable.
5411 *
5412 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.value">"value"</link> D-Bus property.
5413 *
5414 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5415 *
5416 * Returns: The property value.
5417 */
5418gint
5419sensor_integer_settable_get_value (SensorIntegerSettable *object)
5420{
5421 return SENSOR_INTEGER_SETTABLE_GET_IFACE (object)->get_value (object);
5422}
5423
5424/**
5425 * sensor_integer_settable_set_value: (skip)
5426 * @object: A #SensorIntegerSettable.
5427 * @value: The value to set.
5428 *
5429 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.value">"value"</link> D-Bus property to @value.
5430 *
5431 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
5432 */
5433void
5434sensor_integer_settable_set_value (SensorIntegerSettable *object, gint value)
5435{
5436 g_object_set (G_OBJECT (object), "value", value, NULL);
5437}
5438
5439/**
5440 * sensor_integer_settable_get_units: (skip)
5441 * @object: A #SensorIntegerSettable.
5442 *
5443 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.units">"units"</link> D-Bus property.
5444 *
5445 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5446 *
5447 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_integer_settable_dup_units() if on another thread.</warning>
5448 *
5449 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5450 */
5451const gchar *
5452sensor_integer_settable_get_units (SensorIntegerSettable *object)
5453{
5454 return SENSOR_INTEGER_SETTABLE_GET_IFACE (object)->get_units (object);
5455}
5456
5457/**
5458 * sensor_integer_settable_dup_units: (skip)
5459 * @object: A #SensorIntegerSettable.
5460 *
5461 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.units">"units"</link> D-Bus property.
5462 *
5463 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5464 *
5465 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
5466 */
5467gchar *
5468sensor_integer_settable_dup_units (SensorIntegerSettable *object)
5469{
5470 gchar *value;
5471 g_object_get (G_OBJECT (object), "units", &value, NULL);
5472 return value;
5473}
5474
5475/**
5476 * sensor_integer_settable_set_units: (skip)
5477 * @object: A #SensorIntegerSettable.
5478 * @value: The value to set.
5479 *
5480 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerSettable.units">"units"</link> D-Bus property to @value.
5481 *
5482 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
5483 */
5484void
5485sensor_integer_settable_set_units (SensorIntegerSettable *object, const gchar *value)
5486{
5487 g_object_set (G_OBJECT (object), "units", value, NULL);
5488}
5489
5490/**
5491 * sensor_integer_settable_emit_changed:
5492 * @object: A #SensorIntegerSettable.
5493 * @arg_value: Argument to pass with the signal.
5494 *
5495 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerSettable.Changed">"Changed"</link> D-Bus signal.
5496 */
5497void
5498sensor_integer_settable_emit_changed (
5499 SensorIntegerSettable *object,
5500 gint arg_value)
5501{
5502 g_signal_emit_by_name (object, "changed", arg_value);
5503}
5504
5505/**
5506 * sensor_integer_settable_call_get_value:
5507 * @proxy: A #SensorIntegerSettableProxy.
5508 * @cancellable: (allow-none): A #GCancellable or %NULL.
5509 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
5510 * @user_data: User data to pass to @callback.
5511 *
5512 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getValue">getValue()</link> D-Bus method on @proxy.
5513 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5514 * You can then call sensor_integer_settable_call_get_value_finish() to get the result of the operation.
5515 *
5516 * See sensor_integer_settable_call_get_value_sync() for the synchronous, blocking version of this method.
5517 */
5518void
5519sensor_integer_settable_call_get_value (
5520 SensorIntegerSettable *proxy,
5521 GCancellable *cancellable,
5522 GAsyncReadyCallback callback,
5523 gpointer user_data)
5524{
5525 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
5526 "getValue",
5527 g_variant_new ("()"),
5528 G_DBUS_CALL_FLAGS_NONE,
5529 -1,
5530 cancellable,
5531 callback,
5532 user_data);
5533}
5534
5535/**
5536 * sensor_integer_settable_call_get_value_finish:
5537 * @proxy: A #SensorIntegerSettableProxy.
5538 * @out_value: (out): Return location for return parameter or %NULL to ignore.
5539 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_call_get_value().
5540 * @error: Return location for error or %NULL.
5541 *
5542 * Finishes an operation started with sensor_integer_settable_call_get_value().
5543 *
5544 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5545 */
5546gboolean
5547sensor_integer_settable_call_get_value_finish (
5548 SensorIntegerSettable *proxy,
5549 gint *out_value,
5550 GAsyncResult *res,
5551 GError **error)
5552{
5553 GVariant *_ret;
5554 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
5555 if (_ret == NULL)
5556 goto _out;
5557 g_variant_get (_ret,
5558 "(i)",
5559 out_value);
5560 g_variant_unref (_ret);
5561_out:
5562 return _ret != NULL;
5563}
5564
5565/**
5566 * sensor_integer_settable_call_get_value_sync:
5567 * @proxy: A #SensorIntegerSettableProxy.
5568 * @out_value: (out): Return location for return parameter or %NULL to ignore.
5569 * @cancellable: (allow-none): A #GCancellable or %NULL.
5570 * @error: Return location for error or %NULL.
5571 *
5572 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
5573 *
5574 * See sensor_integer_settable_call_get_value() for the asynchronous version of this method.
5575 *
5576 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5577 */
5578gboolean
5579sensor_integer_settable_call_get_value_sync (
5580 SensorIntegerSettable *proxy,
5581 gint *out_value,
5582 GCancellable *cancellable,
5583 GError **error)
5584{
5585 GVariant *_ret;
5586 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5587 "getValue",
5588 g_variant_new ("()"),
5589 G_DBUS_CALL_FLAGS_NONE,
5590 -1,
5591 cancellable,
5592 error);
5593 if (_ret == NULL)
5594 goto _out;
5595 g_variant_get (_ret,
5596 "(i)",
5597 out_value);
5598 g_variant_unref (_ret);
5599_out:
5600 return _ret != NULL;
5601}
5602
5603/**
5604 * sensor_integer_settable_call_set_value:
5605 * @proxy: A #SensorIntegerSettableProxy.
5606 * @arg_value: Argument to pass with the method invocation.
5607 * @cancellable: (allow-none): A #GCancellable or %NULL.
5608 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
5609 * @user_data: User data to pass to @callback.
5610 *
5611 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.setValue">setValue()</link> D-Bus method on @proxy.
5612 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5613 * You can then call sensor_integer_settable_call_set_value_finish() to get the result of the operation.
5614 *
5615 * See sensor_integer_settable_call_set_value_sync() for the synchronous, blocking version of this method.
5616 */
5617void
5618sensor_integer_settable_call_set_value (
5619 SensorIntegerSettable *proxy,
5620 gint arg_value,
5621 GCancellable *cancellable,
5622 GAsyncReadyCallback callback,
5623 gpointer user_data)
5624{
5625 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
5626 "setValue",
5627 g_variant_new ("(i)",
5628 arg_value),
5629 G_DBUS_CALL_FLAGS_NONE,
5630 -1,
5631 cancellable,
5632 callback,
5633 user_data);
5634}
5635
5636/**
5637 * sensor_integer_settable_call_set_value_finish:
5638 * @proxy: A #SensorIntegerSettableProxy.
5639 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_call_set_value().
5640 * @error: Return location for error or %NULL.
5641 *
5642 * Finishes an operation started with sensor_integer_settable_call_set_value().
5643 *
5644 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5645 */
5646gboolean
5647sensor_integer_settable_call_set_value_finish (
5648 SensorIntegerSettable *proxy,
5649 GAsyncResult *res,
5650 GError **error)
5651{
5652 GVariant *_ret;
5653 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
5654 if (_ret == NULL)
5655 goto _out;
5656 g_variant_get (_ret,
5657 "()");
5658 g_variant_unref (_ret);
5659_out:
5660 return _ret != NULL;
5661}
5662
5663/**
5664 * sensor_integer_settable_call_set_value_sync:
5665 * @proxy: A #SensorIntegerSettableProxy.
5666 * @arg_value: Argument to pass with the method invocation.
5667 * @cancellable: (allow-none): A #GCancellable or %NULL.
5668 * @error: Return location for error or %NULL.
5669 *
5670 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
5671 *
5672 * See sensor_integer_settable_call_set_value() for the asynchronous version of this method.
5673 *
5674 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5675 */
5676gboolean
5677sensor_integer_settable_call_set_value_sync (
5678 SensorIntegerSettable *proxy,
5679 gint arg_value,
5680 GCancellable *cancellable,
5681 GError **error)
5682{
5683 GVariant *_ret;
5684 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5685 "setValue",
5686 g_variant_new ("(i)",
5687 arg_value),
5688 G_DBUS_CALL_FLAGS_NONE,
5689 -1,
5690 cancellable,
5691 error);
5692 if (_ret == NULL)
5693 goto _out;
5694 g_variant_get (_ret,
5695 "()");
5696 g_variant_unref (_ret);
5697_out:
5698 return _ret != NULL;
5699}
5700
5701/**
5702 * sensor_integer_settable_call_get_units:
5703 * @proxy: A #SensorIntegerSettableProxy.
5704 * @cancellable: (allow-none): A #GCancellable or %NULL.
5705 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
5706 * @user_data: User data to pass to @callback.
5707 *
5708 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getUnits">getUnits()</link> D-Bus method on @proxy.
5709 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5710 * You can then call sensor_integer_settable_call_get_units_finish() to get the result of the operation.
5711 *
5712 * See sensor_integer_settable_call_get_units_sync() for the synchronous, blocking version of this method.
5713 */
5714void
5715sensor_integer_settable_call_get_units (
5716 SensorIntegerSettable *proxy,
5717 GCancellable *cancellable,
5718 GAsyncReadyCallback callback,
5719 gpointer user_data)
5720{
5721 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
5722 "getUnits",
5723 g_variant_new ("()"),
5724 G_DBUS_CALL_FLAGS_NONE,
5725 -1,
5726 cancellable,
5727 callback,
5728 user_data);
5729}
5730
5731/**
5732 * sensor_integer_settable_call_get_units_finish:
5733 * @proxy: A #SensorIntegerSettableProxy.
5734 * @out_units: (out): Return location for return parameter or %NULL to ignore.
5735 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_call_get_units().
5736 * @error: Return location for error or %NULL.
5737 *
5738 * Finishes an operation started with sensor_integer_settable_call_get_units().
5739 *
5740 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5741 */
5742gboolean
5743sensor_integer_settable_call_get_units_finish (
5744 SensorIntegerSettable *proxy,
5745 gchar **out_units,
5746 GAsyncResult *res,
5747 GError **error)
5748{
5749 GVariant *_ret;
5750 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
5751 if (_ret == NULL)
5752 goto _out;
5753 g_variant_get (_ret,
5754 "(s)",
5755 out_units);
5756 g_variant_unref (_ret);
5757_out:
5758 return _ret != NULL;
5759}
5760
5761/**
5762 * sensor_integer_settable_call_get_units_sync:
5763 * @proxy: A #SensorIntegerSettableProxy.
5764 * @out_units: (out): Return location for return parameter or %NULL to ignore.
5765 * @cancellable: (allow-none): A #GCancellable or %NULL.
5766 * @error: Return location for error or %NULL.
5767 *
5768 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getUnits">getUnits()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
5769 *
5770 * See sensor_integer_settable_call_get_units() for the asynchronous version of this method.
5771 *
5772 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5773 */
5774gboolean
5775sensor_integer_settable_call_get_units_sync (
5776 SensorIntegerSettable *proxy,
5777 gchar **out_units,
5778 GCancellable *cancellable,
5779 GError **error)
5780{
5781 GVariant *_ret;
5782 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5783 "getUnits",
5784 g_variant_new ("()"),
5785 G_DBUS_CALL_FLAGS_NONE,
5786 -1,
5787 cancellable,
5788 error);
5789 if (_ret == NULL)
5790 goto _out;
5791 g_variant_get (_ret,
5792 "(s)",
5793 out_units);
5794 g_variant_unref (_ret);
5795_out:
5796 return _ret != NULL;
5797}
5798
5799/**
5800 * sensor_integer_settable_complete_get_value:
5801 * @object: A #SensorIntegerSettable.
5802 * @invocation: (transfer full): A #GDBusMethodInvocation.
5803 * @value: Parameter to return.
5804 *
5805 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
5806 *
5807 * This method will free @invocation, you cannot use it afterwards.
5808 */
5809void
5810sensor_integer_settable_complete_get_value (
5811 SensorIntegerSettable *object,
5812 GDBusMethodInvocation *invocation,
5813 gint value)
5814{
5815 g_dbus_method_invocation_return_value (invocation,
5816 g_variant_new ("(i)",
5817 value));
5818}
5819
5820/**
5821 * sensor_integer_settable_complete_set_value:
5822 * @object: A #SensorIntegerSettable.
5823 * @invocation: (transfer full): A #GDBusMethodInvocation.
5824 *
5825 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.setValue">setValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
5826 *
5827 * This method will free @invocation, you cannot use it afterwards.
5828 */
5829void
5830sensor_integer_settable_complete_set_value (
5831 SensorIntegerSettable *object,
5832 GDBusMethodInvocation *invocation)
5833{
5834 g_dbus_method_invocation_return_value (invocation,
5835 g_variant_new ("()"));
5836}
5837
5838/**
5839 * sensor_integer_settable_complete_get_units:
5840 * @object: A #SensorIntegerSettable.
5841 * @invocation: (transfer full): A #GDBusMethodInvocation.
5842 * @units: Parameter to return.
5843 *
5844 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerSettable.getUnits">getUnits()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
5845 *
5846 * This method will free @invocation, you cannot use it afterwards.
5847 */
5848void
5849sensor_integer_settable_complete_get_units (
5850 SensorIntegerSettable *object,
5851 GDBusMethodInvocation *invocation,
5852 const gchar *units)
5853{
5854 g_dbus_method_invocation_return_value (invocation,
5855 g_variant_new ("(s)",
5856 units));
5857}
5858
5859/* ------------------------------------------------------------------------ */
5860
5861/**
5862 * SensorIntegerSettableProxy:
5863 *
5864 * The #SensorIntegerSettableProxy structure contains only private data and should only be accessed using the provided API.
5865 */
5866
5867/**
5868 * SensorIntegerSettableProxyClass:
5869 * @parent_class: The parent class.
5870 *
5871 * Class structure for #SensorIntegerSettableProxy.
5872 */
5873
5874struct _SensorIntegerSettableProxyPrivate
5875{
5876 GData *qdata;
5877};
5878
5879static void sensor_integer_settable_proxy_iface_init (SensorIntegerSettableIface *iface);
5880
5881#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5882G_DEFINE_TYPE_WITH_CODE (SensorIntegerSettableProxy, sensor_integer_settable_proxy, G_TYPE_DBUS_PROXY,
5883 G_ADD_PRIVATE (SensorIntegerSettableProxy)
5884 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_SETTABLE, sensor_integer_settable_proxy_iface_init));
5885
5886#else
5887G_DEFINE_TYPE_WITH_CODE (SensorIntegerSettableProxy, sensor_integer_settable_proxy, G_TYPE_DBUS_PROXY,
5888 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_SETTABLE, sensor_integer_settable_proxy_iface_init));
5889
5890#endif
5891static void
5892sensor_integer_settable_proxy_finalize (GObject *object)
5893{
5894 SensorIntegerSettableProxy *proxy = SENSOR_INTEGER_SETTABLE_PROXY (object);
5895 g_datalist_clear (&proxy->priv->qdata);
5896 G_OBJECT_CLASS (sensor_integer_settable_proxy_parent_class)->finalize (object);
5897}
5898
5899static void
5900sensor_integer_settable_proxy_get_property (GObject *object,
5901 guint prop_id,
5902 GValue *value,
5903 GParamSpec *pspec G_GNUC_UNUSED)
5904{
5905 const _ExtendedGDBusPropertyInfo *info;
5906 GVariant *variant;
5907 g_assert (prop_id != 0 && prop_id - 1 < 2);
5908 info = _sensor_integer_settable_property_info_pointers[prop_id - 1];
5909 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5910 if (info->use_gvariant)
5911 {
5912 g_value_set_variant (value, variant);
5913 }
5914 else
5915 {
5916 if (variant != NULL)
5917 g_dbus_gvariant_to_gvalue (variant, value);
5918 }
5919 if (variant != NULL)
5920 g_variant_unref (variant);
5921}
5922
5923static void
5924sensor_integer_settable_proxy_set_property_cb (GDBusProxy *proxy,
5925 GAsyncResult *res,
5926 gpointer user_data)
5927{
5928 const _ExtendedGDBusPropertyInfo *info = user_data;
5929 GError *error;
5930 GVariant *_ret;
5931 error = NULL;
5932 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5933 if (!_ret)
5934 {
5935 g_warning ("Error setting property '%s' on interface org.openbmc.SensorIntegerSettable: %s (%s, %d)",
5936 info->parent_struct.name,
5937 error->message, g_quark_to_string (error->domain), error->code);
5938 g_error_free (error);
5939 }
5940 else
5941 {
5942 g_variant_unref (_ret);
5943 }
5944}
5945
5946static void
5947sensor_integer_settable_proxy_set_property (GObject *object,
5948 guint prop_id,
5949 const GValue *value,
5950 GParamSpec *pspec G_GNUC_UNUSED)
5951{
5952 const _ExtendedGDBusPropertyInfo *info;
5953 GVariant *variant;
5954 g_assert (prop_id != 0 && prop_id - 1 < 2);
5955 info = _sensor_integer_settable_property_info_pointers[prop_id - 1];
5956 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5957 g_dbus_proxy_call (G_DBUS_PROXY (object),
5958 "org.freedesktop.DBus.Properties.Set",
5959 g_variant_new ("(ssv)", "org.openbmc.SensorIntegerSettable", info->parent_struct.name, variant),
5960 G_DBUS_CALL_FLAGS_NONE,
5961 -1,
5962 NULL, (GAsyncReadyCallback) sensor_integer_settable_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5963 g_variant_unref (variant);
5964}
5965
5966static void
5967sensor_integer_settable_proxy_g_signal (GDBusProxy *proxy,
5968 const gchar *sender_name G_GNUC_UNUSED,
5969 const gchar *signal_name,
5970 GVariant *parameters)
5971{
5972 _ExtendedGDBusSignalInfo *info;
5973 GVariantIter iter;
5974 GVariant *child;
5975 GValue *paramv;
5976 guint num_params;
5977 guint n;
5978 guint signal_id;
5979 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, signal_name);
5980 if (info == NULL)
5981 return;
5982 num_params = g_variant_n_children (parameters);
5983 paramv = g_new0 (GValue, num_params + 1);
5984 g_value_init (&paramv[0], TYPE_SENSOR_INTEGER_SETTABLE);
5985 g_value_set_object (&paramv[0], proxy);
5986 g_variant_iter_init (&iter, parameters);
5987 n = 1;
5988 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5989 {
5990 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5991 if (arg_info->use_gvariant)
5992 {
5993 g_value_init (&paramv[n], G_TYPE_VARIANT);
5994 g_value_set_variant (&paramv[n], child);
5995 n++;
5996 }
5997 else
5998 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5999 g_variant_unref (child);
6000 }
6001 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_SETTABLE);
6002 g_signal_emitv (paramv, signal_id, 0, NULL);
6003 for (n = 0; n < num_params + 1; n++)
6004 g_value_unset (&paramv[n]);
6005 g_free (paramv);
6006}
6007
6008static void
6009sensor_integer_settable_proxy_g_properties_changed (GDBusProxy *_proxy,
6010 GVariant *changed_properties,
6011 const gchar *const *invalidated_properties)
6012{
6013 SensorIntegerSettableProxy *proxy = SENSOR_INTEGER_SETTABLE_PROXY (_proxy);
6014 guint n;
6015 const gchar *key;
6016 GVariantIter *iter;
6017 _ExtendedGDBusPropertyInfo *info;
6018 g_variant_get (changed_properties, "a{sv}", &iter);
6019 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6020 {
6021 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, key);
6022 g_datalist_remove_data (&proxy->priv->qdata, key);
6023 if (info != NULL)
6024 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6025 }
6026 g_variant_iter_free (iter);
6027 for (n = 0; invalidated_properties[n] != NULL; n++)
6028 {
6029 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, invalidated_properties[n]);
6030 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6031 if (info != NULL)
6032 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6033 }
6034}
6035
6036static gint
6037sensor_integer_settable_proxy_get_value (SensorIntegerSettable *object)
6038{
6039 SensorIntegerSettableProxy *proxy = SENSOR_INTEGER_SETTABLE_PROXY (object);
6040 GVariant *variant;
6041 gint value = 0;
6042 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
6043 if (variant != NULL)
6044 {
6045 value = g_variant_get_int32 (variant);
6046 g_variant_unref (variant);
6047 }
6048 return value;
6049}
6050
6051static const gchar *
6052sensor_integer_settable_proxy_get_units (SensorIntegerSettable *object)
6053{
6054 SensorIntegerSettableProxy *proxy = SENSOR_INTEGER_SETTABLE_PROXY (object);
6055 GVariant *variant;
6056 const gchar *value = NULL;
6057 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
6058 if (variant != NULL)
6059 {
6060 value = g_variant_get_string (variant, NULL);
6061 g_variant_unref (variant);
6062 }
6063 return value;
6064}
6065
6066static void
6067sensor_integer_settable_proxy_init (SensorIntegerSettableProxy *proxy)
6068{
6069#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6070 proxy->priv = sensor_integer_settable_proxy_get_instance_private (proxy);
6071#else
6072 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_SETTABLE_PROXY, SensorIntegerSettableProxyPrivate);
6073#endif
6074
6075 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_settable_interface_info ());
6076}
6077
6078static void
6079sensor_integer_settable_proxy_class_init (SensorIntegerSettableProxyClass *klass)
6080{
6081 GObjectClass *gobject_class;
6082 GDBusProxyClass *proxy_class;
6083
6084 gobject_class = G_OBJECT_CLASS (klass);
6085 gobject_class->finalize = sensor_integer_settable_proxy_finalize;
6086 gobject_class->get_property = sensor_integer_settable_proxy_get_property;
6087 gobject_class->set_property = sensor_integer_settable_proxy_set_property;
6088
6089 proxy_class = G_DBUS_PROXY_CLASS (klass);
6090 proxy_class->g_signal = sensor_integer_settable_proxy_g_signal;
6091 proxy_class->g_properties_changed = sensor_integer_settable_proxy_g_properties_changed;
6092
6093 sensor_integer_settable_override_properties (gobject_class, 1);
6094
6095#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6096 g_type_class_add_private (klass, sizeof (SensorIntegerSettableProxyPrivate));
6097#endif
6098}
6099
6100static void
6101sensor_integer_settable_proxy_iface_init (SensorIntegerSettableIface *iface)
6102{
6103 iface->get_value = sensor_integer_settable_proxy_get_value;
6104 iface->get_units = sensor_integer_settable_proxy_get_units;
6105}
6106
6107/**
6108 * sensor_integer_settable_proxy_new:
6109 * @connection: A #GDBusConnection.
6110 * @flags: Flags from the #GDBusProxyFlags enumeration.
6111 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6112 * @object_path: An object path.
6113 * @cancellable: (allow-none): A #GCancellable or %NULL.
6114 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6115 * @user_data: User data to pass to @callback.
6116 *
6117 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>. See g_dbus_proxy_new() for more details.
6118 *
6119 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6120 * You can then call sensor_integer_settable_proxy_new_finish() to get the result of the operation.
6121 *
6122 * See sensor_integer_settable_proxy_new_sync() for the synchronous, blocking version of this constructor.
6123 */
6124void
6125sensor_integer_settable_proxy_new (
6126 GDBusConnection *connection,
6127 GDBusProxyFlags flags,
6128 const gchar *name,
6129 const gchar *object_path,
6130 GCancellable *cancellable,
6131 GAsyncReadyCallback callback,
6132 gpointer user_data)
6133{
6134 g_async_initable_new_async (TYPE_SENSOR_INTEGER_SETTABLE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerSettable", NULL);
6135}
6136
6137/**
6138 * sensor_integer_settable_proxy_new_finish:
6139 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_proxy_new().
6140 * @error: Return location for error or %NULL
6141 *
6142 * Finishes an operation started with sensor_integer_settable_proxy_new().
6143 *
6144 * Returns: (transfer full) (type SensorIntegerSettableProxy): The constructed proxy object or %NULL if @error is set.
6145 */
6146SensorIntegerSettable *
6147sensor_integer_settable_proxy_new_finish (
6148 GAsyncResult *res,
6149 GError **error)
6150{
6151 GObject *ret;
6152 GObject *source_object;
6153 source_object = g_async_result_get_source_object (res);
6154 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6155 g_object_unref (source_object);
6156 if (ret != NULL)
6157 return SENSOR_INTEGER_SETTABLE (ret);
6158 else
6159 return NULL;
6160}
6161
6162/**
6163 * sensor_integer_settable_proxy_new_sync:
6164 * @connection: A #GDBusConnection.
6165 * @flags: Flags from the #GDBusProxyFlags enumeration.
6166 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6167 * @object_path: An object path.
6168 * @cancellable: (allow-none): A #GCancellable or %NULL.
6169 * @error: Return location for error or %NULL
6170 *
6171 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>. See g_dbus_proxy_new_sync() for more details.
6172 *
6173 * The calling thread is blocked until a reply is received.
6174 *
6175 * See sensor_integer_settable_proxy_new() for the asynchronous version of this constructor.
6176 *
6177 * Returns: (transfer full) (type SensorIntegerSettableProxy): The constructed proxy object or %NULL if @error is set.
6178 */
6179SensorIntegerSettable *
6180sensor_integer_settable_proxy_new_sync (
6181 GDBusConnection *connection,
6182 GDBusProxyFlags flags,
6183 const gchar *name,
6184 const gchar *object_path,
6185 GCancellable *cancellable,
6186 GError **error)
6187{
6188 GInitable *ret;
6189 ret = g_initable_new (TYPE_SENSOR_INTEGER_SETTABLE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerSettable", NULL);
6190 if (ret != NULL)
6191 return SENSOR_INTEGER_SETTABLE (ret);
6192 else
6193 return NULL;
6194}
6195
6196
6197/**
6198 * sensor_integer_settable_proxy_new_for_bus:
6199 * @bus_type: A #GBusType.
6200 * @flags: Flags from the #GDBusProxyFlags enumeration.
6201 * @name: A bus name (well-known or unique).
6202 * @object_path: An object path.
6203 * @cancellable: (allow-none): A #GCancellable or %NULL.
6204 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6205 * @user_data: User data to pass to @callback.
6206 *
6207 * Like sensor_integer_settable_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6208 *
6209 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6210 * You can then call sensor_integer_settable_proxy_new_for_bus_finish() to get the result of the operation.
6211 *
6212 * See sensor_integer_settable_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6213 */
6214void
6215sensor_integer_settable_proxy_new_for_bus (
6216 GBusType bus_type,
6217 GDBusProxyFlags flags,
6218 const gchar *name,
6219 const gchar *object_path,
6220 GCancellable *cancellable,
6221 GAsyncReadyCallback callback,
6222 gpointer user_data)
6223{
6224 g_async_initable_new_async (TYPE_SENSOR_INTEGER_SETTABLE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerSettable", NULL);
6225}
6226
6227/**
6228 * sensor_integer_settable_proxy_new_for_bus_finish:
6229 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_settable_proxy_new_for_bus().
6230 * @error: Return location for error or %NULL
6231 *
6232 * Finishes an operation started with sensor_integer_settable_proxy_new_for_bus().
6233 *
6234 * Returns: (transfer full) (type SensorIntegerSettableProxy): The constructed proxy object or %NULL if @error is set.
6235 */
6236SensorIntegerSettable *
6237sensor_integer_settable_proxy_new_for_bus_finish (
6238 GAsyncResult *res,
6239 GError **error)
6240{
6241 GObject *ret;
6242 GObject *source_object;
6243 source_object = g_async_result_get_source_object (res);
6244 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6245 g_object_unref (source_object);
6246 if (ret != NULL)
6247 return SENSOR_INTEGER_SETTABLE (ret);
6248 else
6249 return NULL;
6250}
6251
6252/**
6253 * sensor_integer_settable_proxy_new_for_bus_sync:
6254 * @bus_type: A #GBusType.
6255 * @flags: Flags from the #GDBusProxyFlags enumeration.
6256 * @name: A bus name (well-known or unique).
6257 * @object_path: An object path.
6258 * @cancellable: (allow-none): A #GCancellable or %NULL.
6259 * @error: Return location for error or %NULL
6260 *
6261 * Like sensor_integer_settable_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6262 *
6263 * The calling thread is blocked until a reply is received.
6264 *
6265 * See sensor_integer_settable_proxy_new_for_bus() for the asynchronous version of this constructor.
6266 *
6267 * Returns: (transfer full) (type SensorIntegerSettableProxy): The constructed proxy object or %NULL if @error is set.
6268 */
6269SensorIntegerSettable *
6270sensor_integer_settable_proxy_new_for_bus_sync (
6271 GBusType bus_type,
6272 GDBusProxyFlags flags,
6273 const gchar *name,
6274 const gchar *object_path,
6275 GCancellable *cancellable,
6276 GError **error)
6277{
6278 GInitable *ret;
6279 ret = g_initable_new (TYPE_SENSOR_INTEGER_SETTABLE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerSettable", NULL);
6280 if (ret != NULL)
6281 return SENSOR_INTEGER_SETTABLE (ret);
6282 else
6283 return NULL;
6284}
6285
6286
6287/* ------------------------------------------------------------------------ */
6288
6289/**
6290 * SensorIntegerSettableSkeleton:
6291 *
6292 * The #SensorIntegerSettableSkeleton structure contains only private data and should only be accessed using the provided API.
6293 */
6294
6295/**
6296 * SensorIntegerSettableSkeletonClass:
6297 * @parent_class: The parent class.
6298 *
6299 * Class structure for #SensorIntegerSettableSkeleton.
6300 */
6301
6302struct _SensorIntegerSettableSkeletonPrivate
6303{
6304 GValue *properties;
6305 GList *changed_properties;
6306 GSource *changed_properties_idle_source;
6307 GMainContext *context;
6308 GMutex lock;
6309};
6310
6311static void
6312_sensor_integer_settable_skeleton_handle_method_call (
6313 GDBusConnection *connection G_GNUC_UNUSED,
6314 const gchar *sender G_GNUC_UNUSED,
6315 const gchar *object_path G_GNUC_UNUSED,
6316 const gchar *interface_name,
6317 const gchar *method_name,
6318 GVariant *parameters,
6319 GDBusMethodInvocation *invocation,
6320 gpointer user_data)
6321{
6322 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (user_data);
6323 _ExtendedGDBusMethodInfo *info;
6324 GVariantIter iter;
6325 GVariant *child;
6326 GValue *paramv;
6327 guint num_params;
6328 guint num_extra;
6329 guint n;
6330 guint signal_id;
6331 GValue return_value = G_VALUE_INIT;
6332 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6333 g_assert (info != NULL);
6334 num_params = g_variant_n_children (parameters);
6335 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6336 n = 0;
6337 g_value_init (&paramv[n], TYPE_SENSOR_INTEGER_SETTABLE);
6338 g_value_set_object (&paramv[n++], skeleton);
6339 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6340 g_value_set_object (&paramv[n++], invocation);
6341 if (info->pass_fdlist)
6342 {
6343#ifdef G_OS_UNIX
6344 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
6345 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
6346#else
6347 g_assert_not_reached ();
6348#endif
6349 }
6350 g_variant_iter_init (&iter, parameters);
6351 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6352 {
6353 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
6354 if (arg_info->use_gvariant)
6355 {
6356 g_value_init (&paramv[n], G_TYPE_VARIANT);
6357 g_value_set_variant (&paramv[n], child);
6358 n++;
6359 }
6360 else
6361 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6362 g_variant_unref (child);
6363 }
6364 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_SETTABLE);
6365 g_value_init (&return_value, G_TYPE_BOOLEAN);
6366 g_signal_emitv (paramv, signal_id, 0, &return_value);
6367 if (!g_value_get_boolean (&return_value))
6368 g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
6369 g_value_unset (&return_value);
6370 for (n = 0; n < num_params + num_extra; n++)
6371 g_value_unset (&paramv[n]);
6372 g_free (paramv);
6373}
6374
6375static GVariant *
6376_sensor_integer_settable_skeleton_handle_get_property (
6377 GDBusConnection *connection G_GNUC_UNUSED,
6378 const gchar *sender G_GNUC_UNUSED,
6379 const gchar *object_path G_GNUC_UNUSED,
6380 const gchar *interface_name G_GNUC_UNUSED,
6381 const gchar *property_name,
6382 GError **error,
6383 gpointer user_data)
6384{
6385 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (user_data);
6386 GValue value = G_VALUE_INIT;
6387 GParamSpec *pspec;
6388 _ExtendedGDBusPropertyInfo *info;
6389 GVariant *ret;
6390 ret = NULL;
6391 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, property_name);
6392 g_assert (info != NULL);
6393 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6394 if (pspec == NULL)
6395 {
6396 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6397 }
6398 else
6399 {
6400 g_value_init (&value, pspec->value_type);
6401 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6402 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
6403 g_value_unset (&value);
6404 }
6405 return ret;
6406}
6407
6408static gboolean
6409_sensor_integer_settable_skeleton_handle_set_property (
6410 GDBusConnection *connection G_GNUC_UNUSED,
6411 const gchar *sender G_GNUC_UNUSED,
6412 const gchar *object_path G_GNUC_UNUSED,
6413 const gchar *interface_name G_GNUC_UNUSED,
6414 const gchar *property_name,
6415 GVariant *variant,
6416 GError **error,
6417 gpointer user_data)
6418{
6419 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (user_data);
6420 GValue value = G_VALUE_INIT;
6421 GParamSpec *pspec;
6422 _ExtendedGDBusPropertyInfo *info;
6423 gboolean ret;
6424 ret = FALSE;
6425 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_settable_interface_info.parent_struct, property_name);
6426 g_assert (info != NULL);
6427 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6428 if (pspec == NULL)
6429 {
6430 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6431 }
6432 else
6433 {
6434 if (info->use_gvariant)
6435 g_value_set_variant (&value, variant);
6436 else
6437 g_dbus_gvariant_to_gvalue (variant, &value);
6438 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6439 g_value_unset (&value);
6440 ret = TRUE;
6441 }
6442 return ret;
6443}
6444
6445static const GDBusInterfaceVTable _sensor_integer_settable_skeleton_vtable =
6446{
6447 _sensor_integer_settable_skeleton_handle_method_call,
6448 _sensor_integer_settable_skeleton_handle_get_property,
6449 _sensor_integer_settable_skeleton_handle_set_property,
6450 {NULL}
6451};
6452
6453static GDBusInterfaceInfo *
6454sensor_integer_settable_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6455{
6456 return sensor_integer_settable_interface_info ();
6457}
6458
6459static GDBusInterfaceVTable *
6460sensor_integer_settable_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6461{
6462 return (GDBusInterfaceVTable *) &_sensor_integer_settable_skeleton_vtable;
6463}
6464
6465static GVariant *
6466sensor_integer_settable_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
6467{
6468 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (_skeleton);
6469
6470 GVariantBuilder builder;
6471 guint n;
6472 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6473 if (_sensor_integer_settable_interface_info.parent_struct.properties == NULL)
6474 goto out;
6475 for (n = 0; _sensor_integer_settable_interface_info.parent_struct.properties[n] != NULL; n++)
6476 {
6477 GDBusPropertyInfo *info = _sensor_integer_settable_interface_info.parent_struct.properties[n];
6478 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
6479 {
6480 GVariant *value;
6481 value = _sensor_integer_settable_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerSettable", info->name, NULL, skeleton);
6482 if (value != NULL)
6483 {
6484 g_variant_take_ref (value);
6485 g_variant_builder_add (&builder, "{sv}", info->name, value);
6486 g_variant_unref (value);
6487 }
6488 }
6489 }
6490out:
6491 return g_variant_builder_end (&builder);
6492}
6493
6494static gboolean _sensor_integer_settable_emit_changed (gpointer user_data);
6495
6496static void
6497sensor_integer_settable_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
6498{
6499 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (_skeleton);
6500 gboolean emit_changed = FALSE;
6501
6502 g_mutex_lock (&skeleton->priv->lock);
6503 if (skeleton->priv->changed_properties_idle_source != NULL)
6504 {
6505 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6506 skeleton->priv->changed_properties_idle_source = NULL;
6507 emit_changed = TRUE;
6508 }
6509 g_mutex_unlock (&skeleton->priv->lock);
6510
6511 if (emit_changed)
6512 _sensor_integer_settable_emit_changed (skeleton);
6513}
6514
6515static void
6516_sensor_integer_settable_on_signal_changed (
6517 SensorIntegerSettable *object,
6518 gint arg_value)
6519{
6520 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object);
6521
6522 GList *connections, *l;
6523 GVariant *signal_variant;
6524 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6525
6526 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
6527 arg_value));
6528 for (l = connections; l != NULL; l = l->next)
6529 {
6530 GDBusConnection *connection = l->data;
6531 g_dbus_connection_emit_signal (connection,
6532 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerSettable", "Changed",
6533 signal_variant, NULL);
6534 }
6535 g_variant_unref (signal_variant);
6536 g_list_free_full (connections, g_object_unref);
6537}
6538
6539static void sensor_integer_settable_skeleton_iface_init (SensorIntegerSettableIface *iface);
6540#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6541G_DEFINE_TYPE_WITH_CODE (SensorIntegerSettableSkeleton, sensor_integer_settable_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6542 G_ADD_PRIVATE (SensorIntegerSettableSkeleton)
6543 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_SETTABLE, sensor_integer_settable_skeleton_iface_init));
6544
6545#else
6546G_DEFINE_TYPE_WITH_CODE (SensorIntegerSettableSkeleton, sensor_integer_settable_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6547 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_SETTABLE, sensor_integer_settable_skeleton_iface_init));
6548
6549#endif
6550static void
6551sensor_integer_settable_skeleton_finalize (GObject *object)
6552{
6553 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object);
6554 guint n;
6555 for (n = 0; n < 2; n++)
6556 g_value_unset (&skeleton->priv->properties[n]);
6557 g_free (skeleton->priv->properties);
6558 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6559 if (skeleton->priv->changed_properties_idle_source != NULL)
6560 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6561 g_main_context_unref (skeleton->priv->context);
6562 g_mutex_clear (&skeleton->priv->lock);
6563 G_OBJECT_CLASS (sensor_integer_settable_skeleton_parent_class)->finalize (object);
6564}
6565
6566static void
6567sensor_integer_settable_skeleton_get_property (GObject *object,
6568 guint prop_id,
6569 GValue *value,
6570 GParamSpec *pspec G_GNUC_UNUSED)
6571{
6572 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object);
6573 g_assert (prop_id != 0 && prop_id - 1 < 2);
6574 g_mutex_lock (&skeleton->priv->lock);
6575 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
6576 g_mutex_unlock (&skeleton->priv->lock);
6577}
6578
6579static gboolean
6580_sensor_integer_settable_emit_changed (gpointer user_data)
6581{
6582 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (user_data);
6583 GList *l;
6584 GVariantBuilder builder;
6585 GVariantBuilder invalidated_builder;
6586 guint num_changes;
6587
6588 g_mutex_lock (&skeleton->priv->lock);
6589 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6590 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
6591 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
6592 {
6593 ChangedProperty *cp = l->data;
6594 GVariant *variant;
6595 const GValue *cur_value;
6596
6597 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6598 if (!_g_value_equal (cur_value, &cp->orig_value))
6599 {
6600 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6601 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6602 g_variant_unref (variant);
6603 num_changes++;
6604 }
6605 }
6606 if (num_changes > 0)
6607 {
6608 GList *connections, *ll;
6609 GVariant *signal_variant;
6610 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorIntegerSettable",
6611 &builder, &invalidated_builder));
6612 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6613 for (ll = connections; ll != NULL; ll = ll->next)
6614 {
6615 GDBusConnection *connection = ll->data;
6616
6617 g_dbus_connection_emit_signal (connection,
6618 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6619 "org.freedesktop.DBus.Properties",
6620 "PropertiesChanged",
6621 signal_variant,
6622 NULL);
6623 }
6624 g_variant_unref (signal_variant);
6625 g_list_free_full (connections, g_object_unref);
6626 }
6627 else
6628 {
6629 g_variant_builder_clear (&builder);
6630 g_variant_builder_clear (&invalidated_builder);
6631 }
6632 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6633 skeleton->priv->changed_properties = NULL;
6634 skeleton->priv->changed_properties_idle_source = NULL;
6635 g_mutex_unlock (&skeleton->priv->lock);
6636 return FALSE;
6637}
6638
6639static void
6640_sensor_integer_settable_schedule_emit_changed (SensorIntegerSettableSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6641{
6642 ChangedProperty *cp;
6643 GList *l;
6644 cp = NULL;
6645 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
6646 {
6647 ChangedProperty *i_cp = l->data;
6648 if (i_cp->info == info)
6649 {
6650 cp = i_cp;
6651 break;
6652 }
6653 }
6654 if (cp == NULL)
6655 {
6656 cp = g_new0 (ChangedProperty, 1);
6657 cp->prop_id = prop_id;
6658 cp->info = info;
6659 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
6660 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
6661 g_value_copy (orig_value, &cp->orig_value);
6662 }
6663}
6664
6665static void
6666sensor_integer_settable_skeleton_notify (GObject *object,
6667 GParamSpec *pspec G_GNUC_UNUSED)
6668{
6669 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object);
6670 g_mutex_lock (&skeleton->priv->lock);
6671 if (skeleton->priv->changed_properties != NULL &&
6672 skeleton->priv->changed_properties_idle_source == NULL)
6673 {
6674 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
6675 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
6676 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_settable_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
6677 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
6678 g_source_unref (skeleton->priv->changed_properties_idle_source);
6679 }
6680 g_mutex_unlock (&skeleton->priv->lock);
6681}
6682
6683static void
6684sensor_integer_settable_skeleton_set_property (GObject *object,
6685 guint prop_id,
6686 const GValue *value,
6687 GParamSpec *pspec)
6688{
6689 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object);
6690 g_assert (prop_id != 0 && prop_id - 1 < 2);
6691 g_mutex_lock (&skeleton->priv->lock);
6692 g_object_freeze_notify (object);
6693 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
6694 {
6695 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
6696 _sensor_integer_settable_schedule_emit_changed (skeleton, _sensor_integer_settable_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
6697 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6698 g_object_notify_by_pspec (object, pspec);
6699 }
6700 g_mutex_unlock (&skeleton->priv->lock);
6701 g_object_thaw_notify (object);
6702}
6703
6704static void
6705sensor_integer_settable_skeleton_init (SensorIntegerSettableSkeleton *skeleton)
6706{
6707#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6708 skeleton->priv = sensor_integer_settable_skeleton_get_instance_private (skeleton);
6709#else
6710 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_SETTABLE_SKELETON, SensorIntegerSettableSkeletonPrivate);
6711#endif
6712
6713 g_mutex_init (&skeleton->priv->lock);
6714 skeleton->priv->context = g_main_context_ref_thread_default ();
6715 skeleton->priv->properties = g_new0 (GValue, 2);
6716 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
6717 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
6718}
6719
6720static gint
6721sensor_integer_settable_skeleton_get_value (SensorIntegerSettable *object)
6722{
6723 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object);
6724 gint value;
6725 g_mutex_lock (&skeleton->priv->lock);
6726 value = g_value_get_int (&(skeleton->priv->properties[0]));
6727 g_mutex_unlock (&skeleton->priv->lock);
6728 return value;
6729}
6730
6731static const gchar *
6732sensor_integer_settable_skeleton_get_units (SensorIntegerSettable *object)
6733{
6734 SensorIntegerSettableSkeleton *skeleton = SENSOR_INTEGER_SETTABLE_SKELETON (object);
6735 const gchar *value;
6736 g_mutex_lock (&skeleton->priv->lock);
6737 value = g_value_get_string (&(skeleton->priv->properties[1]));
6738 g_mutex_unlock (&skeleton->priv->lock);
6739 return value;
6740}
6741
6742static void
6743sensor_integer_settable_skeleton_class_init (SensorIntegerSettableSkeletonClass *klass)
6744{
6745 GObjectClass *gobject_class;
6746 GDBusInterfaceSkeletonClass *skeleton_class;
6747
6748 gobject_class = G_OBJECT_CLASS (klass);
6749 gobject_class->finalize = sensor_integer_settable_skeleton_finalize;
6750 gobject_class->get_property = sensor_integer_settable_skeleton_get_property;
6751 gobject_class->set_property = sensor_integer_settable_skeleton_set_property;
6752 gobject_class->notify = sensor_integer_settable_skeleton_notify;
6753
6754
6755 sensor_integer_settable_override_properties (gobject_class, 1);
6756
6757 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6758 skeleton_class->get_info = sensor_integer_settable_skeleton_dbus_interface_get_info;
6759 skeleton_class->get_properties = sensor_integer_settable_skeleton_dbus_interface_get_properties;
6760 skeleton_class->flush = sensor_integer_settable_skeleton_dbus_interface_flush;
6761 skeleton_class->get_vtable = sensor_integer_settable_skeleton_dbus_interface_get_vtable;
6762
6763#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6764 g_type_class_add_private (klass, sizeof (SensorIntegerSettableSkeletonPrivate));
6765#endif
6766}
6767
6768static void
6769sensor_integer_settable_skeleton_iface_init (SensorIntegerSettableIface *iface)
6770{
6771 iface->changed = _sensor_integer_settable_on_signal_changed;
6772 iface->get_value = sensor_integer_settable_skeleton_get_value;
6773 iface->get_units = sensor_integer_settable_skeleton_get_units;
6774}
6775
6776/**
6777 * sensor_integer_settable_skeleton_new:
6778 *
6779 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>.
6780 *
6781 * Returns: (transfer full) (type SensorIntegerSettableSkeleton): The skeleton object.
6782 */
6783SensorIntegerSettable *
6784sensor_integer_settable_skeleton_new (void)
6785{
6786 return SENSOR_INTEGER_SETTABLE (g_object_new (TYPE_SENSOR_INTEGER_SETTABLE_SKELETON, NULL));
6787}
6788
6789/* ------------------------------------------------------------------------
Norman Jamescc7ae122015-08-24 14:26:09 -05006790 * Code for interface org.openbmc.SensorIntegerThreshold
6791 * ------------------------------------------------------------------------
6792 */
6793
6794/**
6795 * SECTION:SensorIntegerThreshold
6796 * @title: SensorIntegerThreshold
6797 * @short_description: Generated C code for the org.openbmc.SensorIntegerThreshold D-Bus interface
6798 *
6799 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> D-Bus interface in C.
6800 */
6801
6802/* ---- Introspection data for org.openbmc.SensorIntegerThreshold ---- */
6803
6804static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_check_IN_ARG_value =
6805{
6806 {
6807 -1,
6808 (gchar *) "value",
6809 (gchar *) "i",
6810 NULL
6811 },
6812 FALSE
6813};
6814
6815static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_check_IN_ARG_pointers[] =
6816{
6817 &_sensor_integer_threshold_method_info_check_IN_ARG_value,
6818 NULL
6819};
6820
6821static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_check =
6822{
6823 {
6824 -1,
6825 (gchar *) "check",
6826 (GDBusArgInfo **) &_sensor_integer_threshold_method_info_check_IN_ARG_pointers,
6827 NULL,
6828 NULL
6829 },
6830 "handle-check",
6831 FALSE
6832};
6833
6834static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_critical_upper =
6835{
6836 {
6837 -1,
6838 (gchar *) "critical_upper",
6839 (gchar *) "i",
6840 NULL
6841 },
6842 FALSE
6843};
6844
6845static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_critical_lower =
6846{
6847 {
6848 -1,
6849 (gchar *) "critical_lower",
6850 (gchar *) "i",
6851 NULL
6852 },
6853 FALSE
6854};
6855
6856static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_warning_upper =
6857{
6858 {
6859 -1,
6860 (gchar *) "warning_upper",
6861 (gchar *) "i",
6862 NULL
6863 },
6864 FALSE
6865};
6866
6867static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_warning_lower =
6868{
6869 {
6870 -1,
6871 (gchar *) "warning_lower",
6872 (gchar *) "i",
6873 NULL
6874 },
6875 FALSE
6876};
6877
6878static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_set_thresholds_IN_ARG_pointers[] =
6879{
6880 &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_critical_upper,
6881 &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_critical_lower,
6882 &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_warning_upper,
6883 &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_warning_lower,
6884 NULL
6885};
6886
6887static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_set_thresholds =
6888{
6889 {
6890 -1,
6891 (gchar *) "setThresholds",
6892 (GDBusArgInfo **) &_sensor_integer_threshold_method_info_set_thresholds_IN_ARG_pointers,
6893 NULL,
6894 NULL
6895 },
6896 "handle-set-thresholds",
6897 FALSE
6898};
6899
6900static const _ExtendedGDBusMethodInfo * const _sensor_integer_threshold_method_info_pointers[] =
6901{
6902 &_sensor_integer_threshold_method_info_check,
6903 &_sensor_integer_threshold_method_info_set_thresholds,
6904 NULL
6905};
6906
6907static const _ExtendedGDBusArgInfo _sensor_integer_threshold_signal_info_critical_ARG_over =
6908{
6909 {
6910 -1,
6911 (gchar *) "over",
6912 (gchar *) "b",
6913 NULL
6914 },
6915 FALSE
6916};
6917
6918static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_signal_info_critical_ARG_pointers[] =
6919{
6920 &_sensor_integer_threshold_signal_info_critical_ARG_over,
6921 NULL
6922};
6923
6924static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_critical =
6925{
6926 {
6927 -1,
6928 (gchar *) "critical",
6929 (GDBusArgInfo **) &_sensor_integer_threshold_signal_info_critical_ARG_pointers,
6930 NULL
6931 },
6932 "critical"
6933};
6934
6935static const _ExtendedGDBusArgInfo _sensor_integer_threshold_signal_info_warning_ARG_over =
6936{
6937 {
6938 -1,
6939 (gchar *) "over",
6940 (gchar *) "b",
6941 NULL
6942 },
6943 FALSE
6944};
6945
6946static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_signal_info_warning_ARG_pointers[] =
6947{
6948 &_sensor_integer_threshold_signal_info_warning_ARG_over,
6949 NULL
6950};
6951
6952static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_warning =
6953{
6954 {
6955 -1,
6956 (gchar *) "warning",
6957 (GDBusArgInfo **) &_sensor_integer_threshold_signal_info_warning_ARG_pointers,
6958 NULL
6959 },
6960 "warning"
6961};
6962
6963static const _ExtendedGDBusSignalInfo * const _sensor_integer_threshold_signal_info_pointers[] =
6964{
6965 &_sensor_integer_threshold_signal_info_critical,
6966 &_sensor_integer_threshold_signal_info_warning,
6967 NULL
6968};
6969
6970static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_critical_upper =
6971{
6972 {
6973 -1,
6974 (gchar *) "critical_upper",
6975 (gchar *) "i",
6976 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6977 NULL
6978 },
6979 "critical-upper",
6980 FALSE
6981};
6982
6983static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_critical_lower =
6984{
6985 {
6986 -1,
6987 (gchar *) "critical_lower",
6988 (gchar *) "i",
6989 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6990 NULL
6991 },
6992 "critical-lower",
6993 FALSE
6994};
6995
6996static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_warning_upper =
6997{
6998 {
6999 -1,
7000 (gchar *) "warning_upper",
7001 (gchar *) "i",
7002 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
7003 NULL
7004 },
7005 "warning-upper",
7006 FALSE
7007};
7008
7009static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_warning_lower =
7010{
7011 {
7012 -1,
7013 (gchar *) "warning_lower",
7014 (gchar *) "i",
7015 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
7016 NULL
7017 },
7018 "warning-lower",
7019 FALSE
7020};
7021
7022static const _ExtendedGDBusPropertyInfo * const _sensor_integer_threshold_property_info_pointers[] =
7023{
7024 &_sensor_integer_threshold_property_info_critical_upper,
7025 &_sensor_integer_threshold_property_info_critical_lower,
7026 &_sensor_integer_threshold_property_info_warning_upper,
7027 &_sensor_integer_threshold_property_info_warning_lower,
7028 NULL
7029};
7030
7031static const _ExtendedGDBusInterfaceInfo _sensor_integer_threshold_interface_info =
7032{
7033 {
7034 -1,
7035 (gchar *) "org.openbmc.SensorIntegerThreshold",
7036 (GDBusMethodInfo **) &_sensor_integer_threshold_method_info_pointers,
7037 (GDBusSignalInfo **) &_sensor_integer_threshold_signal_info_pointers,
7038 (GDBusPropertyInfo **) &_sensor_integer_threshold_property_info_pointers,
7039 NULL
7040 },
7041 "sensor-integer-threshold",
7042};
7043
7044
7045/**
7046 * sensor_integer_threshold_interface_info:
7047 *
7048 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> D-Bus interface.
7049 *
7050 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7051 */
7052GDBusInterfaceInfo *
7053sensor_integer_threshold_interface_info (void)
7054{
7055 return (GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct;
7056}
7057
7058/**
7059 * sensor_integer_threshold_override_properties:
7060 * @klass: The class structure for a #GObject<!-- -->-derived class.
7061 * @property_id_begin: The property id to assign to the first overridden property.
7062 *
7063 * Overrides all #GObject properties in the #SensorIntegerThreshold interface for a concrete class.
7064 * The properties are overridden in the order they are defined.
7065 *
7066 * Returns: The last property id.
7067 */
7068guint
7069sensor_integer_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
7070{
7071 g_object_class_override_property (klass, property_id_begin++, "critical-upper");
7072 g_object_class_override_property (klass, property_id_begin++, "critical-lower");
7073 g_object_class_override_property (klass, property_id_begin++, "warning-upper");
7074 g_object_class_override_property (klass, property_id_begin++, "warning-lower");
7075 return property_id_begin - 1;
7076}
7077
7078
7079
7080/**
7081 * SensorIntegerThreshold:
7082 *
7083 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
7084 */
7085
7086/**
7087 * SensorIntegerThresholdIface:
7088 * @parent_iface: The parent interface.
7089 * @handle_check: Handler for the #SensorIntegerThreshold::handle-check signal.
7090 * @handle_set_thresholds: Handler for the #SensorIntegerThreshold::handle-set-thresholds signal.
7091 * @get_critical_lower: Getter for the #SensorIntegerThreshold:critical-lower property.
7092 * @get_critical_upper: Getter for the #SensorIntegerThreshold:critical-upper property.
7093 * @get_warning_lower: Getter for the #SensorIntegerThreshold:warning-lower property.
7094 * @get_warning_upper: Getter for the #SensorIntegerThreshold:warning-upper property.
7095 * @critical: Handler for the #SensorIntegerThreshold::critical signal.
7096 * @warning: Handler for the #SensorIntegerThreshold::warning signal.
7097 *
7098 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
7099 */
7100
7101typedef SensorIntegerThresholdIface SensorIntegerThresholdInterface;
7102G_DEFINE_INTERFACE (SensorIntegerThreshold, sensor_integer_threshold, G_TYPE_OBJECT);
7103
7104static void
7105sensor_integer_threshold_default_init (SensorIntegerThresholdIface *iface)
7106{
7107 /* GObject signals for incoming D-Bus method calls: */
7108 /**
7109 * SensorIntegerThreshold::handle-check:
7110 * @object: A #SensorIntegerThreshold.
7111 * @invocation: A #GDBusMethodInvocation.
7112 * @arg_value: Argument passed by remote caller.
7113 *
7114 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.check">check()</link> D-Bus method.
7115 *
7116 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_threshold_complete_check() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
7117 *
7118 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
7119 */
7120 g_signal_new ("handle-check",
7121 G_TYPE_FROM_INTERFACE (iface),
7122 G_SIGNAL_RUN_LAST,
7123 G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_check),
7124 g_signal_accumulator_true_handled,
7125 NULL,
7126 g_cclosure_marshal_generic,
7127 G_TYPE_BOOLEAN,
7128 2,
7129 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
7130
7131 /**
7132 * SensorIntegerThreshold::handle-set-thresholds:
7133 * @object: A #SensorIntegerThreshold.
7134 * @invocation: A #GDBusMethodInvocation.
7135 * @arg_critical_upper: Argument passed by remote caller.
7136 * @arg_critical_lower: Argument passed by remote caller.
7137 * @arg_warning_upper: Argument passed by remote caller.
7138 * @arg_warning_lower: Argument passed by remote caller.
7139 *
7140 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method.
7141 *
7142 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_threshold_complete_set_thresholds() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
7143 *
7144 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
7145 */
7146 g_signal_new ("handle-set-thresholds",
7147 G_TYPE_FROM_INTERFACE (iface),
7148 G_SIGNAL_RUN_LAST,
7149 G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_set_thresholds),
7150 g_signal_accumulator_true_handled,
7151 NULL,
7152 g_cclosure_marshal_generic,
7153 G_TYPE_BOOLEAN,
7154 5,
7155 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
7156
7157 /* GObject signals for received D-Bus signals: */
7158 /**
7159 * SensorIntegerThreshold::critical:
7160 * @object: A #SensorIntegerThreshold.
7161 * @arg_over: Argument.
7162 *
7163 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.critical">"critical"</link> is received.
7164 *
7165 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
7166 */
7167 g_signal_new ("critical",
7168 G_TYPE_FROM_INTERFACE (iface),
7169 G_SIGNAL_RUN_LAST,
7170 G_STRUCT_OFFSET (SensorIntegerThresholdIface, critical),
7171 NULL,
7172 NULL,
7173 g_cclosure_marshal_generic,
7174 G_TYPE_NONE,
7175 1, G_TYPE_BOOLEAN);
7176
7177 /**
7178 * SensorIntegerThreshold::warning:
7179 * @object: A #SensorIntegerThreshold.
7180 * @arg_over: Argument.
7181 *
7182 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.warning">"warning"</link> is received.
7183 *
7184 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
7185 */
7186 g_signal_new ("warning",
7187 G_TYPE_FROM_INTERFACE (iface),
7188 G_SIGNAL_RUN_LAST,
7189 G_STRUCT_OFFSET (SensorIntegerThresholdIface, warning),
7190 NULL,
7191 NULL,
7192 g_cclosure_marshal_generic,
7193 G_TYPE_NONE,
7194 1, G_TYPE_BOOLEAN);
7195
7196 /* GObject properties for D-Bus properties: */
7197 /**
7198 * SensorIntegerThreshold:critical-upper:
7199 *
7200 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_upper">"critical_upper"</link>.
7201 *
7202 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
7203 */
7204 g_object_interface_install_property (iface,
7205 g_param_spec_int ("critical-upper", "critical_upper", "critical_upper", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7206 /**
7207 * SensorIntegerThreshold:critical-lower:
7208 *
7209 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_lower">"critical_lower"</link>.
7210 *
7211 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
7212 */
7213 g_object_interface_install_property (iface,
7214 g_param_spec_int ("critical-lower", "critical_lower", "critical_lower", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7215 /**
7216 * SensorIntegerThreshold:warning-upper:
7217 *
7218 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_upper">"warning_upper"</link>.
7219 *
7220 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
7221 */
7222 g_object_interface_install_property (iface,
7223 g_param_spec_int ("warning-upper", "warning_upper", "warning_upper", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7224 /**
7225 * SensorIntegerThreshold:warning-lower:
7226 *
7227 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_lower">"warning_lower"</link>.
7228 *
7229 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
7230 */
7231 g_object_interface_install_property (iface,
7232 g_param_spec_int ("warning-lower", "warning_lower", "warning_lower", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7233}
7234
7235/**
7236 * sensor_integer_threshold_get_critical_upper: (skip)
7237 * @object: A #SensorIntegerThreshold.
7238 *
7239 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_upper">"critical_upper"</link> D-Bus property.
7240 *
7241 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7242 *
7243 * Returns: The property value.
7244 */
7245gint
7246sensor_integer_threshold_get_critical_upper (SensorIntegerThreshold *object)
7247{
7248 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_critical_upper (object);
7249}
7250
7251/**
7252 * sensor_integer_threshold_set_critical_upper: (skip)
7253 * @object: A #SensorIntegerThreshold.
7254 * @value: The value to set.
7255 *
7256 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_upper">"critical_upper"</link> D-Bus property to @value.
7257 *
7258 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7259 */
7260void
7261sensor_integer_threshold_set_critical_upper (SensorIntegerThreshold *object, gint value)
7262{
7263 g_object_set (G_OBJECT (object), "critical-upper", value, NULL);
7264}
7265
7266/**
7267 * sensor_integer_threshold_get_critical_lower: (skip)
7268 * @object: A #SensorIntegerThreshold.
7269 *
7270 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_lower">"critical_lower"</link> D-Bus property.
7271 *
7272 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7273 *
7274 * Returns: The property value.
7275 */
7276gint
7277sensor_integer_threshold_get_critical_lower (SensorIntegerThreshold *object)
7278{
7279 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_critical_lower (object);
7280}
7281
7282/**
7283 * sensor_integer_threshold_set_critical_lower: (skip)
7284 * @object: A #SensorIntegerThreshold.
7285 * @value: The value to set.
7286 *
7287 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.critical_lower">"critical_lower"</link> D-Bus property to @value.
7288 *
7289 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7290 */
7291void
7292sensor_integer_threshold_set_critical_lower (SensorIntegerThreshold *object, gint value)
7293{
7294 g_object_set (G_OBJECT (object), "critical-lower", value, NULL);
7295}
7296
7297/**
7298 * sensor_integer_threshold_get_warning_upper: (skip)
7299 * @object: A #SensorIntegerThreshold.
7300 *
7301 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_upper">"warning_upper"</link> D-Bus property.
7302 *
7303 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7304 *
7305 * Returns: The property value.
7306 */
7307gint
7308sensor_integer_threshold_get_warning_upper (SensorIntegerThreshold *object)
7309{
7310 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_warning_upper (object);
7311}
7312
7313/**
7314 * sensor_integer_threshold_set_warning_upper: (skip)
7315 * @object: A #SensorIntegerThreshold.
7316 * @value: The value to set.
7317 *
7318 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_upper">"warning_upper"</link> D-Bus property to @value.
7319 *
7320 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7321 */
7322void
7323sensor_integer_threshold_set_warning_upper (SensorIntegerThreshold *object, gint value)
7324{
7325 g_object_set (G_OBJECT (object), "warning-upper", value, NULL);
7326}
7327
7328/**
7329 * sensor_integer_threshold_get_warning_lower: (skip)
7330 * @object: A #SensorIntegerThreshold.
7331 *
7332 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_lower">"warning_lower"</link> D-Bus property.
7333 *
7334 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7335 *
7336 * Returns: The property value.
7337 */
7338gint
7339sensor_integer_threshold_get_warning_lower (SensorIntegerThreshold *object)
7340{
7341 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_warning_lower (object);
7342}
7343
7344/**
7345 * sensor_integer_threshold_set_warning_lower: (skip)
7346 * @object: A #SensorIntegerThreshold.
7347 * @value: The value to set.
7348 *
7349 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.warning_lower">"warning_lower"</link> D-Bus property to @value.
7350 *
7351 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7352 */
7353void
7354sensor_integer_threshold_set_warning_lower (SensorIntegerThreshold *object, gint value)
7355{
7356 g_object_set (G_OBJECT (object), "warning-lower", value, NULL);
7357}
7358
7359/**
7360 * sensor_integer_threshold_emit_critical:
7361 * @object: A #SensorIntegerThreshold.
7362 * @arg_over: Argument to pass with the signal.
7363 *
7364 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.critical">"critical"</link> D-Bus signal.
7365 */
7366void
7367sensor_integer_threshold_emit_critical (
7368 SensorIntegerThreshold *object,
7369 gboolean arg_over)
7370{
7371 g_signal_emit_by_name (object, "critical", arg_over);
7372}
7373
7374/**
7375 * sensor_integer_threshold_emit_warning:
7376 * @object: A #SensorIntegerThreshold.
7377 * @arg_over: Argument to pass with the signal.
7378 *
7379 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.warning">"warning"</link> D-Bus signal.
7380 */
7381void
7382sensor_integer_threshold_emit_warning (
7383 SensorIntegerThreshold *object,
7384 gboolean arg_over)
7385{
7386 g_signal_emit_by_name (object, "warning", arg_over);
7387}
7388
7389/**
7390 * sensor_integer_threshold_call_check:
7391 * @proxy: A #SensorIntegerThresholdProxy.
7392 * @arg_value: Argument to pass with the method invocation.
7393 * @cancellable: (allow-none): A #GCancellable or %NULL.
7394 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
7395 * @user_data: User data to pass to @callback.
7396 *
7397 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.check">check()</link> D-Bus method on @proxy.
7398 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7399 * You can then call sensor_integer_threshold_call_check_finish() to get the result of the operation.
7400 *
7401 * See sensor_integer_threshold_call_check_sync() for the synchronous, blocking version of this method.
7402 */
7403void
7404sensor_integer_threshold_call_check (
7405 SensorIntegerThreshold *proxy,
7406 gint arg_value,
7407 GCancellable *cancellable,
7408 GAsyncReadyCallback callback,
7409 gpointer user_data)
7410{
7411 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
7412 "check",
7413 g_variant_new ("(i)",
7414 arg_value),
7415 G_DBUS_CALL_FLAGS_NONE,
7416 -1,
7417 cancellable,
7418 callback,
7419 user_data);
7420}
7421
7422/**
7423 * sensor_integer_threshold_call_check_finish:
7424 * @proxy: A #SensorIntegerThresholdProxy.
7425 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_check().
7426 * @error: Return location for error or %NULL.
7427 *
7428 * Finishes an operation started with sensor_integer_threshold_call_check().
7429 *
7430 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
7431 */
7432gboolean
7433sensor_integer_threshold_call_check_finish (
7434 SensorIntegerThreshold *proxy,
7435 GAsyncResult *res,
7436 GError **error)
7437{
7438 GVariant *_ret;
7439 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
7440 if (_ret == NULL)
7441 goto _out;
7442 g_variant_get (_ret,
7443 "()");
7444 g_variant_unref (_ret);
7445_out:
7446 return _ret != NULL;
7447}
7448
7449/**
7450 * sensor_integer_threshold_call_check_sync:
7451 * @proxy: A #SensorIntegerThresholdProxy.
7452 * @arg_value: Argument to pass with the method invocation.
7453 * @cancellable: (allow-none): A #GCancellable or %NULL.
7454 * @error: Return location for error or %NULL.
7455 *
7456 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.check">check()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
7457 *
7458 * See sensor_integer_threshold_call_check() for the asynchronous version of this method.
7459 *
7460 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
7461 */
7462gboolean
7463sensor_integer_threshold_call_check_sync (
7464 SensorIntegerThreshold *proxy,
7465 gint arg_value,
7466 GCancellable *cancellable,
7467 GError **error)
7468{
7469 GVariant *_ret;
7470 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
7471 "check",
7472 g_variant_new ("(i)",
7473 arg_value),
7474 G_DBUS_CALL_FLAGS_NONE,
7475 -1,
7476 cancellable,
7477 error);
7478 if (_ret == NULL)
7479 goto _out;
7480 g_variant_get (_ret,
7481 "()");
7482 g_variant_unref (_ret);
7483_out:
7484 return _ret != NULL;
7485}
7486
7487/**
7488 * sensor_integer_threshold_call_set_thresholds:
7489 * @proxy: A #SensorIntegerThresholdProxy.
7490 * @arg_critical_upper: Argument to pass with the method invocation.
7491 * @arg_critical_lower: Argument to pass with the method invocation.
7492 * @arg_warning_upper: Argument to pass with the method invocation.
7493 * @arg_warning_lower: Argument to pass with the method invocation.
7494 * @cancellable: (allow-none): A #GCancellable or %NULL.
7495 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
7496 * @user_data: User data to pass to @callback.
7497 *
7498 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method on @proxy.
7499 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7500 * You can then call sensor_integer_threshold_call_set_thresholds_finish() to get the result of the operation.
7501 *
7502 * See sensor_integer_threshold_call_set_thresholds_sync() for the synchronous, blocking version of this method.
7503 */
7504void
7505sensor_integer_threshold_call_set_thresholds (
7506 SensorIntegerThreshold *proxy,
7507 gint arg_critical_upper,
7508 gint arg_critical_lower,
7509 gint arg_warning_upper,
7510 gint arg_warning_lower,
7511 GCancellable *cancellable,
7512 GAsyncReadyCallback callback,
7513 gpointer user_data)
7514{
7515 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
7516 "setThresholds",
7517 g_variant_new ("(iiii)",
7518 arg_critical_upper,
7519 arg_critical_lower,
7520 arg_warning_upper,
7521 arg_warning_lower),
7522 G_DBUS_CALL_FLAGS_NONE,
7523 -1,
7524 cancellable,
7525 callback,
7526 user_data);
7527}
7528
7529/**
7530 * sensor_integer_threshold_call_set_thresholds_finish:
7531 * @proxy: A #SensorIntegerThresholdProxy.
7532 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_set_thresholds().
7533 * @error: Return location for error or %NULL.
7534 *
7535 * Finishes an operation started with sensor_integer_threshold_call_set_thresholds().
7536 *
7537 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
7538 */
7539gboolean
7540sensor_integer_threshold_call_set_thresholds_finish (
7541 SensorIntegerThreshold *proxy,
7542 GAsyncResult *res,
7543 GError **error)
7544{
7545 GVariant *_ret;
7546 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
7547 if (_ret == NULL)
7548 goto _out;
7549 g_variant_get (_ret,
7550 "()");
7551 g_variant_unref (_ret);
7552_out:
7553 return _ret != NULL;
7554}
7555
7556/**
7557 * sensor_integer_threshold_call_set_thresholds_sync:
7558 * @proxy: A #SensorIntegerThresholdProxy.
7559 * @arg_critical_upper: Argument to pass with the method invocation.
7560 * @arg_critical_lower: Argument to pass with the method invocation.
7561 * @arg_warning_upper: Argument to pass with the method invocation.
7562 * @arg_warning_lower: Argument to pass with the method invocation.
7563 * @cancellable: (allow-none): A #GCancellable or %NULL.
7564 * @error: Return location for error or %NULL.
7565 *
7566 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
7567 *
7568 * See sensor_integer_threshold_call_set_thresholds() for the asynchronous version of this method.
7569 *
7570 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
7571 */
7572gboolean
7573sensor_integer_threshold_call_set_thresholds_sync (
7574 SensorIntegerThreshold *proxy,
7575 gint arg_critical_upper,
7576 gint arg_critical_lower,
7577 gint arg_warning_upper,
7578 gint arg_warning_lower,
7579 GCancellable *cancellable,
7580 GError **error)
7581{
7582 GVariant *_ret;
7583 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
7584 "setThresholds",
7585 g_variant_new ("(iiii)",
7586 arg_critical_upper,
7587 arg_critical_lower,
7588 arg_warning_upper,
7589 arg_warning_lower),
7590 G_DBUS_CALL_FLAGS_NONE,
7591 -1,
7592 cancellable,
7593 error);
7594 if (_ret == NULL)
7595 goto _out;
7596 g_variant_get (_ret,
7597 "()");
7598 g_variant_unref (_ret);
7599_out:
7600 return _ret != NULL;
7601}
7602
7603/**
7604 * sensor_integer_threshold_complete_check:
7605 * @object: A #SensorIntegerThreshold.
7606 * @invocation: (transfer full): A #GDBusMethodInvocation.
7607 *
7608 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.check">check()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
7609 *
7610 * This method will free @invocation, you cannot use it afterwards.
7611 */
7612void
7613sensor_integer_threshold_complete_check (
7614 SensorIntegerThreshold *object,
7615 GDBusMethodInvocation *invocation)
7616{
7617 g_dbus_method_invocation_return_value (invocation,
7618 g_variant_new ("()"));
7619}
7620
7621/**
7622 * sensor_integer_threshold_complete_set_thresholds:
7623 * @object: A #SensorIntegerThreshold.
7624 * @invocation: (transfer full): A #GDBusMethodInvocation.
7625 *
7626 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.setThresholds">setThresholds()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
7627 *
7628 * This method will free @invocation, you cannot use it afterwards.
7629 */
7630void
7631sensor_integer_threshold_complete_set_thresholds (
7632 SensorIntegerThreshold *object,
7633 GDBusMethodInvocation *invocation)
7634{
7635 g_dbus_method_invocation_return_value (invocation,
7636 g_variant_new ("()"));
7637}
7638
7639/* ------------------------------------------------------------------------ */
7640
7641/**
7642 * SensorIntegerThresholdProxy:
7643 *
7644 * The #SensorIntegerThresholdProxy structure contains only private data and should only be accessed using the provided API.
7645 */
7646
7647/**
7648 * SensorIntegerThresholdProxyClass:
7649 * @parent_class: The parent class.
7650 *
7651 * Class structure for #SensorIntegerThresholdProxy.
7652 */
7653
7654struct _SensorIntegerThresholdProxyPrivate
7655{
7656 GData *qdata;
7657};
7658
7659static void sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface);
7660
7661#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7662G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY,
7663 G_ADD_PRIVATE (SensorIntegerThresholdProxy)
7664 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init));
7665
7666#else
7667G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY,
7668 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init));
7669
7670#endif
7671static void
7672sensor_integer_threshold_proxy_finalize (GObject *object)
7673{
7674 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
7675 g_datalist_clear (&proxy->priv->qdata);
7676 G_OBJECT_CLASS (sensor_integer_threshold_proxy_parent_class)->finalize (object);
7677}
7678
7679static void
7680sensor_integer_threshold_proxy_get_property (GObject *object,
7681 guint prop_id,
7682 GValue *value,
7683 GParamSpec *pspec G_GNUC_UNUSED)
7684{
7685 const _ExtendedGDBusPropertyInfo *info;
7686 GVariant *variant;
7687 g_assert (prop_id != 0 && prop_id - 1 < 4);
7688 info = _sensor_integer_threshold_property_info_pointers[prop_id - 1];
7689 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7690 if (info->use_gvariant)
7691 {
7692 g_value_set_variant (value, variant);
7693 }
7694 else
7695 {
7696 if (variant != NULL)
7697 g_dbus_gvariant_to_gvalue (variant, value);
7698 }
7699 if (variant != NULL)
7700 g_variant_unref (variant);
7701}
7702
7703static void
7704sensor_integer_threshold_proxy_set_property_cb (GDBusProxy *proxy,
7705 GAsyncResult *res,
7706 gpointer user_data)
7707{
7708 const _ExtendedGDBusPropertyInfo *info = user_data;
7709 GError *error;
7710 GVariant *_ret;
7711 error = NULL;
7712 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7713 if (!_ret)
7714 {
7715 g_warning ("Error setting property '%s' on interface org.openbmc.SensorIntegerThreshold: %s (%s, %d)",
7716 info->parent_struct.name,
7717 error->message, g_quark_to_string (error->domain), error->code);
7718 g_error_free (error);
7719 }
7720 else
7721 {
7722 g_variant_unref (_ret);
7723 }
7724}
7725
7726static void
7727sensor_integer_threshold_proxy_set_property (GObject *object,
7728 guint prop_id,
7729 const GValue *value,
7730 GParamSpec *pspec G_GNUC_UNUSED)
7731{
7732 const _ExtendedGDBusPropertyInfo *info;
7733 GVariant *variant;
7734 g_assert (prop_id != 0 && prop_id - 1 < 4);
7735 info = _sensor_integer_threshold_property_info_pointers[prop_id - 1];
7736 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7737 g_dbus_proxy_call (G_DBUS_PROXY (object),
7738 "org.freedesktop.DBus.Properties.Set",
7739 g_variant_new ("(ssv)", "org.openbmc.SensorIntegerThreshold", info->parent_struct.name, variant),
7740 G_DBUS_CALL_FLAGS_NONE,
7741 -1,
7742 NULL, (GAsyncReadyCallback) sensor_integer_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7743 g_variant_unref (variant);
7744}
7745
7746static void
7747sensor_integer_threshold_proxy_g_signal (GDBusProxy *proxy,
7748 const gchar *sender_name G_GNUC_UNUSED,
7749 const gchar *signal_name,
7750 GVariant *parameters)
7751{
7752 _ExtendedGDBusSignalInfo *info;
7753 GVariantIter iter;
7754 GVariant *child;
7755 GValue *paramv;
7756 guint num_params;
7757 guint n;
7758 guint signal_id;
7759 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, signal_name);
7760 if (info == NULL)
7761 return;
7762 num_params = g_variant_n_children (parameters);
7763 paramv = g_new0 (GValue, num_params + 1);
7764 g_value_init (&paramv[0], TYPE_SENSOR_INTEGER_THRESHOLD);
7765 g_value_set_object (&paramv[0], proxy);
7766 g_variant_iter_init (&iter, parameters);
7767 n = 1;
7768 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7769 {
7770 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7771 if (arg_info->use_gvariant)
7772 {
7773 g_value_init (&paramv[n], G_TYPE_VARIANT);
7774 g_value_set_variant (&paramv[n], child);
7775 n++;
7776 }
7777 else
7778 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7779 g_variant_unref (child);
7780 }
7781 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD);
7782 g_signal_emitv (paramv, signal_id, 0, NULL);
7783 for (n = 0; n < num_params + 1; n++)
7784 g_value_unset (&paramv[n]);
7785 g_free (paramv);
7786}
7787
7788static void
7789sensor_integer_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
7790 GVariant *changed_properties,
7791 const gchar *const *invalidated_properties)
7792{
7793 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (_proxy);
7794 guint n;
7795 const gchar *key;
7796 GVariantIter *iter;
7797 _ExtendedGDBusPropertyInfo *info;
7798 g_variant_get (changed_properties, "a{sv}", &iter);
7799 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7800 {
7801 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, key);
7802 g_datalist_remove_data (&proxy->priv->qdata, key);
7803 if (info != NULL)
7804 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7805 }
7806 g_variant_iter_free (iter);
7807 for (n = 0; invalidated_properties[n] != NULL; n++)
7808 {
7809 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, invalidated_properties[n]);
7810 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7811 if (info != NULL)
7812 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7813 }
7814}
7815
7816static gint
7817sensor_integer_threshold_proxy_get_critical_upper (SensorIntegerThreshold *object)
7818{
7819 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
7820 GVariant *variant;
7821 gint value = 0;
7822 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "critical_upper");
7823 if (variant != NULL)
7824 {
7825 value = g_variant_get_int32 (variant);
7826 g_variant_unref (variant);
7827 }
7828 return value;
7829}
7830
7831static gint
7832sensor_integer_threshold_proxy_get_critical_lower (SensorIntegerThreshold *object)
7833{
7834 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
7835 GVariant *variant;
7836 gint value = 0;
7837 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "critical_lower");
7838 if (variant != NULL)
7839 {
7840 value = g_variant_get_int32 (variant);
7841 g_variant_unref (variant);
7842 }
7843 return value;
7844}
7845
7846static gint
7847sensor_integer_threshold_proxy_get_warning_upper (SensorIntegerThreshold *object)
7848{
7849 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
7850 GVariant *variant;
7851 gint value = 0;
7852 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "warning_upper");
7853 if (variant != NULL)
7854 {
7855 value = g_variant_get_int32 (variant);
7856 g_variant_unref (variant);
7857 }
7858 return value;
7859}
7860
7861static gint
7862sensor_integer_threshold_proxy_get_warning_lower (SensorIntegerThreshold *object)
7863{
7864 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
7865 GVariant *variant;
7866 gint value = 0;
7867 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "warning_lower");
7868 if (variant != NULL)
7869 {
7870 value = g_variant_get_int32 (variant);
7871 g_variant_unref (variant);
7872 }
7873 return value;
7874}
7875
7876static void
7877sensor_integer_threshold_proxy_init (SensorIntegerThresholdProxy *proxy)
7878{
7879#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7880 proxy->priv = sensor_integer_threshold_proxy_get_instance_private (proxy);
7881#else
7882 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, SensorIntegerThresholdProxyPrivate);
7883#endif
7884
7885 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_threshold_interface_info ());
7886}
7887
7888static void
7889sensor_integer_threshold_proxy_class_init (SensorIntegerThresholdProxyClass *klass)
7890{
7891 GObjectClass *gobject_class;
7892 GDBusProxyClass *proxy_class;
7893
7894 gobject_class = G_OBJECT_CLASS (klass);
7895 gobject_class->finalize = sensor_integer_threshold_proxy_finalize;
7896 gobject_class->get_property = sensor_integer_threshold_proxy_get_property;
7897 gobject_class->set_property = sensor_integer_threshold_proxy_set_property;
7898
7899 proxy_class = G_DBUS_PROXY_CLASS (klass);
7900 proxy_class->g_signal = sensor_integer_threshold_proxy_g_signal;
7901 proxy_class->g_properties_changed = sensor_integer_threshold_proxy_g_properties_changed;
7902
7903 sensor_integer_threshold_override_properties (gobject_class, 1);
7904
7905#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7906 g_type_class_add_private (klass, sizeof (SensorIntegerThresholdProxyPrivate));
7907#endif
7908}
7909
7910static void
7911sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface)
7912{
7913 iface->get_critical_upper = sensor_integer_threshold_proxy_get_critical_upper;
7914 iface->get_critical_lower = sensor_integer_threshold_proxy_get_critical_lower;
7915 iface->get_warning_upper = sensor_integer_threshold_proxy_get_warning_upper;
7916 iface->get_warning_lower = sensor_integer_threshold_proxy_get_warning_lower;
7917}
7918
7919/**
7920 * sensor_integer_threshold_proxy_new:
7921 * @connection: A #GDBusConnection.
7922 * @flags: Flags from the #GDBusProxyFlags enumeration.
7923 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7924 * @object_path: An object path.
7925 * @cancellable: (allow-none): A #GCancellable or %NULL.
7926 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7927 * @user_data: User data to pass to @callback.
7928 *
7929 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. See g_dbus_proxy_new() for more details.
7930 *
7931 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7932 * You can then call sensor_integer_threshold_proxy_new_finish() to get the result of the operation.
7933 *
7934 * See sensor_integer_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
7935 */
7936void
7937sensor_integer_threshold_proxy_new (
7938 GDBusConnection *connection,
7939 GDBusProxyFlags flags,
7940 const gchar *name,
7941 const gchar *object_path,
7942 GCancellable *cancellable,
7943 GAsyncReadyCallback callback,
7944 gpointer user_data)
7945{
7946 g_async_initable_new_async (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerThreshold", NULL);
7947}
7948
7949/**
7950 * sensor_integer_threshold_proxy_new_finish:
7951 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new().
7952 * @error: Return location for error or %NULL
7953 *
7954 * Finishes an operation started with sensor_integer_threshold_proxy_new().
7955 *
7956 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
7957 */
7958SensorIntegerThreshold *
7959sensor_integer_threshold_proxy_new_finish (
7960 GAsyncResult *res,
7961 GError **error)
7962{
7963 GObject *ret;
7964 GObject *source_object;
7965 source_object = g_async_result_get_source_object (res);
7966 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7967 g_object_unref (source_object);
7968 if (ret != NULL)
7969 return SENSOR_INTEGER_THRESHOLD (ret);
7970 else
7971 return NULL;
7972}
7973
7974/**
7975 * sensor_integer_threshold_proxy_new_sync:
7976 * @connection: A #GDBusConnection.
7977 * @flags: Flags from the #GDBusProxyFlags enumeration.
7978 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7979 * @object_path: An object path.
7980 * @cancellable: (allow-none): A #GCancellable or %NULL.
7981 * @error: Return location for error or %NULL
7982 *
7983 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>. See g_dbus_proxy_new_sync() for more details.
7984 *
7985 * The calling thread is blocked until a reply is received.
7986 *
7987 * See sensor_integer_threshold_proxy_new() for the asynchronous version of this constructor.
7988 *
7989 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
7990 */
7991SensorIntegerThreshold *
7992sensor_integer_threshold_proxy_new_sync (
7993 GDBusConnection *connection,
7994 GDBusProxyFlags flags,
7995 const gchar *name,
7996 const gchar *object_path,
7997 GCancellable *cancellable,
7998 GError **error)
7999{
8000 GInitable *ret;
8001 ret = g_initable_new (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerThreshold", NULL);
8002 if (ret != NULL)
8003 return SENSOR_INTEGER_THRESHOLD (ret);
8004 else
8005 return NULL;
8006}
8007
8008
8009/**
8010 * sensor_integer_threshold_proxy_new_for_bus:
8011 * @bus_type: A #GBusType.
8012 * @flags: Flags from the #GDBusProxyFlags enumeration.
8013 * @name: A bus name (well-known or unique).
8014 * @object_path: An object path.
8015 * @cancellable: (allow-none): A #GCancellable or %NULL.
8016 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8017 * @user_data: User data to pass to @callback.
8018 *
8019 * Like sensor_integer_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8020 *
8021 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8022 * You can then call sensor_integer_threshold_proxy_new_for_bus_finish() to get the result of the operation.
8023 *
8024 * See sensor_integer_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8025 */
8026void
8027sensor_integer_threshold_proxy_new_for_bus (
8028 GBusType bus_type,
8029 GDBusProxyFlags flags,
8030 const gchar *name,
8031 const gchar *object_path,
8032 GCancellable *cancellable,
8033 GAsyncReadyCallback callback,
8034 gpointer user_data)
8035{
8036 g_async_initable_new_async (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerThreshold", NULL);
8037}
8038
8039/**
8040 * sensor_integer_threshold_proxy_new_for_bus_finish:
8041 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new_for_bus().
8042 * @error: Return location for error or %NULL
8043 *
8044 * Finishes an operation started with sensor_integer_threshold_proxy_new_for_bus().
8045 *
8046 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
8047 */
8048SensorIntegerThreshold *
8049sensor_integer_threshold_proxy_new_for_bus_finish (
8050 GAsyncResult *res,
8051 GError **error)
8052{
8053 GObject *ret;
8054 GObject *source_object;
8055 source_object = g_async_result_get_source_object (res);
8056 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8057 g_object_unref (source_object);
8058 if (ret != NULL)
8059 return SENSOR_INTEGER_THRESHOLD (ret);
8060 else
8061 return NULL;
8062}
8063
8064/**
8065 * sensor_integer_threshold_proxy_new_for_bus_sync:
8066 * @bus_type: A #GBusType.
8067 * @flags: Flags from the #GDBusProxyFlags enumeration.
8068 * @name: A bus name (well-known or unique).
8069 * @object_path: An object path.
8070 * @cancellable: (allow-none): A #GCancellable or %NULL.
8071 * @error: Return location for error or %NULL
8072 *
8073 * Like sensor_integer_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8074 *
8075 * The calling thread is blocked until a reply is received.
8076 *
8077 * See sensor_integer_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
8078 *
8079 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
8080 */
8081SensorIntegerThreshold *
8082sensor_integer_threshold_proxy_new_for_bus_sync (
8083 GBusType bus_type,
8084 GDBusProxyFlags flags,
8085 const gchar *name,
8086 const gchar *object_path,
8087 GCancellable *cancellable,
8088 GError **error)
8089{
8090 GInitable *ret;
8091 ret = g_initable_new (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIntegerThreshold", NULL);
8092 if (ret != NULL)
8093 return SENSOR_INTEGER_THRESHOLD (ret);
8094 else
8095 return NULL;
8096}
8097
8098
8099/* ------------------------------------------------------------------------ */
8100
8101/**
8102 * SensorIntegerThresholdSkeleton:
8103 *
8104 * The #SensorIntegerThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
8105 */
8106
8107/**
8108 * SensorIntegerThresholdSkeletonClass:
8109 * @parent_class: The parent class.
8110 *
8111 * Class structure for #SensorIntegerThresholdSkeleton.
8112 */
8113
8114struct _SensorIntegerThresholdSkeletonPrivate
8115{
8116 GValue *properties;
8117 GList *changed_properties;
8118 GSource *changed_properties_idle_source;
8119 GMainContext *context;
8120 GMutex lock;
8121};
8122
8123static void
8124_sensor_integer_threshold_skeleton_handle_method_call (
8125 GDBusConnection *connection G_GNUC_UNUSED,
8126 const gchar *sender G_GNUC_UNUSED,
8127 const gchar *object_path G_GNUC_UNUSED,
8128 const gchar *interface_name,
8129 const gchar *method_name,
8130 GVariant *parameters,
8131 GDBusMethodInvocation *invocation,
8132 gpointer user_data)
8133{
8134 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
8135 _ExtendedGDBusMethodInfo *info;
8136 GVariantIter iter;
8137 GVariant *child;
8138 GValue *paramv;
8139 guint num_params;
8140 guint num_extra;
8141 guint n;
8142 guint signal_id;
8143 GValue return_value = G_VALUE_INIT;
8144 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8145 g_assert (info != NULL);
8146 num_params = g_variant_n_children (parameters);
8147 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8148 n = 0;
8149 g_value_init (&paramv[n], TYPE_SENSOR_INTEGER_THRESHOLD);
8150 g_value_set_object (&paramv[n++], skeleton);
8151 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8152 g_value_set_object (&paramv[n++], invocation);
8153 if (info->pass_fdlist)
8154 {
8155#ifdef G_OS_UNIX
8156 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8157 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8158#else
8159 g_assert_not_reached ();
8160#endif
8161 }
8162 g_variant_iter_init (&iter, parameters);
8163 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8164 {
8165 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8166 if (arg_info->use_gvariant)
8167 {
8168 g_value_init (&paramv[n], G_TYPE_VARIANT);
8169 g_value_set_variant (&paramv[n], child);
8170 n++;
8171 }
8172 else
8173 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8174 g_variant_unref (child);
8175 }
8176 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD);
8177 g_value_init (&return_value, G_TYPE_BOOLEAN);
8178 g_signal_emitv (paramv, signal_id, 0, &return_value);
8179 if (!g_value_get_boolean (&return_value))
8180 g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
8181 g_value_unset (&return_value);
8182 for (n = 0; n < num_params + num_extra; n++)
8183 g_value_unset (&paramv[n]);
8184 g_free (paramv);
8185}
8186
8187static GVariant *
8188_sensor_integer_threshold_skeleton_handle_get_property (
8189 GDBusConnection *connection G_GNUC_UNUSED,
8190 const gchar *sender G_GNUC_UNUSED,
8191 const gchar *object_path G_GNUC_UNUSED,
8192 const gchar *interface_name G_GNUC_UNUSED,
8193 const gchar *property_name,
8194 GError **error,
8195 gpointer user_data)
8196{
8197 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
8198 GValue value = G_VALUE_INIT;
8199 GParamSpec *pspec;
8200 _ExtendedGDBusPropertyInfo *info;
8201 GVariant *ret;
8202 ret = NULL;
8203 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name);
8204 g_assert (info != NULL);
8205 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8206 if (pspec == NULL)
8207 {
8208 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8209 }
8210 else
8211 {
8212 g_value_init (&value, pspec->value_type);
8213 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8214 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8215 g_value_unset (&value);
8216 }
8217 return ret;
8218}
8219
8220static gboolean
8221_sensor_integer_threshold_skeleton_handle_set_property (
8222 GDBusConnection *connection G_GNUC_UNUSED,
8223 const gchar *sender G_GNUC_UNUSED,
8224 const gchar *object_path G_GNUC_UNUSED,
8225 const gchar *interface_name G_GNUC_UNUSED,
8226 const gchar *property_name,
8227 GVariant *variant,
8228 GError **error,
8229 gpointer user_data)
8230{
8231 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
8232 GValue value = G_VALUE_INIT;
8233 GParamSpec *pspec;
8234 _ExtendedGDBusPropertyInfo *info;
8235 gboolean ret;
8236 ret = FALSE;
8237 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name);
8238 g_assert (info != NULL);
8239 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8240 if (pspec == NULL)
8241 {
8242 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8243 }
8244 else
8245 {
8246 if (info->use_gvariant)
8247 g_value_set_variant (&value, variant);
8248 else
8249 g_dbus_gvariant_to_gvalue (variant, &value);
8250 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8251 g_value_unset (&value);
8252 ret = TRUE;
8253 }
8254 return ret;
8255}
8256
8257static const GDBusInterfaceVTable _sensor_integer_threshold_skeleton_vtable =
8258{
8259 _sensor_integer_threshold_skeleton_handle_method_call,
8260 _sensor_integer_threshold_skeleton_handle_get_property,
8261 _sensor_integer_threshold_skeleton_handle_set_property,
8262 {NULL}
8263};
8264
8265static GDBusInterfaceInfo *
8266sensor_integer_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8267{
8268 return sensor_integer_threshold_interface_info ();
8269}
8270
8271static GDBusInterfaceVTable *
8272sensor_integer_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8273{
8274 return (GDBusInterfaceVTable *) &_sensor_integer_threshold_skeleton_vtable;
8275}
8276
8277static GVariant *
8278sensor_integer_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8279{
8280 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton);
8281
8282 GVariantBuilder builder;
8283 guint n;
8284 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8285 if (_sensor_integer_threshold_interface_info.parent_struct.properties == NULL)
8286 goto out;
8287 for (n = 0; _sensor_integer_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
8288 {
8289 GDBusPropertyInfo *info = _sensor_integer_threshold_interface_info.parent_struct.properties[n];
8290 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8291 {
8292 GVariant *value;
8293 value = _sensor_integer_threshold_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", info->name, NULL, skeleton);
8294 if (value != NULL)
8295 {
8296 g_variant_take_ref (value);
8297 g_variant_builder_add (&builder, "{sv}", info->name, value);
8298 g_variant_unref (value);
8299 }
8300 }
8301 }
8302out:
8303 return g_variant_builder_end (&builder);
8304}
8305
8306static gboolean _sensor_integer_threshold_emit_changed (gpointer user_data);
8307
8308static void
8309sensor_integer_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8310{
8311 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton);
8312 gboolean emit_changed = FALSE;
8313
8314 g_mutex_lock (&skeleton->priv->lock);
8315 if (skeleton->priv->changed_properties_idle_source != NULL)
8316 {
8317 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8318 skeleton->priv->changed_properties_idle_source = NULL;
8319 emit_changed = TRUE;
8320 }
8321 g_mutex_unlock (&skeleton->priv->lock);
8322
8323 if (emit_changed)
8324 _sensor_integer_threshold_emit_changed (skeleton);
8325}
8326
8327static void
8328_sensor_integer_threshold_on_signal_critical (
8329 SensorIntegerThreshold *object,
8330 gboolean arg_over)
8331{
8332 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8333
8334 GList *connections, *l;
8335 GVariant *signal_variant;
8336 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8337
8338 signal_variant = g_variant_ref_sink (g_variant_new ("(b)",
8339 arg_over));
8340 for (l = connections; l != NULL; l = l->next)
8341 {
8342 GDBusConnection *connection = l->data;
8343 g_dbus_connection_emit_signal (connection,
8344 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "critical",
8345 signal_variant, NULL);
8346 }
8347 g_variant_unref (signal_variant);
8348 g_list_free_full (connections, g_object_unref);
8349}
8350
8351static void
8352_sensor_integer_threshold_on_signal_warning (
8353 SensorIntegerThreshold *object,
8354 gboolean arg_over)
8355{
8356 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8357
8358 GList *connections, *l;
8359 GVariant *signal_variant;
8360 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8361
8362 signal_variant = g_variant_ref_sink (g_variant_new ("(b)",
8363 arg_over));
8364 for (l = connections; l != NULL; l = l->next)
8365 {
8366 GDBusConnection *connection = l->data;
8367 g_dbus_connection_emit_signal (connection,
8368 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "warning",
8369 signal_variant, NULL);
8370 }
8371 g_variant_unref (signal_variant);
8372 g_list_free_full (connections, g_object_unref);
8373}
8374
8375static void sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface);
8376#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8377G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8378 G_ADD_PRIVATE (SensorIntegerThresholdSkeleton)
8379 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init));
8380
8381#else
8382G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8383 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init));
8384
8385#endif
8386static void
8387sensor_integer_threshold_skeleton_finalize (GObject *object)
8388{
8389 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8390 guint n;
8391 for (n = 0; n < 4; n++)
8392 g_value_unset (&skeleton->priv->properties[n]);
8393 g_free (skeleton->priv->properties);
8394 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8395 if (skeleton->priv->changed_properties_idle_source != NULL)
8396 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8397 g_main_context_unref (skeleton->priv->context);
8398 g_mutex_clear (&skeleton->priv->lock);
8399 G_OBJECT_CLASS (sensor_integer_threshold_skeleton_parent_class)->finalize (object);
8400}
8401
8402static void
8403sensor_integer_threshold_skeleton_get_property (GObject *object,
8404 guint prop_id,
8405 GValue *value,
8406 GParamSpec *pspec G_GNUC_UNUSED)
8407{
8408 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8409 g_assert (prop_id != 0 && prop_id - 1 < 4);
8410 g_mutex_lock (&skeleton->priv->lock);
8411 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8412 g_mutex_unlock (&skeleton->priv->lock);
8413}
8414
8415static gboolean
8416_sensor_integer_threshold_emit_changed (gpointer user_data)
8417{
8418 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
8419 GList *l;
8420 GVariantBuilder builder;
8421 GVariantBuilder invalidated_builder;
8422 guint num_changes;
8423
8424 g_mutex_lock (&skeleton->priv->lock);
8425 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8426 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8427 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8428 {
8429 ChangedProperty *cp = l->data;
8430 GVariant *variant;
8431 const GValue *cur_value;
8432
8433 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8434 if (!_g_value_equal (cur_value, &cp->orig_value))
8435 {
8436 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8437 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8438 g_variant_unref (variant);
8439 num_changes++;
8440 }
8441 }
8442 if (num_changes > 0)
8443 {
8444 GList *connections, *ll;
8445 GVariant *signal_variant;
8446 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorIntegerThreshold",
8447 &builder, &invalidated_builder));
8448 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8449 for (ll = connections; ll != NULL; ll = ll->next)
8450 {
8451 GDBusConnection *connection = ll->data;
8452
8453 g_dbus_connection_emit_signal (connection,
8454 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8455 "org.freedesktop.DBus.Properties",
8456 "PropertiesChanged",
8457 signal_variant,
8458 NULL);
8459 }
8460 g_variant_unref (signal_variant);
8461 g_list_free_full (connections, g_object_unref);
8462 }
8463 else
8464 {
8465 g_variant_builder_clear (&builder);
8466 g_variant_builder_clear (&invalidated_builder);
8467 }
8468 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8469 skeleton->priv->changed_properties = NULL;
8470 skeleton->priv->changed_properties_idle_source = NULL;
8471 g_mutex_unlock (&skeleton->priv->lock);
8472 return FALSE;
8473}
8474
8475static void
8476_sensor_integer_threshold_schedule_emit_changed (SensorIntegerThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8477{
8478 ChangedProperty *cp;
8479 GList *l;
8480 cp = NULL;
8481 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8482 {
8483 ChangedProperty *i_cp = l->data;
8484 if (i_cp->info == info)
8485 {
8486 cp = i_cp;
8487 break;
8488 }
8489 }
8490 if (cp == NULL)
8491 {
8492 cp = g_new0 (ChangedProperty, 1);
8493 cp->prop_id = prop_id;
8494 cp->info = info;
8495 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8496 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8497 g_value_copy (orig_value, &cp->orig_value);
8498 }
8499}
8500
8501static void
8502sensor_integer_threshold_skeleton_notify (GObject *object,
8503 GParamSpec *pspec G_GNUC_UNUSED)
8504{
8505 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8506 g_mutex_lock (&skeleton->priv->lock);
8507 if (skeleton->priv->changed_properties != NULL &&
8508 skeleton->priv->changed_properties_idle_source == NULL)
8509 {
8510 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8511 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8512 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8513 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8514 g_source_unref (skeleton->priv->changed_properties_idle_source);
8515 }
8516 g_mutex_unlock (&skeleton->priv->lock);
8517}
8518
8519static void
8520sensor_integer_threshold_skeleton_set_property (GObject *object,
8521 guint prop_id,
8522 const GValue *value,
8523 GParamSpec *pspec)
8524{
8525 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8526 g_assert (prop_id != 0 && prop_id - 1 < 4);
8527 g_mutex_lock (&skeleton->priv->lock);
8528 g_object_freeze_notify (object);
8529 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8530 {
8531 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8532 _sensor_integer_threshold_schedule_emit_changed (skeleton, _sensor_integer_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8533 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8534 g_object_notify_by_pspec (object, pspec);
8535 }
8536 g_mutex_unlock (&skeleton->priv->lock);
8537 g_object_thaw_notify (object);
8538}
8539
8540static void
8541sensor_integer_threshold_skeleton_init (SensorIntegerThresholdSkeleton *skeleton)
8542{
8543#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8544 skeleton->priv = sensor_integer_threshold_skeleton_get_instance_private (skeleton);
8545#else
8546 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, SensorIntegerThresholdSkeletonPrivate);
8547#endif
8548
8549 g_mutex_init (&skeleton->priv->lock);
8550 skeleton->priv->context = g_main_context_ref_thread_default ();
8551 skeleton->priv->properties = g_new0 (GValue, 4);
8552 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
8553 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
8554 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
8555 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
8556}
8557
8558static gint
8559sensor_integer_threshold_skeleton_get_critical_upper (SensorIntegerThreshold *object)
8560{
8561 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8562 gint value;
8563 g_mutex_lock (&skeleton->priv->lock);
8564 value = g_value_get_int (&(skeleton->priv->properties[0]));
8565 g_mutex_unlock (&skeleton->priv->lock);
8566 return value;
8567}
8568
8569static gint
8570sensor_integer_threshold_skeleton_get_critical_lower (SensorIntegerThreshold *object)
8571{
8572 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8573 gint value;
8574 g_mutex_lock (&skeleton->priv->lock);
8575 value = g_value_get_int (&(skeleton->priv->properties[1]));
8576 g_mutex_unlock (&skeleton->priv->lock);
8577 return value;
8578}
8579
8580static gint
8581sensor_integer_threshold_skeleton_get_warning_upper (SensorIntegerThreshold *object)
8582{
8583 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8584 gint value;
8585 g_mutex_lock (&skeleton->priv->lock);
8586 value = g_value_get_int (&(skeleton->priv->properties[2]));
8587 g_mutex_unlock (&skeleton->priv->lock);
8588 return value;
8589}
8590
8591static gint
8592sensor_integer_threshold_skeleton_get_warning_lower (SensorIntegerThreshold *object)
8593{
8594 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
8595 gint value;
8596 g_mutex_lock (&skeleton->priv->lock);
8597 value = g_value_get_int (&(skeleton->priv->properties[3]));
8598 g_mutex_unlock (&skeleton->priv->lock);
8599 return value;
8600}
8601
8602static void
8603sensor_integer_threshold_skeleton_class_init (SensorIntegerThresholdSkeletonClass *klass)
8604{
8605 GObjectClass *gobject_class;
8606 GDBusInterfaceSkeletonClass *skeleton_class;
8607
8608 gobject_class = G_OBJECT_CLASS (klass);
8609 gobject_class->finalize = sensor_integer_threshold_skeleton_finalize;
8610 gobject_class->get_property = sensor_integer_threshold_skeleton_get_property;
8611 gobject_class->set_property = sensor_integer_threshold_skeleton_set_property;
8612 gobject_class->notify = sensor_integer_threshold_skeleton_notify;
8613
8614
8615 sensor_integer_threshold_override_properties (gobject_class, 1);
8616
8617 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8618 skeleton_class->get_info = sensor_integer_threshold_skeleton_dbus_interface_get_info;
8619 skeleton_class->get_properties = sensor_integer_threshold_skeleton_dbus_interface_get_properties;
8620 skeleton_class->flush = sensor_integer_threshold_skeleton_dbus_interface_flush;
8621 skeleton_class->get_vtable = sensor_integer_threshold_skeleton_dbus_interface_get_vtable;
8622
8623#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8624 g_type_class_add_private (klass, sizeof (SensorIntegerThresholdSkeletonPrivate));
8625#endif
8626}
8627
8628static void
8629sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface)
8630{
8631 iface->critical = _sensor_integer_threshold_on_signal_critical;
8632 iface->warning = _sensor_integer_threshold_on_signal_warning;
8633 iface->get_critical_upper = sensor_integer_threshold_skeleton_get_critical_upper;
8634 iface->get_critical_lower = sensor_integer_threshold_skeleton_get_critical_lower;
8635 iface->get_warning_upper = sensor_integer_threshold_skeleton_get_warning_upper;
8636 iface->get_warning_lower = sensor_integer_threshold_skeleton_get_warning_lower;
8637}
8638
8639/**
8640 * sensor_integer_threshold_skeleton_new:
8641 *
8642 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
8643 *
8644 * Returns: (transfer full) (type SensorIntegerThresholdSkeleton): The skeleton object.
8645 */
8646SensorIntegerThreshold *
8647sensor_integer_threshold_skeleton_new (void)
8648{
8649 return SENSOR_INTEGER_THRESHOLD (g_object_new (TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, NULL));
8650}
8651
8652/* ------------------------------------------------------------------------
Norman Jamese2765102015-08-19 22:00:55 -05008653 * Code for Object, ObjectProxy and ObjectSkeleton
8654 * ------------------------------------------------------------------------
8655 */
8656
8657/**
8658 * SECTION:Object
8659 * @title: Object
8660 * @short_description: Specialized GDBusObject types
8661 *
8662 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
8663 */
8664
8665/**
8666 * Object:
8667 *
8668 * The #Object type is a specialized container of interfaces.
8669 */
8670
8671/**
8672 * ObjectIface:
8673 * @parent_iface: The parent interface.
8674 *
8675 * Virtual table for the #Object interface.
8676 */
8677
8678typedef ObjectIface ObjectInterface;
8679G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
8680
8681static void
8682object_default_init (ObjectIface *iface)
8683{
8684 /**
8685 * Object:sensor-integer:
8686 *
8687 * The #SensorInteger instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>, if any.
8688 *
8689 * Connect to the #GObject::notify signal to get informed of property changes.
8690 */
8691 g_object_interface_install_property (iface, g_param_spec_object ("sensor-integer", "sensor-integer", "sensor-integer", TYPE_SENSOR_INTEGER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
8692
8693 /**
8694 * Object:sensor-string:
8695 *
8696 * The #SensorString instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>, if any.
8697 *
8698 * Connect to the #GObject::notify signal to get informed of property changes.
8699 */
8700 g_object_interface_install_property (iface, g_param_spec_object ("sensor-string", "sensor-string", "sensor-string", TYPE_SENSOR_STRING, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
8701
8702 /**
8703 * Object:sensor-integer-settable:
8704 *
8705 * The #SensorIntegerSettable instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link>, if any.
8706 *
8707 * Connect to the #GObject::notify signal to get informed of property changes.
8708 */
8709 g_object_interface_install_property (iface, g_param_spec_object ("sensor-integer-settable", "sensor-integer-settable", "sensor-integer-settable", TYPE_SENSOR_INTEGER_SETTABLE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
8710
Norman Jamescc7ae122015-08-24 14:26:09 -05008711 /**
8712 * Object:sensor-integer-threshold:
8713 *
8714 * The #SensorIntegerThreshold instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>, if any.
8715 *
8716 * Connect to the #GObject::notify signal to get informed of property changes.
8717 */
8718 g_object_interface_install_property (iface, g_param_spec_object ("sensor-integer-threshold", "sensor-integer-threshold", "sensor-integer-threshold", TYPE_SENSOR_INTEGER_THRESHOLD, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
8719
Norman Jamese2765102015-08-19 22:00:55 -05008720}
8721
8722/**
8723 * object_get_sensor_integer:
8724 * @object: A #Object.
8725 *
8726 * Gets the #SensorInteger instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> on @object, if any.
8727 *
8728 * Returns: (transfer full): A #SensorInteger that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8729 */
8730SensorInteger *object_get_sensor_integer (Object *object)
8731{
8732 GDBusInterface *ret;
8733 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
8734 if (ret == NULL)
8735 return NULL;
8736 return SENSOR_INTEGER (ret);
8737}
8738
8739/**
8740 * object_get_sensor_string:
8741 * @object: A #Object.
8742 *
8743 * Gets the #SensorString instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> on @object, if any.
8744 *
8745 * Returns: (transfer full): A #SensorString that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8746 */
8747SensorString *object_get_sensor_string (Object *object)
8748{
8749 GDBusInterface *ret;
8750 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
8751 if (ret == NULL)
8752 return NULL;
8753 return SENSOR_STRING (ret);
8754}
8755
8756/**
8757 * object_get_sensor_integer_settable:
8758 * @object: A #Object.
8759 *
8760 * Gets the #SensorIntegerSettable instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link> on @object, if any.
8761 *
8762 * Returns: (transfer full): A #SensorIntegerSettable that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8763 */
8764SensorIntegerSettable *object_get_sensor_integer_settable (Object *object)
8765{
8766 GDBusInterface *ret;
8767 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerSettable");
8768 if (ret == NULL)
8769 return NULL;
8770 return SENSOR_INTEGER_SETTABLE (ret);
8771}
8772
Norman Jamescc7ae122015-08-24 14:26:09 -05008773/**
8774 * object_get_sensor_integer_threshold:
8775 * @object: A #Object.
8776 *
8777 * Gets the #SensorIntegerThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> on @object, if any.
8778 *
8779 * Returns: (transfer full): A #SensorIntegerThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
8780 */
8781SensorIntegerThreshold *object_get_sensor_integer_threshold (Object *object)
8782{
8783 GDBusInterface *ret;
8784 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
8785 if (ret == NULL)
8786 return NULL;
8787 return SENSOR_INTEGER_THRESHOLD (ret);
8788}
8789
Norman Jamese2765102015-08-19 22:00:55 -05008790
8791/**
8792 * object_peek_sensor_integer: (skip)
8793 * @object: A #Object.
8794 *
8795 * Like object_get_sensor_integer() but doesn't increase the reference count on the returned object.
8796 *
8797 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
8798 *
8799 * Returns: (transfer none): A #SensorInteger or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8800 */
8801SensorInteger *object_peek_sensor_integer (Object *object)
8802{
8803 GDBusInterface *ret;
8804 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
8805 if (ret == NULL)
8806 return NULL;
8807 g_object_unref (ret);
8808 return SENSOR_INTEGER (ret);
8809}
8810
8811/**
8812 * object_peek_sensor_string: (skip)
8813 * @object: A #Object.
8814 *
8815 * Like object_get_sensor_string() but doesn't increase the reference count on the returned object.
8816 *
8817 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
8818 *
8819 * Returns: (transfer none): A #SensorString or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8820 */
8821SensorString *object_peek_sensor_string (Object *object)
8822{
8823 GDBusInterface *ret;
8824 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
8825 if (ret == NULL)
8826 return NULL;
8827 g_object_unref (ret);
8828 return SENSOR_STRING (ret);
8829}
8830
8831/**
8832 * object_peek_sensor_integer_settable: (skip)
8833 * @object: A #Object.
8834 *
8835 * Like object_get_sensor_integer_settable() but doesn't increase the reference count on the returned object.
8836 *
8837 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
8838 *
8839 * Returns: (transfer none): A #SensorIntegerSettable or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8840 */
8841SensorIntegerSettable *object_peek_sensor_integer_settable (Object *object)
8842{
8843 GDBusInterface *ret;
8844 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerSettable");
8845 if (ret == NULL)
8846 return NULL;
8847 g_object_unref (ret);
8848 return SENSOR_INTEGER_SETTABLE (ret);
8849}
8850
Norman Jamescc7ae122015-08-24 14:26:09 -05008851/**
8852 * object_peek_sensor_integer_threshold: (skip)
8853 * @object: A #Object.
8854 *
8855 * Like object_get_sensor_integer_threshold() but doesn't increase the reference count on the returned object.
8856 *
8857 * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
8858 *
8859 * Returns: (transfer none): A #SensorIntegerThreshold or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
8860 */
8861SensorIntegerThreshold *object_peek_sensor_integer_threshold (Object *object)
8862{
8863 GDBusInterface *ret;
8864 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
8865 if (ret == NULL)
8866 return NULL;
8867 g_object_unref (ret);
8868 return SENSOR_INTEGER_THRESHOLD (ret);
8869}
8870
Norman Jamese2765102015-08-19 22:00:55 -05008871
8872static void
8873object_notify (GDBusObject *object, GDBusInterface *interface)
8874{
8875 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
8876 /* info can be NULL if the other end is using a D-Bus interface we don't know
8877 * anything about, for example old generated code in this process talking to
8878 * newer generated code in the other process. */
8879 if (info != NULL)
8880 g_object_notify (G_OBJECT (object), info->hyphen_name);
8881}
8882
8883/**
8884 * ObjectProxy:
8885 *
8886 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
8887 */
8888
8889/**
8890 * ObjectProxyClass:
8891 * @parent_class: The parent class.
8892 *
8893 * Class structure for #ObjectProxy.
8894 */
8895
8896static void
8897object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
8898{
8899}
8900
8901static void
8902object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
8903{
8904 iface->interface_added = object_notify;
8905 iface->interface_removed = object_notify;
8906}
8907
8908
8909G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
8910 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
8911 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
8912
8913static void
8914object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
8915{
8916}
8917
8918static void
8919object_proxy_set_property (GObject *gobject,
8920 guint prop_id,
8921 const GValue *value G_GNUC_UNUSED,
8922 GParamSpec *pspec)
8923{
8924 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
8925}
8926
8927static void
8928object_proxy_get_property (GObject *gobject,
8929 guint prop_id,
8930 GValue *value,
8931 GParamSpec *pspec)
8932{
8933 ObjectProxy *object = OBJECT_PROXY (gobject);
8934 GDBusInterface *interface;
8935
8936 switch (prop_id)
8937 {
8938 case 1:
8939 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
8940 g_value_take_object (value, interface);
8941 break;
8942
8943 case 2:
8944 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
8945 g_value_take_object (value, interface);
8946 break;
8947
8948 case 3:
8949 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerSettable");
8950 g_value_take_object (value, interface);
8951 break;
8952
Norman Jamescc7ae122015-08-24 14:26:09 -05008953 case 4:
8954 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
8955 g_value_take_object (value, interface);
8956 break;
8957
Norman Jamese2765102015-08-19 22:00:55 -05008958 default:
8959 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
8960 break;
8961 }
8962}
8963
8964static void
8965object_proxy_class_init (ObjectProxyClass *klass)
8966{
8967 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
8968
8969 gobject_class->set_property = object_proxy_set_property;
8970 gobject_class->get_property = object_proxy_get_property;
8971
8972 g_object_class_override_property (gobject_class, 1, "sensor-integer");
8973 g_object_class_override_property (gobject_class, 2, "sensor-string");
8974 g_object_class_override_property (gobject_class, 3, "sensor-integer-settable");
Norman Jamescc7ae122015-08-24 14:26:09 -05008975 g_object_class_override_property (gobject_class, 4, "sensor-integer-threshold");
Norman Jamese2765102015-08-19 22:00:55 -05008976}
8977
8978/**
8979 * object_proxy_new:
8980 * @connection: A #GDBusConnection.
8981 * @object_path: An object path.
8982 *
8983 * Creates a new proxy object.
8984 *
8985 * Returns: (transfer full): The proxy object.
8986 */
8987ObjectProxy *
8988object_proxy_new (GDBusConnection *connection,
8989 const gchar *object_path)
8990{
8991 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
8992 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
8993 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
8994}
8995
8996/**
8997 * ObjectSkeleton:
8998 *
8999 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
9000 */
9001
9002/**
9003 * ObjectSkeletonClass:
9004 * @parent_class: The parent class.
9005 *
9006 * Class structure for #ObjectSkeleton.
9007 */
9008
9009static void
9010object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
9011{
9012}
9013
9014
9015static void
9016object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
9017{
9018 iface->interface_added = object_notify;
9019 iface->interface_removed = object_notify;
9020}
9021
9022G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
9023 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
9024 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
9025
9026static void
9027object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
9028{
9029}
9030
9031static void
9032object_skeleton_set_property (GObject *gobject,
9033 guint prop_id,
9034 const GValue *value,
9035 GParamSpec *pspec)
9036{
9037 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
9038 GDBusInterfaceSkeleton *interface;
9039
9040 switch (prop_id)
9041 {
9042 case 1:
9043 interface = g_value_get_object (value);
9044 if (interface != NULL)
9045 {
9046 g_warn_if_fail (IS_SENSOR_INTEGER (interface));
9047 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
9048 }
9049 else
9050 {
9051 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorInteger");
9052 }
9053 break;
9054
9055 case 2:
9056 interface = g_value_get_object (value);
9057 if (interface != NULL)
9058 {
9059 g_warn_if_fail (IS_SENSOR_STRING (interface));
9060 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
9061 }
9062 else
9063 {
9064 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorString");
9065 }
9066 break;
9067
9068 case 3:
9069 interface = g_value_get_object (value);
9070 if (interface != NULL)
9071 {
9072 g_warn_if_fail (IS_SENSOR_INTEGER_SETTABLE (interface));
9073 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
9074 }
9075 else
9076 {
9077 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorIntegerSettable");
9078 }
9079 break;
9080
Norman Jamescc7ae122015-08-24 14:26:09 -05009081 case 4:
9082 interface = g_value_get_object (value);
9083 if (interface != NULL)
9084 {
9085 g_warn_if_fail (IS_SENSOR_INTEGER_THRESHOLD (interface));
9086 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
9087 }
9088 else
9089 {
9090 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorIntegerThreshold");
9091 }
9092 break;
9093
Norman Jamese2765102015-08-19 22:00:55 -05009094 default:
9095 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
9096 break;
9097 }
9098}
9099
9100static void
9101object_skeleton_get_property (GObject *gobject,
9102 guint prop_id,
9103 GValue *value,
9104 GParamSpec *pspec)
9105{
9106 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
9107 GDBusInterface *interface;
9108
9109 switch (prop_id)
9110 {
9111 case 1:
9112 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
9113 g_value_take_object (value, interface);
9114 break;
9115
9116 case 2:
9117 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
9118 g_value_take_object (value, interface);
9119 break;
9120
9121 case 3:
9122 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerSettable");
9123 g_value_take_object (value, interface);
9124 break;
9125
Norman Jamescc7ae122015-08-24 14:26:09 -05009126 case 4:
9127 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
9128 g_value_take_object (value, interface);
9129 break;
9130
Norman Jamese2765102015-08-19 22:00:55 -05009131 default:
9132 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
9133 break;
9134 }
9135}
9136
9137static void
9138object_skeleton_class_init (ObjectSkeletonClass *klass)
9139{
9140 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
9141
9142 gobject_class->set_property = object_skeleton_set_property;
9143 gobject_class->get_property = object_skeleton_get_property;
9144
9145 g_object_class_override_property (gobject_class, 1, "sensor-integer");
9146 g_object_class_override_property (gobject_class, 2, "sensor-string");
9147 g_object_class_override_property (gobject_class, 3, "sensor-integer-settable");
Norman Jamescc7ae122015-08-24 14:26:09 -05009148 g_object_class_override_property (gobject_class, 4, "sensor-integer-threshold");
Norman Jamese2765102015-08-19 22:00:55 -05009149}
9150
9151/**
9152 * object_skeleton_new:
9153 * @object_path: An object path.
9154 *
9155 * Creates a new skeleton object.
9156 *
9157 * Returns: (transfer full): The skeleton object.
9158 */
9159ObjectSkeleton *
9160object_skeleton_new (const gchar *object_path)
9161{
9162 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
9163 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
9164}
9165
9166/**
9167 * object_skeleton_set_sensor_integer:
9168 * @object: A #ObjectSkeleton.
9169 * @interface_: (allow-none): A #SensorInteger or %NULL to clear the interface.
9170 *
9171 * Sets the #SensorInteger instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> on @object.
9172 */
9173void object_skeleton_set_sensor_integer (ObjectSkeleton *object, SensorInteger *interface_)
9174{
9175 g_object_set (G_OBJECT (object), "sensor-integer", interface_, NULL);
9176}
9177
9178/**
9179 * object_skeleton_set_sensor_string:
9180 * @object: A #ObjectSkeleton.
9181 * @interface_: (allow-none): A #SensorString or %NULL to clear the interface.
9182 *
9183 * Sets the #SensorString instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> on @object.
9184 */
9185void object_skeleton_set_sensor_string (ObjectSkeleton *object, SensorString *interface_)
9186{
9187 g_object_set (G_OBJECT (object), "sensor-string", interface_, NULL);
9188}
9189
9190/**
9191 * object_skeleton_set_sensor_integer_settable:
9192 * @object: A #ObjectSkeleton.
9193 * @interface_: (allow-none): A #SensorIntegerSettable or %NULL to clear the interface.
9194 *
9195 * Sets the #SensorIntegerSettable instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerSettable.top_of_page">org.openbmc.SensorIntegerSettable</link> on @object.
9196 */
9197void object_skeleton_set_sensor_integer_settable (ObjectSkeleton *object, SensorIntegerSettable *interface_)
9198{
9199 g_object_set (G_OBJECT (object), "sensor-integer-settable", interface_, NULL);
9200}
9201
Norman Jamescc7ae122015-08-24 14:26:09 -05009202/**
9203 * object_skeleton_set_sensor_integer_threshold:
9204 * @object: A #ObjectSkeleton.
9205 * @interface_: (allow-none): A #SensorIntegerThreshold or %NULL to clear the interface.
9206 *
9207 * Sets the #SensorIntegerThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> on @object.
9208 */
9209void object_skeleton_set_sensor_integer_threshold (ObjectSkeleton *object, SensorIntegerThreshold *interface_)
9210{
9211 g_object_set (G_OBJECT (object), "sensor-integer-threshold", interface_, NULL);
9212}
9213
Norman Jamese2765102015-08-19 22:00:55 -05009214
9215/* ------------------------------------------------------------------------
9216 * Code for ObjectManager client
9217 * ------------------------------------------------------------------------
9218 */
9219
9220/**
9221 * SECTION:ObjectManagerClient
9222 * @title: ObjectManagerClient
9223 * @short_description: Generated GDBusObjectManagerClient type
9224 *
9225 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
9226 */
9227
9228/**
9229 * ObjectManagerClient:
9230 *
9231 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
9232 */
9233
9234/**
9235 * ObjectManagerClientClass:
9236 * @parent_class: The parent class.
9237 *
9238 * Class structure for #ObjectManagerClient.
9239 */
9240
9241G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
9242
9243static void
9244object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
9245{
9246}
9247
9248static void
9249object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
9250{
9251}
9252
9253/**
9254 * object_manager_client_get_proxy_type:
9255 * @manager: A #GDBusObjectManagerClient.
9256 * @object_path: The object path of the remote object (unused).
9257 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
9258 * @user_data: User data (unused).
9259 *
9260 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
9261 *
9262 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
9263 */
9264GType
9265object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED)
9266{
9267 static gsize once_init_value = 0;
9268 static GHashTable *lookup_hash;
9269 GType ret;
9270
9271 if (interface_name == NULL)
9272 return TYPE_OBJECT_PROXY;
9273 if (g_once_init_enter (&once_init_value))
9274 {
9275 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
9276 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorInteger", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_PROXY));
9277 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorString", GSIZE_TO_POINTER (TYPE_SENSOR_STRING_PROXY));
9278 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorIntegerSettable", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_SETTABLE_PROXY));
Norman Jamescc7ae122015-08-24 14:26:09 -05009279 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorIntegerThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY));
Norman Jamese2765102015-08-19 22:00:55 -05009280 g_once_init_leave (&once_init_value, 1);
9281 }
9282 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
9283 if (ret == (GType) 0)
9284 ret = G_TYPE_DBUS_PROXY;
9285 return ret;
9286}
9287
9288/**
9289 * object_manager_client_new:
9290 * @connection: A #GDBusConnection.
9291 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
9292 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9293 * @object_path: An object path.
9294 * @cancellable: (allow-none): A #GCancellable or %NULL.
9295 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9296 * @user_data: User data to pass to @callback.
9297 *
9298 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
9299 *
9300 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9301 * You can then call object_manager_client_new_finish() to get the result of the operation.
9302 *
9303 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
9304 */
9305void
9306object_manager_client_new (
9307 GDBusConnection *connection,
9308 GDBusObjectManagerClientFlags flags,
9309 const gchar *name,
9310 const gchar *object_path,
9311 GCancellable *cancellable,
9312 GAsyncReadyCallback callback,
9313 gpointer user_data)
9314{
9315 g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
9316}
9317
9318/**
9319 * object_manager_client_new_finish:
9320 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
9321 * @error: Return location for error or %NULL
9322 *
9323 * Finishes an operation started with object_manager_client_new().
9324 *
9325 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
9326 */
9327GDBusObjectManager *
9328object_manager_client_new_finish (
9329 GAsyncResult *res,
9330 GError **error)
9331{
9332 GObject *ret;
9333 GObject *source_object;
9334 source_object = g_async_result_get_source_object (res);
9335 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9336 g_object_unref (source_object);
9337 if (ret != NULL)
9338 return G_DBUS_OBJECT_MANAGER (ret);
9339 else
9340 return NULL;
9341}
9342
9343/**
9344 * object_manager_client_new_sync:
9345 * @connection: A #GDBusConnection.
9346 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
9347 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9348 * @object_path: An object path.
9349 * @cancellable: (allow-none): A #GCancellable or %NULL.
9350 * @error: Return location for error or %NULL
9351 *
9352 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
9353 *
9354 * The calling thread is blocked until a reply is received.
9355 *
9356 * See object_manager_client_new() for the asynchronous version of this constructor.
9357 *
9358 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
9359 */
9360GDBusObjectManager *
9361object_manager_client_new_sync (
9362 GDBusConnection *connection,
9363 GDBusObjectManagerClientFlags flags,
9364 const gchar *name,
9365 const gchar *object_path,
9366 GCancellable *cancellable,
9367 GError **error)
9368{
9369 GInitable *ret;
9370 ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
9371 if (ret != NULL)
9372 return G_DBUS_OBJECT_MANAGER (ret);
9373 else
9374 return NULL;
9375}
9376
9377
9378/**
9379 * object_manager_client_new_for_bus:
9380 * @bus_type: A #GBusType.
9381 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
9382 * @name: A bus name (well-known or unique).
9383 * @object_path: An object path.
9384 * @cancellable: (allow-none): A #GCancellable or %NULL.
9385 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9386 * @user_data: User data to pass to @callback.
9387 *
9388 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
9389 *
9390 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9391 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
9392 *
9393 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9394 */
9395void
9396object_manager_client_new_for_bus (
9397 GBusType bus_type,
9398 GDBusObjectManagerClientFlags flags,
9399 const gchar *name,
9400 const gchar *object_path,
9401 GCancellable *cancellable,
9402 GAsyncReadyCallback callback,
9403 gpointer user_data)
9404{
9405 g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
9406}
9407
9408/**
9409 * object_manager_client_new_for_bus_finish:
9410 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
9411 * @error: Return location for error or %NULL
9412 *
9413 * Finishes an operation started with object_manager_client_new_for_bus().
9414 *
9415 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
9416 */
9417GDBusObjectManager *
9418object_manager_client_new_for_bus_finish (
9419 GAsyncResult *res,
9420 GError **error)
9421{
9422 GObject *ret;
9423 GObject *source_object;
9424 source_object = g_async_result_get_source_object (res);
9425 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9426 g_object_unref (source_object);
9427 if (ret != NULL)
9428 return G_DBUS_OBJECT_MANAGER (ret);
9429 else
9430 return NULL;
9431}
9432
9433/**
9434 * object_manager_client_new_for_bus_sync:
9435 * @bus_type: A #GBusType.
9436 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
9437 * @name: A bus name (well-known or unique).
9438 * @object_path: An object path.
9439 * @cancellable: (allow-none): A #GCancellable or %NULL.
9440 * @error: Return location for error or %NULL
9441 *
9442 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9443 *
9444 * The calling thread is blocked until a reply is received.
9445 *
9446 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
9447 *
9448 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
9449 */
9450GDBusObjectManager *
9451object_manager_client_new_for_bus_sync (
9452 GBusType bus_type,
9453 GDBusObjectManagerClientFlags flags,
9454 const gchar *name,
9455 const gchar *object_path,
9456 GCancellable *cancellable,
9457 GError **error)
9458{
9459 GInitable *ret;
9460 ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL);
9461 if (ret != NULL)
9462 return G_DBUS_OBJECT_MANAGER (ret);
9463 else
9464 return NULL;
9465}
9466
9467