blob: 7c3c9ff95c7c48b12d4ca9d80f9598405d06f1b9 [file] [log] [blame]
Norman Jamesdc95ef72015-08-27 21:27:03 -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/sensor2.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
Norman James471ab592015-08-30 22:29:40 -0500166static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_init =
167{
168 {
169 -1,
170 (gchar *) "init",
171 NULL,
172 NULL,
173 NULL
174 },
175 "handle-init",
176 FALSE
177};
178
Norman Jamesdc95ef72015-08-27 21:27:03 -0500179static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_value_OUT_ARG_value =
180{
181 {
182 -1,
183 (gchar *) "value",
184 (gchar *) "i",
185 NULL
186 },
187 FALSE
188};
189
190static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_value_OUT_ARG_pointers[] =
191{
192 &_sensor_integer_method_info_get_value_OUT_ARG_value,
193 NULL
194};
195
196static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_value =
197{
198 {
199 -1,
200 (gchar *) "getValue",
201 NULL,
202 (GDBusArgInfo **) &_sensor_integer_method_info_get_value_OUT_ARG_pointers,
203 NULL
204 },
205 "handle-get-value",
206 FALSE
207};
208
209static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_value_IN_ARG_value =
210{
211 {
212 -1,
213 (gchar *) "value",
214 (gchar *) "i",
215 NULL
216 },
217 FALSE
218};
219
220static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_value_IN_ARG_pointers[] =
221{
222 &_sensor_integer_method_info_set_value_IN_ARG_value,
223 NULL
224};
225
226static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_value =
227{
228 {
229 -1,
230 (gchar *) "setValue",
231 (GDBusArgInfo **) &_sensor_integer_method_info_set_value_IN_ARG_pointers,
232 NULL,
233 NULL
234 },
235 "handle-set-value",
236 FALSE
237};
238
239static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_units_OUT_ARG_units =
240{
241 {
242 -1,
243 (gchar *) "units",
244 (gchar *) "s",
245 NULL
246 },
247 FALSE
248};
249
250static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_units_OUT_ARG_pointers[] =
251{
252 &_sensor_integer_method_info_get_units_OUT_ARG_units,
253 NULL
254};
255
256static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_units =
257{
258 {
259 -1,
260 (gchar *) "getUnits",
261 NULL,
262 (GDBusArgInfo **) &_sensor_integer_method_info_get_units_OUT_ARG_pointers,
263 NULL
264 },
265 "handle-get-units",
266 FALSE
267};
268
269static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_poll_interval_IN_ARG_poll_interval =
270{
271 {
272 -1,
273 (gchar *) "poll_interval",
274 (gchar *) "i",
275 NULL
276 },
277 FALSE
278};
279
280static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_poll_interval_IN_ARG_pointers[] =
281{
282 &_sensor_integer_method_info_set_poll_interval_IN_ARG_poll_interval,
283 NULL
284};
285
286static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_poll_interval =
287{
288 {
289 -1,
290 (gchar *) "setPollInterval",
291 (GDBusArgInfo **) &_sensor_integer_method_info_set_poll_interval_IN_ARG_pointers,
292 NULL,
293 NULL
294 },
295 "handle-set-poll-interval",
296 FALSE
297};
298
299static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_config_data_IN_ARG_config =
300{
301 {
302 -1,
303 (gchar *) "config",
304 (gchar *) "as",
305 NULL
306 },
307 FALSE
308};
309
310static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_config_data_IN_ARG_pointers[] =
311{
312 &_sensor_integer_method_info_set_config_data_IN_ARG_config,
313 NULL
314};
315
316static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_config_data =
317{
318 {
319 -1,
320 (gchar *) "setConfigData",
321 (GDBusArgInfo **) &_sensor_integer_method_info_set_config_data_IN_ARG_pointers,
322 NULL,
323 NULL
324 },
325 "handle-set-config-data",
326 FALSE
327};
328
329static const _ExtendedGDBusMethodInfo * const _sensor_integer_method_info_pointers[] =
330{
Norman James471ab592015-08-30 22:29:40 -0500331 &_sensor_integer_method_info_init,
Norman Jamesdc95ef72015-08-27 21:27:03 -0500332 &_sensor_integer_method_info_get_value,
333 &_sensor_integer_method_info_set_value,
334 &_sensor_integer_method_info_get_units,
335 &_sensor_integer_method_info_set_poll_interval,
336 &_sensor_integer_method_info_set_config_data,
337 NULL
338};
339
340static const _ExtendedGDBusArgInfo _sensor_integer_signal_info_changed_ARG_value =
341{
342 {
343 -1,
344 (gchar *) "value",
345 (gchar *) "i",
346 NULL
347 },
348 FALSE
349};
350
351static const _ExtendedGDBusArgInfo * const _sensor_integer_signal_info_changed_ARG_pointers[] =
352{
353 &_sensor_integer_signal_info_changed_ARG_value,
354 NULL
355};
356
357static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_changed =
358{
359 {
360 -1,
361 (gchar *) "Changed",
362 (GDBusArgInfo **) &_sensor_integer_signal_info_changed_ARG_pointers,
363 NULL
364 },
365 "changed"
366};
367
368static const _ExtendedGDBusArgInfo _sensor_integer_signal_info_heartbeat_ARG_bus_name =
369{
370 {
371 -1,
372 (gchar *) "bus_name",
373 (gchar *) "s",
374 NULL
375 },
376 FALSE
377};
378
379static const _ExtendedGDBusArgInfo * const _sensor_integer_signal_info_heartbeat_ARG_pointers[] =
380{
381 &_sensor_integer_signal_info_heartbeat_ARG_bus_name,
382 NULL
383};
384
385static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_heartbeat =
386{
387 {
388 -1,
389 (gchar *) "Heartbeat",
390 (GDBusArgInfo **) &_sensor_integer_signal_info_heartbeat_ARG_pointers,
391 NULL
392 },
393 "heartbeat"
394};
395
396static const _ExtendedGDBusSignalInfo * const _sensor_integer_signal_info_pointers[] =
397{
398 &_sensor_integer_signal_info_changed,
399 &_sensor_integer_signal_info_heartbeat,
400 NULL
401};
402
403static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_value =
404{
405 {
406 -1,
407 (gchar *) "value",
408 (gchar *) "i",
409 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
410 NULL
411 },
412 "value",
413 FALSE
414};
415
416static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_units =
417{
418 {
419 -1,
420 (gchar *) "units",
421 (gchar *) "s",
422 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
423 NULL
424 },
425 "units",
426 FALSE
427};
428
429static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_poll_interval =
430{
431 {
432 -1,
433 (gchar *) "poll_interval",
434 (gchar *) "i",
435 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
436 NULL
437 },
438 "poll-interval",
439 FALSE
440};
441
442static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_config_data =
443{
444 {
445 -1,
446 (gchar *) "config_data",
447 (gchar *) "as",
448 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
449 NULL
450 },
451 "config-data",
452 FALSE
453};
454
455static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_heatbeat =
456{
457 {
458 -1,
459 (gchar *) "heatbeat",
460 (gchar *) "i",
461 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
462 NULL
463 },
464 "heatbeat",
465 FALSE
466};
467
468static const _ExtendedGDBusPropertyInfo * const _sensor_integer_property_info_pointers[] =
469{
470 &_sensor_integer_property_info_value,
471 &_sensor_integer_property_info_units,
472 &_sensor_integer_property_info_poll_interval,
473 &_sensor_integer_property_info_config_data,
474 &_sensor_integer_property_info_heatbeat,
475 NULL
476};
477
478static const _ExtendedGDBusInterfaceInfo _sensor_integer_interface_info =
479{
480 {
481 -1,
482 (gchar *) "org.openbmc.SensorInteger",
483 (GDBusMethodInfo **) &_sensor_integer_method_info_pointers,
484 (GDBusSignalInfo **) &_sensor_integer_signal_info_pointers,
485 (GDBusPropertyInfo **) &_sensor_integer_property_info_pointers,
486 NULL
487 },
488 "sensor-integer",
489};
490
491
492/**
493 * sensor_integer_interface_info:
494 *
495 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> D-Bus interface.
496 *
497 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
498 */
499GDBusInterfaceInfo *
500sensor_integer_interface_info (void)
501{
502 return (GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct;
503}
504
505/**
506 * sensor_integer_override_properties:
507 * @klass: The class structure for a #GObject<!-- -->-derived class.
508 * @property_id_begin: The property id to assign to the first overridden property.
509 *
510 * Overrides all #GObject properties in the #SensorInteger interface for a concrete class.
511 * The properties are overridden in the order they are defined.
512 *
513 * Returns: The last property id.
514 */
515guint
516sensor_integer_override_properties (GObjectClass *klass, guint property_id_begin)
517{
518 g_object_class_override_property (klass, property_id_begin++, "value");
519 g_object_class_override_property (klass, property_id_begin++, "units");
520 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
521 g_object_class_override_property (klass, property_id_begin++, "config-data");
522 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
523 return property_id_begin - 1;
524}
525
526
527
528/**
529 * SensorInteger:
530 *
531 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
532 */
533
534/**
535 * SensorIntegerIface:
536 * @parent_iface: The parent interface.
537 * @handle_get_units: Handler for the #SensorInteger::handle-get-units signal.
538 * @handle_get_value: Handler for the #SensorInteger::handle-get-value signal.
Norman James471ab592015-08-30 22:29:40 -0500539 * @handle_init: Handler for the #SensorInteger::handle-init signal.
Norman Jamesdc95ef72015-08-27 21:27:03 -0500540 * @handle_set_config_data: Handler for the #SensorInteger::handle-set-config-data signal.
541 * @handle_set_poll_interval: Handler for the #SensorInteger::handle-set-poll-interval signal.
542 * @handle_set_value: Handler for the #SensorInteger::handle-set-value signal.
543 * @get_config_data: Getter for the #SensorInteger:config-data property.
544 * @get_heatbeat: Getter for the #SensorInteger:heatbeat property.
545 * @get_poll_interval: Getter for the #SensorInteger:poll-interval property.
546 * @get_units: Getter for the #SensorInteger:units property.
547 * @get_value: Getter for the #SensorInteger:value property.
548 * @changed: Handler for the #SensorInteger::changed signal.
549 * @heartbeat: Handler for the #SensorInteger::heartbeat signal.
550 *
551 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
552 */
553
554typedef SensorIntegerIface SensorIntegerInterface;
555G_DEFINE_INTERFACE (SensorInteger, sensor_integer, G_TYPE_OBJECT);
556
557static void
558sensor_integer_default_init (SensorIntegerIface *iface)
559{
560 /* GObject signals for incoming D-Bus method calls: */
561 /**
Norman James471ab592015-08-30 22:29:40 -0500562 * SensorInteger::handle-init:
563 * @object: A #SensorInteger.
564 * @invocation: A #GDBusMethodInvocation.
565 *
566 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.init">init()</link> D-Bus method.
567 *
568 * 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_init() 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.
569 *
570 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
571 */
572 g_signal_new ("handle-init",
573 G_TYPE_FROM_INTERFACE (iface),
574 G_SIGNAL_RUN_LAST,
575 G_STRUCT_OFFSET (SensorIntegerIface, handle_init),
576 g_signal_accumulator_true_handled,
577 NULL,
578 g_cclosure_marshal_generic,
579 G_TYPE_BOOLEAN,
580 1,
581 G_TYPE_DBUS_METHOD_INVOCATION);
582
583 /**
Norman Jamesdc95ef72015-08-27 21:27:03 -0500584 * SensorInteger::handle-get-value:
585 * @object: A #SensorInteger.
586 * @invocation: A #GDBusMethodInvocation.
587 *
588 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method.
589 *
590 * 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.
591 *
592 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
593 */
594 g_signal_new ("handle-get-value",
595 G_TYPE_FROM_INTERFACE (iface),
596 G_SIGNAL_RUN_LAST,
597 G_STRUCT_OFFSET (SensorIntegerIface, handle_get_value),
598 g_signal_accumulator_true_handled,
599 NULL,
600 g_cclosure_marshal_generic,
601 G_TYPE_BOOLEAN,
602 1,
603 G_TYPE_DBUS_METHOD_INVOCATION);
604
605 /**
606 * SensorInteger::handle-set-value:
607 * @object: A #SensorInteger.
608 * @invocation: A #GDBusMethodInvocation.
609 * @arg_value: Argument passed by remote caller.
610 *
611 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setValue">setValue()</link> D-Bus method.
612 *
613 * 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_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.
614 *
615 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
616 */
617 g_signal_new ("handle-set-value",
618 G_TYPE_FROM_INTERFACE (iface),
619 G_SIGNAL_RUN_LAST,
620 G_STRUCT_OFFSET (SensorIntegerIface, handle_set_value),
621 g_signal_accumulator_true_handled,
622 NULL,
623 g_cclosure_marshal_generic,
624 G_TYPE_BOOLEAN,
625 2,
626 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
627
628 /**
629 * SensorInteger::handle-get-units:
630 * @object: A #SensorInteger.
631 * @invocation: A #GDBusMethodInvocation.
632 *
633 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method.
634 *
635 * 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.
636 *
637 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
638 */
639 g_signal_new ("handle-get-units",
640 G_TYPE_FROM_INTERFACE (iface),
641 G_SIGNAL_RUN_LAST,
642 G_STRUCT_OFFSET (SensorIntegerIface, handle_get_units),
643 g_signal_accumulator_true_handled,
644 NULL,
645 g_cclosure_marshal_generic,
646 G_TYPE_BOOLEAN,
647 1,
648 G_TYPE_DBUS_METHOD_INVOCATION);
649
650 /**
651 * SensorInteger::handle-set-poll-interval:
652 * @object: A #SensorInteger.
653 * @invocation: A #GDBusMethodInvocation.
654 * @arg_poll_interval: Argument passed by remote caller.
655 *
656 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method.
657 *
658 * 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.
659 *
660 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
661 */
662 g_signal_new ("handle-set-poll-interval",
663 G_TYPE_FROM_INTERFACE (iface),
664 G_SIGNAL_RUN_LAST,
665 G_STRUCT_OFFSET (SensorIntegerIface, handle_set_poll_interval),
666 g_signal_accumulator_true_handled,
667 NULL,
668 g_cclosure_marshal_generic,
669 G_TYPE_BOOLEAN,
670 2,
671 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
672
673 /**
674 * SensorInteger::handle-set-config-data:
675 * @object: A #SensorInteger.
676 * @invocation: A #GDBusMethodInvocation.
677 * @arg_config: Argument passed by remote caller.
678 *
679 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method.
680 *
681 * 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.
682 *
683 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
684 */
685 g_signal_new ("handle-set-config-data",
686 G_TYPE_FROM_INTERFACE (iface),
687 G_SIGNAL_RUN_LAST,
688 G_STRUCT_OFFSET (SensorIntegerIface, handle_set_config_data),
689 g_signal_accumulator_true_handled,
690 NULL,
691 g_cclosure_marshal_generic,
692 G_TYPE_BOOLEAN,
693 2,
694 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRV);
695
696 /* GObject signals for received D-Bus signals: */
697 /**
698 * SensorInteger::changed:
699 * @object: A #SensorInteger.
700 * @arg_value: Argument.
701 *
702 * 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.
703 *
704 * 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.
705 */
706 g_signal_new ("changed",
707 G_TYPE_FROM_INTERFACE (iface),
708 G_SIGNAL_RUN_LAST,
709 G_STRUCT_OFFSET (SensorIntegerIface, changed),
710 NULL,
711 NULL,
712 g_cclosure_marshal_generic,
713 G_TYPE_NONE,
714 1, G_TYPE_INT);
715
716 /**
717 * SensorInteger::heartbeat:
718 * @object: A #SensorInteger.
719 * @arg_bus_name: Argument.
720 *
721 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorInteger.Heartbeat">"Heartbeat"</link> is received.
722 *
723 * 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.
724 */
725 g_signal_new ("heartbeat",
726 G_TYPE_FROM_INTERFACE (iface),
727 G_SIGNAL_RUN_LAST,
728 G_STRUCT_OFFSET (SensorIntegerIface, heartbeat),
729 NULL,
730 NULL,
731 g_cclosure_marshal_generic,
732 G_TYPE_NONE,
733 1, G_TYPE_STRING);
734
735 /* GObject properties for D-Bus properties: */
736 /**
737 * SensorInteger:value:
738 *
739 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link>.
740 *
741 * 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.
742 */
743 g_object_interface_install_property (iface,
744 g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
745 /**
746 * SensorInteger:units:
747 *
748 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link>.
749 *
750 * 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.
751 */
752 g_object_interface_install_property (iface,
753 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
754 /**
755 * SensorInteger:poll-interval:
756 *
757 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link>.
758 *
759 * 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.
760 */
761 g_object_interface_install_property (iface,
762 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
763 /**
764 * SensorInteger:config-data:
765 *
766 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link>.
767 *
768 * 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.
769 */
770 g_object_interface_install_property (iface,
771 g_param_spec_boxed ("config-data", "config_data", "config_data", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
772 /**
773 * SensorInteger:heatbeat:
774 *
775 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.heatbeat">"heatbeat"</link>.
776 *
777 * 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.
778 */
779 g_object_interface_install_property (iface,
780 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
781}
782
783/**
784 * sensor_integer_get_value: (skip)
785 * @object: A #SensorInteger.
786 *
787 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link> D-Bus property.
788 *
789 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
790 *
791 * Returns: The property value.
792 */
793gint
794sensor_integer_get_value (SensorInteger *object)
795{
796 return SENSOR_INTEGER_GET_IFACE (object)->get_value (object);
797}
798
799/**
800 * sensor_integer_set_value: (skip)
801 * @object: A #SensorInteger.
802 * @value: The value to set.
803 *
804 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link> D-Bus property to @value.
805 *
806 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
807 */
808void
809sensor_integer_set_value (SensorInteger *object, gint value)
810{
811 g_object_set (G_OBJECT (object), "value", value, NULL);
812}
813
814/**
815 * sensor_integer_get_units: (skip)
816 * @object: A #SensorInteger.
817 *
818 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property.
819 *
820 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
821 *
822 * <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>
823 *
824 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
825 */
826const gchar *
827sensor_integer_get_units (SensorInteger *object)
828{
829 return SENSOR_INTEGER_GET_IFACE (object)->get_units (object);
830}
831
832/**
833 * sensor_integer_dup_units: (skip)
834 * @object: A #SensorInteger.
835 *
836 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property.
837 *
838 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
839 *
840 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
841 */
842gchar *
843sensor_integer_dup_units (SensorInteger *object)
844{
845 gchar *value;
846 g_object_get (G_OBJECT (object), "units", &value, NULL);
847 return value;
848}
849
850/**
851 * sensor_integer_set_units: (skip)
852 * @object: A #SensorInteger.
853 * @value: The value to set.
854 *
855 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property to @value.
856 *
857 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
858 */
859void
860sensor_integer_set_units (SensorInteger *object, const gchar *value)
861{
862 g_object_set (G_OBJECT (object), "units", value, NULL);
863}
864
865/**
866 * sensor_integer_get_poll_interval: (skip)
867 * @object: A #SensorInteger.
868 *
869 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link> D-Bus property.
870 *
871 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
872 *
873 * Returns: The property value.
874 */
875gint
876sensor_integer_get_poll_interval (SensorInteger *object)
877{
878 return SENSOR_INTEGER_GET_IFACE (object)->get_poll_interval (object);
879}
880
881/**
882 * sensor_integer_set_poll_interval: (skip)
883 * @object: A #SensorInteger.
884 * @value: The value to set.
885 *
886 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link> D-Bus property to @value.
887 *
888 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
889 */
890void
891sensor_integer_set_poll_interval (SensorInteger *object, gint value)
892{
893 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
894}
895
896/**
897 * sensor_integer_get_config_data: (skip)
898 * @object: A #SensorInteger.
899 *
900 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property.
901 *
902 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
903 *
904 * <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>
905 *
906 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
907 */
908const gchar *const *
909sensor_integer_get_config_data (SensorInteger *object)
910{
911 return SENSOR_INTEGER_GET_IFACE (object)->get_config_data (object);
912}
913
914/**
915 * sensor_integer_dup_config_data: (skip)
916 * @object: A #SensorInteger.
917 *
918 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property.
919 *
920 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
921 *
922 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev().
923 */
924gchar **
925sensor_integer_dup_config_data (SensorInteger *object)
926{
927 gchar **value;
928 g_object_get (G_OBJECT (object), "config-data", &value, NULL);
929 return value;
930}
931
932/**
933 * sensor_integer_set_config_data: (skip)
934 * @object: A #SensorInteger.
935 * @value: The value to set.
936 *
937 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.config_data">"config_data"</link> D-Bus property to @value.
938 *
939 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
940 */
941void
942sensor_integer_set_config_data (SensorInteger *object, const gchar *const *value)
943{
944 g_object_set (G_OBJECT (object), "config-data", value, NULL);
945}
946
947/**
948 * sensor_integer_get_heatbeat: (skip)
949 * @object: A #SensorInteger.
950 *
951 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.heatbeat">"heatbeat"</link> D-Bus property.
952 *
953 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
954 *
955 * Returns: The property value.
956 */
957gint
958sensor_integer_get_heatbeat (SensorInteger *object)
959{
960 return SENSOR_INTEGER_GET_IFACE (object)->get_heatbeat (object);
961}
962
963/**
964 * sensor_integer_set_heatbeat: (skip)
965 * @object: A #SensorInteger.
966 * @value: The value to set.
967 *
968 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.heatbeat">"heatbeat"</link> D-Bus property to @value.
969 *
970 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
971 */
972void
973sensor_integer_set_heatbeat (SensorInteger *object, gint value)
974{
975 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
976}
977
978/**
979 * sensor_integer_emit_changed:
980 * @object: A #SensorInteger.
981 * @arg_value: Argument to pass with the signal.
982 *
983 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Changed">"Changed"</link> D-Bus signal.
984 */
985void
986sensor_integer_emit_changed (
987 SensorInteger *object,
988 gint arg_value)
989{
990 g_signal_emit_by_name (object, "changed", arg_value);
991}
992
993/**
994 * sensor_integer_emit_heartbeat:
995 * @object: A #SensorInteger.
996 * @arg_bus_name: Argument to pass with the signal.
997 *
998 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Heartbeat">"Heartbeat"</link> D-Bus signal.
999 */
1000void
1001sensor_integer_emit_heartbeat (
1002 SensorInteger *object,
1003 const gchar *arg_bus_name)
1004{
1005 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
1006}
1007
1008/**
Norman James471ab592015-08-30 22:29:40 -05001009 * sensor_integer_call_init:
1010 * @proxy: A #SensorIntegerProxy.
1011 * @cancellable: (allow-none): A #GCancellable or %NULL.
1012 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1013 * @user_data: User data to pass to @callback.
1014 *
1015 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.init">init()</link> D-Bus method on @proxy.
1016 * 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.
1017 * You can then call sensor_integer_call_init_finish() to get the result of the operation.
1018 *
1019 * See sensor_integer_call_init_sync() for the synchronous, blocking version of this method.
1020 */
1021void
1022sensor_integer_call_init (
1023 SensorInteger *proxy,
1024 GCancellable *cancellable,
1025 GAsyncReadyCallback callback,
1026 gpointer user_data)
1027{
1028 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1029 "init",
1030 g_variant_new ("()"),
1031 G_DBUS_CALL_FLAGS_NONE,
1032 -1,
1033 cancellable,
1034 callback,
1035 user_data);
1036}
1037
1038/**
1039 * sensor_integer_call_init_finish:
1040 * @proxy: A #SensorIntegerProxy.
1041 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_init().
1042 * @error: Return location for error or %NULL.
1043 *
1044 * Finishes an operation started with sensor_integer_call_init().
1045 *
1046 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1047 */
1048gboolean
1049sensor_integer_call_init_finish (
1050 SensorInteger *proxy,
1051 GAsyncResult *res,
1052 GError **error)
1053{
1054 GVariant *_ret;
1055 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1056 if (_ret == NULL)
1057 goto _out;
1058 g_variant_get (_ret,
1059 "()");
1060 g_variant_unref (_ret);
1061_out:
1062 return _ret != NULL;
1063}
1064
1065/**
1066 * sensor_integer_call_init_sync:
1067 * @proxy: A #SensorIntegerProxy.
1068 * @cancellable: (allow-none): A #GCancellable or %NULL.
1069 * @error: Return location for error or %NULL.
1070 *
1071 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1072 *
1073 * See sensor_integer_call_init() for the asynchronous version of this method.
1074 *
1075 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1076 */
1077gboolean
1078sensor_integer_call_init_sync (
1079 SensorInteger *proxy,
1080 GCancellable *cancellable,
1081 GError **error)
1082{
1083 GVariant *_ret;
1084 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1085 "init",
1086 g_variant_new ("()"),
1087 G_DBUS_CALL_FLAGS_NONE,
1088 -1,
1089 cancellable,
1090 error);
1091 if (_ret == NULL)
1092 goto _out;
1093 g_variant_get (_ret,
1094 "()");
1095 g_variant_unref (_ret);
1096_out:
1097 return _ret != NULL;
1098}
1099
1100/**
Norman Jamesdc95ef72015-08-27 21:27:03 -05001101 * sensor_integer_call_get_value:
1102 * @proxy: A #SensorIntegerProxy.
1103 * @cancellable: (allow-none): A #GCancellable or %NULL.
1104 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1105 * @user_data: User data to pass to @callback.
1106 *
1107 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method on @proxy.
1108 * 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.
1109 * You can then call sensor_integer_call_get_value_finish() to get the result of the operation.
1110 *
1111 * See sensor_integer_call_get_value_sync() for the synchronous, blocking version of this method.
1112 */
1113void
1114sensor_integer_call_get_value (
1115 SensorInteger *proxy,
1116 GCancellable *cancellable,
1117 GAsyncReadyCallback callback,
1118 gpointer user_data)
1119{
1120 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1121 "getValue",
1122 g_variant_new ("()"),
1123 G_DBUS_CALL_FLAGS_NONE,
1124 -1,
1125 cancellable,
1126 callback,
1127 user_data);
1128}
1129
1130/**
1131 * sensor_integer_call_get_value_finish:
1132 * @proxy: A #SensorIntegerProxy.
1133 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1134 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_value().
1135 * @error: Return location for error or %NULL.
1136 *
1137 * Finishes an operation started with sensor_integer_call_get_value().
1138 *
1139 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1140 */
1141gboolean
1142sensor_integer_call_get_value_finish (
1143 SensorInteger *proxy,
1144 gint *out_value,
1145 GAsyncResult *res,
1146 GError **error)
1147{
1148 GVariant *_ret;
1149 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1150 if (_ret == NULL)
1151 goto _out;
1152 g_variant_get (_ret,
1153 "(i)",
1154 out_value);
1155 g_variant_unref (_ret);
1156_out:
1157 return _ret != NULL;
1158}
1159
1160/**
1161 * sensor_integer_call_get_value_sync:
1162 * @proxy: A #SensorIntegerProxy.
1163 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1164 * @cancellable: (allow-none): A #GCancellable or %NULL.
1165 * @error: Return location for error or %NULL.
1166 *
1167 * 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.
1168 *
1169 * See sensor_integer_call_get_value() for the asynchronous version of this method.
1170 *
1171 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1172 */
1173gboolean
1174sensor_integer_call_get_value_sync (
1175 SensorInteger *proxy,
1176 gint *out_value,
1177 GCancellable *cancellable,
1178 GError **error)
1179{
1180 GVariant *_ret;
1181 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1182 "getValue",
1183 g_variant_new ("()"),
1184 G_DBUS_CALL_FLAGS_NONE,
1185 -1,
1186 cancellable,
1187 error);
1188 if (_ret == NULL)
1189 goto _out;
1190 g_variant_get (_ret,
1191 "(i)",
1192 out_value);
1193 g_variant_unref (_ret);
1194_out:
1195 return _ret != NULL;
1196}
1197
1198/**
1199 * sensor_integer_call_set_value:
1200 * @proxy: A #SensorIntegerProxy.
1201 * @arg_value: Argument to pass with the method invocation.
1202 * @cancellable: (allow-none): A #GCancellable or %NULL.
1203 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1204 * @user_data: User data to pass to @callback.
1205 *
1206 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setValue">setValue()</link> D-Bus method on @proxy.
1207 * 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.
1208 * You can then call sensor_integer_call_set_value_finish() to get the result of the operation.
1209 *
1210 * See sensor_integer_call_set_value_sync() for the synchronous, blocking version of this method.
1211 */
1212void
1213sensor_integer_call_set_value (
1214 SensorInteger *proxy,
1215 gint arg_value,
1216 GCancellable *cancellable,
1217 GAsyncReadyCallback callback,
1218 gpointer user_data)
1219{
1220 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1221 "setValue",
1222 g_variant_new ("(i)",
1223 arg_value),
1224 G_DBUS_CALL_FLAGS_NONE,
1225 -1,
1226 cancellable,
1227 callback,
1228 user_data);
1229}
1230
1231/**
1232 * sensor_integer_call_set_value_finish:
1233 * @proxy: A #SensorIntegerProxy.
1234 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_value().
1235 * @error: Return location for error or %NULL.
1236 *
1237 * Finishes an operation started with sensor_integer_call_set_value().
1238 *
1239 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1240 */
1241gboolean
1242sensor_integer_call_set_value_finish (
1243 SensorInteger *proxy,
1244 GAsyncResult *res,
1245 GError **error)
1246{
1247 GVariant *_ret;
1248 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1249 if (_ret == NULL)
1250 goto _out;
1251 g_variant_get (_ret,
1252 "()");
1253 g_variant_unref (_ret);
1254_out:
1255 return _ret != NULL;
1256}
1257
1258/**
1259 * sensor_integer_call_set_value_sync:
1260 * @proxy: A #SensorIntegerProxy.
1261 * @arg_value: Argument to pass with the method invocation.
1262 * @cancellable: (allow-none): A #GCancellable or %NULL.
1263 * @error: Return location for error or %NULL.
1264 *
1265 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1266 *
1267 * See sensor_integer_call_set_value() for the asynchronous version of this method.
1268 *
1269 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1270 */
1271gboolean
1272sensor_integer_call_set_value_sync (
1273 SensorInteger *proxy,
1274 gint arg_value,
1275 GCancellable *cancellable,
1276 GError **error)
1277{
1278 GVariant *_ret;
1279 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1280 "setValue",
1281 g_variant_new ("(i)",
1282 arg_value),
1283 G_DBUS_CALL_FLAGS_NONE,
1284 -1,
1285 cancellable,
1286 error);
1287 if (_ret == NULL)
1288 goto _out;
1289 g_variant_get (_ret,
1290 "()");
1291 g_variant_unref (_ret);
1292_out:
1293 return _ret != NULL;
1294}
1295
1296/**
1297 * sensor_integer_call_get_units:
1298 * @proxy: A #SensorIntegerProxy.
1299 * @cancellable: (allow-none): A #GCancellable or %NULL.
1300 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1301 * @user_data: User data to pass to @callback.
1302 *
1303 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method on @proxy.
1304 * 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.
1305 * You can then call sensor_integer_call_get_units_finish() to get the result of the operation.
1306 *
1307 * See sensor_integer_call_get_units_sync() for the synchronous, blocking version of this method.
1308 */
1309void
1310sensor_integer_call_get_units (
1311 SensorInteger *proxy,
1312 GCancellable *cancellable,
1313 GAsyncReadyCallback callback,
1314 gpointer user_data)
1315{
1316 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1317 "getUnits",
1318 g_variant_new ("()"),
1319 G_DBUS_CALL_FLAGS_NONE,
1320 -1,
1321 cancellable,
1322 callback,
1323 user_data);
1324}
1325
1326/**
1327 * sensor_integer_call_get_units_finish:
1328 * @proxy: A #SensorIntegerProxy.
1329 * @out_units: (out): Return location for return parameter or %NULL to ignore.
1330 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_units().
1331 * @error: Return location for error or %NULL.
1332 *
1333 * Finishes an operation started with sensor_integer_call_get_units().
1334 *
1335 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1336 */
1337gboolean
1338sensor_integer_call_get_units_finish (
1339 SensorInteger *proxy,
1340 gchar **out_units,
1341 GAsyncResult *res,
1342 GError **error)
1343{
1344 GVariant *_ret;
1345 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1346 if (_ret == NULL)
1347 goto _out;
1348 g_variant_get (_ret,
1349 "(s)",
1350 out_units);
1351 g_variant_unref (_ret);
1352_out:
1353 return _ret != NULL;
1354}
1355
1356/**
1357 * sensor_integer_call_get_units_sync:
1358 * @proxy: A #SensorIntegerProxy.
1359 * @out_units: (out): Return location for return parameter or %NULL to ignore.
1360 * @cancellable: (allow-none): A #GCancellable or %NULL.
1361 * @error: Return location for error or %NULL.
1362 *
1363 * 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.
1364 *
1365 * See sensor_integer_call_get_units() for the asynchronous version of this method.
1366 *
1367 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1368 */
1369gboolean
1370sensor_integer_call_get_units_sync (
1371 SensorInteger *proxy,
1372 gchar **out_units,
1373 GCancellable *cancellable,
1374 GError **error)
1375{
1376 GVariant *_ret;
1377 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1378 "getUnits",
1379 g_variant_new ("()"),
1380 G_DBUS_CALL_FLAGS_NONE,
1381 -1,
1382 cancellable,
1383 error);
1384 if (_ret == NULL)
1385 goto _out;
1386 g_variant_get (_ret,
1387 "(s)",
1388 out_units);
1389 g_variant_unref (_ret);
1390_out:
1391 return _ret != NULL;
1392}
1393
1394/**
1395 * sensor_integer_call_set_poll_interval:
1396 * @proxy: A #SensorIntegerProxy.
1397 * @arg_poll_interval: Argument to pass with the method invocation.
1398 * @cancellable: (allow-none): A #GCancellable or %NULL.
1399 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1400 * @user_data: User data to pass to @callback.
1401 *
1402 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method on @proxy.
1403 * 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.
1404 * You can then call sensor_integer_call_set_poll_interval_finish() to get the result of the operation.
1405 *
1406 * See sensor_integer_call_set_poll_interval_sync() for the synchronous, blocking version of this method.
1407 */
1408void
1409sensor_integer_call_set_poll_interval (
1410 SensorInteger *proxy,
1411 gint arg_poll_interval,
1412 GCancellable *cancellable,
1413 GAsyncReadyCallback callback,
1414 gpointer user_data)
1415{
1416 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1417 "setPollInterval",
1418 g_variant_new ("(i)",
1419 arg_poll_interval),
1420 G_DBUS_CALL_FLAGS_NONE,
1421 -1,
1422 cancellable,
1423 callback,
1424 user_data);
1425}
1426
1427/**
1428 * sensor_integer_call_set_poll_interval_finish:
1429 * @proxy: A #SensorIntegerProxy.
1430 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_poll_interval().
1431 * @error: Return location for error or %NULL.
1432 *
1433 * Finishes an operation started with sensor_integer_call_set_poll_interval().
1434 *
1435 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1436 */
1437gboolean
1438sensor_integer_call_set_poll_interval_finish (
1439 SensorInteger *proxy,
1440 GAsyncResult *res,
1441 GError **error)
1442{
1443 GVariant *_ret;
1444 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1445 if (_ret == NULL)
1446 goto _out;
1447 g_variant_get (_ret,
1448 "()");
1449 g_variant_unref (_ret);
1450_out:
1451 return _ret != NULL;
1452}
1453
1454/**
1455 * sensor_integer_call_set_poll_interval_sync:
1456 * @proxy: A #SensorIntegerProxy.
1457 * @arg_poll_interval: Argument to pass with the method invocation.
1458 * @cancellable: (allow-none): A #GCancellable or %NULL.
1459 * @error: Return location for error or %NULL.
1460 *
1461 * 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.
1462 *
1463 * See sensor_integer_call_set_poll_interval() for the asynchronous version of this method.
1464 *
1465 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1466 */
1467gboolean
1468sensor_integer_call_set_poll_interval_sync (
1469 SensorInteger *proxy,
1470 gint arg_poll_interval,
1471 GCancellable *cancellable,
1472 GError **error)
1473{
1474 GVariant *_ret;
1475 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1476 "setPollInterval",
1477 g_variant_new ("(i)",
1478 arg_poll_interval),
1479 G_DBUS_CALL_FLAGS_NONE,
1480 -1,
1481 cancellable,
1482 error);
1483 if (_ret == NULL)
1484 goto _out;
1485 g_variant_get (_ret,
1486 "()");
1487 g_variant_unref (_ret);
1488_out:
1489 return _ret != NULL;
1490}
1491
1492/**
1493 * sensor_integer_call_set_config_data:
1494 * @proxy: A #SensorIntegerProxy.
1495 * @arg_config: Argument to pass with the method invocation.
1496 * @cancellable: (allow-none): A #GCancellable or %NULL.
1497 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1498 * @user_data: User data to pass to @callback.
1499 *
1500 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setConfigData">setConfigData()</link> D-Bus method on @proxy.
1501 * 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.
1502 * You can then call sensor_integer_call_set_config_data_finish() to get the result of the operation.
1503 *
1504 * See sensor_integer_call_set_config_data_sync() for the synchronous, blocking version of this method.
1505 */
1506void
1507sensor_integer_call_set_config_data (
1508 SensorInteger *proxy,
1509 const gchar *const *arg_config,
1510 GCancellable *cancellable,
1511 GAsyncReadyCallback callback,
1512 gpointer user_data)
1513{
1514 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1515 "setConfigData",
1516 g_variant_new ("(^as)",
1517 arg_config),
1518 G_DBUS_CALL_FLAGS_NONE,
1519 -1,
1520 cancellable,
1521 callback,
1522 user_data);
1523}
1524
1525/**
1526 * sensor_integer_call_set_config_data_finish:
1527 * @proxy: A #SensorIntegerProxy.
1528 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_config_data().
1529 * @error: Return location for error or %NULL.
1530 *
1531 * Finishes an operation started with sensor_integer_call_set_config_data().
1532 *
1533 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1534 */
1535gboolean
1536sensor_integer_call_set_config_data_finish (
1537 SensorInteger *proxy,
1538 GAsyncResult *res,
1539 GError **error)
1540{
1541 GVariant *_ret;
1542 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1543 if (_ret == NULL)
1544 goto _out;
1545 g_variant_get (_ret,
1546 "()");
1547 g_variant_unref (_ret);
1548_out:
1549 return _ret != NULL;
1550}
1551
1552/**
1553 * sensor_integer_call_set_config_data_sync:
1554 * @proxy: A #SensorIntegerProxy.
1555 * @arg_config: Argument to pass with the method invocation.
1556 * @cancellable: (allow-none): A #GCancellable or %NULL.
1557 * @error: Return location for error or %NULL.
1558 *
1559 * 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.
1560 *
1561 * See sensor_integer_call_set_config_data() for the asynchronous version of this method.
1562 *
1563 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1564 */
1565gboolean
1566sensor_integer_call_set_config_data_sync (
1567 SensorInteger *proxy,
1568 const gchar *const *arg_config,
1569 GCancellable *cancellable,
1570 GError **error)
1571{
1572 GVariant *_ret;
1573 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1574 "setConfigData",
1575 g_variant_new ("(^as)",
1576 arg_config),
1577 G_DBUS_CALL_FLAGS_NONE,
1578 -1,
1579 cancellable,
1580 error);
1581 if (_ret == NULL)
1582 goto _out;
1583 g_variant_get (_ret,
1584 "()");
1585 g_variant_unref (_ret);
1586_out:
1587 return _ret != NULL;
1588}
1589
1590/**
Norman James471ab592015-08-30 22:29:40 -05001591 * sensor_integer_complete_init:
1592 * @object: A #SensorInteger.
1593 * @invocation: (transfer full): A #GDBusMethodInvocation.
1594 *
1595 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.init">init()</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.
1596 *
1597 * This method will free @invocation, you cannot use it afterwards.
1598 */
1599void
1600sensor_integer_complete_init (
1601 SensorInteger *object,
1602 GDBusMethodInvocation *invocation)
1603{
1604 g_dbus_method_invocation_return_value (invocation,
1605 g_variant_new ("()"));
1606}
1607
1608/**
Norman Jamesdc95ef72015-08-27 21:27:03 -05001609 * sensor_integer_complete_get_value:
1610 * @object: A #SensorInteger.
1611 * @invocation: (transfer full): A #GDBusMethodInvocation.
1612 * @value: Parameter to return.
1613 *
1614 * 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.
1615 *
1616 * This method will free @invocation, you cannot use it afterwards.
1617 */
1618void
1619sensor_integer_complete_get_value (
1620 SensorInteger *object,
1621 GDBusMethodInvocation *invocation,
1622 gint value)
1623{
1624 g_dbus_method_invocation_return_value (invocation,
1625 g_variant_new ("(i)",
1626 value));
1627}
1628
1629/**
1630 * sensor_integer_complete_set_value:
1631 * @object: A #SensorInteger.
1632 * @invocation: (transfer full): A #GDBusMethodInvocation.
1633 *
1634 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.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.
1635 *
1636 * This method will free @invocation, you cannot use it afterwards.
1637 */
1638void
1639sensor_integer_complete_set_value (
1640 SensorInteger *object,
1641 GDBusMethodInvocation *invocation)
1642{
1643 g_dbus_method_invocation_return_value (invocation,
1644 g_variant_new ("()"));
1645}
1646
1647/**
1648 * sensor_integer_complete_get_units:
1649 * @object: A #SensorInteger.
1650 * @invocation: (transfer full): A #GDBusMethodInvocation.
1651 * @units: Parameter to return.
1652 *
1653 * 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.
1654 *
1655 * This method will free @invocation, you cannot use it afterwards.
1656 */
1657void
1658sensor_integer_complete_get_units (
1659 SensorInteger *object,
1660 GDBusMethodInvocation *invocation,
1661 const gchar *units)
1662{
1663 g_dbus_method_invocation_return_value (invocation,
1664 g_variant_new ("(s)",
1665 units));
1666}
1667
1668/**
1669 * sensor_integer_complete_set_poll_interval:
1670 * @object: A #SensorInteger.
1671 * @invocation: (transfer full): A #GDBusMethodInvocation.
1672 *
1673 * 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.
1674 *
1675 * This method will free @invocation, you cannot use it afterwards.
1676 */
1677void
1678sensor_integer_complete_set_poll_interval (
1679 SensorInteger *object,
1680 GDBusMethodInvocation *invocation)
1681{
1682 g_dbus_method_invocation_return_value (invocation,
1683 g_variant_new ("()"));
1684}
1685
1686/**
1687 * sensor_integer_complete_set_config_data:
1688 * @object: A #SensorInteger.
1689 * @invocation: (transfer full): A #GDBusMethodInvocation.
1690 *
1691 * 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.
1692 *
1693 * This method will free @invocation, you cannot use it afterwards.
1694 */
1695void
1696sensor_integer_complete_set_config_data (
1697 SensorInteger *object,
1698 GDBusMethodInvocation *invocation)
1699{
1700 g_dbus_method_invocation_return_value (invocation,
1701 g_variant_new ("()"));
1702}
1703
1704/* ------------------------------------------------------------------------ */
1705
1706/**
1707 * SensorIntegerProxy:
1708 *
1709 * The #SensorIntegerProxy structure contains only private data and should only be accessed using the provided API.
1710 */
1711
1712/**
1713 * SensorIntegerProxyClass:
1714 * @parent_class: The parent class.
1715 *
1716 * Class structure for #SensorIntegerProxy.
1717 */
1718
1719struct _SensorIntegerProxyPrivate
1720{
1721 GData *qdata;
1722};
1723
1724static void sensor_integer_proxy_iface_init (SensorIntegerIface *iface);
1725
1726#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1727G_DEFINE_TYPE_WITH_CODE (SensorIntegerProxy, sensor_integer_proxy, G_TYPE_DBUS_PROXY,
1728 G_ADD_PRIVATE (SensorIntegerProxy)
1729 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_proxy_iface_init));
1730
1731#else
1732G_DEFINE_TYPE_WITH_CODE (SensorIntegerProxy, sensor_integer_proxy, G_TYPE_DBUS_PROXY,
1733 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_proxy_iface_init));
1734
1735#endif
1736static void
1737sensor_integer_proxy_finalize (GObject *object)
1738{
1739 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1740 g_datalist_clear (&proxy->priv->qdata);
1741 G_OBJECT_CLASS (sensor_integer_proxy_parent_class)->finalize (object);
1742}
1743
1744static void
1745sensor_integer_proxy_get_property (GObject *object,
1746 guint prop_id,
1747 GValue *value,
1748 GParamSpec *pspec G_GNUC_UNUSED)
1749{
1750 const _ExtendedGDBusPropertyInfo *info;
1751 GVariant *variant;
1752 g_assert (prop_id != 0 && prop_id - 1 < 5);
1753 info = _sensor_integer_property_info_pointers[prop_id - 1];
1754 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1755 if (info->use_gvariant)
1756 {
1757 g_value_set_variant (value, variant);
1758 }
1759 else
1760 {
1761 if (variant != NULL)
1762 g_dbus_gvariant_to_gvalue (variant, value);
1763 }
1764 if (variant != NULL)
1765 g_variant_unref (variant);
1766}
1767
1768static void
1769sensor_integer_proxy_set_property_cb (GDBusProxy *proxy,
1770 GAsyncResult *res,
1771 gpointer user_data)
1772{
1773 const _ExtendedGDBusPropertyInfo *info = user_data;
1774 GError *error;
1775 GVariant *_ret;
1776 error = NULL;
1777 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1778 if (!_ret)
1779 {
1780 g_warning ("Error setting property '%s' on interface org.openbmc.SensorInteger: %s (%s, %d)",
1781 info->parent_struct.name,
1782 error->message, g_quark_to_string (error->domain), error->code);
1783 g_error_free (error);
1784 }
1785 else
1786 {
1787 g_variant_unref (_ret);
1788 }
1789}
1790
1791static void
1792sensor_integer_proxy_set_property (GObject *object,
1793 guint prop_id,
1794 const GValue *value,
1795 GParamSpec *pspec G_GNUC_UNUSED)
1796{
1797 const _ExtendedGDBusPropertyInfo *info;
1798 GVariant *variant;
1799 g_assert (prop_id != 0 && prop_id - 1 < 5);
1800 info = _sensor_integer_property_info_pointers[prop_id - 1];
1801 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1802 g_dbus_proxy_call (G_DBUS_PROXY (object),
1803 "org.freedesktop.DBus.Properties.Set",
1804 g_variant_new ("(ssv)", "org.openbmc.SensorInteger", info->parent_struct.name, variant),
1805 G_DBUS_CALL_FLAGS_NONE,
1806 -1,
1807 NULL, (GAsyncReadyCallback) sensor_integer_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1808 g_variant_unref (variant);
1809}
1810
1811static void
1812sensor_integer_proxy_g_signal (GDBusProxy *proxy,
1813 const gchar *sender_name G_GNUC_UNUSED,
1814 const gchar *signal_name,
1815 GVariant *parameters)
1816{
1817 _ExtendedGDBusSignalInfo *info;
1818 GVariantIter iter;
1819 GVariant *child;
1820 GValue *paramv;
1821 guint num_params;
1822 guint n;
1823 guint signal_id;
1824 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, signal_name);
1825 if (info == NULL)
1826 return;
1827 num_params = g_variant_n_children (parameters);
1828 paramv = g_new0 (GValue, num_params + 1);
1829 g_value_init (&paramv[0], TYPE_SENSOR_INTEGER);
1830 g_value_set_object (&paramv[0], proxy);
1831 g_variant_iter_init (&iter, parameters);
1832 n = 1;
1833 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1834 {
1835 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1836 if (arg_info->use_gvariant)
1837 {
1838 g_value_init (&paramv[n], G_TYPE_VARIANT);
1839 g_value_set_variant (&paramv[n], child);
1840 n++;
1841 }
1842 else
1843 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1844 g_variant_unref (child);
1845 }
1846 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER);
1847 g_signal_emitv (paramv, signal_id, 0, NULL);
1848 for (n = 0; n < num_params + 1; n++)
1849 g_value_unset (&paramv[n]);
1850 g_free (paramv);
1851}
1852
1853static void
1854sensor_integer_proxy_g_properties_changed (GDBusProxy *_proxy,
1855 GVariant *changed_properties,
1856 const gchar *const *invalidated_properties)
1857{
1858 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (_proxy);
1859 guint n;
1860 const gchar *key;
1861 GVariantIter *iter;
1862 _ExtendedGDBusPropertyInfo *info;
1863 g_variant_get (changed_properties, "a{sv}", &iter);
1864 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1865 {
1866 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, key);
1867 g_datalist_remove_data (&proxy->priv->qdata, key);
1868 if (info != NULL)
1869 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1870 }
1871 g_variant_iter_free (iter);
1872 for (n = 0; invalidated_properties[n] != NULL; n++)
1873 {
1874 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, invalidated_properties[n]);
1875 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1876 if (info != NULL)
1877 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1878 }
1879}
1880
1881static gint
1882sensor_integer_proxy_get_value (SensorInteger *object)
1883{
1884 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1885 GVariant *variant;
1886 gint value = 0;
1887 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
1888 if (variant != NULL)
1889 {
1890 value = g_variant_get_int32 (variant);
1891 g_variant_unref (variant);
1892 }
1893 return value;
1894}
1895
1896static const gchar *
1897sensor_integer_proxy_get_units (SensorInteger *object)
1898{
1899 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1900 GVariant *variant;
1901 const gchar *value = NULL;
1902 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
1903 if (variant != NULL)
1904 {
1905 value = g_variant_get_string (variant, NULL);
1906 g_variant_unref (variant);
1907 }
1908 return value;
1909}
1910
1911static gint
1912sensor_integer_proxy_get_poll_interval (SensorInteger *object)
1913{
1914 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1915 GVariant *variant;
1916 gint value = 0;
1917 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
1918 if (variant != NULL)
1919 {
1920 value = g_variant_get_int32 (variant);
1921 g_variant_unref (variant);
1922 }
1923 return value;
1924}
1925
1926static const gchar *const *
1927sensor_integer_proxy_get_config_data (SensorInteger *object)
1928{
1929 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1930 GVariant *variant;
1931 const gchar *const *value = NULL;
1932 value = g_datalist_get_data (&proxy->priv->qdata, "config_data");
1933 if (value != NULL)
1934 return value;
1935 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "config_data");
1936 if (variant != NULL)
1937 {
1938 value = g_variant_get_strv (variant, NULL);
1939 g_datalist_set_data_full (&proxy->priv->qdata, "config_data", (gpointer) value, g_free);
1940 g_variant_unref (variant);
1941 }
1942 return value;
1943}
1944
1945static gint
1946sensor_integer_proxy_get_heatbeat (SensorInteger *object)
1947{
1948 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1949 GVariant *variant;
1950 gint value = 0;
1951 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
1952 if (variant != NULL)
1953 {
1954 value = g_variant_get_int32 (variant);
1955 g_variant_unref (variant);
1956 }
1957 return value;
1958}
1959
1960static void
1961sensor_integer_proxy_init (SensorIntegerProxy *proxy)
1962{
1963#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1964 proxy->priv = sensor_integer_proxy_get_instance_private (proxy);
1965#else
1966 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_PROXY, SensorIntegerProxyPrivate);
1967#endif
1968
1969 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_interface_info ());
1970}
1971
1972static void
1973sensor_integer_proxy_class_init (SensorIntegerProxyClass *klass)
1974{
1975 GObjectClass *gobject_class;
1976 GDBusProxyClass *proxy_class;
1977
1978 gobject_class = G_OBJECT_CLASS (klass);
1979 gobject_class->finalize = sensor_integer_proxy_finalize;
1980 gobject_class->get_property = sensor_integer_proxy_get_property;
1981 gobject_class->set_property = sensor_integer_proxy_set_property;
1982
1983 proxy_class = G_DBUS_PROXY_CLASS (klass);
1984 proxy_class->g_signal = sensor_integer_proxy_g_signal;
1985 proxy_class->g_properties_changed = sensor_integer_proxy_g_properties_changed;
1986
1987 sensor_integer_override_properties (gobject_class, 1);
1988
1989#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1990 g_type_class_add_private (klass, sizeof (SensorIntegerProxyPrivate));
1991#endif
1992}
1993
1994static void
1995sensor_integer_proxy_iface_init (SensorIntegerIface *iface)
1996{
1997 iface->get_value = sensor_integer_proxy_get_value;
1998 iface->get_units = sensor_integer_proxy_get_units;
1999 iface->get_poll_interval = sensor_integer_proxy_get_poll_interval;
2000 iface->get_config_data = sensor_integer_proxy_get_config_data;
2001 iface->get_heatbeat = sensor_integer_proxy_get_heatbeat;
2002}
2003
2004/**
2005 * sensor_integer_proxy_new:
2006 * @connection: A #GDBusConnection.
2007 * @flags: Flags from the #GDBusProxyFlags enumeration.
2008 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2009 * @object_path: An object path.
2010 * @cancellable: (allow-none): A #GCancellable or %NULL.
2011 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2012 * @user_data: User data to pass to @callback.
2013 *
2014 * 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.
2015 *
2016 * 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.
2017 * You can then call sensor_integer_proxy_new_finish() to get the result of the operation.
2018 *
2019 * See sensor_integer_proxy_new_sync() for the synchronous, blocking version of this constructor.
2020 */
2021void
2022sensor_integer_proxy_new (
2023 GDBusConnection *connection,
2024 GDBusProxyFlags flags,
2025 const gchar *name,
2026 const gchar *object_path,
2027 GCancellable *cancellable,
2028 GAsyncReadyCallback callback,
2029 gpointer user_data)
2030{
2031 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);
2032}
2033
2034/**
2035 * sensor_integer_proxy_new_finish:
2036 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_proxy_new().
2037 * @error: Return location for error or %NULL
2038 *
2039 * Finishes an operation started with sensor_integer_proxy_new().
2040 *
2041 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
2042 */
2043SensorInteger *
2044sensor_integer_proxy_new_finish (
2045 GAsyncResult *res,
2046 GError **error)
2047{
2048 GObject *ret;
2049 GObject *source_object;
2050 source_object = g_async_result_get_source_object (res);
2051 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2052 g_object_unref (source_object);
2053 if (ret != NULL)
2054 return SENSOR_INTEGER (ret);
2055 else
2056 return NULL;
2057}
2058
2059/**
2060 * sensor_integer_proxy_new_sync:
2061 * @connection: A #GDBusConnection.
2062 * @flags: Flags from the #GDBusProxyFlags enumeration.
2063 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2064 * @object_path: An object path.
2065 * @cancellable: (allow-none): A #GCancellable or %NULL.
2066 * @error: Return location for error or %NULL
2067 *
2068 * 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.
2069 *
2070 * The calling thread is blocked until a reply is received.
2071 *
2072 * See sensor_integer_proxy_new() for the asynchronous version of this constructor.
2073 *
2074 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
2075 */
2076SensorInteger *
2077sensor_integer_proxy_new_sync (
2078 GDBusConnection *connection,
2079 GDBusProxyFlags flags,
2080 const gchar *name,
2081 const gchar *object_path,
2082 GCancellable *cancellable,
2083 GError **error)
2084{
2085 GInitable *ret;
2086 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);
2087 if (ret != NULL)
2088 return SENSOR_INTEGER (ret);
2089 else
2090 return NULL;
2091}
2092
2093
2094/**
2095 * sensor_integer_proxy_new_for_bus:
2096 * @bus_type: A #GBusType.
2097 * @flags: Flags from the #GDBusProxyFlags enumeration.
2098 * @name: A bus name (well-known or unique).
2099 * @object_path: An object path.
2100 * @cancellable: (allow-none): A #GCancellable or %NULL.
2101 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2102 * @user_data: User data to pass to @callback.
2103 *
2104 * Like sensor_integer_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2105 *
2106 * 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.
2107 * You can then call sensor_integer_proxy_new_for_bus_finish() to get the result of the operation.
2108 *
2109 * See sensor_integer_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2110 */
2111void
2112sensor_integer_proxy_new_for_bus (
2113 GBusType bus_type,
2114 GDBusProxyFlags flags,
2115 const gchar *name,
2116 const gchar *object_path,
2117 GCancellable *cancellable,
2118 GAsyncReadyCallback callback,
2119 gpointer user_data)
2120{
2121 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);
2122}
2123
2124/**
2125 * sensor_integer_proxy_new_for_bus_finish:
2126 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_proxy_new_for_bus().
2127 * @error: Return location for error or %NULL
2128 *
2129 * Finishes an operation started with sensor_integer_proxy_new_for_bus().
2130 *
2131 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
2132 */
2133SensorInteger *
2134sensor_integer_proxy_new_for_bus_finish (
2135 GAsyncResult *res,
2136 GError **error)
2137{
2138 GObject *ret;
2139 GObject *source_object;
2140 source_object = g_async_result_get_source_object (res);
2141 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2142 g_object_unref (source_object);
2143 if (ret != NULL)
2144 return SENSOR_INTEGER (ret);
2145 else
2146 return NULL;
2147}
2148
2149/**
2150 * sensor_integer_proxy_new_for_bus_sync:
2151 * @bus_type: A #GBusType.
2152 * @flags: Flags from the #GDBusProxyFlags enumeration.
2153 * @name: A bus name (well-known or unique).
2154 * @object_path: An object path.
2155 * @cancellable: (allow-none): A #GCancellable or %NULL.
2156 * @error: Return location for error or %NULL
2157 *
2158 * Like sensor_integer_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2159 *
2160 * The calling thread is blocked until a reply is received.
2161 *
2162 * See sensor_integer_proxy_new_for_bus() for the asynchronous version of this constructor.
2163 *
2164 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
2165 */
2166SensorInteger *
2167sensor_integer_proxy_new_for_bus_sync (
2168 GBusType bus_type,
2169 GDBusProxyFlags flags,
2170 const gchar *name,
2171 const gchar *object_path,
2172 GCancellable *cancellable,
2173 GError **error)
2174{
2175 GInitable *ret;
2176 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);
2177 if (ret != NULL)
2178 return SENSOR_INTEGER (ret);
2179 else
2180 return NULL;
2181}
2182
2183
2184/* ------------------------------------------------------------------------ */
2185
2186/**
2187 * SensorIntegerSkeleton:
2188 *
2189 * The #SensorIntegerSkeleton structure contains only private data and should only be accessed using the provided API.
2190 */
2191
2192/**
2193 * SensorIntegerSkeletonClass:
2194 * @parent_class: The parent class.
2195 *
2196 * Class structure for #SensorIntegerSkeleton.
2197 */
2198
2199struct _SensorIntegerSkeletonPrivate
2200{
2201 GValue *properties;
2202 GList *changed_properties;
2203 GSource *changed_properties_idle_source;
2204 GMainContext *context;
2205 GMutex lock;
2206};
2207
2208static void
2209_sensor_integer_skeleton_handle_method_call (
2210 GDBusConnection *connection G_GNUC_UNUSED,
2211 const gchar *sender G_GNUC_UNUSED,
2212 const gchar *object_path G_GNUC_UNUSED,
2213 const gchar *interface_name,
2214 const gchar *method_name,
2215 GVariant *parameters,
2216 GDBusMethodInvocation *invocation,
2217 gpointer user_data)
2218{
2219 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2220 _ExtendedGDBusMethodInfo *info;
2221 GVariantIter iter;
2222 GVariant *child;
2223 GValue *paramv;
2224 guint num_params;
2225 guint num_extra;
2226 guint n;
2227 guint signal_id;
2228 GValue return_value = G_VALUE_INIT;
2229 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2230 g_assert (info != NULL);
2231 num_params = g_variant_n_children (parameters);
2232 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
2233 n = 0;
2234 g_value_init (&paramv[n], TYPE_SENSOR_INTEGER);
2235 g_value_set_object (&paramv[n++], skeleton);
2236 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
2237 g_value_set_object (&paramv[n++], invocation);
2238 if (info->pass_fdlist)
2239 {
2240#ifdef G_OS_UNIX
2241 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
2242 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
2243#else
2244 g_assert_not_reached ();
2245#endif
2246 }
2247 g_variant_iter_init (&iter, parameters);
2248 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2249 {
2250 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
2251 if (arg_info->use_gvariant)
2252 {
2253 g_value_init (&paramv[n], G_TYPE_VARIANT);
2254 g_value_set_variant (&paramv[n], child);
2255 n++;
2256 }
2257 else
2258 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2259 g_variant_unref (child);
2260 }
2261 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER);
2262 g_value_init (&return_value, G_TYPE_BOOLEAN);
2263 g_signal_emitv (paramv, signal_id, 0, &return_value);
2264 if (!g_value_get_boolean (&return_value))
2265 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);
2266 g_value_unset (&return_value);
2267 for (n = 0; n < num_params + num_extra; n++)
2268 g_value_unset (&paramv[n]);
2269 g_free (paramv);
2270}
2271
2272static GVariant *
2273_sensor_integer_skeleton_handle_get_property (
2274 GDBusConnection *connection G_GNUC_UNUSED,
2275 const gchar *sender G_GNUC_UNUSED,
2276 const gchar *object_path G_GNUC_UNUSED,
2277 const gchar *interface_name G_GNUC_UNUSED,
2278 const gchar *property_name,
2279 GError **error,
2280 gpointer user_data)
2281{
2282 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2283 GValue value = G_VALUE_INIT;
2284 GParamSpec *pspec;
2285 _ExtendedGDBusPropertyInfo *info;
2286 GVariant *ret;
2287 ret = NULL;
2288 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, property_name);
2289 g_assert (info != NULL);
2290 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2291 if (pspec == NULL)
2292 {
2293 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2294 }
2295 else
2296 {
2297 g_value_init (&value, pspec->value_type);
2298 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2299 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2300 g_value_unset (&value);
2301 }
2302 return ret;
2303}
2304
2305static gboolean
2306_sensor_integer_skeleton_handle_set_property (
2307 GDBusConnection *connection G_GNUC_UNUSED,
2308 const gchar *sender G_GNUC_UNUSED,
2309 const gchar *object_path G_GNUC_UNUSED,
2310 const gchar *interface_name G_GNUC_UNUSED,
2311 const gchar *property_name,
2312 GVariant *variant,
2313 GError **error,
2314 gpointer user_data)
2315{
2316 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2317 GValue value = G_VALUE_INIT;
2318 GParamSpec *pspec;
2319 _ExtendedGDBusPropertyInfo *info;
2320 gboolean ret;
2321 ret = FALSE;
2322 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, property_name);
2323 g_assert (info != NULL);
2324 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2325 if (pspec == NULL)
2326 {
2327 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2328 }
2329 else
2330 {
2331 if (info->use_gvariant)
2332 g_value_set_variant (&value, variant);
2333 else
2334 g_dbus_gvariant_to_gvalue (variant, &value);
2335 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2336 g_value_unset (&value);
2337 ret = TRUE;
2338 }
2339 return ret;
2340}
2341
2342static const GDBusInterfaceVTable _sensor_integer_skeleton_vtable =
2343{
2344 _sensor_integer_skeleton_handle_method_call,
2345 _sensor_integer_skeleton_handle_get_property,
2346 _sensor_integer_skeleton_handle_set_property,
2347 {NULL}
2348};
2349
2350static GDBusInterfaceInfo *
2351sensor_integer_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2352{
2353 return sensor_integer_interface_info ();
2354}
2355
2356static GDBusInterfaceVTable *
2357sensor_integer_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2358{
2359 return (GDBusInterfaceVTable *) &_sensor_integer_skeleton_vtable;
2360}
2361
2362static GVariant *
2363sensor_integer_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2364{
2365 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (_skeleton);
2366
2367 GVariantBuilder builder;
2368 guint n;
2369 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2370 if (_sensor_integer_interface_info.parent_struct.properties == NULL)
2371 goto out;
2372 for (n = 0; _sensor_integer_interface_info.parent_struct.properties[n] != NULL; n++)
2373 {
2374 GDBusPropertyInfo *info = _sensor_integer_interface_info.parent_struct.properties[n];
2375 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2376 {
2377 GVariant *value;
2378 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);
2379 if (value != NULL)
2380 {
2381 g_variant_take_ref (value);
2382 g_variant_builder_add (&builder, "{sv}", info->name, value);
2383 g_variant_unref (value);
2384 }
2385 }
2386 }
2387out:
2388 return g_variant_builder_end (&builder);
2389}
2390
2391static gboolean _sensor_integer_emit_changed (gpointer user_data);
2392
2393static void
2394sensor_integer_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2395{
2396 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (_skeleton);
2397 gboolean emit_changed = FALSE;
2398
2399 g_mutex_lock (&skeleton->priv->lock);
2400 if (skeleton->priv->changed_properties_idle_source != NULL)
2401 {
2402 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2403 skeleton->priv->changed_properties_idle_source = NULL;
2404 emit_changed = TRUE;
2405 }
2406 g_mutex_unlock (&skeleton->priv->lock);
2407
2408 if (emit_changed)
2409 _sensor_integer_emit_changed (skeleton);
2410}
2411
2412static void
2413_sensor_integer_on_signal_changed (
2414 SensorInteger *object,
2415 gint arg_value)
2416{
2417 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2418
2419 GList *connections, *l;
2420 GVariant *signal_variant;
2421 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2422
2423 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
2424 arg_value));
2425 for (l = connections; l != NULL; l = l->next)
2426 {
2427 GDBusConnection *connection = l->data;
2428 g_dbus_connection_emit_signal (connection,
2429 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Changed",
2430 signal_variant, NULL);
2431 }
2432 g_variant_unref (signal_variant);
2433 g_list_free_full (connections, g_object_unref);
2434}
2435
2436static void
2437_sensor_integer_on_signal_heartbeat (
2438 SensorInteger *object,
2439 const gchar *arg_bus_name)
2440{
2441 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2442
2443 GList *connections, *l;
2444 GVariant *signal_variant;
2445 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2446
2447 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
2448 arg_bus_name));
2449 for (l = connections; l != NULL; l = l->next)
2450 {
2451 GDBusConnection *connection = l->data;
2452 g_dbus_connection_emit_signal (connection,
2453 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Heartbeat",
2454 signal_variant, NULL);
2455 }
2456 g_variant_unref (signal_variant);
2457 g_list_free_full (connections, g_object_unref);
2458}
2459
2460static void sensor_integer_skeleton_iface_init (SensorIntegerIface *iface);
2461#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2462G_DEFINE_TYPE_WITH_CODE (SensorIntegerSkeleton, sensor_integer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2463 G_ADD_PRIVATE (SensorIntegerSkeleton)
2464 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_skeleton_iface_init));
2465
2466#else
2467G_DEFINE_TYPE_WITH_CODE (SensorIntegerSkeleton, sensor_integer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2468 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_skeleton_iface_init));
2469
2470#endif
2471static void
2472sensor_integer_skeleton_finalize (GObject *object)
2473{
2474 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2475 guint n;
2476 for (n = 0; n < 5; n++)
2477 g_value_unset (&skeleton->priv->properties[n]);
2478 g_free (skeleton->priv->properties);
2479 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2480 if (skeleton->priv->changed_properties_idle_source != NULL)
2481 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2482 g_main_context_unref (skeleton->priv->context);
2483 g_mutex_clear (&skeleton->priv->lock);
2484 G_OBJECT_CLASS (sensor_integer_skeleton_parent_class)->finalize (object);
2485}
2486
2487static void
2488sensor_integer_skeleton_get_property (GObject *object,
2489 guint prop_id,
2490 GValue *value,
2491 GParamSpec *pspec G_GNUC_UNUSED)
2492{
2493 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2494 g_assert (prop_id != 0 && prop_id - 1 < 5);
2495 g_mutex_lock (&skeleton->priv->lock);
2496 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
2497 g_mutex_unlock (&skeleton->priv->lock);
2498}
2499
2500static gboolean
2501_sensor_integer_emit_changed (gpointer user_data)
2502{
2503 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2504 GList *l;
2505 GVariantBuilder builder;
2506 GVariantBuilder invalidated_builder;
2507 guint num_changes;
2508
2509 g_mutex_lock (&skeleton->priv->lock);
2510 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2511 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
2512 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
2513 {
2514 ChangedProperty *cp = l->data;
2515 GVariant *variant;
2516 const GValue *cur_value;
2517
2518 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
2519 if (!_g_value_equal (cur_value, &cp->orig_value))
2520 {
2521 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
2522 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
2523 g_variant_unref (variant);
2524 num_changes++;
2525 }
2526 }
2527 if (num_changes > 0)
2528 {
2529 GList *connections, *ll;
2530 GVariant *signal_variant;
2531 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorInteger",
2532 &builder, &invalidated_builder));
2533 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2534 for (ll = connections; ll != NULL; ll = ll->next)
2535 {
2536 GDBusConnection *connection = ll->data;
2537
2538 g_dbus_connection_emit_signal (connection,
2539 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
2540 "org.freedesktop.DBus.Properties",
2541 "PropertiesChanged",
2542 signal_variant,
2543 NULL);
2544 }
2545 g_variant_unref (signal_variant);
2546 g_list_free_full (connections, g_object_unref);
2547 }
2548 else
2549 {
2550 g_variant_builder_clear (&builder);
2551 g_variant_builder_clear (&invalidated_builder);
2552 }
2553 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2554 skeleton->priv->changed_properties = NULL;
2555 skeleton->priv->changed_properties_idle_source = NULL;
2556 g_mutex_unlock (&skeleton->priv->lock);
2557 return FALSE;
2558}
2559
2560static void
2561_sensor_integer_schedule_emit_changed (SensorIntegerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
2562{
2563 ChangedProperty *cp;
2564 GList *l;
2565 cp = NULL;
2566 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
2567 {
2568 ChangedProperty *i_cp = l->data;
2569 if (i_cp->info == info)
2570 {
2571 cp = i_cp;
2572 break;
2573 }
2574 }
2575 if (cp == NULL)
2576 {
2577 cp = g_new0 (ChangedProperty, 1);
2578 cp->prop_id = prop_id;
2579 cp->info = info;
2580 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
2581 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
2582 g_value_copy (orig_value, &cp->orig_value);
2583 }
2584}
2585
2586static void
2587sensor_integer_skeleton_notify (GObject *object,
2588 GParamSpec *pspec G_GNUC_UNUSED)
2589{
2590 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2591 g_mutex_lock (&skeleton->priv->lock);
2592 if (skeleton->priv->changed_properties != NULL &&
2593 skeleton->priv->changed_properties_idle_source == NULL)
2594 {
2595 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
2596 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
2597 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
2598 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2599 g_source_unref (skeleton->priv->changed_properties_idle_source);
2600 }
2601 g_mutex_unlock (&skeleton->priv->lock);
2602}
2603
2604static void
2605sensor_integer_skeleton_set_property (GObject *object,
2606 guint prop_id,
2607 const GValue *value,
2608 GParamSpec *pspec)
2609{
2610 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2611 g_assert (prop_id != 0 && prop_id - 1 < 5);
2612 g_mutex_lock (&skeleton->priv->lock);
2613 g_object_freeze_notify (object);
2614 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2615 {
2616 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
2617 _sensor_integer_schedule_emit_changed (skeleton, _sensor_integer_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
2618 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2619 g_object_notify_by_pspec (object, pspec);
2620 }
2621 g_mutex_unlock (&skeleton->priv->lock);
2622 g_object_thaw_notify (object);
2623}
2624
2625static void
2626sensor_integer_skeleton_init (SensorIntegerSkeleton *skeleton)
2627{
2628#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2629 skeleton->priv = sensor_integer_skeleton_get_instance_private (skeleton);
2630#else
2631 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_SKELETON, SensorIntegerSkeletonPrivate);
2632#endif
2633
2634 g_mutex_init (&skeleton->priv->lock);
2635 skeleton->priv->context = g_main_context_ref_thread_default ();
2636 skeleton->priv->properties = g_new0 (GValue, 5);
2637 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
2638 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
2639 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
2640 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRV);
2641 g_value_init (&skeleton->priv->properties[4], G_TYPE_INT);
2642}
2643
2644static gint
2645sensor_integer_skeleton_get_value (SensorInteger *object)
2646{
2647 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2648 gint value;
2649 g_mutex_lock (&skeleton->priv->lock);
2650 value = g_value_get_int (&(skeleton->priv->properties[0]));
2651 g_mutex_unlock (&skeleton->priv->lock);
2652 return value;
2653}
2654
2655static const gchar *
2656sensor_integer_skeleton_get_units (SensorInteger *object)
2657{
2658 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2659 const gchar *value;
2660 g_mutex_lock (&skeleton->priv->lock);
2661 value = g_value_get_string (&(skeleton->priv->properties[1]));
2662 g_mutex_unlock (&skeleton->priv->lock);
2663 return value;
2664}
2665
2666static gint
2667sensor_integer_skeleton_get_poll_interval (SensorInteger *object)
2668{
2669 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2670 gint value;
2671 g_mutex_lock (&skeleton->priv->lock);
2672 value = g_value_get_int (&(skeleton->priv->properties[2]));
2673 g_mutex_unlock (&skeleton->priv->lock);
2674 return value;
2675}
2676
2677static const gchar *const *
2678sensor_integer_skeleton_get_config_data (SensorInteger *object)
2679{
2680 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2681 const gchar *const *value;
2682 g_mutex_lock (&skeleton->priv->lock);
2683 value = g_value_get_boxed (&(skeleton->priv->properties[3]));
2684 g_mutex_unlock (&skeleton->priv->lock);
2685 return value;
2686}
2687
2688static gint
2689sensor_integer_skeleton_get_heatbeat (SensorInteger *object)
2690{
2691 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2692 gint value;
2693 g_mutex_lock (&skeleton->priv->lock);
2694 value = g_value_get_int (&(skeleton->priv->properties[4]));
2695 g_mutex_unlock (&skeleton->priv->lock);
2696 return value;
2697}
2698
2699static void
2700sensor_integer_skeleton_class_init (SensorIntegerSkeletonClass *klass)
2701{
2702 GObjectClass *gobject_class;
2703 GDBusInterfaceSkeletonClass *skeleton_class;
2704
2705 gobject_class = G_OBJECT_CLASS (klass);
2706 gobject_class->finalize = sensor_integer_skeleton_finalize;
2707 gobject_class->get_property = sensor_integer_skeleton_get_property;
2708 gobject_class->set_property = sensor_integer_skeleton_set_property;
2709 gobject_class->notify = sensor_integer_skeleton_notify;
2710
2711
2712 sensor_integer_override_properties (gobject_class, 1);
2713
2714 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2715 skeleton_class->get_info = sensor_integer_skeleton_dbus_interface_get_info;
2716 skeleton_class->get_properties = sensor_integer_skeleton_dbus_interface_get_properties;
2717 skeleton_class->flush = sensor_integer_skeleton_dbus_interface_flush;
2718 skeleton_class->get_vtable = sensor_integer_skeleton_dbus_interface_get_vtable;
2719
2720#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2721 g_type_class_add_private (klass, sizeof (SensorIntegerSkeletonPrivate));
2722#endif
2723}
2724
2725static void
2726sensor_integer_skeleton_iface_init (SensorIntegerIface *iface)
2727{
2728 iface->changed = _sensor_integer_on_signal_changed;
2729 iface->heartbeat = _sensor_integer_on_signal_heartbeat;
2730 iface->get_value = sensor_integer_skeleton_get_value;
2731 iface->get_units = sensor_integer_skeleton_get_units;
2732 iface->get_poll_interval = sensor_integer_skeleton_get_poll_interval;
2733 iface->get_config_data = sensor_integer_skeleton_get_config_data;
2734 iface->get_heatbeat = sensor_integer_skeleton_get_heatbeat;
2735}
2736
2737/**
2738 * sensor_integer_skeleton_new:
2739 *
2740 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
2741 *
2742 * Returns: (transfer full) (type SensorIntegerSkeleton): The skeleton object.
2743 */
2744SensorInteger *
2745sensor_integer_skeleton_new (void)
2746{
2747 return SENSOR_INTEGER (g_object_new (TYPE_SENSOR_INTEGER_SKELETON, NULL));
2748}
2749
2750/* ------------------------------------------------------------------------
2751 * Code for interface org.openbmc.SensorString
2752 * ------------------------------------------------------------------------
2753 */
2754
2755/**
2756 * SECTION:SensorString
2757 * @title: SensorString
2758 * @short_description: Generated C code for the org.openbmc.SensorString D-Bus interface
2759 *
2760 * 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.
2761 */
2762
2763/* ---- Introspection data for org.openbmc.SensorString ---- */
2764
2765static const _ExtendedGDBusArgInfo _sensor_string_method_info_get_value_OUT_ARG_value =
2766{
2767 {
2768 -1,
2769 (gchar *) "value",
2770 (gchar *) "s",
2771 NULL
2772 },
2773 FALSE
2774};
2775
2776static const _ExtendedGDBusArgInfo * const _sensor_string_method_info_get_value_OUT_ARG_pointers[] =
2777{
2778 &_sensor_string_method_info_get_value_OUT_ARG_value,
2779 NULL
2780};
2781
2782static const _ExtendedGDBusMethodInfo _sensor_string_method_info_get_value =
2783{
2784 {
2785 -1,
2786 (gchar *) "getValue",
2787 NULL,
2788 (GDBusArgInfo **) &_sensor_string_method_info_get_value_OUT_ARG_pointers,
2789 NULL
2790 },
2791 "handle-get-value",
2792 FALSE
2793};
2794
2795static const _ExtendedGDBusArgInfo _sensor_string_method_info_get_units_OUT_ARG_units =
2796{
2797 {
2798 -1,
2799 (gchar *) "units",
2800 (gchar *) "s",
2801 NULL
2802 },
2803 FALSE
2804};
2805
2806static const _ExtendedGDBusArgInfo * const _sensor_string_method_info_get_units_OUT_ARG_pointers[] =
2807{
2808 &_sensor_string_method_info_get_units_OUT_ARG_units,
2809 NULL
2810};
2811
2812static const _ExtendedGDBusMethodInfo _sensor_string_method_info_get_units =
2813{
2814 {
2815 -1,
2816 (gchar *) "getUnits",
2817 NULL,
2818 (GDBusArgInfo **) &_sensor_string_method_info_get_units_OUT_ARG_pointers,
2819 NULL
2820 },
2821 "handle-get-units",
2822 FALSE
2823};
2824
2825static const _ExtendedGDBusMethodInfo * const _sensor_string_method_info_pointers[] =
2826{
2827 &_sensor_string_method_info_get_value,
2828 &_sensor_string_method_info_get_units,
2829 NULL
2830};
2831
2832static const _ExtendedGDBusArgInfo _sensor_string_signal_info_changed_ARG_value =
2833{
2834 {
2835 -1,
2836 (gchar *) "value",
2837 (gchar *) "s",
2838 NULL
2839 },
2840 FALSE
2841};
2842
2843static const _ExtendedGDBusArgInfo * const _sensor_string_signal_info_changed_ARG_pointers[] =
2844{
2845 &_sensor_string_signal_info_changed_ARG_value,
2846 NULL
2847};
2848
2849static const _ExtendedGDBusSignalInfo _sensor_string_signal_info_changed =
2850{
2851 {
2852 -1,
2853 (gchar *) "Changed",
2854 (GDBusArgInfo **) &_sensor_string_signal_info_changed_ARG_pointers,
2855 NULL
2856 },
2857 "changed"
2858};
2859
2860static const _ExtendedGDBusSignalInfo * const _sensor_string_signal_info_pointers[] =
2861{
2862 &_sensor_string_signal_info_changed,
2863 NULL
2864};
2865
2866static const _ExtendedGDBusPropertyInfo _sensor_string_property_info_value =
2867{
2868 {
2869 -1,
2870 (gchar *) "value",
2871 (gchar *) "i",
2872 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2873 NULL
2874 },
2875 "value",
2876 FALSE
2877};
2878
2879static const _ExtendedGDBusPropertyInfo _sensor_string_property_info_units =
2880{
2881 {
2882 -1,
2883 (gchar *) "units",
2884 (gchar *) "s",
2885 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2886 NULL
2887 },
2888 "units",
2889 FALSE
2890};
2891
2892static const _ExtendedGDBusPropertyInfo * const _sensor_string_property_info_pointers[] =
2893{
2894 &_sensor_string_property_info_value,
2895 &_sensor_string_property_info_units,
2896 NULL
2897};
2898
2899static const _ExtendedGDBusInterfaceInfo _sensor_string_interface_info =
2900{
2901 {
2902 -1,
2903 (gchar *) "org.openbmc.SensorString",
2904 (GDBusMethodInfo **) &_sensor_string_method_info_pointers,
2905 (GDBusSignalInfo **) &_sensor_string_signal_info_pointers,
2906 (GDBusPropertyInfo **) &_sensor_string_property_info_pointers,
2907 NULL
2908 },
2909 "sensor-string",
2910};
2911
2912
2913/**
2914 * sensor_string_interface_info:
2915 *
2916 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> D-Bus interface.
2917 *
2918 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2919 */
2920GDBusInterfaceInfo *
2921sensor_string_interface_info (void)
2922{
2923 return (GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct;
2924}
2925
2926/**
2927 * sensor_string_override_properties:
2928 * @klass: The class structure for a #GObject<!-- -->-derived class.
2929 * @property_id_begin: The property id to assign to the first overridden property.
2930 *
2931 * Overrides all #GObject properties in the #SensorString interface for a concrete class.
2932 * The properties are overridden in the order they are defined.
2933 *
2934 * Returns: The last property id.
2935 */
2936guint
2937sensor_string_override_properties (GObjectClass *klass, guint property_id_begin)
2938{
2939 g_object_class_override_property (klass, property_id_begin++, "value");
2940 g_object_class_override_property (klass, property_id_begin++, "units");
2941 return property_id_begin - 1;
2942}
2943
2944
2945
2946/**
2947 * SensorString:
2948 *
2949 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
2950 */
2951
2952/**
2953 * SensorStringIface:
2954 * @parent_iface: The parent interface.
2955 * @handle_get_units: Handler for the #SensorString::handle-get-units signal.
2956 * @handle_get_value: Handler for the #SensorString::handle-get-value signal.
2957 * @get_units: Getter for the #SensorString:units property.
2958 * @get_value: Getter for the #SensorString:value property.
2959 * @changed: Handler for the #SensorString::changed signal.
2960 *
2961 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
2962 */
2963
2964typedef SensorStringIface SensorStringInterface;
2965G_DEFINE_INTERFACE (SensorString, sensor_string, G_TYPE_OBJECT);
2966
2967static void
2968sensor_string_default_init (SensorStringIface *iface)
2969{
2970 /* GObject signals for incoming D-Bus method calls: */
2971 /**
2972 * SensorString::handle-get-value:
2973 * @object: A #SensorString.
2974 * @invocation: A #GDBusMethodInvocation.
2975 *
2976 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method.
2977 *
2978 * 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.
2979 *
2980 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2981 */
2982 g_signal_new ("handle-get-value",
2983 G_TYPE_FROM_INTERFACE (iface),
2984 G_SIGNAL_RUN_LAST,
2985 G_STRUCT_OFFSET (SensorStringIface, handle_get_value),
2986 g_signal_accumulator_true_handled,
2987 NULL,
2988 g_cclosure_marshal_generic,
2989 G_TYPE_BOOLEAN,
2990 1,
2991 G_TYPE_DBUS_METHOD_INVOCATION);
2992
2993 /**
2994 * SensorString::handle-get-units:
2995 * @object: A #SensorString.
2996 * @invocation: A #GDBusMethodInvocation.
2997 *
2998 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method.
2999 *
3000 * 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.
3001 *
3002 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3003 */
3004 g_signal_new ("handle-get-units",
3005 G_TYPE_FROM_INTERFACE (iface),
3006 G_SIGNAL_RUN_LAST,
3007 G_STRUCT_OFFSET (SensorStringIface, handle_get_units),
3008 g_signal_accumulator_true_handled,
3009 NULL,
3010 g_cclosure_marshal_generic,
3011 G_TYPE_BOOLEAN,
3012 1,
3013 G_TYPE_DBUS_METHOD_INVOCATION);
3014
3015 /* GObject signals for received D-Bus signals: */
3016 /**
3017 * SensorString::changed:
3018 * @object: A #SensorString.
3019 * @arg_value: Argument.
3020 *
3021 * 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.
3022 *
3023 * 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.
3024 */
3025 g_signal_new ("changed",
3026 G_TYPE_FROM_INTERFACE (iface),
3027 G_SIGNAL_RUN_LAST,
3028 G_STRUCT_OFFSET (SensorStringIface, changed),
3029 NULL,
3030 NULL,
3031 g_cclosure_marshal_generic,
3032 G_TYPE_NONE,
3033 1, G_TYPE_STRING);
3034
3035 /* GObject properties for D-Bus properties: */
3036 /**
3037 * SensorString:value:
3038 *
3039 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link>.
3040 *
3041 * 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.
3042 */
3043 g_object_interface_install_property (iface,
3044 g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3045 /**
3046 * SensorString:units:
3047 *
3048 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link>.
3049 *
3050 * 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.
3051 */
3052 g_object_interface_install_property (iface,
3053 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3054}
3055
3056/**
3057 * sensor_string_get_value: (skip)
3058 * @object: A #SensorString.
3059 *
3060 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link> D-Bus property.
3061 *
3062 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3063 *
3064 * Returns: The property value.
3065 */
3066gint
3067sensor_string_get_value (SensorString *object)
3068{
3069 return SENSOR_STRING_GET_IFACE (object)->get_value (object);
3070}
3071
3072/**
3073 * sensor_string_set_value: (skip)
3074 * @object: A #SensorString.
3075 * @value: The value to set.
3076 *
3077 * Sets the <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link> D-Bus property to @value.
3078 *
3079 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3080 */
3081void
3082sensor_string_set_value (SensorString *object, gint value)
3083{
3084 g_object_set (G_OBJECT (object), "value", value, NULL);
3085}
3086
3087/**
3088 * sensor_string_get_units: (skip)
3089 * @object: A #SensorString.
3090 *
3091 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property.
3092 *
3093 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3094 *
3095 * <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>
3096 *
3097 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
3098 */
3099const gchar *
3100sensor_string_get_units (SensorString *object)
3101{
3102 return SENSOR_STRING_GET_IFACE (object)->get_units (object);
3103}
3104
3105/**
3106 * sensor_string_dup_units: (skip)
3107 * @object: A #SensorString.
3108 *
3109 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property.
3110 *
3111 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3112 *
3113 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
3114 */
3115gchar *
3116sensor_string_dup_units (SensorString *object)
3117{
3118 gchar *value;
3119 g_object_get (G_OBJECT (object), "units", &value, NULL);
3120 return value;
3121}
3122
3123/**
3124 * sensor_string_set_units: (skip)
3125 * @object: A #SensorString.
3126 * @value: The value to set.
3127 *
3128 * Sets the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property to @value.
3129 *
3130 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3131 */
3132void
3133sensor_string_set_units (SensorString *object, const gchar *value)
3134{
3135 g_object_set (G_OBJECT (object), "units", value, NULL);
3136}
3137
3138/**
3139 * sensor_string_emit_changed:
3140 * @object: A #SensorString.
3141 * @arg_value: Argument to pass with the signal.
3142 *
3143 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorString.Changed">"Changed"</link> D-Bus signal.
3144 */
3145void
3146sensor_string_emit_changed (
3147 SensorString *object,
3148 const gchar *arg_value)
3149{
3150 g_signal_emit_by_name (object, "changed", arg_value);
3151}
3152
3153/**
3154 * sensor_string_call_get_value:
3155 * @proxy: A #SensorStringProxy.
3156 * @cancellable: (allow-none): A #GCancellable or %NULL.
3157 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3158 * @user_data: User data to pass to @callback.
3159 *
3160 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method on @proxy.
3161 * 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.
3162 * You can then call sensor_string_call_get_value_finish() to get the result of the operation.
3163 *
3164 * See sensor_string_call_get_value_sync() for the synchronous, blocking version of this method.
3165 */
3166void
3167sensor_string_call_get_value (
3168 SensorString *proxy,
3169 GCancellable *cancellable,
3170 GAsyncReadyCallback callback,
3171 gpointer user_data)
3172{
3173 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3174 "getValue",
3175 g_variant_new ("()"),
3176 G_DBUS_CALL_FLAGS_NONE,
3177 -1,
3178 cancellable,
3179 callback,
3180 user_data);
3181}
3182
3183/**
3184 * sensor_string_call_get_value_finish:
3185 * @proxy: A #SensorStringProxy.
3186 * @out_value: (out): Return location for return parameter or %NULL to ignore.
3187 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_call_get_value().
3188 * @error: Return location for error or %NULL.
3189 *
3190 * Finishes an operation started with sensor_string_call_get_value().
3191 *
3192 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3193 */
3194gboolean
3195sensor_string_call_get_value_finish (
3196 SensorString *proxy,
3197 gchar **out_value,
3198 GAsyncResult *res,
3199 GError **error)
3200{
3201 GVariant *_ret;
3202 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3203 if (_ret == NULL)
3204 goto _out;
3205 g_variant_get (_ret,
3206 "(s)",
3207 out_value);
3208 g_variant_unref (_ret);
3209_out:
3210 return _ret != NULL;
3211}
3212
3213/**
3214 * sensor_string_call_get_value_sync:
3215 * @proxy: A #SensorStringProxy.
3216 * @out_value: (out): Return location for return parameter or %NULL to ignore.
3217 * @cancellable: (allow-none): A #GCancellable or %NULL.
3218 * @error: Return location for error or %NULL.
3219 *
3220 * 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.
3221 *
3222 * See sensor_string_call_get_value() for the asynchronous version of this method.
3223 *
3224 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3225 */
3226gboolean
3227sensor_string_call_get_value_sync (
3228 SensorString *proxy,
3229 gchar **out_value,
3230 GCancellable *cancellable,
3231 GError **error)
3232{
3233 GVariant *_ret;
3234 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3235 "getValue",
3236 g_variant_new ("()"),
3237 G_DBUS_CALL_FLAGS_NONE,
3238 -1,
3239 cancellable,
3240 error);
3241 if (_ret == NULL)
3242 goto _out;
3243 g_variant_get (_ret,
3244 "(s)",
3245 out_value);
3246 g_variant_unref (_ret);
3247_out:
3248 return _ret != NULL;
3249}
3250
3251/**
3252 * sensor_string_call_get_units:
3253 * @proxy: A #SensorStringProxy.
3254 * @cancellable: (allow-none): A #GCancellable or %NULL.
3255 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3256 * @user_data: User data to pass to @callback.
3257 *
3258 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method on @proxy.
3259 * 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.
3260 * You can then call sensor_string_call_get_units_finish() to get the result of the operation.
3261 *
3262 * See sensor_string_call_get_units_sync() for the synchronous, blocking version of this method.
3263 */
3264void
3265sensor_string_call_get_units (
3266 SensorString *proxy,
3267 GCancellable *cancellable,
3268 GAsyncReadyCallback callback,
3269 gpointer user_data)
3270{
3271 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3272 "getUnits",
3273 g_variant_new ("()"),
3274 G_DBUS_CALL_FLAGS_NONE,
3275 -1,
3276 cancellable,
3277 callback,
3278 user_data);
3279}
3280
3281/**
3282 * sensor_string_call_get_units_finish:
3283 * @proxy: A #SensorStringProxy.
3284 * @out_units: (out): Return location for return parameter or %NULL to ignore.
3285 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_call_get_units().
3286 * @error: Return location for error or %NULL.
3287 *
3288 * Finishes an operation started with sensor_string_call_get_units().
3289 *
3290 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3291 */
3292gboolean
3293sensor_string_call_get_units_finish (
3294 SensorString *proxy,
3295 gchar **out_units,
3296 GAsyncResult *res,
3297 GError **error)
3298{
3299 GVariant *_ret;
3300 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3301 if (_ret == NULL)
3302 goto _out;
3303 g_variant_get (_ret,
3304 "(s)",
3305 out_units);
3306 g_variant_unref (_ret);
3307_out:
3308 return _ret != NULL;
3309}
3310
3311/**
3312 * sensor_string_call_get_units_sync:
3313 * @proxy: A #SensorStringProxy.
3314 * @out_units: (out): Return location for return parameter or %NULL to ignore.
3315 * @cancellable: (allow-none): A #GCancellable or %NULL.
3316 * @error: Return location for error or %NULL.
3317 *
3318 * 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.
3319 *
3320 * See sensor_string_call_get_units() for the asynchronous version of this method.
3321 *
3322 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3323 */
3324gboolean
3325sensor_string_call_get_units_sync (
3326 SensorString *proxy,
3327 gchar **out_units,
3328 GCancellable *cancellable,
3329 GError **error)
3330{
3331 GVariant *_ret;
3332 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3333 "getUnits",
3334 g_variant_new ("()"),
3335 G_DBUS_CALL_FLAGS_NONE,
3336 -1,
3337 cancellable,
3338 error);
3339 if (_ret == NULL)
3340 goto _out;
3341 g_variant_get (_ret,
3342 "(s)",
3343 out_units);
3344 g_variant_unref (_ret);
3345_out:
3346 return _ret != NULL;
3347}
3348
3349/**
3350 * sensor_string_complete_get_value:
3351 * @object: A #SensorString.
3352 * @invocation: (transfer full): A #GDBusMethodInvocation.
3353 * @value: Parameter to return.
3354 *
3355 * 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.
3356 *
3357 * This method will free @invocation, you cannot use it afterwards.
3358 */
3359void
3360sensor_string_complete_get_value (
3361 SensorString *object,
3362 GDBusMethodInvocation *invocation,
3363 const gchar *value)
3364{
3365 g_dbus_method_invocation_return_value (invocation,
3366 g_variant_new ("(s)",
3367 value));
3368}
3369
3370/**
3371 * sensor_string_complete_get_units:
3372 * @object: A #SensorString.
3373 * @invocation: (transfer full): A #GDBusMethodInvocation.
3374 * @units: Parameter to return.
3375 *
3376 * 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.
3377 *
3378 * This method will free @invocation, you cannot use it afterwards.
3379 */
3380void
3381sensor_string_complete_get_units (
3382 SensorString *object,
3383 GDBusMethodInvocation *invocation,
3384 const gchar *units)
3385{
3386 g_dbus_method_invocation_return_value (invocation,
3387 g_variant_new ("(s)",
3388 units));
3389}
3390
3391/* ------------------------------------------------------------------------ */
3392
3393/**
3394 * SensorStringProxy:
3395 *
3396 * The #SensorStringProxy structure contains only private data and should only be accessed using the provided API.
3397 */
3398
3399/**
3400 * SensorStringProxyClass:
3401 * @parent_class: The parent class.
3402 *
3403 * Class structure for #SensorStringProxy.
3404 */
3405
3406struct _SensorStringProxyPrivate
3407{
3408 GData *qdata;
3409};
3410
3411static void sensor_string_proxy_iface_init (SensorStringIface *iface);
3412
3413#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3414G_DEFINE_TYPE_WITH_CODE (SensorStringProxy, sensor_string_proxy, G_TYPE_DBUS_PROXY,
3415 G_ADD_PRIVATE (SensorStringProxy)
3416 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_proxy_iface_init));
3417
3418#else
3419G_DEFINE_TYPE_WITH_CODE (SensorStringProxy, sensor_string_proxy, G_TYPE_DBUS_PROXY,
3420 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_proxy_iface_init));
3421
3422#endif
3423static void
3424sensor_string_proxy_finalize (GObject *object)
3425{
3426 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
3427 g_datalist_clear (&proxy->priv->qdata);
3428 G_OBJECT_CLASS (sensor_string_proxy_parent_class)->finalize (object);
3429}
3430
3431static void
3432sensor_string_proxy_get_property (GObject *object,
3433 guint prop_id,
3434 GValue *value,
3435 GParamSpec *pspec G_GNUC_UNUSED)
3436{
3437 const _ExtendedGDBusPropertyInfo *info;
3438 GVariant *variant;
3439 g_assert (prop_id != 0 && prop_id - 1 < 2);
3440 info = _sensor_string_property_info_pointers[prop_id - 1];
3441 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3442 if (info->use_gvariant)
3443 {
3444 g_value_set_variant (value, variant);
3445 }
3446 else
3447 {
3448 if (variant != NULL)
3449 g_dbus_gvariant_to_gvalue (variant, value);
3450 }
3451 if (variant != NULL)
3452 g_variant_unref (variant);
3453}
3454
3455static void
3456sensor_string_proxy_set_property_cb (GDBusProxy *proxy,
3457 GAsyncResult *res,
3458 gpointer user_data)
3459{
3460 const _ExtendedGDBusPropertyInfo *info = user_data;
3461 GError *error;
3462 GVariant *_ret;
3463 error = NULL;
3464 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3465 if (!_ret)
3466 {
3467 g_warning ("Error setting property '%s' on interface org.openbmc.SensorString: %s (%s, %d)",
3468 info->parent_struct.name,
3469 error->message, g_quark_to_string (error->domain), error->code);
3470 g_error_free (error);
3471 }
3472 else
3473 {
3474 g_variant_unref (_ret);
3475 }
3476}
3477
3478static void
3479sensor_string_proxy_set_property (GObject *object,
3480 guint prop_id,
3481 const GValue *value,
3482 GParamSpec *pspec G_GNUC_UNUSED)
3483{
3484 const _ExtendedGDBusPropertyInfo *info;
3485 GVariant *variant;
3486 g_assert (prop_id != 0 && prop_id - 1 < 2);
3487 info = _sensor_string_property_info_pointers[prop_id - 1];
3488 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3489 g_dbus_proxy_call (G_DBUS_PROXY (object),
3490 "org.freedesktop.DBus.Properties.Set",
3491 g_variant_new ("(ssv)", "org.openbmc.SensorString", info->parent_struct.name, variant),
3492 G_DBUS_CALL_FLAGS_NONE,
3493 -1,
3494 NULL, (GAsyncReadyCallback) sensor_string_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3495 g_variant_unref (variant);
3496}
3497
3498static void
3499sensor_string_proxy_g_signal (GDBusProxy *proxy,
3500 const gchar *sender_name G_GNUC_UNUSED,
3501 const gchar *signal_name,
3502 GVariant *parameters)
3503{
3504 _ExtendedGDBusSignalInfo *info;
3505 GVariantIter iter;
3506 GVariant *child;
3507 GValue *paramv;
3508 guint num_params;
3509 guint n;
3510 guint signal_id;
3511 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, signal_name);
3512 if (info == NULL)
3513 return;
3514 num_params = g_variant_n_children (parameters);
3515 paramv = g_new0 (GValue, num_params + 1);
3516 g_value_init (&paramv[0], TYPE_SENSOR_STRING);
3517 g_value_set_object (&paramv[0], proxy);
3518 g_variant_iter_init (&iter, parameters);
3519 n = 1;
3520 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3521 {
3522 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3523 if (arg_info->use_gvariant)
3524 {
3525 g_value_init (&paramv[n], G_TYPE_VARIANT);
3526 g_value_set_variant (&paramv[n], child);
3527 n++;
3528 }
3529 else
3530 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3531 g_variant_unref (child);
3532 }
3533 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_STRING);
3534 g_signal_emitv (paramv, signal_id, 0, NULL);
3535 for (n = 0; n < num_params + 1; n++)
3536 g_value_unset (&paramv[n]);
3537 g_free (paramv);
3538}
3539
3540static void
3541sensor_string_proxy_g_properties_changed (GDBusProxy *_proxy,
3542 GVariant *changed_properties,
3543 const gchar *const *invalidated_properties)
3544{
3545 SensorStringProxy *proxy = SENSOR_STRING_PROXY (_proxy);
3546 guint n;
3547 const gchar *key;
3548 GVariantIter *iter;
3549 _ExtendedGDBusPropertyInfo *info;
3550 g_variant_get (changed_properties, "a{sv}", &iter);
3551 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3552 {
3553 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, key);
3554 g_datalist_remove_data (&proxy->priv->qdata, key);
3555 if (info != NULL)
3556 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3557 }
3558 g_variant_iter_free (iter);
3559 for (n = 0; invalidated_properties[n] != NULL; n++)
3560 {
3561 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, invalidated_properties[n]);
3562 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3563 if (info != NULL)
3564 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3565 }
3566}
3567
3568static gint
3569sensor_string_proxy_get_value (SensorString *object)
3570{
3571 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
3572 GVariant *variant;
3573 gint value = 0;
3574 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
3575 if (variant != NULL)
3576 {
3577 value = g_variant_get_int32 (variant);
3578 g_variant_unref (variant);
3579 }
3580 return value;
3581}
3582
3583static const gchar *
3584sensor_string_proxy_get_units (SensorString *object)
3585{
3586 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
3587 GVariant *variant;
3588 const gchar *value = NULL;
3589 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
3590 if (variant != NULL)
3591 {
3592 value = g_variant_get_string (variant, NULL);
3593 g_variant_unref (variant);
3594 }
3595 return value;
3596}
3597
3598static void
3599sensor_string_proxy_init (SensorStringProxy *proxy)
3600{
3601#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3602 proxy->priv = sensor_string_proxy_get_instance_private (proxy);
3603#else
3604 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_STRING_PROXY, SensorStringProxyPrivate);
3605#endif
3606
3607 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_string_interface_info ());
3608}
3609
3610static void
3611sensor_string_proxy_class_init (SensorStringProxyClass *klass)
3612{
3613 GObjectClass *gobject_class;
3614 GDBusProxyClass *proxy_class;
3615
3616 gobject_class = G_OBJECT_CLASS (klass);
3617 gobject_class->finalize = sensor_string_proxy_finalize;
3618 gobject_class->get_property = sensor_string_proxy_get_property;
3619 gobject_class->set_property = sensor_string_proxy_set_property;
3620
3621 proxy_class = G_DBUS_PROXY_CLASS (klass);
3622 proxy_class->g_signal = sensor_string_proxy_g_signal;
3623 proxy_class->g_properties_changed = sensor_string_proxy_g_properties_changed;
3624
3625 sensor_string_override_properties (gobject_class, 1);
3626
3627#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3628 g_type_class_add_private (klass, sizeof (SensorStringProxyPrivate));
3629#endif
3630}
3631
3632static void
3633sensor_string_proxy_iface_init (SensorStringIface *iface)
3634{
3635 iface->get_value = sensor_string_proxy_get_value;
3636 iface->get_units = sensor_string_proxy_get_units;
3637}
3638
3639/**
3640 * sensor_string_proxy_new:
3641 * @connection: A #GDBusConnection.
3642 * @flags: Flags from the #GDBusProxyFlags enumeration.
3643 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3644 * @object_path: An object path.
3645 * @cancellable: (allow-none): A #GCancellable or %NULL.
3646 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3647 * @user_data: User data to pass to @callback.
3648 *
3649 * 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.
3650 *
3651 * 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.
3652 * You can then call sensor_string_proxy_new_finish() to get the result of the operation.
3653 *
3654 * See sensor_string_proxy_new_sync() for the synchronous, blocking version of this constructor.
3655 */
3656void
3657sensor_string_proxy_new (
3658 GDBusConnection *connection,
3659 GDBusProxyFlags flags,
3660 const gchar *name,
3661 const gchar *object_path,
3662 GCancellable *cancellable,
3663 GAsyncReadyCallback callback,
3664 gpointer user_data)
3665{
3666 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);
3667}
3668
3669/**
3670 * sensor_string_proxy_new_finish:
3671 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_proxy_new().
3672 * @error: Return location for error or %NULL
3673 *
3674 * Finishes an operation started with sensor_string_proxy_new().
3675 *
3676 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
3677 */
3678SensorString *
3679sensor_string_proxy_new_finish (
3680 GAsyncResult *res,
3681 GError **error)
3682{
3683 GObject *ret;
3684 GObject *source_object;
3685 source_object = g_async_result_get_source_object (res);
3686 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3687 g_object_unref (source_object);
3688 if (ret != NULL)
3689 return SENSOR_STRING (ret);
3690 else
3691 return NULL;
3692}
3693
3694/**
3695 * sensor_string_proxy_new_sync:
3696 * @connection: A #GDBusConnection.
3697 * @flags: Flags from the #GDBusProxyFlags enumeration.
3698 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3699 * @object_path: An object path.
3700 * @cancellable: (allow-none): A #GCancellable or %NULL.
3701 * @error: Return location for error or %NULL
3702 *
3703 * 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.
3704 *
3705 * The calling thread is blocked until a reply is received.
3706 *
3707 * See sensor_string_proxy_new() for the asynchronous version of this constructor.
3708 *
3709 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
3710 */
3711SensorString *
3712sensor_string_proxy_new_sync (
3713 GDBusConnection *connection,
3714 GDBusProxyFlags flags,
3715 const gchar *name,
3716 const gchar *object_path,
3717 GCancellable *cancellable,
3718 GError **error)
3719{
3720 GInitable *ret;
3721 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);
3722 if (ret != NULL)
3723 return SENSOR_STRING (ret);
3724 else
3725 return NULL;
3726}
3727
3728
3729/**
3730 * sensor_string_proxy_new_for_bus:
3731 * @bus_type: A #GBusType.
3732 * @flags: Flags from the #GDBusProxyFlags enumeration.
3733 * @name: A bus name (well-known or unique).
3734 * @object_path: An object path.
3735 * @cancellable: (allow-none): A #GCancellable or %NULL.
3736 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3737 * @user_data: User data to pass to @callback.
3738 *
3739 * Like sensor_string_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3740 *
3741 * 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.
3742 * You can then call sensor_string_proxy_new_for_bus_finish() to get the result of the operation.
3743 *
3744 * See sensor_string_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3745 */
3746void
3747sensor_string_proxy_new_for_bus (
3748 GBusType bus_type,
3749 GDBusProxyFlags flags,
3750 const gchar *name,
3751 const gchar *object_path,
3752 GCancellable *cancellable,
3753 GAsyncReadyCallback callback,
3754 gpointer user_data)
3755{
3756 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);
3757}
3758
3759/**
3760 * sensor_string_proxy_new_for_bus_finish:
3761 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_proxy_new_for_bus().
3762 * @error: Return location for error or %NULL
3763 *
3764 * Finishes an operation started with sensor_string_proxy_new_for_bus().
3765 *
3766 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
3767 */
3768SensorString *
3769sensor_string_proxy_new_for_bus_finish (
3770 GAsyncResult *res,
3771 GError **error)
3772{
3773 GObject *ret;
3774 GObject *source_object;
3775 source_object = g_async_result_get_source_object (res);
3776 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3777 g_object_unref (source_object);
3778 if (ret != NULL)
3779 return SENSOR_STRING (ret);
3780 else
3781 return NULL;
3782}
3783
3784/**
3785 * sensor_string_proxy_new_for_bus_sync:
3786 * @bus_type: A #GBusType.
3787 * @flags: Flags from the #GDBusProxyFlags enumeration.
3788 * @name: A bus name (well-known or unique).
3789 * @object_path: An object path.
3790 * @cancellable: (allow-none): A #GCancellable or %NULL.
3791 * @error: Return location for error or %NULL
3792 *
3793 * Like sensor_string_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3794 *
3795 * The calling thread is blocked until a reply is received.
3796 *
3797 * See sensor_string_proxy_new_for_bus() for the asynchronous version of this constructor.
3798 *
3799 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
3800 */
3801SensorString *
3802sensor_string_proxy_new_for_bus_sync (
3803 GBusType bus_type,
3804 GDBusProxyFlags flags,
3805 const gchar *name,
3806 const gchar *object_path,
3807 GCancellable *cancellable,
3808 GError **error)
3809{
3810 GInitable *ret;
3811 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);
3812 if (ret != NULL)
3813 return SENSOR_STRING (ret);
3814 else
3815 return NULL;
3816}
3817
3818
3819/* ------------------------------------------------------------------------ */
3820
3821/**
3822 * SensorStringSkeleton:
3823 *
3824 * The #SensorStringSkeleton structure contains only private data and should only be accessed using the provided API.
3825 */
3826
3827/**
3828 * SensorStringSkeletonClass:
3829 * @parent_class: The parent class.
3830 *
3831 * Class structure for #SensorStringSkeleton.
3832 */
3833
3834struct _SensorStringSkeletonPrivate
3835{
3836 GValue *properties;
3837 GList *changed_properties;
3838 GSource *changed_properties_idle_source;
3839 GMainContext *context;
3840 GMutex lock;
3841};
3842
3843static void
3844_sensor_string_skeleton_handle_method_call (
3845 GDBusConnection *connection G_GNUC_UNUSED,
3846 const gchar *sender G_GNUC_UNUSED,
3847 const gchar *object_path G_GNUC_UNUSED,
3848 const gchar *interface_name,
3849 const gchar *method_name,
3850 GVariant *parameters,
3851 GDBusMethodInvocation *invocation,
3852 gpointer user_data)
3853{
3854 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
3855 _ExtendedGDBusMethodInfo *info;
3856 GVariantIter iter;
3857 GVariant *child;
3858 GValue *paramv;
3859 guint num_params;
3860 guint num_extra;
3861 guint n;
3862 guint signal_id;
3863 GValue return_value = G_VALUE_INIT;
3864 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3865 g_assert (info != NULL);
3866 num_params = g_variant_n_children (parameters);
3867 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3868 n = 0;
3869 g_value_init (&paramv[n], TYPE_SENSOR_STRING);
3870 g_value_set_object (&paramv[n++], skeleton);
3871 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3872 g_value_set_object (&paramv[n++], invocation);
3873 if (info->pass_fdlist)
3874 {
3875#ifdef G_OS_UNIX
3876 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3877 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3878#else
3879 g_assert_not_reached ();
3880#endif
3881 }
3882 g_variant_iter_init (&iter, parameters);
3883 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3884 {
3885 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3886 if (arg_info->use_gvariant)
3887 {
3888 g_value_init (&paramv[n], G_TYPE_VARIANT);
3889 g_value_set_variant (&paramv[n], child);
3890 n++;
3891 }
3892 else
3893 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3894 g_variant_unref (child);
3895 }
3896 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_STRING);
3897 g_value_init (&return_value, G_TYPE_BOOLEAN);
3898 g_signal_emitv (paramv, signal_id, 0, &return_value);
3899 if (!g_value_get_boolean (&return_value))
3900 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);
3901 g_value_unset (&return_value);
3902 for (n = 0; n < num_params + num_extra; n++)
3903 g_value_unset (&paramv[n]);
3904 g_free (paramv);
3905}
3906
3907static GVariant *
3908_sensor_string_skeleton_handle_get_property (
3909 GDBusConnection *connection G_GNUC_UNUSED,
3910 const gchar *sender G_GNUC_UNUSED,
3911 const gchar *object_path G_GNUC_UNUSED,
3912 const gchar *interface_name G_GNUC_UNUSED,
3913 const gchar *property_name,
3914 GError **error,
3915 gpointer user_data)
3916{
3917 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
3918 GValue value = G_VALUE_INIT;
3919 GParamSpec *pspec;
3920 _ExtendedGDBusPropertyInfo *info;
3921 GVariant *ret;
3922 ret = NULL;
3923 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, property_name);
3924 g_assert (info != NULL);
3925 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3926 if (pspec == NULL)
3927 {
3928 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3929 }
3930 else
3931 {
3932 g_value_init (&value, pspec->value_type);
3933 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3934 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3935 g_value_unset (&value);
3936 }
3937 return ret;
3938}
3939
3940static gboolean
3941_sensor_string_skeleton_handle_set_property (
3942 GDBusConnection *connection G_GNUC_UNUSED,
3943 const gchar *sender G_GNUC_UNUSED,
3944 const gchar *object_path G_GNUC_UNUSED,
3945 const gchar *interface_name G_GNUC_UNUSED,
3946 const gchar *property_name,
3947 GVariant *variant,
3948 GError **error,
3949 gpointer user_data)
3950{
3951 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
3952 GValue value = G_VALUE_INIT;
3953 GParamSpec *pspec;
3954 _ExtendedGDBusPropertyInfo *info;
3955 gboolean ret;
3956 ret = FALSE;
3957 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, property_name);
3958 g_assert (info != NULL);
3959 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3960 if (pspec == NULL)
3961 {
3962 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3963 }
3964 else
3965 {
3966 if (info->use_gvariant)
3967 g_value_set_variant (&value, variant);
3968 else
3969 g_dbus_gvariant_to_gvalue (variant, &value);
3970 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3971 g_value_unset (&value);
3972 ret = TRUE;
3973 }
3974 return ret;
3975}
3976
3977static const GDBusInterfaceVTable _sensor_string_skeleton_vtable =
3978{
3979 _sensor_string_skeleton_handle_method_call,
3980 _sensor_string_skeleton_handle_get_property,
3981 _sensor_string_skeleton_handle_set_property,
3982 {NULL}
3983};
3984
3985static GDBusInterfaceInfo *
3986sensor_string_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3987{
3988 return sensor_string_interface_info ();
3989}
3990
3991static GDBusInterfaceVTable *
3992sensor_string_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3993{
3994 return (GDBusInterfaceVTable *) &_sensor_string_skeleton_vtable;
3995}
3996
3997static GVariant *
3998sensor_string_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3999{
4000 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (_skeleton);
4001
4002 GVariantBuilder builder;
4003 guint n;
4004 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4005 if (_sensor_string_interface_info.parent_struct.properties == NULL)
4006 goto out;
4007 for (n = 0; _sensor_string_interface_info.parent_struct.properties[n] != NULL; n++)
4008 {
4009 GDBusPropertyInfo *info = _sensor_string_interface_info.parent_struct.properties[n];
4010 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
4011 {
4012 GVariant *value;
4013 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);
4014 if (value != NULL)
4015 {
4016 g_variant_take_ref (value);
4017 g_variant_builder_add (&builder, "{sv}", info->name, value);
4018 g_variant_unref (value);
4019 }
4020 }
4021 }
4022out:
4023 return g_variant_builder_end (&builder);
4024}
4025
4026static gboolean _sensor_string_emit_changed (gpointer user_data);
4027
4028static void
4029sensor_string_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
4030{
4031 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (_skeleton);
4032 gboolean emit_changed = FALSE;
4033
4034 g_mutex_lock (&skeleton->priv->lock);
4035 if (skeleton->priv->changed_properties_idle_source != NULL)
4036 {
4037 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4038 skeleton->priv->changed_properties_idle_source = NULL;
4039 emit_changed = TRUE;
4040 }
4041 g_mutex_unlock (&skeleton->priv->lock);
4042
4043 if (emit_changed)
4044 _sensor_string_emit_changed (skeleton);
4045}
4046
4047static void
4048_sensor_string_on_signal_changed (
4049 SensorString *object,
4050 const gchar *arg_value)
4051{
4052 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4053
4054 GList *connections, *l;
4055 GVariant *signal_variant;
4056 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4057
4058 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
4059 arg_value));
4060 for (l = connections; l != NULL; l = l->next)
4061 {
4062 GDBusConnection *connection = l->data;
4063 g_dbus_connection_emit_signal (connection,
4064 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorString", "Changed",
4065 signal_variant, NULL);
4066 }
4067 g_variant_unref (signal_variant);
4068 g_list_free_full (connections, g_object_unref);
4069}
4070
4071static void sensor_string_skeleton_iface_init (SensorStringIface *iface);
4072#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4073G_DEFINE_TYPE_WITH_CODE (SensorStringSkeleton, sensor_string_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4074 G_ADD_PRIVATE (SensorStringSkeleton)
4075 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_skeleton_iface_init));
4076
4077#else
4078G_DEFINE_TYPE_WITH_CODE (SensorStringSkeleton, sensor_string_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4079 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_skeleton_iface_init));
4080
4081#endif
4082static void
4083sensor_string_skeleton_finalize (GObject *object)
4084{
4085 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4086 guint n;
4087 for (n = 0; n < 2; n++)
4088 g_value_unset (&skeleton->priv->properties[n]);
4089 g_free (skeleton->priv->properties);
4090 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4091 if (skeleton->priv->changed_properties_idle_source != NULL)
4092 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4093 g_main_context_unref (skeleton->priv->context);
4094 g_mutex_clear (&skeleton->priv->lock);
4095 G_OBJECT_CLASS (sensor_string_skeleton_parent_class)->finalize (object);
4096}
4097
4098static void
4099sensor_string_skeleton_get_property (GObject *object,
4100 guint prop_id,
4101 GValue *value,
4102 GParamSpec *pspec G_GNUC_UNUSED)
4103{
4104 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4105 g_assert (prop_id != 0 && prop_id - 1 < 2);
4106 g_mutex_lock (&skeleton->priv->lock);
4107 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
4108 g_mutex_unlock (&skeleton->priv->lock);
4109}
4110
4111static gboolean
4112_sensor_string_emit_changed (gpointer user_data)
4113{
4114 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
4115 GList *l;
4116 GVariantBuilder builder;
4117 GVariantBuilder invalidated_builder;
4118 guint num_changes;
4119
4120 g_mutex_lock (&skeleton->priv->lock);
4121 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4122 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
4123 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
4124 {
4125 ChangedProperty *cp = l->data;
4126 GVariant *variant;
4127 const GValue *cur_value;
4128
4129 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
4130 if (!_g_value_equal (cur_value, &cp->orig_value))
4131 {
4132 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
4133 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
4134 g_variant_unref (variant);
4135 num_changes++;
4136 }
4137 }
4138 if (num_changes > 0)
4139 {
4140 GList *connections, *ll;
4141 GVariant *signal_variant;
4142 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorString",
4143 &builder, &invalidated_builder));
4144 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4145 for (ll = connections; ll != NULL; ll = ll->next)
4146 {
4147 GDBusConnection *connection = ll->data;
4148
4149 g_dbus_connection_emit_signal (connection,
4150 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
4151 "org.freedesktop.DBus.Properties",
4152 "PropertiesChanged",
4153 signal_variant,
4154 NULL);
4155 }
4156 g_variant_unref (signal_variant);
4157 g_list_free_full (connections, g_object_unref);
4158 }
4159 else
4160 {
4161 g_variant_builder_clear (&builder);
4162 g_variant_builder_clear (&invalidated_builder);
4163 }
4164 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4165 skeleton->priv->changed_properties = NULL;
4166 skeleton->priv->changed_properties_idle_source = NULL;
4167 g_mutex_unlock (&skeleton->priv->lock);
4168 return FALSE;
4169}
4170
4171static void
4172_sensor_string_schedule_emit_changed (SensorStringSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
4173{
4174 ChangedProperty *cp;
4175 GList *l;
4176 cp = NULL;
4177 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
4178 {
4179 ChangedProperty *i_cp = l->data;
4180 if (i_cp->info == info)
4181 {
4182 cp = i_cp;
4183 break;
4184 }
4185 }
4186 if (cp == NULL)
4187 {
4188 cp = g_new0 (ChangedProperty, 1);
4189 cp->prop_id = prop_id;
4190 cp->info = info;
4191 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
4192 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
4193 g_value_copy (orig_value, &cp->orig_value);
4194 }
4195}
4196
4197static void
4198sensor_string_skeleton_notify (GObject *object,
4199 GParamSpec *pspec G_GNUC_UNUSED)
4200{
4201 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4202 g_mutex_lock (&skeleton->priv->lock);
4203 if (skeleton->priv->changed_properties != NULL &&
4204 skeleton->priv->changed_properties_idle_source == NULL)
4205 {
4206 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
4207 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
4208 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_string_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
4209 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
4210 g_source_unref (skeleton->priv->changed_properties_idle_source);
4211 }
4212 g_mutex_unlock (&skeleton->priv->lock);
4213}
4214
4215static void
4216sensor_string_skeleton_set_property (GObject *object,
4217 guint prop_id,
4218 const GValue *value,
4219 GParamSpec *pspec)
4220{
4221 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4222 g_assert (prop_id != 0 && prop_id - 1 < 2);
4223 g_mutex_lock (&skeleton->priv->lock);
4224 g_object_freeze_notify (object);
4225 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
4226 {
4227 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
4228 _sensor_string_schedule_emit_changed (skeleton, _sensor_string_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
4229 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
4230 g_object_notify_by_pspec (object, pspec);
4231 }
4232 g_mutex_unlock (&skeleton->priv->lock);
4233 g_object_thaw_notify (object);
4234}
4235
4236static void
4237sensor_string_skeleton_init (SensorStringSkeleton *skeleton)
4238{
4239#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4240 skeleton->priv = sensor_string_skeleton_get_instance_private (skeleton);
4241#else
4242 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_STRING_SKELETON, SensorStringSkeletonPrivate);
4243#endif
4244
4245 g_mutex_init (&skeleton->priv->lock);
4246 skeleton->priv->context = g_main_context_ref_thread_default ();
4247 skeleton->priv->properties = g_new0 (GValue, 2);
4248 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
4249 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
4250}
4251
4252static gint
4253sensor_string_skeleton_get_value (SensorString *object)
4254{
4255 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4256 gint value;
4257 g_mutex_lock (&skeleton->priv->lock);
4258 value = g_value_get_int (&(skeleton->priv->properties[0]));
4259 g_mutex_unlock (&skeleton->priv->lock);
4260 return value;
4261}
4262
4263static const gchar *
4264sensor_string_skeleton_get_units (SensorString *object)
4265{
4266 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4267 const gchar *value;
4268 g_mutex_lock (&skeleton->priv->lock);
4269 value = g_value_get_string (&(skeleton->priv->properties[1]));
4270 g_mutex_unlock (&skeleton->priv->lock);
4271 return value;
4272}
4273
4274static void
4275sensor_string_skeleton_class_init (SensorStringSkeletonClass *klass)
4276{
4277 GObjectClass *gobject_class;
4278 GDBusInterfaceSkeletonClass *skeleton_class;
4279
4280 gobject_class = G_OBJECT_CLASS (klass);
4281 gobject_class->finalize = sensor_string_skeleton_finalize;
4282 gobject_class->get_property = sensor_string_skeleton_get_property;
4283 gobject_class->set_property = sensor_string_skeleton_set_property;
4284 gobject_class->notify = sensor_string_skeleton_notify;
4285
4286
4287 sensor_string_override_properties (gobject_class, 1);
4288
4289 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4290 skeleton_class->get_info = sensor_string_skeleton_dbus_interface_get_info;
4291 skeleton_class->get_properties = sensor_string_skeleton_dbus_interface_get_properties;
4292 skeleton_class->flush = sensor_string_skeleton_dbus_interface_flush;
4293 skeleton_class->get_vtable = sensor_string_skeleton_dbus_interface_get_vtable;
4294
4295#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4296 g_type_class_add_private (klass, sizeof (SensorStringSkeletonPrivate));
4297#endif
4298}
4299
4300static void
4301sensor_string_skeleton_iface_init (SensorStringIface *iface)
4302{
4303 iface->changed = _sensor_string_on_signal_changed;
4304 iface->get_value = sensor_string_skeleton_get_value;
4305 iface->get_units = sensor_string_skeleton_get_units;
4306}
4307
4308/**
4309 * sensor_string_skeleton_new:
4310 *
4311 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
4312 *
4313 * Returns: (transfer full) (type SensorStringSkeleton): The skeleton object.
4314 */
4315SensorString *
4316sensor_string_skeleton_new (void)
4317{
4318 return SENSOR_STRING (g_object_new (TYPE_SENSOR_STRING_SKELETON, NULL));
4319}
4320
4321/* ------------------------------------------------------------------------
4322 * Code for interface org.openbmc.SensorIntegerThreshold
4323 * ------------------------------------------------------------------------
4324 */
4325
4326/**
4327 * SECTION:SensorIntegerThreshold
4328 * @title: SensorIntegerThreshold
4329 * @short_description: Generated C code for the org.openbmc.SensorIntegerThreshold D-Bus interface
4330 *
4331 * 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.
4332 */
4333
4334/* ---- Introspection data for org.openbmc.SensorIntegerThreshold ---- */
4335
4336static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_IN_ARG_lower_critical =
4337{
4338 {
4339 -1,
4340 (gchar *) "lower_critical",
4341 (gchar *) "i",
4342 NULL
4343 },
4344 FALSE
4345};
4346
4347static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_IN_ARG_lower_warning =
4348{
4349 {
4350 -1,
4351 (gchar *) "lower_warning",
4352 (gchar *) "i",
4353 NULL
4354 },
4355 FALSE
4356};
4357
4358static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_IN_ARG_upper_warning =
4359{
4360 {
4361 -1,
4362 (gchar *) "upper_warning",
4363 (gchar *) "i",
4364 NULL
4365 },
4366 FALSE
4367};
4368
4369static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_IN_ARG_upper_critical =
4370{
4371 {
4372 -1,
4373 (gchar *) "upper_critical",
4374 (gchar *) "i",
4375 NULL
4376 },
4377 FALSE
4378};
4379
4380static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_set_IN_ARG_pointers[] =
4381{
4382 &_sensor_integer_threshold_method_info_set_IN_ARG_lower_critical,
4383 &_sensor_integer_threshold_method_info_set_IN_ARG_lower_warning,
4384 &_sensor_integer_threshold_method_info_set_IN_ARG_upper_warning,
4385 &_sensor_integer_threshold_method_info_set_IN_ARG_upper_critical,
4386 NULL
4387};
4388
4389static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_set =
4390{
4391 {
4392 -1,
4393 (gchar *) "set",
4394 (GDBusArgInfo **) &_sensor_integer_threshold_method_info_set_IN_ARG_pointers,
4395 NULL,
4396 NULL
4397 },
4398 "handle-set",
4399 FALSE
4400};
4401
4402static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_get_state_OUT_ARG_state =
4403{
4404 {
4405 -1,
4406 (gchar *) "state",
4407 (gchar *) "i",
4408 NULL
4409 },
4410 FALSE
4411};
4412
4413static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_get_state_OUT_ARG_pointers[] =
4414{
4415 &_sensor_integer_threshold_method_info_get_state_OUT_ARG_state,
4416 NULL
4417};
4418
4419static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_get_state =
4420{
4421 {
4422 -1,
4423 (gchar *) "getState",
4424 NULL,
4425 (GDBusArgInfo **) &_sensor_integer_threshold_method_info_get_state_OUT_ARG_pointers,
4426 NULL
4427 },
4428 "handle-get-state",
4429 FALSE
4430};
4431
4432static const _ExtendedGDBusMethodInfo * const _sensor_integer_threshold_method_info_pointers[] =
4433{
4434 &_sensor_integer_threshold_method_info_set,
4435 &_sensor_integer_threshold_method_info_get_state,
4436 NULL
4437};
4438
4439static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_warning =
4440{
4441 {
4442 -1,
4443 (gchar *) "Warning",
4444 NULL,
4445 NULL
4446 },
4447 "warning"
4448};
4449
4450static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_critical =
4451{
4452 {
4453 -1,
4454 (gchar *) "Critical",
4455 NULL,
4456 NULL
4457 },
4458 "critical"
4459};
4460
4461static const _ExtendedGDBusSignalInfo * const _sensor_integer_threshold_signal_info_pointers[] =
4462{
4463 &_sensor_integer_threshold_signal_info_warning,
4464 &_sensor_integer_threshold_signal_info_critical,
4465 NULL
4466};
4467
4468static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_lower_critical =
4469{
4470 {
4471 -1,
4472 (gchar *) "lower_critical",
4473 (gchar *) "i",
Norman James471ab592015-08-30 22:29:40 -05004474 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamesdc95ef72015-08-27 21:27:03 -05004475 NULL
4476 },
4477 "lower-critical",
4478 FALSE
4479};
4480
4481static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_lower_warning =
4482{
4483 {
4484 -1,
4485 (gchar *) "lower_warning",
4486 (gchar *) "i",
Norman James471ab592015-08-30 22:29:40 -05004487 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamesdc95ef72015-08-27 21:27:03 -05004488 NULL
4489 },
4490 "lower-warning",
4491 FALSE
4492};
4493
4494static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_upper_warning =
4495{
4496 {
4497 -1,
4498 (gchar *) "upper_warning",
4499 (gchar *) "i",
Norman James471ab592015-08-30 22:29:40 -05004500 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamesdc95ef72015-08-27 21:27:03 -05004501 NULL
4502 },
4503 "upper-warning",
4504 FALSE
4505};
4506
4507static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_upper_critical =
4508{
4509 {
4510 -1,
4511 (gchar *) "upper_critical",
4512 (gchar *) "i",
Norman James471ab592015-08-30 22:29:40 -05004513 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamesdc95ef72015-08-27 21:27:03 -05004514 NULL
4515 },
4516 "upper-critical",
4517 FALSE
4518};
4519
4520static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_state =
4521{
4522 {
4523 -1,
4524 (gchar *) "state",
4525 (gchar *) "i",
4526 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4527 NULL
4528 },
4529 "state",
4530 FALSE
4531};
4532
4533static const _ExtendedGDBusPropertyInfo * const _sensor_integer_threshold_property_info_pointers[] =
4534{
4535 &_sensor_integer_threshold_property_info_lower_critical,
4536 &_sensor_integer_threshold_property_info_lower_warning,
4537 &_sensor_integer_threshold_property_info_upper_warning,
4538 &_sensor_integer_threshold_property_info_upper_critical,
4539 &_sensor_integer_threshold_property_info_state,
4540 NULL
4541};
4542
4543static const _ExtendedGDBusInterfaceInfo _sensor_integer_threshold_interface_info =
4544{
4545 {
4546 -1,
4547 (gchar *) "org.openbmc.SensorIntegerThreshold",
4548 (GDBusMethodInfo **) &_sensor_integer_threshold_method_info_pointers,
4549 (GDBusSignalInfo **) &_sensor_integer_threshold_signal_info_pointers,
4550 (GDBusPropertyInfo **) &_sensor_integer_threshold_property_info_pointers,
4551 NULL
4552 },
4553 "sensor-integer-threshold",
4554};
4555
4556
4557/**
4558 * sensor_integer_threshold_interface_info:
4559 *
4560 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> D-Bus interface.
4561 *
4562 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4563 */
4564GDBusInterfaceInfo *
4565sensor_integer_threshold_interface_info (void)
4566{
4567 return (GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct;
4568}
4569
4570/**
4571 * sensor_integer_threshold_override_properties:
4572 * @klass: The class structure for a #GObject<!-- -->-derived class.
4573 * @property_id_begin: The property id to assign to the first overridden property.
4574 *
4575 * Overrides all #GObject properties in the #SensorIntegerThreshold interface for a concrete class.
4576 * The properties are overridden in the order they are defined.
4577 *
4578 * Returns: The last property id.
4579 */
4580guint
4581sensor_integer_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
4582{
4583 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
4584 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
4585 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
4586 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
4587 g_object_class_override_property (klass, property_id_begin++, "state");
4588 return property_id_begin - 1;
4589}
4590
4591
4592
4593/**
4594 * SensorIntegerThreshold:
4595 *
4596 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
4597 */
4598
4599/**
4600 * SensorIntegerThresholdIface:
4601 * @parent_iface: The parent interface.
4602 * @handle_get_state: Handler for the #SensorIntegerThreshold::handle-get-state signal.
4603 * @handle_set: Handler for the #SensorIntegerThreshold::handle-set signal.
4604 * @get_lower_critical: Getter for the #SensorIntegerThreshold:lower-critical property.
4605 * @get_lower_warning: Getter for the #SensorIntegerThreshold:lower-warning property.
4606 * @get_state: Getter for the #SensorIntegerThreshold:state property.
4607 * @get_upper_critical: Getter for the #SensorIntegerThreshold:upper-critical property.
4608 * @get_upper_warning: Getter for the #SensorIntegerThreshold:upper-warning property.
4609 * @critical: Handler for the #SensorIntegerThreshold::critical signal.
4610 * @warning: Handler for the #SensorIntegerThreshold::warning signal.
4611 *
4612 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
4613 */
4614
4615typedef SensorIntegerThresholdIface SensorIntegerThresholdInterface;
4616G_DEFINE_INTERFACE (SensorIntegerThreshold, sensor_integer_threshold, G_TYPE_OBJECT);
4617
4618static void
4619sensor_integer_threshold_default_init (SensorIntegerThresholdIface *iface)
4620{
4621 /* GObject signals for incoming D-Bus method calls: */
4622 /**
4623 * SensorIntegerThreshold::handle-set:
4624 * @object: A #SensorIntegerThreshold.
4625 * @invocation: A #GDBusMethodInvocation.
4626 * @arg_lower_critical: Argument passed by remote caller.
4627 * @arg_lower_warning: Argument passed by remote caller.
4628 * @arg_upper_warning: Argument passed by remote caller.
4629 * @arg_upper_critical: Argument passed by remote caller.
4630 *
4631 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.set">set()</link> D-Bus method.
4632 *
4633 * 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() 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.
4634 *
4635 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4636 */
4637 g_signal_new ("handle-set",
4638 G_TYPE_FROM_INTERFACE (iface),
4639 G_SIGNAL_RUN_LAST,
4640 G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_set),
4641 g_signal_accumulator_true_handled,
4642 NULL,
4643 g_cclosure_marshal_generic,
4644 G_TYPE_BOOLEAN,
4645 5,
4646 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
4647
4648 /**
4649 * SensorIntegerThreshold::handle-get-state:
4650 * @object: A #SensorIntegerThreshold.
4651 * @invocation: A #GDBusMethodInvocation.
4652 *
4653 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getState">getState()</link> D-Bus method.
4654 *
4655 * 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_get_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.
4656 *
4657 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4658 */
4659 g_signal_new ("handle-get-state",
4660 G_TYPE_FROM_INTERFACE (iface),
4661 G_SIGNAL_RUN_LAST,
4662 G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_get_state),
4663 g_signal_accumulator_true_handled,
4664 NULL,
4665 g_cclosure_marshal_generic,
4666 G_TYPE_BOOLEAN,
4667 1,
4668 G_TYPE_DBUS_METHOD_INVOCATION);
4669
4670 /* GObject signals for received D-Bus signals: */
4671 /**
4672 * SensorIntegerThreshold::warning:
4673 * @object: A #SensorIntegerThreshold.
4674 *
4675 * 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.
4676 *
4677 * 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.
4678 */
4679 g_signal_new ("warning",
4680 G_TYPE_FROM_INTERFACE (iface),
4681 G_SIGNAL_RUN_LAST,
4682 G_STRUCT_OFFSET (SensorIntegerThresholdIface, warning),
4683 NULL,
4684 NULL,
4685 g_cclosure_marshal_generic,
4686 G_TYPE_NONE,
4687 0);
4688
4689 /**
4690 * SensorIntegerThreshold::critical:
4691 * @object: A #SensorIntegerThreshold.
4692 *
4693 * 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.
4694 *
4695 * 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.
4696 */
4697 g_signal_new ("critical",
4698 G_TYPE_FROM_INTERFACE (iface),
4699 G_SIGNAL_RUN_LAST,
4700 G_STRUCT_OFFSET (SensorIntegerThresholdIface, critical),
4701 NULL,
4702 NULL,
4703 g_cclosure_marshal_generic,
4704 G_TYPE_NONE,
4705 0);
4706
4707 /* GObject properties for D-Bus properties: */
4708 /**
4709 * SensorIntegerThreshold:lower-critical:
4710 *
4711 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_critical">"lower_critical"</link>.
4712 *
Norman James471ab592015-08-30 22:29:40 -05004713 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004714 */
4715 g_object_interface_install_property (iface,
4716 g_param_spec_int ("lower-critical", "lower_critical", "lower_critical", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4717 /**
4718 * SensorIntegerThreshold:lower-warning:
4719 *
4720 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_warning">"lower_warning"</link>.
4721 *
Norman James471ab592015-08-30 22:29:40 -05004722 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004723 */
4724 g_object_interface_install_property (iface,
4725 g_param_spec_int ("lower-warning", "lower_warning", "lower_warning", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4726 /**
4727 * SensorIntegerThreshold:upper-warning:
4728 *
4729 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_warning">"upper_warning"</link>.
4730 *
Norman James471ab592015-08-30 22:29:40 -05004731 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004732 */
4733 g_object_interface_install_property (iface,
4734 g_param_spec_int ("upper-warning", "upper_warning", "upper_warning", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4735 /**
4736 * SensorIntegerThreshold:upper-critical:
4737 *
4738 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_critical">"upper_critical"</link>.
4739 *
Norman James471ab592015-08-30 22:29:40 -05004740 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004741 */
4742 g_object_interface_install_property (iface,
4743 g_param_spec_int ("upper-critical", "upper_critical", "upper_critical", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4744 /**
4745 * SensorIntegerThreshold:state:
4746 *
4747 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.state">"state"</link>.
4748 *
4749 * 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.
4750 */
4751 g_object_interface_install_property (iface,
4752 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4753}
4754
4755/**
4756 * sensor_integer_threshold_get_lower_critical: (skip)
4757 * @object: A #SensorIntegerThreshold.
4758 *
4759 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_critical">"lower_critical"</link> D-Bus property.
4760 *
Norman James471ab592015-08-30 22:29:40 -05004761 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004762 *
4763 * Returns: The property value.
4764 */
4765gint
4766sensor_integer_threshold_get_lower_critical (SensorIntegerThreshold *object)
4767{
4768 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
4769}
4770
4771/**
4772 * sensor_integer_threshold_set_lower_critical: (skip)
4773 * @object: A #SensorIntegerThreshold.
4774 * @value: The value to set.
4775 *
4776 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
4777 *
Norman James471ab592015-08-30 22:29:40 -05004778 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004779 */
4780void
4781sensor_integer_threshold_set_lower_critical (SensorIntegerThreshold *object, gint value)
4782{
4783 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
4784}
4785
4786/**
4787 * sensor_integer_threshold_get_lower_warning: (skip)
4788 * @object: A #SensorIntegerThreshold.
4789 *
4790 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_warning">"lower_warning"</link> D-Bus property.
4791 *
Norman James471ab592015-08-30 22:29:40 -05004792 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004793 *
4794 * Returns: The property value.
4795 */
4796gint
4797sensor_integer_threshold_get_lower_warning (SensorIntegerThreshold *object)
4798{
4799 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
4800}
4801
4802/**
4803 * sensor_integer_threshold_set_lower_warning: (skip)
4804 * @object: A #SensorIntegerThreshold.
4805 * @value: The value to set.
4806 *
4807 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
4808 *
Norman James471ab592015-08-30 22:29:40 -05004809 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004810 */
4811void
4812sensor_integer_threshold_set_lower_warning (SensorIntegerThreshold *object, gint value)
4813{
4814 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
4815}
4816
4817/**
4818 * sensor_integer_threshold_get_upper_warning: (skip)
4819 * @object: A #SensorIntegerThreshold.
4820 *
4821 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_warning">"upper_warning"</link> D-Bus property.
4822 *
Norman James471ab592015-08-30 22:29:40 -05004823 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004824 *
4825 * Returns: The property value.
4826 */
4827gint
4828sensor_integer_threshold_get_upper_warning (SensorIntegerThreshold *object)
4829{
4830 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
4831}
4832
4833/**
4834 * sensor_integer_threshold_set_upper_warning: (skip)
4835 * @object: A #SensorIntegerThreshold.
4836 * @value: The value to set.
4837 *
4838 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
4839 *
Norman James471ab592015-08-30 22:29:40 -05004840 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004841 */
4842void
4843sensor_integer_threshold_set_upper_warning (SensorIntegerThreshold *object, gint value)
4844{
4845 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
4846}
4847
4848/**
4849 * sensor_integer_threshold_get_upper_critical: (skip)
4850 * @object: A #SensorIntegerThreshold.
4851 *
4852 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_critical">"upper_critical"</link> D-Bus property.
4853 *
Norman James471ab592015-08-30 22:29:40 -05004854 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004855 *
4856 * Returns: The property value.
4857 */
4858gint
4859sensor_integer_threshold_get_upper_critical (SensorIntegerThreshold *object)
4860{
4861 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
4862}
4863
4864/**
4865 * sensor_integer_threshold_set_upper_critical: (skip)
4866 * @object: A #SensorIntegerThreshold.
4867 * @value: The value to set.
4868 *
4869 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
4870 *
Norman James471ab592015-08-30 22:29:40 -05004871 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesdc95ef72015-08-27 21:27:03 -05004872 */
4873void
4874sensor_integer_threshold_set_upper_critical (SensorIntegerThreshold *object, gint value)
4875{
4876 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
4877}
4878
4879/**
4880 * sensor_integer_threshold_get_state: (skip)
4881 * @object: A #SensorIntegerThreshold.
4882 *
4883 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.state">"state"</link> D-Bus property.
4884 *
4885 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4886 *
4887 * Returns: The property value.
4888 */
4889gint
4890sensor_integer_threshold_get_state (SensorIntegerThreshold *object)
4891{
4892 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_state (object);
4893}
4894
4895/**
4896 * sensor_integer_threshold_set_state: (skip)
4897 * @object: A #SensorIntegerThreshold.
4898 * @value: The value to set.
4899 *
4900 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.state">"state"</link> D-Bus property to @value.
4901 *
4902 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4903 */
4904void
4905sensor_integer_threshold_set_state (SensorIntegerThreshold *object, gint value)
4906{
4907 g_object_set (G_OBJECT (object), "state", value, NULL);
4908}
4909
4910/**
4911 * sensor_integer_threshold_emit_warning:
4912 * @object: A #SensorIntegerThreshold.
4913 *
4914 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Warning">"Warning"</link> D-Bus signal.
4915 */
4916void
4917sensor_integer_threshold_emit_warning (
4918 SensorIntegerThreshold *object)
4919{
4920 g_signal_emit_by_name (object, "warning");
4921}
4922
4923/**
4924 * sensor_integer_threshold_emit_critical:
4925 * @object: A #SensorIntegerThreshold.
4926 *
4927 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Critical">"Critical"</link> D-Bus signal.
4928 */
4929void
4930sensor_integer_threshold_emit_critical (
4931 SensorIntegerThreshold *object)
4932{
4933 g_signal_emit_by_name (object, "critical");
4934}
4935
4936/**
4937 * sensor_integer_threshold_call_set:
4938 * @proxy: A #SensorIntegerThresholdProxy.
4939 * @arg_lower_critical: Argument to pass with the method invocation.
4940 * @arg_lower_warning: Argument to pass with the method invocation.
4941 * @arg_upper_warning: Argument to pass with the method invocation.
4942 * @arg_upper_critical: Argument to pass with the method invocation.
4943 * @cancellable: (allow-none): A #GCancellable or %NULL.
4944 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4945 * @user_data: User data to pass to @callback.
4946 *
4947 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.set">set()</link> D-Bus method on @proxy.
4948 * 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.
4949 * You can then call sensor_integer_threshold_call_set_finish() to get the result of the operation.
4950 *
4951 * See sensor_integer_threshold_call_set_sync() for the synchronous, blocking version of this method.
4952 */
4953void
4954sensor_integer_threshold_call_set (
4955 SensorIntegerThreshold *proxy,
4956 gint arg_lower_critical,
4957 gint arg_lower_warning,
4958 gint arg_upper_warning,
4959 gint arg_upper_critical,
4960 GCancellable *cancellable,
4961 GAsyncReadyCallback callback,
4962 gpointer user_data)
4963{
4964 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4965 "set",
4966 g_variant_new ("(iiii)",
4967 arg_lower_critical,
4968 arg_lower_warning,
4969 arg_upper_warning,
4970 arg_upper_critical),
4971 G_DBUS_CALL_FLAGS_NONE,
4972 -1,
4973 cancellable,
4974 callback,
4975 user_data);
4976}
4977
4978/**
4979 * sensor_integer_threshold_call_set_finish:
4980 * @proxy: A #SensorIntegerThresholdProxy.
4981 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_set().
4982 * @error: Return location for error or %NULL.
4983 *
4984 * Finishes an operation started with sensor_integer_threshold_call_set().
4985 *
4986 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4987 */
4988gboolean
4989sensor_integer_threshold_call_set_finish (
4990 SensorIntegerThreshold *proxy,
4991 GAsyncResult *res,
4992 GError **error)
4993{
4994 GVariant *_ret;
4995 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4996 if (_ret == NULL)
4997 goto _out;
4998 g_variant_get (_ret,
4999 "()");
5000 g_variant_unref (_ret);
5001_out:
5002 return _ret != NULL;
5003}
5004
5005/**
5006 * sensor_integer_threshold_call_set_sync:
5007 * @proxy: A #SensorIntegerThresholdProxy.
5008 * @arg_lower_critical: Argument to pass with the method invocation.
5009 * @arg_lower_warning: Argument to pass with the method invocation.
5010 * @arg_upper_warning: Argument to pass with the method invocation.
5011 * @arg_upper_critical: Argument to pass with the method invocation.
5012 * @cancellable: (allow-none): A #GCancellable or %NULL.
5013 * @error: Return location for error or %NULL.
5014 *
5015 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.set">set()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
5016 *
5017 * See sensor_integer_threshold_call_set() for the asynchronous version of this method.
5018 *
5019 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5020 */
5021gboolean
5022sensor_integer_threshold_call_set_sync (
5023 SensorIntegerThreshold *proxy,
5024 gint arg_lower_critical,
5025 gint arg_lower_warning,
5026 gint arg_upper_warning,
5027 gint arg_upper_critical,
5028 GCancellable *cancellable,
5029 GError **error)
5030{
5031 GVariant *_ret;
5032 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5033 "set",
5034 g_variant_new ("(iiii)",
5035 arg_lower_critical,
5036 arg_lower_warning,
5037 arg_upper_warning,
5038 arg_upper_critical),
5039 G_DBUS_CALL_FLAGS_NONE,
5040 -1,
5041 cancellable,
5042 error);
5043 if (_ret == NULL)
5044 goto _out;
5045 g_variant_get (_ret,
5046 "()");
5047 g_variant_unref (_ret);
5048_out:
5049 return _ret != NULL;
5050}
5051
5052/**
5053 * sensor_integer_threshold_call_get_state:
5054 * @proxy: A #SensorIntegerThresholdProxy.
5055 * @cancellable: (allow-none): A #GCancellable or %NULL.
5056 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
5057 * @user_data: User data to pass to @callback.
5058 *
5059 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getState">getState()</link> D-Bus method on @proxy.
5060 * 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.
5061 * You can then call sensor_integer_threshold_call_get_state_finish() to get the result of the operation.
5062 *
5063 * See sensor_integer_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
5064 */
5065void
5066sensor_integer_threshold_call_get_state (
5067 SensorIntegerThreshold *proxy,
5068 GCancellable *cancellable,
5069 GAsyncReadyCallback callback,
5070 gpointer user_data)
5071{
5072 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
5073 "getState",
5074 g_variant_new ("()"),
5075 G_DBUS_CALL_FLAGS_NONE,
5076 -1,
5077 cancellable,
5078 callback,
5079 user_data);
5080}
5081
5082/**
5083 * sensor_integer_threshold_call_get_state_finish:
5084 * @proxy: A #SensorIntegerThresholdProxy.
5085 * @out_state: (out): Return location for return parameter or %NULL to ignore.
5086 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_get_state().
5087 * @error: Return location for error or %NULL.
5088 *
5089 * Finishes an operation started with sensor_integer_threshold_call_get_state().
5090 *
5091 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5092 */
5093gboolean
5094sensor_integer_threshold_call_get_state_finish (
5095 SensorIntegerThreshold *proxy,
5096 gint *out_state,
5097 GAsyncResult *res,
5098 GError **error)
5099{
5100 GVariant *_ret;
5101 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
5102 if (_ret == NULL)
5103 goto _out;
5104 g_variant_get (_ret,
5105 "(i)",
5106 out_state);
5107 g_variant_unref (_ret);
5108_out:
5109 return _ret != NULL;
5110}
5111
5112/**
5113 * sensor_integer_threshold_call_get_state_sync:
5114 * @proxy: A #SensorIntegerThresholdProxy.
5115 * @out_state: (out): Return location for return parameter or %NULL to ignore.
5116 * @cancellable: (allow-none): A #GCancellable or %NULL.
5117 * @error: Return location for error or %NULL.
5118 *
5119 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getState">getState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
5120 *
5121 * See sensor_integer_threshold_call_get_state() for the asynchronous version of this method.
5122 *
5123 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5124 */
5125gboolean
5126sensor_integer_threshold_call_get_state_sync (
5127 SensorIntegerThreshold *proxy,
5128 gint *out_state,
5129 GCancellable *cancellable,
5130 GError **error)
5131{
5132 GVariant *_ret;
5133 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5134 "getState",
5135 g_variant_new ("()"),
5136 G_DBUS_CALL_FLAGS_NONE,
5137 -1,
5138 cancellable,
5139 error);
5140 if (_ret == NULL)
5141 goto _out;
5142 g_variant_get (_ret,
5143 "(i)",
5144 out_state);
5145 g_variant_unref (_ret);
5146_out:
5147 return _ret != NULL;
5148}
5149
5150/**
5151 * sensor_integer_threshold_complete_set:
5152 * @object: A #SensorIntegerThreshold.
5153 * @invocation: (transfer full): A #GDBusMethodInvocation.
5154 *
5155 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.set">set()</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.
5156 *
5157 * This method will free @invocation, you cannot use it afterwards.
5158 */
5159void
5160sensor_integer_threshold_complete_set (
5161 SensorIntegerThreshold *object,
5162 GDBusMethodInvocation *invocation)
5163{
5164 g_dbus_method_invocation_return_value (invocation,
5165 g_variant_new ("()"));
5166}
5167
5168/**
5169 * sensor_integer_threshold_complete_get_state:
5170 * @object: A #SensorIntegerThreshold.
5171 * @invocation: (transfer full): A #GDBusMethodInvocation.
5172 * @state: Parameter to return.
5173 *
5174 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getState">getState()</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.
5175 *
5176 * This method will free @invocation, you cannot use it afterwards.
5177 */
5178void
5179sensor_integer_threshold_complete_get_state (
5180 SensorIntegerThreshold *object,
5181 GDBusMethodInvocation *invocation,
5182 gint state)
5183{
5184 g_dbus_method_invocation_return_value (invocation,
5185 g_variant_new ("(i)",
5186 state));
5187}
5188
5189/* ------------------------------------------------------------------------ */
5190
5191/**
5192 * SensorIntegerThresholdProxy:
5193 *
5194 * The #SensorIntegerThresholdProxy structure contains only private data and should only be accessed using the provided API.
5195 */
5196
5197/**
5198 * SensorIntegerThresholdProxyClass:
5199 * @parent_class: The parent class.
5200 *
5201 * Class structure for #SensorIntegerThresholdProxy.
5202 */
5203
5204struct _SensorIntegerThresholdProxyPrivate
5205{
5206 GData *qdata;
5207};
5208
5209static void sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface);
5210
5211#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5212G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY,
5213 G_ADD_PRIVATE (SensorIntegerThresholdProxy)
5214 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init));
5215
5216#else
5217G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY,
5218 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init));
5219
5220#endif
5221static void
5222sensor_integer_threshold_proxy_finalize (GObject *object)
5223{
5224 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5225 g_datalist_clear (&proxy->priv->qdata);
5226 G_OBJECT_CLASS (sensor_integer_threshold_proxy_parent_class)->finalize (object);
5227}
5228
5229static void
5230sensor_integer_threshold_proxy_get_property (GObject *object,
5231 guint prop_id,
5232 GValue *value,
5233 GParamSpec *pspec G_GNUC_UNUSED)
5234{
5235 const _ExtendedGDBusPropertyInfo *info;
5236 GVariant *variant;
5237 g_assert (prop_id != 0 && prop_id - 1 < 5);
5238 info = _sensor_integer_threshold_property_info_pointers[prop_id - 1];
5239 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5240 if (info->use_gvariant)
5241 {
5242 g_value_set_variant (value, variant);
5243 }
5244 else
5245 {
5246 if (variant != NULL)
5247 g_dbus_gvariant_to_gvalue (variant, value);
5248 }
5249 if (variant != NULL)
5250 g_variant_unref (variant);
5251}
5252
5253static void
5254sensor_integer_threshold_proxy_set_property_cb (GDBusProxy *proxy,
5255 GAsyncResult *res,
5256 gpointer user_data)
5257{
5258 const _ExtendedGDBusPropertyInfo *info = user_data;
5259 GError *error;
5260 GVariant *_ret;
5261 error = NULL;
5262 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5263 if (!_ret)
5264 {
5265 g_warning ("Error setting property '%s' on interface org.openbmc.SensorIntegerThreshold: %s (%s, %d)",
5266 info->parent_struct.name,
5267 error->message, g_quark_to_string (error->domain), error->code);
5268 g_error_free (error);
5269 }
5270 else
5271 {
5272 g_variant_unref (_ret);
5273 }
5274}
5275
5276static void
5277sensor_integer_threshold_proxy_set_property (GObject *object,
5278 guint prop_id,
5279 const GValue *value,
5280 GParamSpec *pspec G_GNUC_UNUSED)
5281{
5282 const _ExtendedGDBusPropertyInfo *info;
5283 GVariant *variant;
5284 g_assert (prop_id != 0 && prop_id - 1 < 5);
5285 info = _sensor_integer_threshold_property_info_pointers[prop_id - 1];
5286 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5287 g_dbus_proxy_call (G_DBUS_PROXY (object),
5288 "org.freedesktop.DBus.Properties.Set",
5289 g_variant_new ("(ssv)", "org.openbmc.SensorIntegerThreshold", info->parent_struct.name, variant),
5290 G_DBUS_CALL_FLAGS_NONE,
5291 -1,
5292 NULL, (GAsyncReadyCallback) sensor_integer_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5293 g_variant_unref (variant);
5294}
5295
5296static void
5297sensor_integer_threshold_proxy_g_signal (GDBusProxy *proxy,
5298 const gchar *sender_name G_GNUC_UNUSED,
5299 const gchar *signal_name,
5300 GVariant *parameters)
5301{
5302 _ExtendedGDBusSignalInfo *info;
5303 GVariantIter iter;
5304 GVariant *child;
5305 GValue *paramv;
5306 guint num_params;
5307 guint n;
5308 guint signal_id;
5309 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, signal_name);
5310 if (info == NULL)
5311 return;
5312 num_params = g_variant_n_children (parameters);
5313 paramv = g_new0 (GValue, num_params + 1);
5314 g_value_init (&paramv[0], TYPE_SENSOR_INTEGER_THRESHOLD);
5315 g_value_set_object (&paramv[0], proxy);
5316 g_variant_iter_init (&iter, parameters);
5317 n = 1;
5318 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5319 {
5320 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5321 if (arg_info->use_gvariant)
5322 {
5323 g_value_init (&paramv[n], G_TYPE_VARIANT);
5324 g_value_set_variant (&paramv[n], child);
5325 n++;
5326 }
5327 else
5328 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5329 g_variant_unref (child);
5330 }
5331 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD);
5332 g_signal_emitv (paramv, signal_id, 0, NULL);
5333 for (n = 0; n < num_params + 1; n++)
5334 g_value_unset (&paramv[n]);
5335 g_free (paramv);
5336}
5337
5338static void
5339sensor_integer_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
5340 GVariant *changed_properties,
5341 const gchar *const *invalidated_properties)
5342{
5343 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (_proxy);
5344 guint n;
5345 const gchar *key;
5346 GVariantIter *iter;
5347 _ExtendedGDBusPropertyInfo *info;
5348 g_variant_get (changed_properties, "a{sv}", &iter);
5349 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5350 {
5351 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, key);
5352 g_datalist_remove_data (&proxy->priv->qdata, key);
5353 if (info != NULL)
5354 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5355 }
5356 g_variant_iter_free (iter);
5357 for (n = 0; invalidated_properties[n] != NULL; n++)
5358 {
5359 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, invalidated_properties[n]);
5360 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5361 if (info != NULL)
5362 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5363 }
5364}
5365
5366static gint
5367sensor_integer_threshold_proxy_get_lower_critical (SensorIntegerThreshold *object)
5368{
5369 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5370 GVariant *variant;
5371 gint value = 0;
5372 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
5373 if (variant != NULL)
5374 {
5375 value = g_variant_get_int32 (variant);
5376 g_variant_unref (variant);
5377 }
5378 return value;
5379}
5380
5381static gint
5382sensor_integer_threshold_proxy_get_lower_warning (SensorIntegerThreshold *object)
5383{
5384 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5385 GVariant *variant;
5386 gint value = 0;
5387 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
5388 if (variant != NULL)
5389 {
5390 value = g_variant_get_int32 (variant);
5391 g_variant_unref (variant);
5392 }
5393 return value;
5394}
5395
5396static gint
5397sensor_integer_threshold_proxy_get_upper_warning (SensorIntegerThreshold *object)
5398{
5399 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5400 GVariant *variant;
5401 gint value = 0;
5402 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
5403 if (variant != NULL)
5404 {
5405 value = g_variant_get_int32 (variant);
5406 g_variant_unref (variant);
5407 }
5408 return value;
5409}
5410
5411static gint
5412sensor_integer_threshold_proxy_get_upper_critical (SensorIntegerThreshold *object)
5413{
5414 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5415 GVariant *variant;
5416 gint value = 0;
5417 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
5418 if (variant != NULL)
5419 {
5420 value = g_variant_get_int32 (variant);
5421 g_variant_unref (variant);
5422 }
5423 return value;
5424}
5425
5426static gint
5427sensor_integer_threshold_proxy_get_state (SensorIntegerThreshold *object)
5428{
5429 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5430 GVariant *variant;
5431 gint value = 0;
5432 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
5433 if (variant != NULL)
5434 {
5435 value = g_variant_get_int32 (variant);
5436 g_variant_unref (variant);
5437 }
5438 return value;
5439}
5440
5441static void
5442sensor_integer_threshold_proxy_init (SensorIntegerThresholdProxy *proxy)
5443{
5444#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5445 proxy->priv = sensor_integer_threshold_proxy_get_instance_private (proxy);
5446#else
5447 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, SensorIntegerThresholdProxyPrivate);
5448#endif
5449
5450 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_threshold_interface_info ());
5451}
5452
5453static void
5454sensor_integer_threshold_proxy_class_init (SensorIntegerThresholdProxyClass *klass)
5455{
5456 GObjectClass *gobject_class;
5457 GDBusProxyClass *proxy_class;
5458
5459 gobject_class = G_OBJECT_CLASS (klass);
5460 gobject_class->finalize = sensor_integer_threshold_proxy_finalize;
5461 gobject_class->get_property = sensor_integer_threshold_proxy_get_property;
5462 gobject_class->set_property = sensor_integer_threshold_proxy_set_property;
5463
5464 proxy_class = G_DBUS_PROXY_CLASS (klass);
5465 proxy_class->g_signal = sensor_integer_threshold_proxy_g_signal;
5466 proxy_class->g_properties_changed = sensor_integer_threshold_proxy_g_properties_changed;
5467
5468 sensor_integer_threshold_override_properties (gobject_class, 1);
5469
5470#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5471 g_type_class_add_private (klass, sizeof (SensorIntegerThresholdProxyPrivate));
5472#endif
5473}
5474
5475static void
5476sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface)
5477{
5478 iface->get_lower_critical = sensor_integer_threshold_proxy_get_lower_critical;
5479 iface->get_lower_warning = sensor_integer_threshold_proxy_get_lower_warning;
5480 iface->get_upper_warning = sensor_integer_threshold_proxy_get_upper_warning;
5481 iface->get_upper_critical = sensor_integer_threshold_proxy_get_upper_critical;
5482 iface->get_state = sensor_integer_threshold_proxy_get_state;
5483}
5484
5485/**
5486 * sensor_integer_threshold_proxy_new:
5487 * @connection: A #GDBusConnection.
5488 * @flags: Flags from the #GDBusProxyFlags enumeration.
5489 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5490 * @object_path: An object path.
5491 * @cancellable: (allow-none): A #GCancellable or %NULL.
5492 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5493 * @user_data: User data to pass to @callback.
5494 *
5495 * 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.
5496 *
5497 * 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.
5498 * You can then call sensor_integer_threshold_proxy_new_finish() to get the result of the operation.
5499 *
5500 * See sensor_integer_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
5501 */
5502void
5503sensor_integer_threshold_proxy_new (
5504 GDBusConnection *connection,
5505 GDBusProxyFlags flags,
5506 const gchar *name,
5507 const gchar *object_path,
5508 GCancellable *cancellable,
5509 GAsyncReadyCallback callback,
5510 gpointer user_data)
5511{
5512 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);
5513}
5514
5515/**
5516 * sensor_integer_threshold_proxy_new_finish:
5517 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new().
5518 * @error: Return location for error or %NULL
5519 *
5520 * Finishes an operation started with sensor_integer_threshold_proxy_new().
5521 *
5522 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
5523 */
5524SensorIntegerThreshold *
5525sensor_integer_threshold_proxy_new_finish (
5526 GAsyncResult *res,
5527 GError **error)
5528{
5529 GObject *ret;
5530 GObject *source_object;
5531 source_object = g_async_result_get_source_object (res);
5532 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5533 g_object_unref (source_object);
5534 if (ret != NULL)
5535 return SENSOR_INTEGER_THRESHOLD (ret);
5536 else
5537 return NULL;
5538}
5539
5540/**
5541 * sensor_integer_threshold_proxy_new_sync:
5542 * @connection: A #GDBusConnection.
5543 * @flags: Flags from the #GDBusProxyFlags enumeration.
5544 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5545 * @object_path: An object path.
5546 * @cancellable: (allow-none): A #GCancellable or %NULL.
5547 * @error: Return location for error or %NULL
5548 *
5549 * 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.
5550 *
5551 * The calling thread is blocked until a reply is received.
5552 *
5553 * See sensor_integer_threshold_proxy_new() for the asynchronous version of this constructor.
5554 *
5555 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
5556 */
5557SensorIntegerThreshold *
5558sensor_integer_threshold_proxy_new_sync (
5559 GDBusConnection *connection,
5560 GDBusProxyFlags flags,
5561 const gchar *name,
5562 const gchar *object_path,
5563 GCancellable *cancellable,
5564 GError **error)
5565{
5566 GInitable *ret;
5567 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);
5568 if (ret != NULL)
5569 return SENSOR_INTEGER_THRESHOLD (ret);
5570 else
5571 return NULL;
5572}
5573
5574
5575/**
5576 * sensor_integer_threshold_proxy_new_for_bus:
5577 * @bus_type: A #GBusType.
5578 * @flags: Flags from the #GDBusProxyFlags enumeration.
5579 * @name: A bus name (well-known or unique).
5580 * @object_path: An object path.
5581 * @cancellable: (allow-none): A #GCancellable or %NULL.
5582 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5583 * @user_data: User data to pass to @callback.
5584 *
5585 * Like sensor_integer_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5586 *
5587 * 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.
5588 * You can then call sensor_integer_threshold_proxy_new_for_bus_finish() to get the result of the operation.
5589 *
5590 * See sensor_integer_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5591 */
5592void
5593sensor_integer_threshold_proxy_new_for_bus (
5594 GBusType bus_type,
5595 GDBusProxyFlags flags,
5596 const gchar *name,
5597 const gchar *object_path,
5598 GCancellable *cancellable,
5599 GAsyncReadyCallback callback,
5600 gpointer user_data)
5601{
5602 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);
5603}
5604
5605/**
5606 * sensor_integer_threshold_proxy_new_for_bus_finish:
5607 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new_for_bus().
5608 * @error: Return location for error or %NULL
5609 *
5610 * Finishes an operation started with sensor_integer_threshold_proxy_new_for_bus().
5611 *
5612 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
5613 */
5614SensorIntegerThreshold *
5615sensor_integer_threshold_proxy_new_for_bus_finish (
5616 GAsyncResult *res,
5617 GError **error)
5618{
5619 GObject *ret;
5620 GObject *source_object;
5621 source_object = g_async_result_get_source_object (res);
5622 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5623 g_object_unref (source_object);
5624 if (ret != NULL)
5625 return SENSOR_INTEGER_THRESHOLD (ret);
5626 else
5627 return NULL;
5628}
5629
5630/**
5631 * sensor_integer_threshold_proxy_new_for_bus_sync:
5632 * @bus_type: A #GBusType.
5633 * @flags: Flags from the #GDBusProxyFlags enumeration.
5634 * @name: A bus name (well-known or unique).
5635 * @object_path: An object path.
5636 * @cancellable: (allow-none): A #GCancellable or %NULL.
5637 * @error: Return location for error or %NULL
5638 *
5639 * Like sensor_integer_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5640 *
5641 * The calling thread is blocked until a reply is received.
5642 *
5643 * See sensor_integer_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
5644 *
5645 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
5646 */
5647SensorIntegerThreshold *
5648sensor_integer_threshold_proxy_new_for_bus_sync (
5649 GBusType bus_type,
5650 GDBusProxyFlags flags,
5651 const gchar *name,
5652 const gchar *object_path,
5653 GCancellable *cancellable,
5654 GError **error)
5655{
5656 GInitable *ret;
5657 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);
5658 if (ret != NULL)
5659 return SENSOR_INTEGER_THRESHOLD (ret);
5660 else
5661 return NULL;
5662}
5663
5664
5665/* ------------------------------------------------------------------------ */
5666
5667/**
5668 * SensorIntegerThresholdSkeleton:
5669 *
5670 * The #SensorIntegerThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
5671 */
5672
5673/**
5674 * SensorIntegerThresholdSkeletonClass:
5675 * @parent_class: The parent class.
5676 *
5677 * Class structure for #SensorIntegerThresholdSkeleton.
5678 */
5679
5680struct _SensorIntegerThresholdSkeletonPrivate
5681{
5682 GValue *properties;
5683 GList *changed_properties;
5684 GSource *changed_properties_idle_source;
5685 GMainContext *context;
5686 GMutex lock;
5687};
5688
5689static void
5690_sensor_integer_threshold_skeleton_handle_method_call (
5691 GDBusConnection *connection G_GNUC_UNUSED,
5692 const gchar *sender G_GNUC_UNUSED,
5693 const gchar *object_path G_GNUC_UNUSED,
5694 const gchar *interface_name,
5695 const gchar *method_name,
5696 GVariant *parameters,
5697 GDBusMethodInvocation *invocation,
5698 gpointer user_data)
5699{
5700 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
5701 _ExtendedGDBusMethodInfo *info;
5702 GVariantIter iter;
5703 GVariant *child;
5704 GValue *paramv;
5705 guint num_params;
5706 guint num_extra;
5707 guint n;
5708 guint signal_id;
5709 GValue return_value = G_VALUE_INIT;
5710 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5711 g_assert (info != NULL);
5712 num_params = g_variant_n_children (parameters);
5713 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5714 n = 0;
5715 g_value_init (&paramv[n], TYPE_SENSOR_INTEGER_THRESHOLD);
5716 g_value_set_object (&paramv[n++], skeleton);
5717 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5718 g_value_set_object (&paramv[n++], invocation);
5719 if (info->pass_fdlist)
5720 {
5721#ifdef G_OS_UNIX
5722 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5723 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5724#else
5725 g_assert_not_reached ();
5726#endif
5727 }
5728 g_variant_iter_init (&iter, parameters);
5729 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5730 {
5731 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5732 if (arg_info->use_gvariant)
5733 {
5734 g_value_init (&paramv[n], G_TYPE_VARIANT);
5735 g_value_set_variant (&paramv[n], child);
5736 n++;
5737 }
5738 else
5739 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5740 g_variant_unref (child);
5741 }
5742 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD);
5743 g_value_init (&return_value, G_TYPE_BOOLEAN);
5744 g_signal_emitv (paramv, signal_id, 0, &return_value);
5745 if (!g_value_get_boolean (&return_value))
5746 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);
5747 g_value_unset (&return_value);
5748 for (n = 0; n < num_params + num_extra; n++)
5749 g_value_unset (&paramv[n]);
5750 g_free (paramv);
5751}
5752
5753static GVariant *
5754_sensor_integer_threshold_skeleton_handle_get_property (
5755 GDBusConnection *connection G_GNUC_UNUSED,
5756 const gchar *sender G_GNUC_UNUSED,
5757 const gchar *object_path G_GNUC_UNUSED,
5758 const gchar *interface_name G_GNUC_UNUSED,
5759 const gchar *property_name,
5760 GError **error,
5761 gpointer user_data)
5762{
5763 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
5764 GValue value = G_VALUE_INIT;
5765 GParamSpec *pspec;
5766 _ExtendedGDBusPropertyInfo *info;
5767 GVariant *ret;
5768 ret = NULL;
5769 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name);
5770 g_assert (info != NULL);
5771 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5772 if (pspec == NULL)
5773 {
5774 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5775 }
5776 else
5777 {
5778 g_value_init (&value, pspec->value_type);
5779 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5780 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5781 g_value_unset (&value);
5782 }
5783 return ret;
5784}
5785
5786static gboolean
5787_sensor_integer_threshold_skeleton_handle_set_property (
5788 GDBusConnection *connection G_GNUC_UNUSED,
5789 const gchar *sender G_GNUC_UNUSED,
5790 const gchar *object_path G_GNUC_UNUSED,
5791 const gchar *interface_name G_GNUC_UNUSED,
5792 const gchar *property_name,
5793 GVariant *variant,
5794 GError **error,
5795 gpointer user_data)
5796{
5797 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
5798 GValue value = G_VALUE_INIT;
5799 GParamSpec *pspec;
5800 _ExtendedGDBusPropertyInfo *info;
5801 gboolean ret;
5802 ret = FALSE;
5803 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name);
5804 g_assert (info != NULL);
5805 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5806 if (pspec == NULL)
5807 {
5808 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5809 }
5810 else
5811 {
5812 if (info->use_gvariant)
5813 g_value_set_variant (&value, variant);
5814 else
5815 g_dbus_gvariant_to_gvalue (variant, &value);
5816 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5817 g_value_unset (&value);
5818 ret = TRUE;
5819 }
5820 return ret;
5821}
5822
5823static const GDBusInterfaceVTable _sensor_integer_threshold_skeleton_vtable =
5824{
5825 _sensor_integer_threshold_skeleton_handle_method_call,
5826 _sensor_integer_threshold_skeleton_handle_get_property,
5827 _sensor_integer_threshold_skeleton_handle_set_property,
5828 {NULL}
5829};
5830
5831static GDBusInterfaceInfo *
5832sensor_integer_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5833{
5834 return sensor_integer_threshold_interface_info ();
5835}
5836
5837static GDBusInterfaceVTable *
5838sensor_integer_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5839{
5840 return (GDBusInterfaceVTable *) &_sensor_integer_threshold_skeleton_vtable;
5841}
5842
5843static GVariant *
5844sensor_integer_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5845{
5846 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton);
5847
5848 GVariantBuilder builder;
5849 guint n;
5850 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5851 if (_sensor_integer_threshold_interface_info.parent_struct.properties == NULL)
5852 goto out;
5853 for (n = 0; _sensor_integer_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
5854 {
5855 GDBusPropertyInfo *info = _sensor_integer_threshold_interface_info.parent_struct.properties[n];
5856 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5857 {
5858 GVariant *value;
5859 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);
5860 if (value != NULL)
5861 {
5862 g_variant_take_ref (value);
5863 g_variant_builder_add (&builder, "{sv}", info->name, value);
5864 g_variant_unref (value);
5865 }
5866 }
5867 }
5868out:
5869 return g_variant_builder_end (&builder);
5870}
5871
5872static gboolean _sensor_integer_threshold_emit_changed (gpointer user_data);
5873
5874static void
5875sensor_integer_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5876{
5877 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton);
5878 gboolean emit_changed = FALSE;
5879
5880 g_mutex_lock (&skeleton->priv->lock);
5881 if (skeleton->priv->changed_properties_idle_source != NULL)
5882 {
5883 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5884 skeleton->priv->changed_properties_idle_source = NULL;
5885 emit_changed = TRUE;
5886 }
5887 g_mutex_unlock (&skeleton->priv->lock);
5888
5889 if (emit_changed)
5890 _sensor_integer_threshold_emit_changed (skeleton);
5891}
5892
5893static void
5894_sensor_integer_threshold_on_signal_warning (
5895 SensorIntegerThreshold *object)
5896{
5897 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5898
5899 GList *connections, *l;
5900 GVariant *signal_variant;
5901 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5902
5903 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5904 for (l = connections; l != NULL; l = l->next)
5905 {
5906 GDBusConnection *connection = l->data;
5907 g_dbus_connection_emit_signal (connection,
5908 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "Warning",
5909 signal_variant, NULL);
5910 }
5911 g_variant_unref (signal_variant);
5912 g_list_free_full (connections, g_object_unref);
5913}
5914
5915static void
5916_sensor_integer_threshold_on_signal_critical (
5917 SensorIntegerThreshold *object)
5918{
5919 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5920
5921 GList *connections, *l;
5922 GVariant *signal_variant;
5923 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5924
5925 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5926 for (l = connections; l != NULL; l = l->next)
5927 {
5928 GDBusConnection *connection = l->data;
5929 g_dbus_connection_emit_signal (connection,
5930 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "Critical",
5931 signal_variant, NULL);
5932 }
5933 g_variant_unref (signal_variant);
5934 g_list_free_full (connections, g_object_unref);
5935}
5936
5937static void sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface);
5938#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5939G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5940 G_ADD_PRIVATE (SensorIntegerThresholdSkeleton)
5941 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init));
5942
5943#else
5944G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5945 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init));
5946
5947#endif
5948static void
5949sensor_integer_threshold_skeleton_finalize (GObject *object)
5950{
5951 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5952 guint n;
5953 for (n = 0; n < 5; n++)
5954 g_value_unset (&skeleton->priv->properties[n]);
5955 g_free (skeleton->priv->properties);
5956 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5957 if (skeleton->priv->changed_properties_idle_source != NULL)
5958 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5959 g_main_context_unref (skeleton->priv->context);
5960 g_mutex_clear (&skeleton->priv->lock);
5961 G_OBJECT_CLASS (sensor_integer_threshold_skeleton_parent_class)->finalize (object);
5962}
5963
5964static void
5965sensor_integer_threshold_skeleton_get_property (GObject *object,
5966 guint prop_id,
5967 GValue *value,
5968 GParamSpec *pspec G_GNUC_UNUSED)
5969{
5970 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5971 g_assert (prop_id != 0 && prop_id - 1 < 5);
5972 g_mutex_lock (&skeleton->priv->lock);
5973 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5974 g_mutex_unlock (&skeleton->priv->lock);
5975}
5976
5977static gboolean
5978_sensor_integer_threshold_emit_changed (gpointer user_data)
5979{
5980 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
5981 GList *l;
5982 GVariantBuilder builder;
5983 GVariantBuilder invalidated_builder;
5984 guint num_changes;
5985
5986 g_mutex_lock (&skeleton->priv->lock);
5987 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5988 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5989 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5990 {
5991 ChangedProperty *cp = l->data;
5992 GVariant *variant;
5993 const GValue *cur_value;
5994
5995 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5996 if (!_g_value_equal (cur_value, &cp->orig_value))
5997 {
5998 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5999 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6000 g_variant_unref (variant);
6001 num_changes++;
6002 }
6003 }
6004 if (num_changes > 0)
6005 {
6006 GList *connections, *ll;
6007 GVariant *signal_variant;
6008 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorIntegerThreshold",
6009 &builder, &invalidated_builder));
6010 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6011 for (ll = connections; ll != NULL; ll = ll->next)
6012 {
6013 GDBusConnection *connection = ll->data;
6014
6015 g_dbus_connection_emit_signal (connection,
6016 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6017 "org.freedesktop.DBus.Properties",
6018 "PropertiesChanged",
6019 signal_variant,
6020 NULL);
6021 }
6022 g_variant_unref (signal_variant);
6023 g_list_free_full (connections, g_object_unref);
6024 }
6025 else
6026 {
6027 g_variant_builder_clear (&builder);
6028 g_variant_builder_clear (&invalidated_builder);
6029 }
6030 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6031 skeleton->priv->changed_properties = NULL;
6032 skeleton->priv->changed_properties_idle_source = NULL;
6033 g_mutex_unlock (&skeleton->priv->lock);
6034 return FALSE;
6035}
6036
6037static void
6038_sensor_integer_threshold_schedule_emit_changed (SensorIntegerThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6039{
6040 ChangedProperty *cp;
6041 GList *l;
6042 cp = NULL;
6043 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
6044 {
6045 ChangedProperty *i_cp = l->data;
6046 if (i_cp->info == info)
6047 {
6048 cp = i_cp;
6049 break;
6050 }
6051 }
6052 if (cp == NULL)
6053 {
6054 cp = g_new0 (ChangedProperty, 1);
6055 cp->prop_id = prop_id;
6056 cp->info = info;
6057 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
6058 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
6059 g_value_copy (orig_value, &cp->orig_value);
6060 }
6061}
6062
6063static void
6064sensor_integer_threshold_skeleton_notify (GObject *object,
6065 GParamSpec *pspec G_GNUC_UNUSED)
6066{
6067 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
6068 g_mutex_lock (&skeleton->priv->lock);
6069 if (skeleton->priv->changed_properties != NULL &&
6070 skeleton->priv->changed_properties_idle_source == NULL)
6071 {
6072 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
6073 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
6074 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
6075 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
6076 g_source_unref (skeleton->priv->changed_properties_idle_source);
6077 }
6078 g_mutex_unlock (&skeleton->priv->lock);
6079}
6080
6081static void
6082sensor_integer_threshold_skeleton_set_property (GObject *object,
6083 guint prop_id,
6084 const GValue *value,
6085 GParamSpec *pspec)
6086{
6087 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
6088 g_assert (prop_id != 0 && prop_id - 1 < 5);
6089 g_mutex_lock (&skeleton->priv->lock);
6090 g_object_freeze_notify (object);
6091 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
6092 {
6093 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
6094 _sensor_integer_threshold_schedule_emit_changed (skeleton, _sensor_integer_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
6095 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6096 g_object_notify_by_pspec (object, pspec);
6097 }
6098 g_mutex_unlock (&skeleton->priv->lock);
6099 g_object_thaw_notify (object);
6100}
6101
6102static void
6103sensor_integer_threshold_skeleton_init (SensorIntegerThresholdSkeleton *skeleton)
6104{
6105#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6106 skeleton->priv = sensor_integer_threshold_skeleton_get_instance_private (skeleton);
6107#else
6108 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, SensorIntegerThresholdSkeletonPrivate);
6109#endif
6110
6111 g_mutex_init (&skeleton->priv->lock);
6112 skeleton->priv->context = g_main_context_ref_thread_default ();
6113 skeleton->priv->properties = g_new0 (GValue, 5);
6114 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
6115 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
6116 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
6117 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
6118 g_value_init (&skeleton->priv->properties[4], G_TYPE_INT);
6119}
6120
6121static gint
6122sensor_integer_threshold_skeleton_get_lower_critical (SensorIntegerThreshold *object)
6123{
6124 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
6125 gint value;
6126 g_mutex_lock (&skeleton->priv->lock);
6127 value = g_value_get_int (&(skeleton->priv->properties[0]));
6128 g_mutex_unlock (&skeleton->priv->lock);
6129 return value;
6130}
6131
6132static gint
6133sensor_integer_threshold_skeleton_get_lower_warning (SensorIntegerThreshold *object)
6134{
6135 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
6136 gint value;
6137 g_mutex_lock (&skeleton->priv->lock);
6138 value = g_value_get_int (&(skeleton->priv->properties[1]));
6139 g_mutex_unlock (&skeleton->priv->lock);
6140 return value;
6141}
6142
6143static gint
6144sensor_integer_threshold_skeleton_get_upper_warning (SensorIntegerThreshold *object)
6145{
6146 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
6147 gint value;
6148 g_mutex_lock (&skeleton->priv->lock);
6149 value = g_value_get_int (&(skeleton->priv->properties[2]));
6150 g_mutex_unlock (&skeleton->priv->lock);
6151 return value;
6152}
6153
6154static gint
6155sensor_integer_threshold_skeleton_get_upper_critical (SensorIntegerThreshold *object)
6156{
6157 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
6158 gint value;
6159 g_mutex_lock (&skeleton->priv->lock);
6160 value = g_value_get_int (&(skeleton->priv->properties[3]));
6161 g_mutex_unlock (&skeleton->priv->lock);
6162 return value;
6163}
6164
6165static gint
6166sensor_integer_threshold_skeleton_get_state (SensorIntegerThreshold *object)
6167{
6168 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
6169 gint value;
6170 g_mutex_lock (&skeleton->priv->lock);
6171 value = g_value_get_int (&(skeleton->priv->properties[4]));
6172 g_mutex_unlock (&skeleton->priv->lock);
6173 return value;
6174}
6175
6176static void
6177sensor_integer_threshold_skeleton_class_init (SensorIntegerThresholdSkeletonClass *klass)
6178{
6179 GObjectClass *gobject_class;
6180 GDBusInterfaceSkeletonClass *skeleton_class;
6181
6182 gobject_class = G_OBJECT_CLASS (klass);
6183 gobject_class->finalize = sensor_integer_threshold_skeleton_finalize;
6184 gobject_class->get_property = sensor_integer_threshold_skeleton_get_property;
6185 gobject_class->set_property = sensor_integer_threshold_skeleton_set_property;
6186 gobject_class->notify = sensor_integer_threshold_skeleton_notify;
6187
6188
6189 sensor_integer_threshold_override_properties (gobject_class, 1);
6190
6191 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6192 skeleton_class->get_info = sensor_integer_threshold_skeleton_dbus_interface_get_info;
6193 skeleton_class->get_properties = sensor_integer_threshold_skeleton_dbus_interface_get_properties;
6194 skeleton_class->flush = sensor_integer_threshold_skeleton_dbus_interface_flush;
6195 skeleton_class->get_vtable = sensor_integer_threshold_skeleton_dbus_interface_get_vtable;
6196
6197#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6198 g_type_class_add_private (klass, sizeof (SensorIntegerThresholdSkeletonPrivate));
6199#endif
6200}
6201
6202static void
6203sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface)
6204{
6205 iface->warning = _sensor_integer_threshold_on_signal_warning;
6206 iface->critical = _sensor_integer_threshold_on_signal_critical;
6207 iface->get_lower_critical = sensor_integer_threshold_skeleton_get_lower_critical;
6208 iface->get_lower_warning = sensor_integer_threshold_skeleton_get_lower_warning;
6209 iface->get_upper_warning = sensor_integer_threshold_skeleton_get_upper_warning;
6210 iface->get_upper_critical = sensor_integer_threshold_skeleton_get_upper_critical;
6211 iface->get_state = sensor_integer_threshold_skeleton_get_state;
6212}
6213
6214/**
6215 * sensor_integer_threshold_skeleton_new:
6216 *
6217 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
6218 *
6219 * Returns: (transfer full) (type SensorIntegerThresholdSkeleton): The skeleton object.
6220 */
6221SensorIntegerThreshold *
6222sensor_integer_threshold_skeleton_new (void)
6223{
6224 return SENSOR_INTEGER_THRESHOLD (g_object_new (TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, NULL));
6225}
6226
6227/* ------------------------------------------------------------------------
6228 * Code for Object, ObjectProxy and ObjectSkeleton
6229 * ------------------------------------------------------------------------
6230 */
6231
6232/**
6233 * SECTION:Object
6234 * @title: Object
6235 * @short_description: Specialized GDBusObject types
6236 *
6237 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
6238 */
6239
6240/**
6241 * Object:
6242 *
6243 * The #Object type is a specialized container of interfaces.
6244 */
6245
6246/**
6247 * ObjectIface:
6248 * @parent_iface: The parent interface.
6249 *
6250 * Virtual table for the #Object interface.
6251 */
6252
6253typedef ObjectIface ObjectInterface;
6254G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
6255
6256static void
6257object_default_init (ObjectIface *iface)
6258{
6259 /**
6260 * Object:sensor-integer:
6261 *
6262 * 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.
6263 *
6264 * Connect to the #GObject::notify signal to get informed of property changes.
6265 */
6266 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));
6267
6268 /**
6269 * Object:sensor-string:
6270 *
6271 * 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.
6272 *
6273 * Connect to the #GObject::notify signal to get informed of property changes.
6274 */
6275 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));
6276
6277 /**
6278 * Object:sensor-integer-threshold:
6279 *
6280 * 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.
6281 *
6282 * Connect to the #GObject::notify signal to get informed of property changes.
6283 */
6284 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));
6285
6286}
6287
6288/**
6289 * object_get_sensor_integer:
6290 * @object: A #Object.
6291 *
6292 * 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.
6293 *
6294 * Returns: (transfer full): A #SensorInteger that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
6295 */
6296SensorInteger *object_get_sensor_integer (Object *object)
6297{
6298 GDBusInterface *ret;
6299 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
6300 if (ret == NULL)
6301 return NULL;
6302 return SENSOR_INTEGER (ret);
6303}
6304
6305/**
6306 * object_get_sensor_string:
6307 * @object: A #Object.
6308 *
6309 * 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.
6310 *
6311 * Returns: (transfer full): A #SensorString that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
6312 */
6313SensorString *object_get_sensor_string (Object *object)
6314{
6315 GDBusInterface *ret;
6316 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
6317 if (ret == NULL)
6318 return NULL;
6319 return SENSOR_STRING (ret);
6320}
6321
6322/**
6323 * object_get_sensor_integer_threshold:
6324 * @object: A #Object.
6325 *
6326 * 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.
6327 *
6328 * Returns: (transfer full): A #SensorIntegerThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
6329 */
6330SensorIntegerThreshold *object_get_sensor_integer_threshold (Object *object)
6331{
6332 GDBusInterface *ret;
6333 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
6334 if (ret == NULL)
6335 return NULL;
6336 return SENSOR_INTEGER_THRESHOLD (ret);
6337}
6338
6339
6340/**
6341 * object_peek_sensor_integer: (skip)
6342 * @object: A #Object.
6343 *
6344 * Like object_get_sensor_integer() but doesn't increase the reference count on the returned object.
6345 *
6346 * <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>
6347 *
6348 * 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.
6349 */
6350SensorInteger *object_peek_sensor_integer (Object *object)
6351{
6352 GDBusInterface *ret;
6353 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
6354 if (ret == NULL)
6355 return NULL;
6356 g_object_unref (ret);
6357 return SENSOR_INTEGER (ret);
6358}
6359
6360/**
6361 * object_peek_sensor_string: (skip)
6362 * @object: A #Object.
6363 *
6364 * Like object_get_sensor_string() but doesn't increase the reference count on the returned object.
6365 *
6366 * <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>
6367 *
6368 * 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.
6369 */
6370SensorString *object_peek_sensor_string (Object *object)
6371{
6372 GDBusInterface *ret;
6373 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
6374 if (ret == NULL)
6375 return NULL;
6376 g_object_unref (ret);
6377 return SENSOR_STRING (ret);
6378}
6379
6380/**
6381 * object_peek_sensor_integer_threshold: (skip)
6382 * @object: A #Object.
6383 *
6384 * Like object_get_sensor_integer_threshold() but doesn't increase the reference count on the returned object.
6385 *
6386 * <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>
6387 *
6388 * 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.
6389 */
6390SensorIntegerThreshold *object_peek_sensor_integer_threshold (Object *object)
6391{
6392 GDBusInterface *ret;
6393 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
6394 if (ret == NULL)
6395 return NULL;
6396 g_object_unref (ret);
6397 return SENSOR_INTEGER_THRESHOLD (ret);
6398}
6399
6400
6401static void
6402object_notify (GDBusObject *object, GDBusInterface *interface)
6403{
6404 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
6405 /* info can be NULL if the other end is using a D-Bus interface we don't know
6406 * anything about, for example old generated code in this process talking to
6407 * newer generated code in the other process. */
6408 if (info != NULL)
6409 g_object_notify (G_OBJECT (object), info->hyphen_name);
6410}
6411
6412/**
6413 * ObjectProxy:
6414 *
6415 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
6416 */
6417
6418/**
6419 * ObjectProxyClass:
6420 * @parent_class: The parent class.
6421 *
6422 * Class structure for #ObjectProxy.
6423 */
6424
6425static void
6426object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
6427{
6428}
6429
6430static void
6431object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
6432{
6433 iface->interface_added = object_notify;
6434 iface->interface_removed = object_notify;
6435}
6436
6437
6438G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
6439 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
6440 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
6441
6442static void
6443object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
6444{
6445}
6446
6447static void
6448object_proxy_set_property (GObject *gobject,
6449 guint prop_id,
6450 const GValue *value G_GNUC_UNUSED,
6451 GParamSpec *pspec)
6452{
6453 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
6454}
6455
6456static void
6457object_proxy_get_property (GObject *gobject,
6458 guint prop_id,
6459 GValue *value,
6460 GParamSpec *pspec)
6461{
6462 ObjectProxy *object = OBJECT_PROXY (gobject);
6463 GDBusInterface *interface;
6464
6465 switch (prop_id)
6466 {
6467 case 1:
6468 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
6469 g_value_take_object (value, interface);
6470 break;
6471
6472 case 2:
6473 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
6474 g_value_take_object (value, interface);
6475 break;
6476
6477 case 3:
6478 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
6479 g_value_take_object (value, interface);
6480 break;
6481
6482 default:
6483 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
6484 break;
6485 }
6486}
6487
6488static void
6489object_proxy_class_init (ObjectProxyClass *klass)
6490{
6491 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
6492
6493 gobject_class->set_property = object_proxy_set_property;
6494 gobject_class->get_property = object_proxy_get_property;
6495
6496 g_object_class_override_property (gobject_class, 1, "sensor-integer");
6497 g_object_class_override_property (gobject_class, 2, "sensor-string");
6498 g_object_class_override_property (gobject_class, 3, "sensor-integer-threshold");
6499}
6500
6501/**
6502 * object_proxy_new:
6503 * @connection: A #GDBusConnection.
6504 * @object_path: An object path.
6505 *
6506 * Creates a new proxy object.
6507 *
6508 * Returns: (transfer full): The proxy object.
6509 */
6510ObjectProxy *
6511object_proxy_new (GDBusConnection *connection,
6512 const gchar *object_path)
6513{
6514 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
6515 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
6516 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
6517}
6518
6519/**
6520 * ObjectSkeleton:
6521 *
6522 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
6523 */
6524
6525/**
6526 * ObjectSkeletonClass:
6527 * @parent_class: The parent class.
6528 *
6529 * Class structure for #ObjectSkeleton.
6530 */
6531
6532static void
6533object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
6534{
6535}
6536
6537
6538static void
6539object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
6540{
6541 iface->interface_added = object_notify;
6542 iface->interface_removed = object_notify;
6543}
6544
6545G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
6546 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
6547 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
6548
6549static void
6550object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
6551{
6552}
6553
6554static void
6555object_skeleton_set_property (GObject *gobject,
6556 guint prop_id,
6557 const GValue *value,
6558 GParamSpec *pspec)
6559{
6560 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
6561 GDBusInterfaceSkeleton *interface;
6562
6563 switch (prop_id)
6564 {
6565 case 1:
6566 interface = g_value_get_object (value);
6567 if (interface != NULL)
6568 {
6569 g_warn_if_fail (IS_SENSOR_INTEGER (interface));
6570 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
6571 }
6572 else
6573 {
6574 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorInteger");
6575 }
6576 break;
6577
6578 case 2:
6579 interface = g_value_get_object (value);
6580 if (interface != NULL)
6581 {
6582 g_warn_if_fail (IS_SENSOR_STRING (interface));
6583 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
6584 }
6585 else
6586 {
6587 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorString");
6588 }
6589 break;
6590
6591 case 3:
6592 interface = g_value_get_object (value);
6593 if (interface != NULL)
6594 {
6595 g_warn_if_fail (IS_SENSOR_INTEGER_THRESHOLD (interface));
6596 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
6597 }
6598 else
6599 {
6600 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorIntegerThreshold");
6601 }
6602 break;
6603
6604 default:
6605 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
6606 break;
6607 }
6608}
6609
6610static void
6611object_skeleton_get_property (GObject *gobject,
6612 guint prop_id,
6613 GValue *value,
6614 GParamSpec *pspec)
6615{
6616 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
6617 GDBusInterface *interface;
6618
6619 switch (prop_id)
6620 {
6621 case 1:
6622 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
6623 g_value_take_object (value, interface);
6624 break;
6625
6626 case 2:
6627 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
6628 g_value_take_object (value, interface);
6629 break;
6630
6631 case 3:
6632 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
6633 g_value_take_object (value, interface);
6634 break;
6635
6636 default:
6637 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
6638 break;
6639 }
6640}
6641
6642static void
6643object_skeleton_class_init (ObjectSkeletonClass *klass)
6644{
6645 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
6646
6647 gobject_class->set_property = object_skeleton_set_property;
6648 gobject_class->get_property = object_skeleton_get_property;
6649
6650 g_object_class_override_property (gobject_class, 1, "sensor-integer");
6651 g_object_class_override_property (gobject_class, 2, "sensor-string");
6652 g_object_class_override_property (gobject_class, 3, "sensor-integer-threshold");
6653}
6654
6655/**
6656 * object_skeleton_new:
6657 * @object_path: An object path.
6658 *
6659 * Creates a new skeleton object.
6660 *
6661 * Returns: (transfer full): The skeleton object.
6662 */
6663ObjectSkeleton *
6664object_skeleton_new (const gchar *object_path)
6665{
6666 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
6667 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
6668}
6669
6670/**
6671 * object_skeleton_set_sensor_integer:
6672 * @object: A #ObjectSkeleton.
6673 * @interface_: (allow-none): A #SensorInteger or %NULL to clear the interface.
6674 *
6675 * 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.
6676 */
6677void object_skeleton_set_sensor_integer (ObjectSkeleton *object, SensorInteger *interface_)
6678{
6679 g_object_set (G_OBJECT (object), "sensor-integer", interface_, NULL);
6680}
6681
6682/**
6683 * object_skeleton_set_sensor_string:
6684 * @object: A #ObjectSkeleton.
6685 * @interface_: (allow-none): A #SensorString or %NULL to clear the interface.
6686 *
6687 * 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.
6688 */
6689void object_skeleton_set_sensor_string (ObjectSkeleton *object, SensorString *interface_)
6690{
6691 g_object_set (G_OBJECT (object), "sensor-string", interface_, NULL);
6692}
6693
6694/**
6695 * object_skeleton_set_sensor_integer_threshold:
6696 * @object: A #ObjectSkeleton.
6697 * @interface_: (allow-none): A #SensorIntegerThreshold or %NULL to clear the interface.
6698 *
6699 * 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.
6700 */
6701void object_skeleton_set_sensor_integer_threshold (ObjectSkeleton *object, SensorIntegerThreshold *interface_)
6702{
6703 g_object_set (G_OBJECT (object), "sensor-integer-threshold", interface_, NULL);
6704}
6705
6706
6707/* ------------------------------------------------------------------------
6708 * Code for ObjectManager client
6709 * ------------------------------------------------------------------------
6710 */
6711
6712/**
6713 * SECTION:ObjectManagerClient
6714 * @title: ObjectManagerClient
6715 * @short_description: Generated GDBusObjectManagerClient type
6716 *
6717 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
6718 */
6719
6720/**
6721 * ObjectManagerClient:
6722 *
6723 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
6724 */
6725
6726/**
6727 * ObjectManagerClientClass:
6728 * @parent_class: The parent class.
6729 *
6730 * Class structure for #ObjectManagerClient.
6731 */
6732
6733G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
6734
6735static void
6736object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
6737{
6738}
6739
6740static void
6741object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
6742{
6743}
6744
6745/**
6746 * object_manager_client_get_proxy_type:
6747 * @manager: A #GDBusObjectManagerClient.
6748 * @object_path: The object path of the remote object (unused).
6749 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
6750 * @user_data: User data (unused).
6751 *
6752 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
6753 *
6754 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
6755 */
6756GType
6757object_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)
6758{
6759 static gsize once_init_value = 0;
6760 static GHashTable *lookup_hash;
6761 GType ret;
6762
6763 if (interface_name == NULL)
6764 return TYPE_OBJECT_PROXY;
6765 if (g_once_init_enter (&once_init_value))
6766 {
6767 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
6768 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorInteger", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_PROXY));
6769 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorString", GSIZE_TO_POINTER (TYPE_SENSOR_STRING_PROXY));
6770 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorIntegerThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY));
6771 g_once_init_leave (&once_init_value, 1);
6772 }
6773 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
6774 if (ret == (GType) 0)
6775 ret = G_TYPE_DBUS_PROXY;
6776 return ret;
6777}
6778
6779/**
6780 * object_manager_client_new:
6781 * @connection: A #GDBusConnection.
6782 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
6783 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6784 * @object_path: An object path.
6785 * @cancellable: (allow-none): A #GCancellable or %NULL.
6786 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6787 * @user_data: User data to pass to @callback.
6788 *
6789 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
6790 *
6791 * 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.
6792 * You can then call object_manager_client_new_finish() to get the result of the operation.
6793 *
6794 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
6795 */
6796void
6797object_manager_client_new (
6798 GDBusConnection *connection,
6799 GDBusObjectManagerClientFlags flags,
6800 const gchar *name,
6801 const gchar *object_path,
6802 GCancellable *cancellable,
6803 GAsyncReadyCallback callback,
6804 gpointer user_data)
6805{
6806 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);
6807}
6808
6809/**
6810 * object_manager_client_new_finish:
6811 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
6812 * @error: Return location for error or %NULL
6813 *
6814 * Finishes an operation started with object_manager_client_new().
6815 *
6816 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
6817 */
6818GDBusObjectManager *
6819object_manager_client_new_finish (
6820 GAsyncResult *res,
6821 GError **error)
6822{
6823 GObject *ret;
6824 GObject *source_object;
6825 source_object = g_async_result_get_source_object (res);
6826 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6827 g_object_unref (source_object);
6828 if (ret != NULL)
6829 return G_DBUS_OBJECT_MANAGER (ret);
6830 else
6831 return NULL;
6832}
6833
6834/**
6835 * object_manager_client_new_sync:
6836 * @connection: A #GDBusConnection.
6837 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
6838 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6839 * @object_path: An object path.
6840 * @cancellable: (allow-none): A #GCancellable or %NULL.
6841 * @error: Return location for error or %NULL
6842 *
6843 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
6844 *
6845 * The calling thread is blocked until a reply is received.
6846 *
6847 * See object_manager_client_new() for the asynchronous version of this constructor.
6848 *
6849 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
6850 */
6851GDBusObjectManager *
6852object_manager_client_new_sync (
6853 GDBusConnection *connection,
6854 GDBusObjectManagerClientFlags flags,
6855 const gchar *name,
6856 const gchar *object_path,
6857 GCancellable *cancellable,
6858 GError **error)
6859{
6860 GInitable *ret;
6861 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);
6862 if (ret != NULL)
6863 return G_DBUS_OBJECT_MANAGER (ret);
6864 else
6865 return NULL;
6866}
6867
6868
6869/**
6870 * object_manager_client_new_for_bus:
6871 * @bus_type: A #GBusType.
6872 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
6873 * @name: A bus name (well-known or unique).
6874 * @object_path: An object path.
6875 * @cancellable: (allow-none): A #GCancellable or %NULL.
6876 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6877 * @user_data: User data to pass to @callback.
6878 *
6879 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
6880 *
6881 * 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.
6882 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
6883 *
6884 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6885 */
6886void
6887object_manager_client_new_for_bus (
6888 GBusType bus_type,
6889 GDBusObjectManagerClientFlags flags,
6890 const gchar *name,
6891 const gchar *object_path,
6892 GCancellable *cancellable,
6893 GAsyncReadyCallback callback,
6894 gpointer user_data)
6895{
6896 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);
6897}
6898
6899/**
6900 * object_manager_client_new_for_bus_finish:
6901 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
6902 * @error: Return location for error or %NULL
6903 *
6904 * Finishes an operation started with object_manager_client_new_for_bus().
6905 *
6906 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
6907 */
6908GDBusObjectManager *
6909object_manager_client_new_for_bus_finish (
6910 GAsyncResult *res,
6911 GError **error)
6912{
6913 GObject *ret;
6914 GObject *source_object;
6915 source_object = g_async_result_get_source_object (res);
6916 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6917 g_object_unref (source_object);
6918 if (ret != NULL)
6919 return G_DBUS_OBJECT_MANAGER (ret);
6920 else
6921 return NULL;
6922}
6923
6924/**
6925 * object_manager_client_new_for_bus_sync:
6926 * @bus_type: A #GBusType.
6927 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
6928 * @name: A bus name (well-known or unique).
6929 * @object_path: An object path.
6930 * @cancellable: (allow-none): A #GCancellable or %NULL.
6931 * @error: Return location for error or %NULL
6932 *
6933 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6934 *
6935 * The calling thread is blocked until a reply is received.
6936 *
6937 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
6938 *
6939 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
6940 */
6941GDBusObjectManager *
6942object_manager_client_new_for_bus_sync (
6943 GBusType bus_type,
6944 GDBusObjectManagerClientFlags flags,
6945 const gchar *name,
6946 const gchar *object_path,
6947 GCancellable *cancellable,
6948 GError **error)
6949{
6950 GInitable *ret;
6951 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);
6952 if (ret != NULL)
6953 return G_DBUS_OBJECT_MANAGER (ret);
6954 else
6955 return NULL;
6956}
6957
6958