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