blob: 96419dfb4aa05b786a5edbaf8ce74f76f3485700 [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
Norman James90baede2015-09-02 20:32:49 -0500166static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_init =
167{
168 {
169 -1,
170 (gchar *) "init",
171 NULL,
172 NULL,
173 NULL
174 },
175 "handle-init",
176 FALSE
177};
178
Norman Jamese2765102015-08-19 22:00:55 -0500179static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_value_OUT_ARG_value =
180{
181 {
182 -1,
183 (gchar *) "value",
184 (gchar *) "i",
185 NULL
186 },
187 FALSE
188};
189
190static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_value_OUT_ARG_pointers[] =
191{
192 &_sensor_integer_method_info_get_value_OUT_ARG_value,
193 NULL
194};
195
196static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_value =
197{
198 {
199 -1,
200 (gchar *) "getValue",
201 NULL,
202 (GDBusArgInfo **) &_sensor_integer_method_info_get_value_OUT_ARG_pointers,
203 NULL
204 },
205 "handle-get-value",
206 FALSE
207};
208
Norman James90baede2015-09-02 20:32:49 -0500209static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_value_IN_ARG_value =
210{
211 {
212 -1,
213 (gchar *) "value",
214 (gchar *) "i",
215 NULL
216 },
217 FALSE
218};
219
220static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_value_IN_ARG_pointers[] =
221{
222 &_sensor_integer_method_info_set_value_IN_ARG_value,
223 NULL
224};
225
226static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_value =
227{
228 {
229 -1,
230 (gchar *) "setValue",
231 (GDBusArgInfo **) &_sensor_integer_method_info_set_value_IN_ARG_pointers,
232 NULL,
233 NULL
234 },
235 "handle-set-value",
236 FALSE
237};
238
Norman Jamese2765102015-08-19 22:00:55 -0500239static const _ExtendedGDBusArgInfo _sensor_integer_method_info_get_units_OUT_ARG_units =
240{
241 {
242 -1,
243 (gchar *) "units",
244 (gchar *) "s",
245 NULL
246 },
247 FALSE
248};
249
250static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_get_units_OUT_ARG_pointers[] =
251{
252 &_sensor_integer_method_info_get_units_OUT_ARG_units,
253 NULL
254};
255
256static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_get_units =
257{
258 {
259 -1,
260 (gchar *) "getUnits",
261 NULL,
262 (GDBusArgInfo **) &_sensor_integer_method_info_get_units_OUT_ARG_pointers,
263 NULL
264 },
265 "handle-get-units",
266 FALSE
267};
268
Norman Jamescc7ae122015-08-24 14:26:09 -0500269static const _ExtendedGDBusArgInfo _sensor_integer_method_info_set_poll_interval_IN_ARG_poll_interval =
270{
271 {
272 -1,
273 (gchar *) "poll_interval",
274 (gchar *) "i",
275 NULL
276 },
277 FALSE
278};
279
280static const _ExtendedGDBusArgInfo * const _sensor_integer_method_info_set_poll_interval_IN_ARG_pointers[] =
281{
282 &_sensor_integer_method_info_set_poll_interval_IN_ARG_poll_interval,
283 NULL
284};
285
286static const _ExtendedGDBusMethodInfo _sensor_integer_method_info_set_poll_interval =
287{
288 {
289 -1,
290 (gchar *) "setPollInterval",
291 (GDBusArgInfo **) &_sensor_integer_method_info_set_poll_interval_IN_ARG_pointers,
292 NULL,
293 NULL
294 },
295 "handle-set-poll-interval",
296 FALSE
297};
298
Norman Jamese2765102015-08-19 22:00:55 -0500299static const _ExtendedGDBusMethodInfo * const _sensor_integer_method_info_pointers[] =
300{
Norman James90baede2015-09-02 20:32:49 -0500301 &_sensor_integer_method_info_init,
Norman Jamese2765102015-08-19 22:00:55 -0500302 &_sensor_integer_method_info_get_value,
Norman James90baede2015-09-02 20:32:49 -0500303 &_sensor_integer_method_info_set_value,
Norman Jamese2765102015-08-19 22:00:55 -0500304 &_sensor_integer_method_info_get_units,
Norman Jamescc7ae122015-08-24 14:26:09 -0500305 &_sensor_integer_method_info_set_poll_interval,
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
Norman James90baede2015-09-02 20:32:49 -0500320static const _ExtendedGDBusArgInfo _sensor_integer_signal_info_changed_ARG_units =
321{
322 {
323 -1,
324 (gchar *) "units",
325 (gchar *) "s",
326 NULL
327 },
328 FALSE
329};
330
Norman Jamese2765102015-08-19 22:00:55 -0500331static const _ExtendedGDBusArgInfo * const _sensor_integer_signal_info_changed_ARG_pointers[] =
332{
333 &_sensor_integer_signal_info_changed_ARG_value,
Norman James90baede2015-09-02 20:32:49 -0500334 &_sensor_integer_signal_info_changed_ARG_units,
Norman Jamese2765102015-08-19 22:00:55 -0500335 NULL
336};
337
338static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_changed =
339{
340 {
341 -1,
342 (gchar *) "Changed",
343 (GDBusArgInfo **) &_sensor_integer_signal_info_changed_ARG_pointers,
344 NULL
345 },
346 "changed"
347};
348
Norman James90baede2015-09-02 20:32:49 -0500349static const _ExtendedGDBusArgInfo _sensor_integer_signal_info_heartbeat_ARG_bus_name =
Norman James3f97c5d2015-08-26 17:44:14 -0500350{
351 {
352 -1,
Norman James90baede2015-09-02 20:32:49 -0500353 (gchar *) "bus_name",
354 (gchar *) "s",
Norman James3f97c5d2015-08-26 17:44:14 -0500355 NULL
356 },
Norman James90baede2015-09-02 20:32:49 -0500357 FALSE
Norman James3f97c5d2015-08-26 17:44:14 -0500358};
359
Norman James90baede2015-09-02 20:32:49 -0500360static const _ExtendedGDBusArgInfo * const _sensor_integer_signal_info_heartbeat_ARG_pointers[] =
361{
362 &_sensor_integer_signal_info_heartbeat_ARG_bus_name,
363 NULL
364};
365
366static const _ExtendedGDBusSignalInfo _sensor_integer_signal_info_heartbeat =
Norman James3f97c5d2015-08-26 17:44:14 -0500367{
368 {
369 -1,
Norman James90baede2015-09-02 20:32:49 -0500370 (gchar *) "Heartbeat",
371 (GDBusArgInfo **) &_sensor_integer_signal_info_heartbeat_ARG_pointers,
Norman James3f97c5d2015-08-26 17:44:14 -0500372 NULL
373 },
Norman James90baede2015-09-02 20:32:49 -0500374 "heartbeat"
Norman James3f97c5d2015-08-26 17:44:14 -0500375};
376
Norman Jamese2765102015-08-19 22:00:55 -0500377static const _ExtendedGDBusSignalInfo * const _sensor_integer_signal_info_pointers[] =
378{
379 &_sensor_integer_signal_info_changed,
Norman James90baede2015-09-02 20:32:49 -0500380 &_sensor_integer_signal_info_heartbeat,
Norman Jamese2765102015-08-19 22:00:55 -0500381 NULL
382};
383
384static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_value =
385{
386 {
387 -1,
388 (gchar *) "value",
389 (gchar *) "i",
Norman James90baede2015-09-02 20:32:49 -0500390 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamese2765102015-08-19 22:00:55 -0500391 NULL
392 },
393 "value",
394 FALSE
395};
396
397static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_units =
398{
399 {
400 -1,
401 (gchar *) "units",
402 (gchar *) "s",
403 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
404 NULL
405 },
406 "units",
407 FALSE
408};
409
Norman Jamescc7ae122015-08-24 14:26:09 -0500410static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_poll_interval =
411{
412 {
413 -1,
414 (gchar *) "poll_interval",
415 (gchar *) "i",
416 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
417 NULL
418 },
419 "poll-interval",
420 FALSE
421};
422
Norman James90baede2015-09-02 20:32:49 -0500423static const _ExtendedGDBusPropertyInfo _sensor_integer_property_info_heatbeat =
Norman Jamescc7ae122015-08-24 14:26:09 -0500424{
425 {
426 -1,
Norman James90baede2015-09-02 20:32:49 -0500427 (gchar *) "heatbeat",
Norman Jamescc7ae122015-08-24 14:26:09 -0500428 (gchar *) "i",
429 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
430 NULL
431 },
Norman James90baede2015-09-02 20:32:49 -0500432 "heatbeat",
Norman Jamescc7ae122015-08-24 14:26:09 -0500433 FALSE
434};
435
Norman Jamese2765102015-08-19 22:00:55 -0500436static const _ExtendedGDBusPropertyInfo * const _sensor_integer_property_info_pointers[] =
437{
438 &_sensor_integer_property_info_value,
439 &_sensor_integer_property_info_units,
Norman Jamescc7ae122015-08-24 14:26:09 -0500440 &_sensor_integer_property_info_poll_interval,
Norman James90baede2015-09-02 20:32:49 -0500441 &_sensor_integer_property_info_heatbeat,
Norman Jamese2765102015-08-19 22:00:55 -0500442 NULL
443};
444
445static const _ExtendedGDBusInterfaceInfo _sensor_integer_interface_info =
446{
447 {
448 -1,
449 (gchar *) "org.openbmc.SensorInteger",
450 (GDBusMethodInfo **) &_sensor_integer_method_info_pointers,
451 (GDBusSignalInfo **) &_sensor_integer_signal_info_pointers,
452 (GDBusPropertyInfo **) &_sensor_integer_property_info_pointers,
453 NULL
454 },
455 "sensor-integer",
456};
457
458
459/**
460 * sensor_integer_interface_info:
461 *
462 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link> D-Bus interface.
463 *
464 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
465 */
466GDBusInterfaceInfo *
467sensor_integer_interface_info (void)
468{
469 return (GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct;
470}
471
472/**
473 * sensor_integer_override_properties:
474 * @klass: The class structure for a #GObject<!-- -->-derived class.
475 * @property_id_begin: The property id to assign to the first overridden property.
476 *
477 * Overrides all #GObject properties in the #SensorInteger interface for a concrete class.
478 * The properties are overridden in the order they are defined.
479 *
480 * Returns: The last property id.
481 */
482guint
483sensor_integer_override_properties (GObjectClass *klass, guint property_id_begin)
484{
485 g_object_class_override_property (klass, property_id_begin++, "value");
486 g_object_class_override_property (klass, property_id_begin++, "units");
Norman Jamescc7ae122015-08-24 14:26:09 -0500487 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
Norman James90baede2015-09-02 20:32:49 -0500488 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
Norman Jamese2765102015-08-19 22:00:55 -0500489 return property_id_begin - 1;
490}
491
492
493
494/**
495 * SensorInteger:
496 *
497 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
498 */
499
500/**
501 * SensorIntegerIface:
502 * @parent_iface: The parent interface.
503 * @handle_get_units: Handler for the #SensorInteger::handle-get-units signal.
504 * @handle_get_value: Handler for the #SensorInteger::handle-get-value signal.
Norman James90baede2015-09-02 20:32:49 -0500505 * @handle_init: Handler for the #SensorInteger::handle-init signal.
Norman Jamescc7ae122015-08-24 14:26:09 -0500506 * @handle_set_poll_interval: Handler for the #SensorInteger::handle-set-poll-interval signal.
Norman James90baede2015-09-02 20:32:49 -0500507 * @handle_set_value: Handler for the #SensorInteger::handle-set-value signal.
508 * @get_heatbeat: Getter for the #SensorInteger:heatbeat property.
Norman Jamescc7ae122015-08-24 14:26:09 -0500509 * @get_poll_interval: Getter for the #SensorInteger:poll-interval property.
Norman Jamese2765102015-08-19 22:00:55 -0500510 * @get_units: Getter for the #SensorInteger:units property.
511 * @get_value: Getter for the #SensorInteger:value property.
512 * @changed: Handler for the #SensorInteger::changed signal.
Norman James90baede2015-09-02 20:32:49 -0500513 * @heartbeat: Handler for the #SensorInteger::heartbeat signal.
Norman Jamese2765102015-08-19 22:00:55 -0500514 *
515 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
516 */
517
518typedef SensorIntegerIface SensorIntegerInterface;
519G_DEFINE_INTERFACE (SensorInteger, sensor_integer, G_TYPE_OBJECT);
520
521static void
522sensor_integer_default_init (SensorIntegerIface *iface)
523{
524 /* GObject signals for incoming D-Bus method calls: */
525 /**
Norman James90baede2015-09-02 20:32:49 -0500526 * SensorInteger::handle-init:
527 * @object: A #SensorInteger.
528 * @invocation: A #GDBusMethodInvocation.
529 *
530 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.init">init()</link> D-Bus method.
531 *
532 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
533 *
534 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
535 */
536 g_signal_new ("handle-init",
537 G_TYPE_FROM_INTERFACE (iface),
538 G_SIGNAL_RUN_LAST,
539 G_STRUCT_OFFSET (SensorIntegerIface, handle_init),
540 g_signal_accumulator_true_handled,
541 NULL,
542 g_cclosure_marshal_generic,
543 G_TYPE_BOOLEAN,
544 1,
545 G_TYPE_DBUS_METHOD_INVOCATION);
546
547 /**
Norman Jamese2765102015-08-19 22:00:55 -0500548 * SensorInteger::handle-get-value:
549 * @object: A #SensorInteger.
550 * @invocation: A #GDBusMethodInvocation.
551 *
552 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method.
553 *
554 * 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.
555 *
556 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
557 */
558 g_signal_new ("handle-get-value",
559 G_TYPE_FROM_INTERFACE (iface),
560 G_SIGNAL_RUN_LAST,
561 G_STRUCT_OFFSET (SensorIntegerIface, handle_get_value),
562 g_signal_accumulator_true_handled,
563 NULL,
564 g_cclosure_marshal_generic,
565 G_TYPE_BOOLEAN,
566 1,
567 G_TYPE_DBUS_METHOD_INVOCATION);
568
569 /**
Norman James90baede2015-09-02 20:32:49 -0500570 * SensorInteger::handle-set-value:
571 * @object: A #SensorInteger.
572 * @invocation: A #GDBusMethodInvocation.
573 * @arg_value: Argument passed by remote caller.
574 *
575 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setValue">setValue()</link> D-Bus method.
576 *
577 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_complete_set_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
578 *
579 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
580 */
581 g_signal_new ("handle-set-value",
582 G_TYPE_FROM_INTERFACE (iface),
583 G_SIGNAL_RUN_LAST,
584 G_STRUCT_OFFSET (SensorIntegerIface, handle_set_value),
585 g_signal_accumulator_true_handled,
586 NULL,
587 g_cclosure_marshal_generic,
588 G_TYPE_BOOLEAN,
589 2,
590 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
591
592 /**
Norman Jamese2765102015-08-19 22:00:55 -0500593 * SensorInteger::handle-get-units:
594 * @object: A #SensorInteger.
595 * @invocation: A #GDBusMethodInvocation.
596 *
597 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method.
598 *
599 * 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.
600 *
601 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
602 */
603 g_signal_new ("handle-get-units",
604 G_TYPE_FROM_INTERFACE (iface),
605 G_SIGNAL_RUN_LAST,
606 G_STRUCT_OFFSET (SensorIntegerIface, handle_get_units),
607 g_signal_accumulator_true_handled,
608 NULL,
609 g_cclosure_marshal_generic,
610 G_TYPE_BOOLEAN,
611 1,
612 G_TYPE_DBUS_METHOD_INVOCATION);
613
Norman Jamescc7ae122015-08-24 14:26:09 -0500614 /**
615 * SensorInteger::handle-set-poll-interval:
616 * @object: A #SensorInteger.
617 * @invocation: A #GDBusMethodInvocation.
618 * @arg_poll_interval: Argument passed by remote caller.
619 *
620 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method.
621 *
622 * 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.
623 *
624 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
625 */
626 g_signal_new ("handle-set-poll-interval",
627 G_TYPE_FROM_INTERFACE (iface),
628 G_SIGNAL_RUN_LAST,
629 G_STRUCT_OFFSET (SensorIntegerIface, handle_set_poll_interval),
630 g_signal_accumulator_true_handled,
631 NULL,
632 g_cclosure_marshal_generic,
633 G_TYPE_BOOLEAN,
634 2,
635 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
636
Norman Jamese2765102015-08-19 22:00:55 -0500637 /* GObject signals for received D-Bus signals: */
638 /**
639 * SensorInteger::changed:
640 * @object: A #SensorInteger.
641 * @arg_value: Argument.
Norman James90baede2015-09-02 20:32:49 -0500642 * @arg_units: Argument.
Norman Jamese2765102015-08-19 22:00:55 -0500643 *
644 * 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.
645 *
646 * 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.
647 */
648 g_signal_new ("changed",
649 G_TYPE_FROM_INTERFACE (iface),
650 G_SIGNAL_RUN_LAST,
651 G_STRUCT_OFFSET (SensorIntegerIface, changed),
652 NULL,
653 NULL,
654 g_cclosure_marshal_generic,
655 G_TYPE_NONE,
Norman James90baede2015-09-02 20:32:49 -0500656 2, G_TYPE_INT, G_TYPE_STRING);
Norman Jamese2765102015-08-19 22:00:55 -0500657
Norman James3f97c5d2015-08-26 17:44:14 -0500658 /**
Norman James90baede2015-09-02 20:32:49 -0500659 * SensorInteger::heartbeat:
Norman James3f97c5d2015-08-26 17:44:14 -0500660 * @object: A #SensorInteger.
Norman James90baede2015-09-02 20:32:49 -0500661 * @arg_bus_name: Argument.
Norman James3f97c5d2015-08-26 17:44:14 -0500662 *
Norman James90baede2015-09-02 20:32:49 -0500663 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorInteger.Heartbeat">"Heartbeat"</link> is received.
Norman James3f97c5d2015-08-26 17:44:14 -0500664 *
665 * 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.
666 */
Norman James90baede2015-09-02 20:32:49 -0500667 g_signal_new ("heartbeat",
Norman James3f97c5d2015-08-26 17:44:14 -0500668 G_TYPE_FROM_INTERFACE (iface),
669 G_SIGNAL_RUN_LAST,
Norman James90baede2015-09-02 20:32:49 -0500670 G_STRUCT_OFFSET (SensorIntegerIface, heartbeat),
Norman James3f97c5d2015-08-26 17:44:14 -0500671 NULL,
672 NULL,
673 g_cclosure_marshal_generic,
674 G_TYPE_NONE,
Norman James90baede2015-09-02 20:32:49 -0500675 1, G_TYPE_STRING);
Norman James3f97c5d2015-08-26 17:44:14 -0500676
Norman Jamese2765102015-08-19 22:00:55 -0500677 /* GObject properties for D-Bus properties: */
678 /**
679 * SensorInteger:value:
680 *
681 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link>.
682 *
Norman James90baede2015-09-02 20:32:49 -0500683 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamese2765102015-08-19 22:00:55 -0500684 */
685 g_object_interface_install_property (iface,
686 g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
687 /**
688 * SensorInteger:units:
689 *
690 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link>.
691 *
692 * 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.
693 */
694 g_object_interface_install_property (iface,
695 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -0500696 /**
697 * SensorInteger:poll-interval:
698 *
699 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link>.
700 *
701 * 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.
702 */
703 g_object_interface_install_property (iface,
704 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
705 /**
Norman James90baede2015-09-02 20:32:49 -0500706 * SensorInteger:heatbeat:
Norman Jamescc7ae122015-08-24 14:26:09 -0500707 *
Norman James90baede2015-09-02 20:32:49 -0500708 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorInteger.heatbeat">"heatbeat"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -0500709 *
710 * 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.
711 */
712 g_object_interface_install_property (iface,
Norman James90baede2015-09-02 20:32:49 -0500713 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamese2765102015-08-19 22:00:55 -0500714}
715
716/**
717 * sensor_integer_get_value: (skip)
718 * @object: A #SensorInteger.
719 *
720 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link> D-Bus property.
721 *
Norman James90baede2015-09-02 20:32:49 -0500722 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamese2765102015-08-19 22:00:55 -0500723 *
724 * Returns: The property value.
725 */
726gint
727sensor_integer_get_value (SensorInteger *object)
728{
729 return SENSOR_INTEGER_GET_IFACE (object)->get_value (object);
730}
731
732/**
733 * sensor_integer_set_value: (skip)
734 * @object: A #SensorInteger.
735 * @value: The value to set.
736 *
737 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.value">"value"</link> D-Bus property to @value.
738 *
Norman James90baede2015-09-02 20:32:49 -0500739 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamese2765102015-08-19 22:00:55 -0500740 */
741void
742sensor_integer_set_value (SensorInteger *object, gint value)
743{
744 g_object_set (G_OBJECT (object), "value", value, NULL);
745}
746
747/**
748 * sensor_integer_get_units: (skip)
749 * @object: A #SensorInteger.
750 *
751 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property.
752 *
753 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
754 *
755 * <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>
756 *
757 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
758 */
759const gchar *
760sensor_integer_get_units (SensorInteger *object)
761{
762 return SENSOR_INTEGER_GET_IFACE (object)->get_units (object);
763}
764
765/**
766 * sensor_integer_dup_units: (skip)
767 * @object: A #SensorInteger.
768 *
769 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property.
770 *
771 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
772 *
773 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
774 */
775gchar *
776sensor_integer_dup_units (SensorInteger *object)
777{
778 gchar *value;
779 g_object_get (G_OBJECT (object), "units", &value, NULL);
780 return value;
781}
782
783/**
784 * sensor_integer_set_units: (skip)
785 * @object: A #SensorInteger.
786 * @value: The value to set.
787 *
788 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.units">"units"</link> D-Bus property to @value.
789 *
790 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
791 */
792void
793sensor_integer_set_units (SensorInteger *object, const gchar *value)
794{
795 g_object_set (G_OBJECT (object), "units", value, NULL);
796}
797
798/**
Norman Jamescc7ae122015-08-24 14:26:09 -0500799 * sensor_integer_get_poll_interval: (skip)
800 * @object: A #SensorInteger.
801 *
802 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link> D-Bus property.
803 *
804 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
805 *
806 * Returns: The property value.
807 */
808gint
809sensor_integer_get_poll_interval (SensorInteger *object)
810{
811 return SENSOR_INTEGER_GET_IFACE (object)->get_poll_interval (object);
812}
813
814/**
815 * sensor_integer_set_poll_interval: (skip)
816 * @object: A #SensorInteger.
817 * @value: The value to set.
818 *
819 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.poll_interval">"poll_interval"</link> D-Bus property to @value.
820 *
821 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
822 */
823void
824sensor_integer_set_poll_interval (SensorInteger *object, gint value)
825{
826 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
827}
828
829/**
Norman James90baede2015-09-02 20:32:49 -0500830 * sensor_integer_get_heatbeat: (skip)
Norman Jamescc7ae122015-08-24 14:26:09 -0500831 * @object: A #SensorInteger.
832 *
Norman James90baede2015-09-02 20:32:49 -0500833 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorInteger.heatbeat">"heatbeat"</link> D-Bus property.
Norman Jamescc7ae122015-08-24 14:26:09 -0500834 *
835 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
836 *
837 * Returns: The property value.
838 */
839gint
Norman James90baede2015-09-02 20:32:49 -0500840sensor_integer_get_heatbeat (SensorInteger *object)
Norman Jamescc7ae122015-08-24 14:26:09 -0500841{
Norman James90baede2015-09-02 20:32:49 -0500842 return SENSOR_INTEGER_GET_IFACE (object)->get_heatbeat (object);
Norman Jamescc7ae122015-08-24 14:26:09 -0500843}
844
845/**
Norman James90baede2015-09-02 20:32:49 -0500846 * sensor_integer_set_heatbeat: (skip)
Norman Jamescc7ae122015-08-24 14:26:09 -0500847 * @object: A #SensorInteger.
848 * @value: The value to set.
849 *
Norman James90baede2015-09-02 20:32:49 -0500850 * Sets the <link linkend="gdbus-property-org-openbmc-SensorInteger.heatbeat">"heatbeat"</link> D-Bus property to @value.
Norman Jamescc7ae122015-08-24 14:26:09 -0500851 *
852 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
853 */
854void
Norman James90baede2015-09-02 20:32:49 -0500855sensor_integer_set_heatbeat (SensorInteger *object, gint value)
Norman Jamescc7ae122015-08-24 14:26:09 -0500856{
Norman James90baede2015-09-02 20:32:49 -0500857 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
Norman Jamescc7ae122015-08-24 14:26:09 -0500858}
859
860/**
Norman Jamese2765102015-08-19 22:00:55 -0500861 * sensor_integer_emit_changed:
862 * @object: A #SensorInteger.
863 * @arg_value: Argument to pass with the signal.
Norman James90baede2015-09-02 20:32:49 -0500864 * @arg_units: Argument to pass with the signal.
Norman Jamese2765102015-08-19 22:00:55 -0500865 *
866 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Changed">"Changed"</link> D-Bus signal.
867 */
868void
869sensor_integer_emit_changed (
870 SensorInteger *object,
Norman James90baede2015-09-02 20:32:49 -0500871 gint arg_value,
872 const gchar *arg_units)
Norman Jamese2765102015-08-19 22:00:55 -0500873{
Norman James90baede2015-09-02 20:32:49 -0500874 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
Norman Jamese2765102015-08-19 22:00:55 -0500875}
876
877/**
Norman James90baede2015-09-02 20:32:49 -0500878 * sensor_integer_emit_heartbeat:
Norman James3f97c5d2015-08-26 17:44:14 -0500879 * @object: A #SensorInteger.
Norman James90baede2015-09-02 20:32:49 -0500880 * @arg_bus_name: Argument to pass with the signal.
Norman James3f97c5d2015-08-26 17:44:14 -0500881 *
Norman James90baede2015-09-02 20:32:49 -0500882 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorInteger.Heartbeat">"Heartbeat"</link> D-Bus signal.
Norman James3f97c5d2015-08-26 17:44:14 -0500883 */
884void
Norman James90baede2015-09-02 20:32:49 -0500885sensor_integer_emit_heartbeat (
886 SensorInteger *object,
887 const gchar *arg_bus_name)
Norman James3f97c5d2015-08-26 17:44:14 -0500888{
Norman James90baede2015-09-02 20:32:49 -0500889 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
Norman James3f97c5d2015-08-26 17:44:14 -0500890}
891
892/**
Norman James90baede2015-09-02 20:32:49 -0500893 * sensor_integer_call_init:
894 * @proxy: A #SensorIntegerProxy.
895 * @cancellable: (allow-none): A #GCancellable or %NULL.
896 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
897 * @user_data: User data to pass to @callback.
Norman James3f97c5d2015-08-26 17:44:14 -0500898 *
Norman James90baede2015-09-02 20:32:49 -0500899 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.init">init()</link> D-Bus method on @proxy.
900 * 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.
901 * You can then call sensor_integer_call_init_finish() to get the result of the operation.
902 *
903 * See sensor_integer_call_init_sync() for the synchronous, blocking version of this method.
Norman James3f97c5d2015-08-26 17:44:14 -0500904 */
905void
Norman James90baede2015-09-02 20:32:49 -0500906sensor_integer_call_init (
907 SensorInteger *proxy,
908 GCancellable *cancellable,
909 GAsyncReadyCallback callback,
910 gpointer user_data)
Norman James3f97c5d2015-08-26 17:44:14 -0500911{
Norman James90baede2015-09-02 20:32:49 -0500912 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
913 "init",
914 g_variant_new ("()"),
915 G_DBUS_CALL_FLAGS_NONE,
916 -1,
917 cancellable,
918 callback,
919 user_data);
920}
921
922/**
923 * sensor_integer_call_init_finish:
924 * @proxy: A #SensorIntegerProxy.
925 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_init().
926 * @error: Return location for error or %NULL.
927 *
928 * Finishes an operation started with sensor_integer_call_init().
929 *
930 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
931 */
932gboolean
933sensor_integer_call_init_finish (
934 SensorInteger *proxy,
935 GAsyncResult *res,
936 GError **error)
937{
938 GVariant *_ret;
939 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
940 if (_ret == NULL)
941 goto _out;
942 g_variant_get (_ret,
943 "()");
944 g_variant_unref (_ret);
945_out:
946 return _ret != NULL;
947}
948
949/**
950 * sensor_integer_call_init_sync:
951 * @proxy: A #SensorIntegerProxy.
952 * @cancellable: (allow-none): A #GCancellable or %NULL.
953 * @error: Return location for error or %NULL.
954 *
955 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
956 *
957 * See sensor_integer_call_init() for the asynchronous version of this method.
958 *
959 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
960 */
961gboolean
962sensor_integer_call_init_sync (
963 SensorInteger *proxy,
964 GCancellable *cancellable,
965 GError **error)
966{
967 GVariant *_ret;
968 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
969 "init",
970 g_variant_new ("()"),
971 G_DBUS_CALL_FLAGS_NONE,
972 -1,
973 cancellable,
974 error);
975 if (_ret == NULL)
976 goto _out;
977 g_variant_get (_ret,
978 "()");
979 g_variant_unref (_ret);
980_out:
981 return _ret != NULL;
Norman James3f97c5d2015-08-26 17:44:14 -0500982}
983
984/**
Norman Jamese2765102015-08-19 22:00:55 -0500985 * sensor_integer_call_get_value:
986 * @proxy: A #SensorIntegerProxy.
987 * @cancellable: (allow-none): A #GCancellable or %NULL.
988 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
989 * @user_data: User data to pass to @callback.
990 *
991 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getValue">getValue()</link> D-Bus method on @proxy.
992 * 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.
993 * You can then call sensor_integer_call_get_value_finish() to get the result of the operation.
994 *
995 * See sensor_integer_call_get_value_sync() for the synchronous, blocking version of this method.
996 */
997void
998sensor_integer_call_get_value (
999 SensorInteger *proxy,
1000 GCancellable *cancellable,
1001 GAsyncReadyCallback callback,
1002 gpointer user_data)
1003{
1004 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1005 "getValue",
1006 g_variant_new ("()"),
1007 G_DBUS_CALL_FLAGS_NONE,
1008 -1,
1009 cancellable,
1010 callback,
1011 user_data);
1012}
1013
1014/**
1015 * sensor_integer_call_get_value_finish:
1016 * @proxy: A #SensorIntegerProxy.
1017 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1018 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_value().
1019 * @error: Return location for error or %NULL.
1020 *
1021 * Finishes an operation started with sensor_integer_call_get_value().
1022 *
1023 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1024 */
1025gboolean
1026sensor_integer_call_get_value_finish (
1027 SensorInteger *proxy,
1028 gint *out_value,
1029 GAsyncResult *res,
1030 GError **error)
1031{
1032 GVariant *_ret;
1033 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1034 if (_ret == NULL)
1035 goto _out;
1036 g_variant_get (_ret,
1037 "(i)",
1038 out_value);
1039 g_variant_unref (_ret);
1040_out:
1041 return _ret != NULL;
1042}
1043
1044/**
1045 * sensor_integer_call_get_value_sync:
1046 * @proxy: A #SensorIntegerProxy.
1047 * @out_value: (out): Return location for return parameter or %NULL to ignore.
1048 * @cancellable: (allow-none): A #GCancellable or %NULL.
1049 * @error: Return location for error or %NULL.
1050 *
1051 * 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.
1052 *
1053 * See sensor_integer_call_get_value() for the asynchronous version of this method.
1054 *
1055 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1056 */
1057gboolean
1058sensor_integer_call_get_value_sync (
1059 SensorInteger *proxy,
1060 gint *out_value,
1061 GCancellable *cancellable,
1062 GError **error)
1063{
1064 GVariant *_ret;
1065 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1066 "getValue",
1067 g_variant_new ("()"),
1068 G_DBUS_CALL_FLAGS_NONE,
1069 -1,
1070 cancellable,
1071 error);
1072 if (_ret == NULL)
1073 goto _out;
1074 g_variant_get (_ret,
1075 "(i)",
1076 out_value);
1077 g_variant_unref (_ret);
1078_out:
1079 return _ret != NULL;
1080}
1081
1082/**
Norman James90baede2015-09-02 20:32:49 -05001083 * sensor_integer_call_set_value:
1084 * @proxy: A #SensorIntegerProxy.
1085 * @arg_value: Argument to pass with the method invocation.
1086 * @cancellable: (allow-none): A #GCancellable or %NULL.
1087 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1088 * @user_data: User data to pass to @callback.
1089 *
1090 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setValue">setValue()</link> D-Bus method on @proxy.
1091 * 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.
1092 * You can then call sensor_integer_call_set_value_finish() to get the result of the operation.
1093 *
1094 * See sensor_integer_call_set_value_sync() for the synchronous, blocking version of this method.
1095 */
1096void
1097sensor_integer_call_set_value (
1098 SensorInteger *proxy,
1099 gint arg_value,
1100 GCancellable *cancellable,
1101 GAsyncReadyCallback callback,
1102 gpointer user_data)
1103{
1104 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1105 "setValue",
1106 g_variant_new ("(i)",
1107 arg_value),
1108 G_DBUS_CALL_FLAGS_NONE,
1109 -1,
1110 cancellable,
1111 callback,
1112 user_data);
1113}
1114
1115/**
1116 * sensor_integer_call_set_value_finish:
1117 * @proxy: A #SensorIntegerProxy.
1118 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_value().
1119 * @error: Return location for error or %NULL.
1120 *
1121 * Finishes an operation started with sensor_integer_call_set_value().
1122 *
1123 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1124 */
1125gboolean
1126sensor_integer_call_set_value_finish (
1127 SensorInteger *proxy,
1128 GAsyncResult *res,
1129 GError **error)
1130{
1131 GVariant *_ret;
1132 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1133 if (_ret == NULL)
1134 goto _out;
1135 g_variant_get (_ret,
1136 "()");
1137 g_variant_unref (_ret);
1138_out:
1139 return _ret != NULL;
1140}
1141
1142/**
1143 * sensor_integer_call_set_value_sync:
1144 * @proxy: A #SensorIntegerProxy.
1145 * @arg_value: Argument to pass with the method invocation.
1146 * @cancellable: (allow-none): A #GCancellable or %NULL.
1147 * @error: Return location for error or %NULL.
1148 *
1149 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1150 *
1151 * See sensor_integer_call_set_value() for the asynchronous version of this method.
1152 *
1153 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1154 */
1155gboolean
1156sensor_integer_call_set_value_sync (
1157 SensorInteger *proxy,
1158 gint arg_value,
1159 GCancellable *cancellable,
1160 GError **error)
1161{
1162 GVariant *_ret;
1163 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1164 "setValue",
1165 g_variant_new ("(i)",
1166 arg_value),
1167 G_DBUS_CALL_FLAGS_NONE,
1168 -1,
1169 cancellable,
1170 error);
1171 if (_ret == NULL)
1172 goto _out;
1173 g_variant_get (_ret,
1174 "()");
1175 g_variant_unref (_ret);
1176_out:
1177 return _ret != NULL;
1178}
1179
1180/**
Norman Jamese2765102015-08-19 22:00:55 -05001181 * sensor_integer_call_get_units:
1182 * @proxy: A #SensorIntegerProxy.
1183 * @cancellable: (allow-none): A #GCancellable or %NULL.
1184 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1185 * @user_data: User data to pass to @callback.
1186 *
1187 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.getUnits">getUnits()</link> D-Bus method on @proxy.
1188 * 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.
1189 * You can then call sensor_integer_call_get_units_finish() to get the result of the operation.
1190 *
1191 * See sensor_integer_call_get_units_sync() for the synchronous, blocking version of this method.
1192 */
1193void
1194sensor_integer_call_get_units (
1195 SensorInteger *proxy,
1196 GCancellable *cancellable,
1197 GAsyncReadyCallback callback,
1198 gpointer user_data)
1199{
1200 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1201 "getUnits",
1202 g_variant_new ("()"),
1203 G_DBUS_CALL_FLAGS_NONE,
1204 -1,
1205 cancellable,
1206 callback,
1207 user_data);
1208}
1209
1210/**
1211 * sensor_integer_call_get_units_finish:
1212 * @proxy: A #SensorIntegerProxy.
1213 * @out_units: (out): Return location for return parameter or %NULL to ignore.
1214 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_get_units().
1215 * @error: Return location for error or %NULL.
1216 *
1217 * Finishes an operation started with sensor_integer_call_get_units().
1218 *
1219 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1220 */
1221gboolean
1222sensor_integer_call_get_units_finish (
1223 SensorInteger *proxy,
1224 gchar **out_units,
1225 GAsyncResult *res,
1226 GError **error)
1227{
1228 GVariant *_ret;
1229 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1230 if (_ret == NULL)
1231 goto _out;
1232 g_variant_get (_ret,
1233 "(s)",
1234 out_units);
1235 g_variant_unref (_ret);
1236_out:
1237 return _ret != NULL;
1238}
1239
1240/**
1241 * sensor_integer_call_get_units_sync:
1242 * @proxy: A #SensorIntegerProxy.
1243 * @out_units: (out): Return location for return parameter or %NULL to ignore.
1244 * @cancellable: (allow-none): A #GCancellable or %NULL.
1245 * @error: Return location for error or %NULL.
1246 *
1247 * 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.
1248 *
1249 * See sensor_integer_call_get_units() for the asynchronous version of this method.
1250 *
1251 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1252 */
1253gboolean
1254sensor_integer_call_get_units_sync (
1255 SensorInteger *proxy,
1256 gchar **out_units,
1257 GCancellable *cancellable,
1258 GError **error)
1259{
1260 GVariant *_ret;
1261 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1262 "getUnits",
1263 g_variant_new ("()"),
1264 G_DBUS_CALL_FLAGS_NONE,
1265 -1,
1266 cancellable,
1267 error);
1268 if (_ret == NULL)
1269 goto _out;
1270 g_variant_get (_ret,
1271 "(s)",
1272 out_units);
1273 g_variant_unref (_ret);
1274_out:
1275 return _ret != NULL;
1276}
1277
1278/**
Norman Jamescc7ae122015-08-24 14:26:09 -05001279 * sensor_integer_call_set_poll_interval:
1280 * @proxy: A #SensorIntegerProxy.
1281 * @arg_poll_interval: Argument to pass with the method invocation.
1282 * @cancellable: (allow-none): A #GCancellable or %NULL.
1283 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1284 * @user_data: User data to pass to @callback.
1285 *
1286 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorInteger.setPollInterval">setPollInterval()</link> D-Bus method on @proxy.
1287 * 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.
1288 * You can then call sensor_integer_call_set_poll_interval_finish() to get the result of the operation.
1289 *
1290 * See sensor_integer_call_set_poll_interval_sync() for the synchronous, blocking version of this method.
1291 */
1292void
1293sensor_integer_call_set_poll_interval (
1294 SensorInteger *proxy,
1295 gint arg_poll_interval,
1296 GCancellable *cancellable,
1297 GAsyncReadyCallback callback,
1298 gpointer user_data)
1299{
1300 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1301 "setPollInterval",
1302 g_variant_new ("(i)",
1303 arg_poll_interval),
1304 G_DBUS_CALL_FLAGS_NONE,
1305 -1,
1306 cancellable,
1307 callback,
1308 user_data);
1309}
1310
1311/**
1312 * sensor_integer_call_set_poll_interval_finish:
1313 * @proxy: A #SensorIntegerProxy.
1314 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_call_set_poll_interval().
1315 * @error: Return location for error or %NULL.
1316 *
1317 * Finishes an operation started with sensor_integer_call_set_poll_interval().
1318 *
1319 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1320 */
1321gboolean
1322sensor_integer_call_set_poll_interval_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_set_poll_interval_sync:
1340 * @proxy: A #SensorIntegerProxy.
1341 * @arg_poll_interval: Argument to pass with the method invocation.
1342 * @cancellable: (allow-none): A #GCancellable or %NULL.
1343 * @error: Return location for error or %NULL.
1344 *
1345 * 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.
1346 *
1347 * See sensor_integer_call_set_poll_interval() for the asynchronous version of this method.
1348 *
1349 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1350 */
1351gboolean
1352sensor_integer_call_set_poll_interval_sync (
1353 SensorInteger *proxy,
1354 gint arg_poll_interval,
1355 GCancellable *cancellable,
1356 GError **error)
1357{
1358 GVariant *_ret;
1359 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1360 "setPollInterval",
1361 g_variant_new ("(i)",
1362 arg_poll_interval),
1363 G_DBUS_CALL_FLAGS_NONE,
1364 -1,
1365 cancellable,
1366 error);
1367 if (_ret == NULL)
1368 goto _out;
1369 g_variant_get (_ret,
1370 "()");
1371 g_variant_unref (_ret);
1372_out:
1373 return _ret != NULL;
1374}
1375
1376/**
Norman James90baede2015-09-02 20:32:49 -05001377 * sensor_integer_complete_init:
1378 * @object: A #SensorInteger.
1379 * @invocation: (transfer full): A #GDBusMethodInvocation.
Norman Jamescc7ae122015-08-24 14:26:09 -05001380 *
Norman James90baede2015-09-02 20:32:49 -05001381 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorInteger.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman Jamescc7ae122015-08-24 14:26:09 -05001382 *
Norman James90baede2015-09-02 20:32:49 -05001383 * This method will free @invocation, you cannot use it afterwards.
Norman Jamescc7ae122015-08-24 14:26:09 -05001384 */
1385void
Norman James90baede2015-09-02 20:32:49 -05001386sensor_integer_complete_init (
1387 SensorInteger *object,
1388 GDBusMethodInvocation *invocation)
Norman Jamescc7ae122015-08-24 14:26:09 -05001389{
Norman James90baede2015-09-02 20:32:49 -05001390 g_dbus_method_invocation_return_value (invocation,
1391 g_variant_new ("()"));
Norman Jamese7594922015-08-27 14:25:24 -05001392}
1393
1394/**
Norman Jamese2765102015-08-19 22:00:55 -05001395 * sensor_integer_complete_get_value:
1396 * @object: A #SensorInteger.
1397 * @invocation: (transfer full): A #GDBusMethodInvocation.
1398 * @value: Parameter to return.
1399 *
1400 * 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.
1401 *
1402 * This method will free @invocation, you cannot use it afterwards.
1403 */
1404void
1405sensor_integer_complete_get_value (
1406 SensorInteger *object,
1407 GDBusMethodInvocation *invocation,
1408 gint value)
1409{
1410 g_dbus_method_invocation_return_value (invocation,
1411 g_variant_new ("(i)",
1412 value));
1413}
1414
1415/**
Norman James90baede2015-09-02 20:32:49 -05001416 * sensor_integer_complete_set_value:
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.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.
1421 *
1422 * This method will free @invocation, you cannot use it afterwards.
1423 */
1424void
1425sensor_integer_complete_set_value (
1426 SensorInteger *object,
1427 GDBusMethodInvocation *invocation)
1428{
1429 g_dbus_method_invocation_return_value (invocation,
1430 g_variant_new ("()"));
1431}
1432
1433/**
Norman Jamese2765102015-08-19 22:00:55 -05001434 * sensor_integer_complete_get_units:
1435 * @object: A #SensorInteger.
1436 * @invocation: (transfer full): A #GDBusMethodInvocation.
1437 * @units: Parameter to return.
1438 *
1439 * 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.
1440 *
1441 * This method will free @invocation, you cannot use it afterwards.
1442 */
1443void
1444sensor_integer_complete_get_units (
1445 SensorInteger *object,
1446 GDBusMethodInvocation *invocation,
1447 const gchar *units)
1448{
1449 g_dbus_method_invocation_return_value (invocation,
1450 g_variant_new ("(s)",
1451 units));
1452}
1453
Norman Jamescc7ae122015-08-24 14:26:09 -05001454/**
1455 * sensor_integer_complete_set_poll_interval:
1456 * @object: A #SensorInteger.
1457 * @invocation: (transfer full): A #GDBusMethodInvocation.
1458 *
1459 * 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.
1460 *
1461 * This method will free @invocation, you cannot use it afterwards.
1462 */
1463void
1464sensor_integer_complete_set_poll_interval (
1465 SensorInteger *object,
1466 GDBusMethodInvocation *invocation)
1467{
1468 g_dbus_method_invocation_return_value (invocation,
1469 g_variant_new ("()"));
1470}
1471
Norman Jamese2765102015-08-19 22:00:55 -05001472/* ------------------------------------------------------------------------ */
1473
1474/**
1475 * SensorIntegerProxy:
1476 *
1477 * The #SensorIntegerProxy structure contains only private data and should only be accessed using the provided API.
1478 */
1479
1480/**
1481 * SensorIntegerProxyClass:
1482 * @parent_class: The parent class.
1483 *
1484 * Class structure for #SensorIntegerProxy.
1485 */
1486
1487struct _SensorIntegerProxyPrivate
1488{
1489 GData *qdata;
1490};
1491
1492static void sensor_integer_proxy_iface_init (SensorIntegerIface *iface);
1493
1494#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1495G_DEFINE_TYPE_WITH_CODE (SensorIntegerProxy, sensor_integer_proxy, G_TYPE_DBUS_PROXY,
1496 G_ADD_PRIVATE (SensorIntegerProxy)
1497 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_proxy_iface_init));
1498
1499#else
1500G_DEFINE_TYPE_WITH_CODE (SensorIntegerProxy, sensor_integer_proxy, G_TYPE_DBUS_PROXY,
1501 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_proxy_iface_init));
1502
1503#endif
1504static void
1505sensor_integer_proxy_finalize (GObject *object)
1506{
1507 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1508 g_datalist_clear (&proxy->priv->qdata);
1509 G_OBJECT_CLASS (sensor_integer_proxy_parent_class)->finalize (object);
1510}
1511
1512static void
1513sensor_integer_proxy_get_property (GObject *object,
1514 guint prop_id,
1515 GValue *value,
1516 GParamSpec *pspec G_GNUC_UNUSED)
1517{
1518 const _ExtendedGDBusPropertyInfo *info;
1519 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05001520 g_assert (prop_id != 0 && prop_id - 1 < 4);
Norman Jamese2765102015-08-19 22:00:55 -05001521 info = _sensor_integer_property_info_pointers[prop_id - 1];
1522 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1523 if (info->use_gvariant)
1524 {
1525 g_value_set_variant (value, variant);
1526 }
1527 else
1528 {
1529 if (variant != NULL)
1530 g_dbus_gvariant_to_gvalue (variant, value);
1531 }
1532 if (variant != NULL)
1533 g_variant_unref (variant);
1534}
1535
1536static void
1537sensor_integer_proxy_set_property_cb (GDBusProxy *proxy,
1538 GAsyncResult *res,
1539 gpointer user_data)
1540{
1541 const _ExtendedGDBusPropertyInfo *info = user_data;
1542 GError *error;
1543 GVariant *_ret;
1544 error = NULL;
1545 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1546 if (!_ret)
1547 {
1548 g_warning ("Error setting property '%s' on interface org.openbmc.SensorInteger: %s (%s, %d)",
1549 info->parent_struct.name,
1550 error->message, g_quark_to_string (error->domain), error->code);
1551 g_error_free (error);
1552 }
1553 else
1554 {
1555 g_variant_unref (_ret);
1556 }
1557}
1558
1559static void
1560sensor_integer_proxy_set_property (GObject *object,
1561 guint prop_id,
1562 const GValue *value,
1563 GParamSpec *pspec G_GNUC_UNUSED)
1564{
1565 const _ExtendedGDBusPropertyInfo *info;
1566 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05001567 g_assert (prop_id != 0 && prop_id - 1 < 4);
Norman Jamese2765102015-08-19 22:00:55 -05001568 info = _sensor_integer_property_info_pointers[prop_id - 1];
1569 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1570 g_dbus_proxy_call (G_DBUS_PROXY (object),
1571 "org.freedesktop.DBus.Properties.Set",
1572 g_variant_new ("(ssv)", "org.openbmc.SensorInteger", info->parent_struct.name, variant),
1573 G_DBUS_CALL_FLAGS_NONE,
1574 -1,
1575 NULL, (GAsyncReadyCallback) sensor_integer_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1576 g_variant_unref (variant);
1577}
1578
1579static void
1580sensor_integer_proxy_g_signal (GDBusProxy *proxy,
1581 const gchar *sender_name G_GNUC_UNUSED,
1582 const gchar *signal_name,
1583 GVariant *parameters)
1584{
1585 _ExtendedGDBusSignalInfo *info;
1586 GVariantIter iter;
1587 GVariant *child;
1588 GValue *paramv;
1589 guint num_params;
1590 guint n;
1591 guint signal_id;
1592 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, signal_name);
1593 if (info == NULL)
1594 return;
1595 num_params = g_variant_n_children (parameters);
1596 paramv = g_new0 (GValue, num_params + 1);
1597 g_value_init (&paramv[0], TYPE_SENSOR_INTEGER);
1598 g_value_set_object (&paramv[0], proxy);
1599 g_variant_iter_init (&iter, parameters);
1600 n = 1;
1601 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1602 {
1603 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1604 if (arg_info->use_gvariant)
1605 {
1606 g_value_init (&paramv[n], G_TYPE_VARIANT);
1607 g_value_set_variant (&paramv[n], child);
1608 n++;
1609 }
1610 else
1611 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1612 g_variant_unref (child);
1613 }
1614 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER);
1615 g_signal_emitv (paramv, signal_id, 0, NULL);
1616 for (n = 0; n < num_params + 1; n++)
1617 g_value_unset (&paramv[n]);
1618 g_free (paramv);
1619}
1620
1621static void
1622sensor_integer_proxy_g_properties_changed (GDBusProxy *_proxy,
1623 GVariant *changed_properties,
1624 const gchar *const *invalidated_properties)
1625{
1626 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (_proxy);
1627 guint n;
1628 const gchar *key;
1629 GVariantIter *iter;
1630 _ExtendedGDBusPropertyInfo *info;
1631 g_variant_get (changed_properties, "a{sv}", &iter);
1632 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1633 {
1634 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, key);
1635 g_datalist_remove_data (&proxy->priv->qdata, key);
1636 if (info != NULL)
1637 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1638 }
1639 g_variant_iter_free (iter);
1640 for (n = 0; invalidated_properties[n] != NULL; n++)
1641 {
1642 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, invalidated_properties[n]);
1643 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1644 if (info != NULL)
1645 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1646 }
1647}
1648
1649static gint
1650sensor_integer_proxy_get_value (SensorInteger *object)
1651{
1652 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1653 GVariant *variant;
1654 gint value = 0;
1655 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
1656 if (variant != NULL)
1657 {
1658 value = g_variant_get_int32 (variant);
1659 g_variant_unref (variant);
1660 }
1661 return value;
1662}
1663
1664static const gchar *
1665sensor_integer_proxy_get_units (SensorInteger *object)
1666{
1667 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1668 GVariant *variant;
1669 const gchar *value = NULL;
1670 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
1671 if (variant != NULL)
1672 {
1673 value = g_variant_get_string (variant, NULL);
1674 g_variant_unref (variant);
1675 }
1676 return value;
1677}
1678
Norman Jamescc7ae122015-08-24 14:26:09 -05001679static gint
1680sensor_integer_proxy_get_poll_interval (SensorInteger *object)
1681{
1682 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1683 GVariant *variant;
1684 gint value = 0;
1685 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
1686 if (variant != NULL)
1687 {
1688 value = g_variant_get_int32 (variant);
1689 g_variant_unref (variant);
1690 }
1691 return value;
1692}
1693
Norman Jamescc7ae122015-08-24 14:26:09 -05001694static gint
Norman James90baede2015-09-02 20:32:49 -05001695sensor_integer_proxy_get_heatbeat (SensorInteger *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05001696{
1697 SensorIntegerProxy *proxy = SENSOR_INTEGER_PROXY (object);
1698 GVariant *variant;
1699 gint value = 0;
Norman James90baede2015-09-02 20:32:49 -05001700 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
Norman Jamescc7ae122015-08-24 14:26:09 -05001701 if (variant != NULL)
1702 {
1703 value = g_variant_get_int32 (variant);
1704 g_variant_unref (variant);
1705 }
1706 return value;
1707}
1708
Norman Jamese2765102015-08-19 22:00:55 -05001709static void
1710sensor_integer_proxy_init (SensorIntegerProxy *proxy)
1711{
1712#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1713 proxy->priv = sensor_integer_proxy_get_instance_private (proxy);
1714#else
1715 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_PROXY, SensorIntegerProxyPrivate);
1716#endif
1717
1718 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_interface_info ());
1719}
1720
1721static void
1722sensor_integer_proxy_class_init (SensorIntegerProxyClass *klass)
1723{
1724 GObjectClass *gobject_class;
1725 GDBusProxyClass *proxy_class;
1726
1727 gobject_class = G_OBJECT_CLASS (klass);
1728 gobject_class->finalize = sensor_integer_proxy_finalize;
1729 gobject_class->get_property = sensor_integer_proxy_get_property;
1730 gobject_class->set_property = sensor_integer_proxy_set_property;
1731
1732 proxy_class = G_DBUS_PROXY_CLASS (klass);
1733 proxy_class->g_signal = sensor_integer_proxy_g_signal;
1734 proxy_class->g_properties_changed = sensor_integer_proxy_g_properties_changed;
1735
1736 sensor_integer_override_properties (gobject_class, 1);
1737
1738#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1739 g_type_class_add_private (klass, sizeof (SensorIntegerProxyPrivate));
1740#endif
1741}
1742
1743static void
1744sensor_integer_proxy_iface_init (SensorIntegerIface *iface)
1745{
1746 iface->get_value = sensor_integer_proxy_get_value;
1747 iface->get_units = sensor_integer_proxy_get_units;
Norman Jamescc7ae122015-08-24 14:26:09 -05001748 iface->get_poll_interval = sensor_integer_proxy_get_poll_interval;
Norman James90baede2015-09-02 20:32:49 -05001749 iface->get_heatbeat = sensor_integer_proxy_get_heatbeat;
Norman Jamese2765102015-08-19 22:00:55 -05001750}
1751
1752/**
1753 * sensor_integer_proxy_new:
1754 * @connection: A #GDBusConnection.
1755 * @flags: Flags from the #GDBusProxyFlags enumeration.
1756 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1757 * @object_path: An object path.
1758 * @cancellable: (allow-none): A #GCancellable or %NULL.
1759 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1760 * @user_data: User data to pass to @callback.
1761 *
1762 * 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.
1763 *
1764 * 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.
1765 * You can then call sensor_integer_proxy_new_finish() to get the result of the operation.
1766 *
1767 * See sensor_integer_proxy_new_sync() for the synchronous, blocking version of this constructor.
1768 */
1769void
1770sensor_integer_proxy_new (
1771 GDBusConnection *connection,
1772 GDBusProxyFlags flags,
1773 const gchar *name,
1774 const gchar *object_path,
1775 GCancellable *cancellable,
1776 GAsyncReadyCallback callback,
1777 gpointer user_data)
1778{
1779 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);
1780}
1781
1782/**
1783 * sensor_integer_proxy_new_finish:
1784 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_proxy_new().
1785 * @error: Return location for error or %NULL
1786 *
1787 * Finishes an operation started with sensor_integer_proxy_new().
1788 *
1789 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
1790 */
1791SensorInteger *
1792sensor_integer_proxy_new_finish (
1793 GAsyncResult *res,
1794 GError **error)
1795{
1796 GObject *ret;
1797 GObject *source_object;
1798 source_object = g_async_result_get_source_object (res);
1799 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1800 g_object_unref (source_object);
1801 if (ret != NULL)
1802 return SENSOR_INTEGER (ret);
1803 else
1804 return NULL;
1805}
1806
1807/**
1808 * sensor_integer_proxy_new_sync:
1809 * @connection: A #GDBusConnection.
1810 * @flags: Flags from the #GDBusProxyFlags enumeration.
1811 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1812 * @object_path: An object path.
1813 * @cancellable: (allow-none): A #GCancellable or %NULL.
1814 * @error: Return location for error or %NULL
1815 *
1816 * 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.
1817 *
1818 * The calling thread is blocked until a reply is received.
1819 *
1820 * See sensor_integer_proxy_new() for the asynchronous version of this constructor.
1821 *
1822 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
1823 */
1824SensorInteger *
1825sensor_integer_proxy_new_sync (
1826 GDBusConnection *connection,
1827 GDBusProxyFlags flags,
1828 const gchar *name,
1829 const gchar *object_path,
1830 GCancellable *cancellable,
1831 GError **error)
1832{
1833 GInitable *ret;
1834 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);
1835 if (ret != NULL)
1836 return SENSOR_INTEGER (ret);
1837 else
1838 return NULL;
1839}
1840
1841
1842/**
1843 * sensor_integer_proxy_new_for_bus:
1844 * @bus_type: A #GBusType.
1845 * @flags: Flags from the #GDBusProxyFlags enumeration.
1846 * @name: A bus name (well-known or unique).
1847 * @object_path: An object path.
1848 * @cancellable: (allow-none): A #GCancellable or %NULL.
1849 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1850 * @user_data: User data to pass to @callback.
1851 *
1852 * Like sensor_integer_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1853 *
1854 * 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.
1855 * You can then call sensor_integer_proxy_new_for_bus_finish() to get the result of the operation.
1856 *
1857 * See sensor_integer_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1858 */
1859void
1860sensor_integer_proxy_new_for_bus (
1861 GBusType bus_type,
1862 GDBusProxyFlags flags,
1863 const gchar *name,
1864 const gchar *object_path,
1865 GCancellable *cancellable,
1866 GAsyncReadyCallback callback,
1867 gpointer user_data)
1868{
1869 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);
1870}
1871
1872/**
1873 * sensor_integer_proxy_new_for_bus_finish:
1874 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_proxy_new_for_bus().
1875 * @error: Return location for error or %NULL
1876 *
1877 * Finishes an operation started with sensor_integer_proxy_new_for_bus().
1878 *
1879 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
1880 */
1881SensorInteger *
1882sensor_integer_proxy_new_for_bus_finish (
1883 GAsyncResult *res,
1884 GError **error)
1885{
1886 GObject *ret;
1887 GObject *source_object;
1888 source_object = g_async_result_get_source_object (res);
1889 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1890 g_object_unref (source_object);
1891 if (ret != NULL)
1892 return SENSOR_INTEGER (ret);
1893 else
1894 return NULL;
1895}
1896
1897/**
1898 * sensor_integer_proxy_new_for_bus_sync:
1899 * @bus_type: A #GBusType.
1900 * @flags: Flags from the #GDBusProxyFlags enumeration.
1901 * @name: A bus name (well-known or unique).
1902 * @object_path: An object path.
1903 * @cancellable: (allow-none): A #GCancellable or %NULL.
1904 * @error: Return location for error or %NULL
1905 *
1906 * Like sensor_integer_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1907 *
1908 * The calling thread is blocked until a reply is received.
1909 *
1910 * See sensor_integer_proxy_new_for_bus() for the asynchronous version of this constructor.
1911 *
1912 * Returns: (transfer full) (type SensorIntegerProxy): The constructed proxy object or %NULL if @error is set.
1913 */
1914SensorInteger *
1915sensor_integer_proxy_new_for_bus_sync (
1916 GBusType bus_type,
1917 GDBusProxyFlags flags,
1918 const gchar *name,
1919 const gchar *object_path,
1920 GCancellable *cancellable,
1921 GError **error)
1922{
1923 GInitable *ret;
1924 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);
1925 if (ret != NULL)
1926 return SENSOR_INTEGER (ret);
1927 else
1928 return NULL;
1929}
1930
1931
1932/* ------------------------------------------------------------------------ */
1933
1934/**
1935 * SensorIntegerSkeleton:
1936 *
1937 * The #SensorIntegerSkeleton structure contains only private data and should only be accessed using the provided API.
1938 */
1939
1940/**
1941 * SensorIntegerSkeletonClass:
1942 * @parent_class: The parent class.
1943 *
1944 * Class structure for #SensorIntegerSkeleton.
1945 */
1946
1947struct _SensorIntegerSkeletonPrivate
1948{
1949 GValue *properties;
1950 GList *changed_properties;
1951 GSource *changed_properties_idle_source;
1952 GMainContext *context;
1953 GMutex lock;
1954};
1955
1956static void
1957_sensor_integer_skeleton_handle_method_call (
1958 GDBusConnection *connection G_GNUC_UNUSED,
1959 const gchar *sender G_GNUC_UNUSED,
1960 const gchar *object_path G_GNUC_UNUSED,
1961 const gchar *interface_name,
1962 const gchar *method_name,
1963 GVariant *parameters,
1964 GDBusMethodInvocation *invocation,
1965 gpointer user_data)
1966{
1967 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
1968 _ExtendedGDBusMethodInfo *info;
1969 GVariantIter iter;
1970 GVariant *child;
1971 GValue *paramv;
1972 guint num_params;
1973 guint num_extra;
1974 guint n;
1975 guint signal_id;
1976 GValue return_value = G_VALUE_INIT;
1977 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1978 g_assert (info != NULL);
1979 num_params = g_variant_n_children (parameters);
1980 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1981 n = 0;
1982 g_value_init (&paramv[n], TYPE_SENSOR_INTEGER);
1983 g_value_set_object (&paramv[n++], skeleton);
1984 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1985 g_value_set_object (&paramv[n++], invocation);
1986 if (info->pass_fdlist)
1987 {
1988#ifdef G_OS_UNIX
1989 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1990 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1991#else
1992 g_assert_not_reached ();
1993#endif
1994 }
1995 g_variant_iter_init (&iter, parameters);
1996 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1997 {
1998 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1999 if (arg_info->use_gvariant)
2000 {
2001 g_value_init (&paramv[n], G_TYPE_VARIANT);
2002 g_value_set_variant (&paramv[n], child);
2003 n++;
2004 }
2005 else
2006 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2007 g_variant_unref (child);
2008 }
2009 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER);
2010 g_value_init (&return_value, G_TYPE_BOOLEAN);
2011 g_signal_emitv (paramv, signal_id, 0, &return_value);
2012 if (!g_value_get_boolean (&return_value))
2013 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);
2014 g_value_unset (&return_value);
2015 for (n = 0; n < num_params + num_extra; n++)
2016 g_value_unset (&paramv[n]);
2017 g_free (paramv);
2018}
2019
2020static GVariant *
2021_sensor_integer_skeleton_handle_get_property (
2022 GDBusConnection *connection G_GNUC_UNUSED,
2023 const gchar *sender G_GNUC_UNUSED,
2024 const gchar *object_path G_GNUC_UNUSED,
2025 const gchar *interface_name G_GNUC_UNUSED,
2026 const gchar *property_name,
2027 GError **error,
2028 gpointer user_data)
2029{
2030 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2031 GValue value = G_VALUE_INIT;
2032 GParamSpec *pspec;
2033 _ExtendedGDBusPropertyInfo *info;
2034 GVariant *ret;
2035 ret = NULL;
2036 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, property_name);
2037 g_assert (info != NULL);
2038 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2039 if (pspec == NULL)
2040 {
2041 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2042 }
2043 else
2044 {
2045 g_value_init (&value, pspec->value_type);
2046 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2047 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2048 g_value_unset (&value);
2049 }
2050 return ret;
2051}
2052
2053static gboolean
2054_sensor_integer_skeleton_handle_set_property (
2055 GDBusConnection *connection G_GNUC_UNUSED,
2056 const gchar *sender G_GNUC_UNUSED,
2057 const gchar *object_path G_GNUC_UNUSED,
2058 const gchar *interface_name G_GNUC_UNUSED,
2059 const gchar *property_name,
2060 GVariant *variant,
2061 GError **error,
2062 gpointer user_data)
2063{
2064 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2065 GValue value = G_VALUE_INIT;
2066 GParamSpec *pspec;
2067 _ExtendedGDBusPropertyInfo *info;
2068 gboolean ret;
2069 ret = FALSE;
2070 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_interface_info.parent_struct, property_name);
2071 g_assert (info != NULL);
2072 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2073 if (pspec == NULL)
2074 {
2075 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2076 }
2077 else
2078 {
2079 if (info->use_gvariant)
2080 g_value_set_variant (&value, variant);
2081 else
2082 g_dbus_gvariant_to_gvalue (variant, &value);
2083 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2084 g_value_unset (&value);
2085 ret = TRUE;
2086 }
2087 return ret;
2088}
2089
2090static const GDBusInterfaceVTable _sensor_integer_skeleton_vtable =
2091{
2092 _sensor_integer_skeleton_handle_method_call,
2093 _sensor_integer_skeleton_handle_get_property,
2094 _sensor_integer_skeleton_handle_set_property,
2095 {NULL}
2096};
2097
2098static GDBusInterfaceInfo *
2099sensor_integer_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2100{
2101 return sensor_integer_interface_info ();
2102}
2103
2104static GDBusInterfaceVTable *
2105sensor_integer_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2106{
2107 return (GDBusInterfaceVTable *) &_sensor_integer_skeleton_vtable;
2108}
2109
2110static GVariant *
2111sensor_integer_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2112{
2113 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (_skeleton);
2114
2115 GVariantBuilder builder;
2116 guint n;
2117 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2118 if (_sensor_integer_interface_info.parent_struct.properties == NULL)
2119 goto out;
2120 for (n = 0; _sensor_integer_interface_info.parent_struct.properties[n] != NULL; n++)
2121 {
2122 GDBusPropertyInfo *info = _sensor_integer_interface_info.parent_struct.properties[n];
2123 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2124 {
2125 GVariant *value;
2126 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);
2127 if (value != NULL)
2128 {
2129 g_variant_take_ref (value);
2130 g_variant_builder_add (&builder, "{sv}", info->name, value);
2131 g_variant_unref (value);
2132 }
2133 }
2134 }
2135out:
2136 return g_variant_builder_end (&builder);
2137}
2138
2139static gboolean _sensor_integer_emit_changed (gpointer user_data);
2140
2141static void
2142sensor_integer_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2143{
2144 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (_skeleton);
2145 gboolean emit_changed = FALSE;
2146
2147 g_mutex_lock (&skeleton->priv->lock);
2148 if (skeleton->priv->changed_properties_idle_source != NULL)
2149 {
2150 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2151 skeleton->priv->changed_properties_idle_source = NULL;
2152 emit_changed = TRUE;
2153 }
2154 g_mutex_unlock (&skeleton->priv->lock);
2155
2156 if (emit_changed)
2157 _sensor_integer_emit_changed (skeleton);
2158}
2159
2160static void
2161_sensor_integer_on_signal_changed (
2162 SensorInteger *object,
Norman James90baede2015-09-02 20:32:49 -05002163 gint arg_value,
2164 const gchar *arg_units)
Norman Jamese2765102015-08-19 22:00:55 -05002165{
2166 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2167
2168 GList *connections, *l;
2169 GVariant *signal_variant;
2170 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2171
Norman James90baede2015-09-02 20:32:49 -05002172 signal_variant = g_variant_ref_sink (g_variant_new ("(is)",
2173 arg_value,
2174 arg_units));
Norman Jamese2765102015-08-19 22:00:55 -05002175 for (l = connections; l != NULL; l = l->next)
2176 {
2177 GDBusConnection *connection = l->data;
2178 g_dbus_connection_emit_signal (connection,
2179 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Changed",
2180 signal_variant, NULL);
2181 }
2182 g_variant_unref (signal_variant);
2183 g_list_free_full (connections, g_object_unref);
2184}
2185
Norman James3f97c5d2015-08-26 17:44:14 -05002186static void
Norman James90baede2015-09-02 20:32:49 -05002187_sensor_integer_on_signal_heartbeat (
2188 SensorInteger *object,
2189 const gchar *arg_bus_name)
Norman James3f97c5d2015-08-26 17:44:14 -05002190{
2191 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2192
2193 GList *connections, *l;
2194 GVariant *signal_variant;
2195 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2196
Norman James90baede2015-09-02 20:32:49 -05002197 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
2198 arg_bus_name));
Norman James3f97c5d2015-08-26 17:44:14 -05002199 for (l = connections; l != NULL; l = l->next)
2200 {
2201 GDBusConnection *connection = l->data;
2202 g_dbus_connection_emit_signal (connection,
Norman James90baede2015-09-02 20:32:49 -05002203 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorInteger", "Heartbeat",
Norman James3f97c5d2015-08-26 17:44:14 -05002204 signal_variant, NULL);
2205 }
2206 g_variant_unref (signal_variant);
2207 g_list_free_full (connections, g_object_unref);
2208}
2209
Norman Jamese2765102015-08-19 22:00:55 -05002210static void sensor_integer_skeleton_iface_init (SensorIntegerIface *iface);
2211#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2212G_DEFINE_TYPE_WITH_CODE (SensorIntegerSkeleton, sensor_integer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2213 G_ADD_PRIVATE (SensorIntegerSkeleton)
2214 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_skeleton_iface_init));
2215
2216#else
2217G_DEFINE_TYPE_WITH_CODE (SensorIntegerSkeleton, sensor_integer_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2218 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER, sensor_integer_skeleton_iface_init));
2219
2220#endif
2221static void
2222sensor_integer_skeleton_finalize (GObject *object)
2223{
2224 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2225 guint n;
Norman James90baede2015-09-02 20:32:49 -05002226 for (n = 0; n < 4; n++)
Norman Jamese2765102015-08-19 22:00:55 -05002227 g_value_unset (&skeleton->priv->properties[n]);
2228 g_free (skeleton->priv->properties);
2229 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2230 if (skeleton->priv->changed_properties_idle_source != NULL)
2231 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2232 g_main_context_unref (skeleton->priv->context);
2233 g_mutex_clear (&skeleton->priv->lock);
2234 G_OBJECT_CLASS (sensor_integer_skeleton_parent_class)->finalize (object);
2235}
2236
2237static void
2238sensor_integer_skeleton_get_property (GObject *object,
2239 guint prop_id,
2240 GValue *value,
2241 GParamSpec *pspec G_GNUC_UNUSED)
2242{
2243 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05002244 g_assert (prop_id != 0 && prop_id - 1 < 4);
Norman Jamese2765102015-08-19 22:00:55 -05002245 g_mutex_lock (&skeleton->priv->lock);
2246 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
2247 g_mutex_unlock (&skeleton->priv->lock);
2248}
2249
2250static gboolean
2251_sensor_integer_emit_changed (gpointer user_data)
2252{
2253 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (user_data);
2254 GList *l;
2255 GVariantBuilder builder;
2256 GVariantBuilder invalidated_builder;
2257 guint num_changes;
2258
2259 g_mutex_lock (&skeleton->priv->lock);
2260 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2261 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
2262 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
2263 {
2264 ChangedProperty *cp = l->data;
2265 GVariant *variant;
2266 const GValue *cur_value;
2267
2268 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
2269 if (!_g_value_equal (cur_value, &cp->orig_value))
2270 {
2271 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
2272 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
2273 g_variant_unref (variant);
2274 num_changes++;
2275 }
2276 }
2277 if (num_changes > 0)
2278 {
2279 GList *connections, *ll;
2280 GVariant *signal_variant;
2281 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorInteger",
2282 &builder, &invalidated_builder));
2283 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2284 for (ll = connections; ll != NULL; ll = ll->next)
2285 {
2286 GDBusConnection *connection = ll->data;
2287
2288 g_dbus_connection_emit_signal (connection,
2289 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
2290 "org.freedesktop.DBus.Properties",
2291 "PropertiesChanged",
2292 signal_variant,
2293 NULL);
2294 }
2295 g_variant_unref (signal_variant);
2296 g_list_free_full (connections, g_object_unref);
2297 }
2298 else
2299 {
2300 g_variant_builder_clear (&builder);
2301 g_variant_builder_clear (&invalidated_builder);
2302 }
2303 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2304 skeleton->priv->changed_properties = NULL;
2305 skeleton->priv->changed_properties_idle_source = NULL;
2306 g_mutex_unlock (&skeleton->priv->lock);
2307 return FALSE;
2308}
2309
2310static void
2311_sensor_integer_schedule_emit_changed (SensorIntegerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
2312{
2313 ChangedProperty *cp;
2314 GList *l;
2315 cp = NULL;
2316 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
2317 {
2318 ChangedProperty *i_cp = l->data;
2319 if (i_cp->info == info)
2320 {
2321 cp = i_cp;
2322 break;
2323 }
2324 }
2325 if (cp == NULL)
2326 {
2327 cp = g_new0 (ChangedProperty, 1);
2328 cp->prop_id = prop_id;
2329 cp->info = info;
2330 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
2331 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
2332 g_value_copy (orig_value, &cp->orig_value);
2333 }
2334}
2335
2336static void
2337sensor_integer_skeleton_notify (GObject *object,
2338 GParamSpec *pspec G_GNUC_UNUSED)
2339{
2340 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2341 g_mutex_lock (&skeleton->priv->lock);
2342 if (skeleton->priv->changed_properties != NULL &&
2343 skeleton->priv->changed_properties_idle_source == NULL)
2344 {
2345 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
2346 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
2347 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
2348 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2349 g_source_unref (skeleton->priv->changed_properties_idle_source);
2350 }
2351 g_mutex_unlock (&skeleton->priv->lock);
2352}
2353
2354static void
2355sensor_integer_skeleton_set_property (GObject *object,
2356 guint prop_id,
2357 const GValue *value,
2358 GParamSpec *pspec)
2359{
2360 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05002361 g_assert (prop_id != 0 && prop_id - 1 < 4);
Norman Jamese2765102015-08-19 22:00:55 -05002362 g_mutex_lock (&skeleton->priv->lock);
2363 g_object_freeze_notify (object);
2364 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2365 {
2366 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
2367 _sensor_integer_schedule_emit_changed (skeleton, _sensor_integer_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
2368 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2369 g_object_notify_by_pspec (object, pspec);
2370 }
2371 g_mutex_unlock (&skeleton->priv->lock);
2372 g_object_thaw_notify (object);
2373}
2374
2375static void
2376sensor_integer_skeleton_init (SensorIntegerSkeleton *skeleton)
2377{
2378#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2379 skeleton->priv = sensor_integer_skeleton_get_instance_private (skeleton);
2380#else
2381 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_SKELETON, SensorIntegerSkeletonPrivate);
2382#endif
2383
2384 g_mutex_init (&skeleton->priv->lock);
2385 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James90baede2015-09-02 20:32:49 -05002386 skeleton->priv->properties = g_new0 (GValue, 4);
Norman Jamese2765102015-08-19 22:00:55 -05002387 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
2388 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman Jamescc7ae122015-08-24 14:26:09 -05002389 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James3f97c5d2015-08-26 17:44:14 -05002390 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
Norman Jamese2765102015-08-19 22:00:55 -05002391}
2392
2393static gint
2394sensor_integer_skeleton_get_value (SensorInteger *object)
2395{
2396 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2397 gint value;
2398 g_mutex_lock (&skeleton->priv->lock);
2399 value = g_value_get_int (&(skeleton->priv->properties[0]));
2400 g_mutex_unlock (&skeleton->priv->lock);
2401 return value;
2402}
2403
2404static const gchar *
2405sensor_integer_skeleton_get_units (SensorInteger *object)
2406{
2407 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2408 const gchar *value;
2409 g_mutex_lock (&skeleton->priv->lock);
2410 value = g_value_get_string (&(skeleton->priv->properties[1]));
2411 g_mutex_unlock (&skeleton->priv->lock);
2412 return value;
2413}
2414
Norman Jamescc7ae122015-08-24 14:26:09 -05002415static gint
Norman James90baede2015-09-02 20:32:49 -05002416sensor_integer_skeleton_get_poll_interval (SensorInteger *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05002417{
2418 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2419 gint value;
2420 g_mutex_lock (&skeleton->priv->lock);
2421 value = g_value_get_int (&(skeleton->priv->properties[2]));
2422 g_mutex_unlock (&skeleton->priv->lock);
2423 return value;
2424}
2425
Norman James3f97c5d2015-08-26 17:44:14 -05002426static gint
Norman James90baede2015-09-02 20:32:49 -05002427sensor_integer_skeleton_get_heatbeat (SensorInteger *object)
Norman James3f97c5d2015-08-26 17:44:14 -05002428{
2429 SensorIntegerSkeleton *skeleton = SENSOR_INTEGER_SKELETON (object);
2430 gint value;
2431 g_mutex_lock (&skeleton->priv->lock);
2432 value = g_value_get_int (&(skeleton->priv->properties[3]));
2433 g_mutex_unlock (&skeleton->priv->lock);
2434 return value;
2435}
2436
Norman Jamese2765102015-08-19 22:00:55 -05002437static void
2438sensor_integer_skeleton_class_init (SensorIntegerSkeletonClass *klass)
2439{
2440 GObjectClass *gobject_class;
2441 GDBusInterfaceSkeletonClass *skeleton_class;
2442
2443 gobject_class = G_OBJECT_CLASS (klass);
2444 gobject_class->finalize = sensor_integer_skeleton_finalize;
2445 gobject_class->get_property = sensor_integer_skeleton_get_property;
2446 gobject_class->set_property = sensor_integer_skeleton_set_property;
2447 gobject_class->notify = sensor_integer_skeleton_notify;
2448
2449
2450 sensor_integer_override_properties (gobject_class, 1);
2451
2452 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2453 skeleton_class->get_info = sensor_integer_skeleton_dbus_interface_get_info;
2454 skeleton_class->get_properties = sensor_integer_skeleton_dbus_interface_get_properties;
2455 skeleton_class->flush = sensor_integer_skeleton_dbus_interface_flush;
2456 skeleton_class->get_vtable = sensor_integer_skeleton_dbus_interface_get_vtable;
2457
2458#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2459 g_type_class_add_private (klass, sizeof (SensorIntegerSkeletonPrivate));
2460#endif
2461}
2462
2463static void
2464sensor_integer_skeleton_iface_init (SensorIntegerIface *iface)
2465{
2466 iface->changed = _sensor_integer_on_signal_changed;
Norman James90baede2015-09-02 20:32:49 -05002467 iface->heartbeat = _sensor_integer_on_signal_heartbeat;
Norman Jamese2765102015-08-19 22:00:55 -05002468 iface->get_value = sensor_integer_skeleton_get_value;
2469 iface->get_units = sensor_integer_skeleton_get_units;
Norman Jamescc7ae122015-08-24 14:26:09 -05002470 iface->get_poll_interval = sensor_integer_skeleton_get_poll_interval;
Norman James90baede2015-09-02 20:32:49 -05002471 iface->get_heatbeat = sensor_integer_skeleton_get_heatbeat;
Norman Jamese2765102015-08-19 22:00:55 -05002472}
2473
2474/**
2475 * sensor_integer_skeleton_new:
2476 *
2477 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorInteger.top_of_page">org.openbmc.SensorInteger</link>.
2478 *
2479 * Returns: (transfer full) (type SensorIntegerSkeleton): The skeleton object.
2480 */
2481SensorInteger *
2482sensor_integer_skeleton_new (void)
2483{
2484 return SENSOR_INTEGER (g_object_new (TYPE_SENSOR_INTEGER_SKELETON, NULL));
2485}
2486
2487/* ------------------------------------------------------------------------
2488 * Code for interface org.openbmc.SensorString
2489 * ------------------------------------------------------------------------
2490 */
2491
2492/**
2493 * SECTION:SensorString
2494 * @title: SensorString
2495 * @short_description: Generated C code for the org.openbmc.SensorString D-Bus interface
2496 *
2497 * 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.
2498 */
2499
2500/* ---- Introspection data for org.openbmc.SensorString ---- */
2501
2502static const _ExtendedGDBusArgInfo _sensor_string_method_info_get_value_OUT_ARG_value =
2503{
2504 {
2505 -1,
2506 (gchar *) "value",
2507 (gchar *) "s",
2508 NULL
2509 },
2510 FALSE
2511};
2512
2513static const _ExtendedGDBusArgInfo * const _sensor_string_method_info_get_value_OUT_ARG_pointers[] =
2514{
2515 &_sensor_string_method_info_get_value_OUT_ARG_value,
2516 NULL
2517};
2518
2519static const _ExtendedGDBusMethodInfo _sensor_string_method_info_get_value =
2520{
2521 {
2522 -1,
2523 (gchar *) "getValue",
2524 NULL,
2525 (GDBusArgInfo **) &_sensor_string_method_info_get_value_OUT_ARG_pointers,
2526 NULL
2527 },
2528 "handle-get-value",
2529 FALSE
2530};
2531
2532static const _ExtendedGDBusArgInfo _sensor_string_method_info_get_units_OUT_ARG_units =
2533{
2534 {
2535 -1,
2536 (gchar *) "units",
2537 (gchar *) "s",
2538 NULL
2539 },
2540 FALSE
2541};
2542
2543static const _ExtendedGDBusArgInfo * const _sensor_string_method_info_get_units_OUT_ARG_pointers[] =
2544{
2545 &_sensor_string_method_info_get_units_OUT_ARG_units,
2546 NULL
2547};
2548
2549static const _ExtendedGDBusMethodInfo _sensor_string_method_info_get_units =
2550{
2551 {
2552 -1,
2553 (gchar *) "getUnits",
2554 NULL,
2555 (GDBusArgInfo **) &_sensor_string_method_info_get_units_OUT_ARG_pointers,
2556 NULL
2557 },
2558 "handle-get-units",
2559 FALSE
2560};
2561
2562static const _ExtendedGDBusMethodInfo * const _sensor_string_method_info_pointers[] =
2563{
2564 &_sensor_string_method_info_get_value,
2565 &_sensor_string_method_info_get_units,
2566 NULL
2567};
2568
2569static const _ExtendedGDBusArgInfo _sensor_string_signal_info_changed_ARG_value =
2570{
2571 {
2572 -1,
2573 (gchar *) "value",
2574 (gchar *) "s",
2575 NULL
2576 },
2577 FALSE
2578};
2579
2580static const _ExtendedGDBusArgInfo * const _sensor_string_signal_info_changed_ARG_pointers[] =
2581{
2582 &_sensor_string_signal_info_changed_ARG_value,
2583 NULL
2584};
2585
2586static const _ExtendedGDBusSignalInfo _sensor_string_signal_info_changed =
2587{
2588 {
2589 -1,
2590 (gchar *) "Changed",
2591 (GDBusArgInfo **) &_sensor_string_signal_info_changed_ARG_pointers,
2592 NULL
2593 },
2594 "changed"
2595};
2596
2597static const _ExtendedGDBusSignalInfo * const _sensor_string_signal_info_pointers[] =
2598{
2599 &_sensor_string_signal_info_changed,
2600 NULL
2601};
2602
2603static const _ExtendedGDBusPropertyInfo _sensor_string_property_info_value =
2604{
2605 {
2606 -1,
2607 (gchar *) "value",
2608 (gchar *) "i",
2609 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2610 NULL
2611 },
2612 "value",
2613 FALSE
2614};
2615
2616static const _ExtendedGDBusPropertyInfo _sensor_string_property_info_units =
2617{
2618 {
2619 -1,
2620 (gchar *) "units",
2621 (gchar *) "s",
2622 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2623 NULL
2624 },
2625 "units",
2626 FALSE
2627};
2628
2629static const _ExtendedGDBusPropertyInfo * const _sensor_string_property_info_pointers[] =
2630{
2631 &_sensor_string_property_info_value,
2632 &_sensor_string_property_info_units,
2633 NULL
2634};
2635
2636static const _ExtendedGDBusInterfaceInfo _sensor_string_interface_info =
2637{
2638 {
2639 -1,
2640 (gchar *) "org.openbmc.SensorString",
2641 (GDBusMethodInfo **) &_sensor_string_method_info_pointers,
2642 (GDBusSignalInfo **) &_sensor_string_signal_info_pointers,
2643 (GDBusPropertyInfo **) &_sensor_string_property_info_pointers,
2644 NULL
2645 },
2646 "sensor-string",
2647};
2648
2649
2650/**
2651 * sensor_string_interface_info:
2652 *
2653 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link> D-Bus interface.
2654 *
2655 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2656 */
2657GDBusInterfaceInfo *
2658sensor_string_interface_info (void)
2659{
2660 return (GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct;
2661}
2662
2663/**
2664 * sensor_string_override_properties:
2665 * @klass: The class structure for a #GObject<!-- -->-derived class.
2666 * @property_id_begin: The property id to assign to the first overridden property.
2667 *
2668 * Overrides all #GObject properties in the #SensorString interface for a concrete class.
2669 * The properties are overridden in the order they are defined.
2670 *
2671 * Returns: The last property id.
2672 */
2673guint
2674sensor_string_override_properties (GObjectClass *klass, guint property_id_begin)
2675{
2676 g_object_class_override_property (klass, property_id_begin++, "value");
2677 g_object_class_override_property (klass, property_id_begin++, "units");
2678 return property_id_begin - 1;
2679}
2680
2681
2682
2683/**
2684 * SensorString:
2685 *
2686 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
2687 */
2688
2689/**
2690 * SensorStringIface:
2691 * @parent_iface: The parent interface.
2692 * @handle_get_units: Handler for the #SensorString::handle-get-units signal.
2693 * @handle_get_value: Handler for the #SensorString::handle-get-value signal.
2694 * @get_units: Getter for the #SensorString:units property.
2695 * @get_value: Getter for the #SensorString:value property.
2696 * @changed: Handler for the #SensorString::changed signal.
2697 *
2698 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
2699 */
2700
2701typedef SensorStringIface SensorStringInterface;
2702G_DEFINE_INTERFACE (SensorString, sensor_string, G_TYPE_OBJECT);
2703
2704static void
2705sensor_string_default_init (SensorStringIface *iface)
2706{
2707 /* GObject signals for incoming D-Bus method calls: */
2708 /**
2709 * SensorString::handle-get-value:
2710 * @object: A #SensorString.
2711 * @invocation: A #GDBusMethodInvocation.
2712 *
2713 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method.
2714 *
2715 * 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.
2716 *
2717 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2718 */
2719 g_signal_new ("handle-get-value",
2720 G_TYPE_FROM_INTERFACE (iface),
2721 G_SIGNAL_RUN_LAST,
2722 G_STRUCT_OFFSET (SensorStringIface, handle_get_value),
2723 g_signal_accumulator_true_handled,
2724 NULL,
2725 g_cclosure_marshal_generic,
2726 G_TYPE_BOOLEAN,
2727 1,
2728 G_TYPE_DBUS_METHOD_INVOCATION);
2729
2730 /**
2731 * SensorString::handle-get-units:
2732 * @object: A #SensorString.
2733 * @invocation: A #GDBusMethodInvocation.
2734 *
2735 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method.
2736 *
2737 * 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.
2738 *
2739 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2740 */
2741 g_signal_new ("handle-get-units",
2742 G_TYPE_FROM_INTERFACE (iface),
2743 G_SIGNAL_RUN_LAST,
2744 G_STRUCT_OFFSET (SensorStringIface, handle_get_units),
2745 g_signal_accumulator_true_handled,
2746 NULL,
2747 g_cclosure_marshal_generic,
2748 G_TYPE_BOOLEAN,
2749 1,
2750 G_TYPE_DBUS_METHOD_INVOCATION);
2751
2752 /* GObject signals for received D-Bus signals: */
2753 /**
2754 * SensorString::changed:
2755 * @object: A #SensorString.
2756 * @arg_value: Argument.
2757 *
2758 * 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.
2759 *
2760 * 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.
2761 */
2762 g_signal_new ("changed",
2763 G_TYPE_FROM_INTERFACE (iface),
2764 G_SIGNAL_RUN_LAST,
2765 G_STRUCT_OFFSET (SensorStringIface, changed),
2766 NULL,
2767 NULL,
2768 g_cclosure_marshal_generic,
2769 G_TYPE_NONE,
2770 1, G_TYPE_STRING);
2771
2772 /* GObject properties for D-Bus properties: */
2773 /**
2774 * SensorString:value:
2775 *
2776 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link>.
2777 *
2778 * 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.
2779 */
2780 g_object_interface_install_property (iface,
2781 g_param_spec_int ("value", "value", "value", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2782 /**
2783 * SensorString:units:
2784 *
2785 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link>.
2786 *
2787 * 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.
2788 */
2789 g_object_interface_install_property (iface,
2790 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2791}
2792
2793/**
2794 * sensor_string_get_value: (skip)
2795 * @object: A #SensorString.
2796 *
2797 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link> D-Bus property.
2798 *
2799 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2800 *
2801 * Returns: The property value.
2802 */
2803gint
2804sensor_string_get_value (SensorString *object)
2805{
2806 return SENSOR_STRING_GET_IFACE (object)->get_value (object);
2807}
2808
2809/**
2810 * sensor_string_set_value: (skip)
2811 * @object: A #SensorString.
2812 * @value: The value to set.
2813 *
2814 * Sets the <link linkend="gdbus-property-org-openbmc-SensorString.value">"value"</link> D-Bus property to @value.
2815 *
2816 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2817 */
2818void
2819sensor_string_set_value (SensorString *object, gint value)
2820{
2821 g_object_set (G_OBJECT (object), "value", value, NULL);
2822}
2823
2824/**
2825 * sensor_string_get_units: (skip)
2826 * @object: A #SensorString.
2827 *
2828 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property.
2829 *
2830 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2831 *
2832 * <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>
2833 *
2834 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
2835 */
2836const gchar *
2837sensor_string_get_units (SensorString *object)
2838{
2839 return SENSOR_STRING_GET_IFACE (object)->get_units (object);
2840}
2841
2842/**
2843 * sensor_string_dup_units: (skip)
2844 * @object: A #SensorString.
2845 *
2846 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property.
2847 *
2848 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
2849 *
2850 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
2851 */
2852gchar *
2853sensor_string_dup_units (SensorString *object)
2854{
2855 gchar *value;
2856 g_object_get (G_OBJECT (object), "units", &value, NULL);
2857 return value;
2858}
2859
2860/**
2861 * sensor_string_set_units: (skip)
2862 * @object: A #SensorString.
2863 * @value: The value to set.
2864 *
2865 * Sets the <link linkend="gdbus-property-org-openbmc-SensorString.units">"units"</link> D-Bus property to @value.
2866 *
2867 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
2868 */
2869void
2870sensor_string_set_units (SensorString *object, const gchar *value)
2871{
2872 g_object_set (G_OBJECT (object), "units", value, NULL);
2873}
2874
2875/**
2876 * sensor_string_emit_changed:
2877 * @object: A #SensorString.
2878 * @arg_value: Argument to pass with the signal.
2879 *
2880 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorString.Changed">"Changed"</link> D-Bus signal.
2881 */
2882void
2883sensor_string_emit_changed (
2884 SensorString *object,
2885 const gchar *arg_value)
2886{
2887 g_signal_emit_by_name (object, "changed", arg_value);
2888}
2889
2890/**
2891 * sensor_string_call_get_value:
2892 * @proxy: A #SensorStringProxy.
2893 * @cancellable: (allow-none): A #GCancellable or %NULL.
2894 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2895 * @user_data: User data to pass to @callback.
2896 *
2897 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getValue">getValue()</link> D-Bus method on @proxy.
2898 * 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.
2899 * You can then call sensor_string_call_get_value_finish() to get the result of the operation.
2900 *
2901 * See sensor_string_call_get_value_sync() for the synchronous, blocking version of this method.
2902 */
2903void
2904sensor_string_call_get_value (
2905 SensorString *proxy,
2906 GCancellable *cancellable,
2907 GAsyncReadyCallback callback,
2908 gpointer user_data)
2909{
2910 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2911 "getValue",
2912 g_variant_new ("()"),
2913 G_DBUS_CALL_FLAGS_NONE,
2914 -1,
2915 cancellable,
2916 callback,
2917 user_data);
2918}
2919
2920/**
2921 * sensor_string_call_get_value_finish:
2922 * @proxy: A #SensorStringProxy.
2923 * @out_value: (out): Return location for return parameter or %NULL to ignore.
2924 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_call_get_value().
2925 * @error: Return location for error or %NULL.
2926 *
2927 * Finishes an operation started with sensor_string_call_get_value().
2928 *
2929 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2930 */
2931gboolean
2932sensor_string_call_get_value_finish (
2933 SensorString *proxy,
2934 gchar **out_value,
2935 GAsyncResult *res,
2936 GError **error)
2937{
2938 GVariant *_ret;
2939 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2940 if (_ret == NULL)
2941 goto _out;
2942 g_variant_get (_ret,
2943 "(s)",
2944 out_value);
2945 g_variant_unref (_ret);
2946_out:
2947 return _ret != NULL;
2948}
2949
2950/**
2951 * sensor_string_call_get_value_sync:
2952 * @proxy: A #SensorStringProxy.
2953 * @out_value: (out): Return location for return parameter or %NULL to ignore.
2954 * @cancellable: (allow-none): A #GCancellable or %NULL.
2955 * @error: Return location for error or %NULL.
2956 *
2957 * 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.
2958 *
2959 * See sensor_string_call_get_value() for the asynchronous version of this method.
2960 *
2961 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2962 */
2963gboolean
2964sensor_string_call_get_value_sync (
2965 SensorString *proxy,
2966 gchar **out_value,
2967 GCancellable *cancellable,
2968 GError **error)
2969{
2970 GVariant *_ret;
2971 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2972 "getValue",
2973 g_variant_new ("()"),
2974 G_DBUS_CALL_FLAGS_NONE,
2975 -1,
2976 cancellable,
2977 error);
2978 if (_ret == NULL)
2979 goto _out;
2980 g_variant_get (_ret,
2981 "(s)",
2982 out_value);
2983 g_variant_unref (_ret);
2984_out:
2985 return _ret != NULL;
2986}
2987
2988/**
2989 * sensor_string_call_get_units:
2990 * @proxy: A #SensorStringProxy.
2991 * @cancellable: (allow-none): A #GCancellable or %NULL.
2992 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2993 * @user_data: User data to pass to @callback.
2994 *
2995 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorString.getUnits">getUnits()</link> D-Bus method on @proxy.
2996 * 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.
2997 * You can then call sensor_string_call_get_units_finish() to get the result of the operation.
2998 *
2999 * See sensor_string_call_get_units_sync() for the synchronous, blocking version of this method.
3000 */
3001void
3002sensor_string_call_get_units (
3003 SensorString *proxy,
3004 GCancellable *cancellable,
3005 GAsyncReadyCallback callback,
3006 gpointer user_data)
3007{
3008 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3009 "getUnits",
3010 g_variant_new ("()"),
3011 G_DBUS_CALL_FLAGS_NONE,
3012 -1,
3013 cancellable,
3014 callback,
3015 user_data);
3016}
3017
3018/**
3019 * sensor_string_call_get_units_finish:
3020 * @proxy: A #SensorStringProxy.
3021 * @out_units: (out): Return location for return parameter or %NULL to ignore.
3022 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_call_get_units().
3023 * @error: Return location for error or %NULL.
3024 *
3025 * Finishes an operation started with sensor_string_call_get_units().
3026 *
3027 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3028 */
3029gboolean
3030sensor_string_call_get_units_finish (
3031 SensorString *proxy,
3032 gchar **out_units,
3033 GAsyncResult *res,
3034 GError **error)
3035{
3036 GVariant *_ret;
3037 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3038 if (_ret == NULL)
3039 goto _out;
3040 g_variant_get (_ret,
3041 "(s)",
3042 out_units);
3043 g_variant_unref (_ret);
3044_out:
3045 return _ret != NULL;
3046}
3047
3048/**
3049 * sensor_string_call_get_units_sync:
3050 * @proxy: A #SensorStringProxy.
3051 * @out_units: (out): Return location for return parameter or %NULL to ignore.
3052 * @cancellable: (allow-none): A #GCancellable or %NULL.
3053 * @error: Return location for error or %NULL.
3054 *
3055 * 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.
3056 *
3057 * See sensor_string_call_get_units() for the asynchronous version of this method.
3058 *
3059 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3060 */
3061gboolean
3062sensor_string_call_get_units_sync (
3063 SensorString *proxy,
3064 gchar **out_units,
3065 GCancellable *cancellable,
3066 GError **error)
3067{
3068 GVariant *_ret;
3069 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3070 "getUnits",
3071 g_variant_new ("()"),
3072 G_DBUS_CALL_FLAGS_NONE,
3073 -1,
3074 cancellable,
3075 error);
3076 if (_ret == NULL)
3077 goto _out;
3078 g_variant_get (_ret,
3079 "(s)",
3080 out_units);
3081 g_variant_unref (_ret);
3082_out:
3083 return _ret != NULL;
3084}
3085
3086/**
3087 * sensor_string_complete_get_value:
3088 * @object: A #SensorString.
3089 * @invocation: (transfer full): A #GDBusMethodInvocation.
3090 * @value: Parameter to return.
3091 *
3092 * 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.
3093 *
3094 * This method will free @invocation, you cannot use it afterwards.
3095 */
3096void
3097sensor_string_complete_get_value (
3098 SensorString *object,
3099 GDBusMethodInvocation *invocation,
3100 const gchar *value)
3101{
3102 g_dbus_method_invocation_return_value (invocation,
3103 g_variant_new ("(s)",
3104 value));
3105}
3106
3107/**
3108 * sensor_string_complete_get_units:
3109 * @object: A #SensorString.
3110 * @invocation: (transfer full): A #GDBusMethodInvocation.
3111 * @units: Parameter to return.
3112 *
3113 * 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.
3114 *
3115 * This method will free @invocation, you cannot use it afterwards.
3116 */
3117void
3118sensor_string_complete_get_units (
3119 SensorString *object,
3120 GDBusMethodInvocation *invocation,
3121 const gchar *units)
3122{
3123 g_dbus_method_invocation_return_value (invocation,
3124 g_variant_new ("(s)",
3125 units));
3126}
3127
3128/* ------------------------------------------------------------------------ */
3129
3130/**
3131 * SensorStringProxy:
3132 *
3133 * The #SensorStringProxy structure contains only private data and should only be accessed using the provided API.
3134 */
3135
3136/**
3137 * SensorStringProxyClass:
3138 * @parent_class: The parent class.
3139 *
3140 * Class structure for #SensorStringProxy.
3141 */
3142
3143struct _SensorStringProxyPrivate
3144{
3145 GData *qdata;
3146};
3147
3148static void sensor_string_proxy_iface_init (SensorStringIface *iface);
3149
3150#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3151G_DEFINE_TYPE_WITH_CODE (SensorStringProxy, sensor_string_proxy, G_TYPE_DBUS_PROXY,
3152 G_ADD_PRIVATE (SensorStringProxy)
3153 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_proxy_iface_init));
3154
3155#else
3156G_DEFINE_TYPE_WITH_CODE (SensorStringProxy, sensor_string_proxy, G_TYPE_DBUS_PROXY,
3157 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_proxy_iface_init));
3158
3159#endif
3160static void
3161sensor_string_proxy_finalize (GObject *object)
3162{
3163 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
3164 g_datalist_clear (&proxy->priv->qdata);
3165 G_OBJECT_CLASS (sensor_string_proxy_parent_class)->finalize (object);
3166}
3167
3168static void
3169sensor_string_proxy_get_property (GObject *object,
3170 guint prop_id,
3171 GValue *value,
3172 GParamSpec *pspec G_GNUC_UNUSED)
3173{
3174 const _ExtendedGDBusPropertyInfo *info;
3175 GVariant *variant;
3176 g_assert (prop_id != 0 && prop_id - 1 < 2);
3177 info = _sensor_string_property_info_pointers[prop_id - 1];
3178 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3179 if (info->use_gvariant)
3180 {
3181 g_value_set_variant (value, variant);
3182 }
3183 else
3184 {
3185 if (variant != NULL)
3186 g_dbus_gvariant_to_gvalue (variant, value);
3187 }
3188 if (variant != NULL)
3189 g_variant_unref (variant);
3190}
3191
3192static void
3193sensor_string_proxy_set_property_cb (GDBusProxy *proxy,
3194 GAsyncResult *res,
3195 gpointer user_data)
3196{
3197 const _ExtendedGDBusPropertyInfo *info = user_data;
3198 GError *error;
3199 GVariant *_ret;
3200 error = NULL;
3201 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3202 if (!_ret)
3203 {
3204 g_warning ("Error setting property '%s' on interface org.openbmc.SensorString: %s (%s, %d)",
3205 info->parent_struct.name,
3206 error->message, g_quark_to_string (error->domain), error->code);
3207 g_error_free (error);
3208 }
3209 else
3210 {
3211 g_variant_unref (_ret);
3212 }
3213}
3214
3215static void
3216sensor_string_proxy_set_property (GObject *object,
3217 guint prop_id,
3218 const GValue *value,
3219 GParamSpec *pspec G_GNUC_UNUSED)
3220{
3221 const _ExtendedGDBusPropertyInfo *info;
3222 GVariant *variant;
3223 g_assert (prop_id != 0 && prop_id - 1 < 2);
3224 info = _sensor_string_property_info_pointers[prop_id - 1];
3225 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3226 g_dbus_proxy_call (G_DBUS_PROXY (object),
3227 "org.freedesktop.DBus.Properties.Set",
3228 g_variant_new ("(ssv)", "org.openbmc.SensorString", info->parent_struct.name, variant),
3229 G_DBUS_CALL_FLAGS_NONE,
3230 -1,
3231 NULL, (GAsyncReadyCallback) sensor_string_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3232 g_variant_unref (variant);
3233}
3234
3235static void
3236sensor_string_proxy_g_signal (GDBusProxy *proxy,
3237 const gchar *sender_name G_GNUC_UNUSED,
3238 const gchar *signal_name,
3239 GVariant *parameters)
3240{
3241 _ExtendedGDBusSignalInfo *info;
3242 GVariantIter iter;
3243 GVariant *child;
3244 GValue *paramv;
3245 guint num_params;
3246 guint n;
3247 guint signal_id;
3248 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, signal_name);
3249 if (info == NULL)
3250 return;
3251 num_params = g_variant_n_children (parameters);
3252 paramv = g_new0 (GValue, num_params + 1);
3253 g_value_init (&paramv[0], TYPE_SENSOR_STRING);
3254 g_value_set_object (&paramv[0], proxy);
3255 g_variant_iter_init (&iter, parameters);
3256 n = 1;
3257 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3258 {
3259 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3260 if (arg_info->use_gvariant)
3261 {
3262 g_value_init (&paramv[n], G_TYPE_VARIANT);
3263 g_value_set_variant (&paramv[n], child);
3264 n++;
3265 }
3266 else
3267 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3268 g_variant_unref (child);
3269 }
3270 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_STRING);
3271 g_signal_emitv (paramv, signal_id, 0, NULL);
3272 for (n = 0; n < num_params + 1; n++)
3273 g_value_unset (&paramv[n]);
3274 g_free (paramv);
3275}
3276
3277static void
3278sensor_string_proxy_g_properties_changed (GDBusProxy *_proxy,
3279 GVariant *changed_properties,
3280 const gchar *const *invalidated_properties)
3281{
3282 SensorStringProxy *proxy = SENSOR_STRING_PROXY (_proxy);
3283 guint n;
3284 const gchar *key;
3285 GVariantIter *iter;
3286 _ExtendedGDBusPropertyInfo *info;
3287 g_variant_get (changed_properties, "a{sv}", &iter);
3288 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3289 {
3290 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, key);
3291 g_datalist_remove_data (&proxy->priv->qdata, key);
3292 if (info != NULL)
3293 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3294 }
3295 g_variant_iter_free (iter);
3296 for (n = 0; invalidated_properties[n] != NULL; n++)
3297 {
3298 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, invalidated_properties[n]);
3299 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3300 if (info != NULL)
3301 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3302 }
3303}
3304
3305static gint
3306sensor_string_proxy_get_value (SensorString *object)
3307{
3308 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
3309 GVariant *variant;
3310 gint value = 0;
3311 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
3312 if (variant != NULL)
3313 {
3314 value = g_variant_get_int32 (variant);
3315 g_variant_unref (variant);
3316 }
3317 return value;
3318}
3319
3320static const gchar *
3321sensor_string_proxy_get_units (SensorString *object)
3322{
3323 SensorStringProxy *proxy = SENSOR_STRING_PROXY (object);
3324 GVariant *variant;
3325 const gchar *value = NULL;
3326 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
3327 if (variant != NULL)
3328 {
3329 value = g_variant_get_string (variant, NULL);
3330 g_variant_unref (variant);
3331 }
3332 return value;
3333}
3334
3335static void
3336sensor_string_proxy_init (SensorStringProxy *proxy)
3337{
3338#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3339 proxy->priv = sensor_string_proxy_get_instance_private (proxy);
3340#else
3341 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_STRING_PROXY, SensorStringProxyPrivate);
3342#endif
3343
3344 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_string_interface_info ());
3345}
3346
3347static void
3348sensor_string_proxy_class_init (SensorStringProxyClass *klass)
3349{
3350 GObjectClass *gobject_class;
3351 GDBusProxyClass *proxy_class;
3352
3353 gobject_class = G_OBJECT_CLASS (klass);
3354 gobject_class->finalize = sensor_string_proxy_finalize;
3355 gobject_class->get_property = sensor_string_proxy_get_property;
3356 gobject_class->set_property = sensor_string_proxy_set_property;
3357
3358 proxy_class = G_DBUS_PROXY_CLASS (klass);
3359 proxy_class->g_signal = sensor_string_proxy_g_signal;
3360 proxy_class->g_properties_changed = sensor_string_proxy_g_properties_changed;
3361
3362 sensor_string_override_properties (gobject_class, 1);
3363
3364#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3365 g_type_class_add_private (klass, sizeof (SensorStringProxyPrivate));
3366#endif
3367}
3368
3369static void
3370sensor_string_proxy_iface_init (SensorStringIface *iface)
3371{
3372 iface->get_value = sensor_string_proxy_get_value;
3373 iface->get_units = sensor_string_proxy_get_units;
3374}
3375
3376/**
3377 * sensor_string_proxy_new:
3378 * @connection: A #GDBusConnection.
3379 * @flags: Flags from the #GDBusProxyFlags enumeration.
3380 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3381 * @object_path: An object path.
3382 * @cancellable: (allow-none): A #GCancellable or %NULL.
3383 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3384 * @user_data: User data to pass to @callback.
3385 *
3386 * 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.
3387 *
3388 * 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.
3389 * You can then call sensor_string_proxy_new_finish() to get the result of the operation.
3390 *
3391 * See sensor_string_proxy_new_sync() for the synchronous, blocking version of this constructor.
3392 */
3393void
3394sensor_string_proxy_new (
3395 GDBusConnection *connection,
3396 GDBusProxyFlags flags,
3397 const gchar *name,
3398 const gchar *object_path,
3399 GCancellable *cancellable,
3400 GAsyncReadyCallback callback,
3401 gpointer user_data)
3402{
3403 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);
3404}
3405
3406/**
3407 * sensor_string_proxy_new_finish:
3408 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_proxy_new().
3409 * @error: Return location for error or %NULL
3410 *
3411 * Finishes an operation started with sensor_string_proxy_new().
3412 *
3413 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
3414 */
3415SensorString *
3416sensor_string_proxy_new_finish (
3417 GAsyncResult *res,
3418 GError **error)
3419{
3420 GObject *ret;
3421 GObject *source_object;
3422 source_object = g_async_result_get_source_object (res);
3423 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3424 g_object_unref (source_object);
3425 if (ret != NULL)
3426 return SENSOR_STRING (ret);
3427 else
3428 return NULL;
3429}
3430
3431/**
3432 * sensor_string_proxy_new_sync:
3433 * @connection: A #GDBusConnection.
3434 * @flags: Flags from the #GDBusProxyFlags enumeration.
3435 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3436 * @object_path: An object path.
3437 * @cancellable: (allow-none): A #GCancellable or %NULL.
3438 * @error: Return location for error or %NULL
3439 *
3440 * 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.
3441 *
3442 * The calling thread is blocked until a reply is received.
3443 *
3444 * See sensor_string_proxy_new() for the asynchronous version of this constructor.
3445 *
3446 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
3447 */
3448SensorString *
3449sensor_string_proxy_new_sync (
3450 GDBusConnection *connection,
3451 GDBusProxyFlags flags,
3452 const gchar *name,
3453 const gchar *object_path,
3454 GCancellable *cancellable,
3455 GError **error)
3456{
3457 GInitable *ret;
3458 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);
3459 if (ret != NULL)
3460 return SENSOR_STRING (ret);
3461 else
3462 return NULL;
3463}
3464
3465
3466/**
3467 * sensor_string_proxy_new_for_bus:
3468 * @bus_type: A #GBusType.
3469 * @flags: Flags from the #GDBusProxyFlags enumeration.
3470 * @name: A bus name (well-known or unique).
3471 * @object_path: An object path.
3472 * @cancellable: (allow-none): A #GCancellable or %NULL.
3473 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3474 * @user_data: User data to pass to @callback.
3475 *
3476 * Like sensor_string_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3477 *
3478 * 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.
3479 * You can then call sensor_string_proxy_new_for_bus_finish() to get the result of the operation.
3480 *
3481 * See sensor_string_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3482 */
3483void
3484sensor_string_proxy_new_for_bus (
3485 GBusType bus_type,
3486 GDBusProxyFlags flags,
3487 const gchar *name,
3488 const gchar *object_path,
3489 GCancellable *cancellable,
3490 GAsyncReadyCallback callback,
3491 gpointer user_data)
3492{
3493 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);
3494}
3495
3496/**
3497 * sensor_string_proxy_new_for_bus_finish:
3498 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_string_proxy_new_for_bus().
3499 * @error: Return location for error or %NULL
3500 *
3501 * Finishes an operation started with sensor_string_proxy_new_for_bus().
3502 *
3503 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
3504 */
3505SensorString *
3506sensor_string_proxy_new_for_bus_finish (
3507 GAsyncResult *res,
3508 GError **error)
3509{
3510 GObject *ret;
3511 GObject *source_object;
3512 source_object = g_async_result_get_source_object (res);
3513 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3514 g_object_unref (source_object);
3515 if (ret != NULL)
3516 return SENSOR_STRING (ret);
3517 else
3518 return NULL;
3519}
3520
3521/**
3522 * sensor_string_proxy_new_for_bus_sync:
3523 * @bus_type: A #GBusType.
3524 * @flags: Flags from the #GDBusProxyFlags enumeration.
3525 * @name: A bus name (well-known or unique).
3526 * @object_path: An object path.
3527 * @cancellable: (allow-none): A #GCancellable or %NULL.
3528 * @error: Return location for error or %NULL
3529 *
3530 * Like sensor_string_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3531 *
3532 * The calling thread is blocked until a reply is received.
3533 *
3534 * See sensor_string_proxy_new_for_bus() for the asynchronous version of this constructor.
3535 *
3536 * Returns: (transfer full) (type SensorStringProxy): The constructed proxy object or %NULL if @error is set.
3537 */
3538SensorString *
3539sensor_string_proxy_new_for_bus_sync (
3540 GBusType bus_type,
3541 GDBusProxyFlags flags,
3542 const gchar *name,
3543 const gchar *object_path,
3544 GCancellable *cancellable,
3545 GError **error)
3546{
3547 GInitable *ret;
3548 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);
3549 if (ret != NULL)
3550 return SENSOR_STRING (ret);
3551 else
3552 return NULL;
3553}
3554
3555
3556/* ------------------------------------------------------------------------ */
3557
3558/**
3559 * SensorStringSkeleton:
3560 *
3561 * The #SensorStringSkeleton structure contains only private data and should only be accessed using the provided API.
3562 */
3563
3564/**
3565 * SensorStringSkeletonClass:
3566 * @parent_class: The parent class.
3567 *
3568 * Class structure for #SensorStringSkeleton.
3569 */
3570
3571struct _SensorStringSkeletonPrivate
3572{
3573 GValue *properties;
3574 GList *changed_properties;
3575 GSource *changed_properties_idle_source;
3576 GMainContext *context;
3577 GMutex lock;
3578};
3579
3580static void
3581_sensor_string_skeleton_handle_method_call (
3582 GDBusConnection *connection G_GNUC_UNUSED,
3583 const gchar *sender G_GNUC_UNUSED,
3584 const gchar *object_path G_GNUC_UNUSED,
3585 const gchar *interface_name,
3586 const gchar *method_name,
3587 GVariant *parameters,
3588 GDBusMethodInvocation *invocation,
3589 gpointer user_data)
3590{
3591 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
3592 _ExtendedGDBusMethodInfo *info;
3593 GVariantIter iter;
3594 GVariant *child;
3595 GValue *paramv;
3596 guint num_params;
3597 guint num_extra;
3598 guint n;
3599 guint signal_id;
3600 GValue return_value = G_VALUE_INIT;
3601 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3602 g_assert (info != NULL);
3603 num_params = g_variant_n_children (parameters);
3604 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3605 n = 0;
3606 g_value_init (&paramv[n], TYPE_SENSOR_STRING);
3607 g_value_set_object (&paramv[n++], skeleton);
3608 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3609 g_value_set_object (&paramv[n++], invocation);
3610 if (info->pass_fdlist)
3611 {
3612#ifdef G_OS_UNIX
3613 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3614 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3615#else
3616 g_assert_not_reached ();
3617#endif
3618 }
3619 g_variant_iter_init (&iter, parameters);
3620 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3621 {
3622 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3623 if (arg_info->use_gvariant)
3624 {
3625 g_value_init (&paramv[n], G_TYPE_VARIANT);
3626 g_value_set_variant (&paramv[n], child);
3627 n++;
3628 }
3629 else
3630 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3631 g_variant_unref (child);
3632 }
3633 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_STRING);
3634 g_value_init (&return_value, G_TYPE_BOOLEAN);
3635 g_signal_emitv (paramv, signal_id, 0, &return_value);
3636 if (!g_value_get_boolean (&return_value))
3637 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);
3638 g_value_unset (&return_value);
3639 for (n = 0; n < num_params + num_extra; n++)
3640 g_value_unset (&paramv[n]);
3641 g_free (paramv);
3642}
3643
3644static GVariant *
3645_sensor_string_skeleton_handle_get_property (
3646 GDBusConnection *connection G_GNUC_UNUSED,
3647 const gchar *sender G_GNUC_UNUSED,
3648 const gchar *object_path G_GNUC_UNUSED,
3649 const gchar *interface_name G_GNUC_UNUSED,
3650 const gchar *property_name,
3651 GError **error,
3652 gpointer user_data)
3653{
3654 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
3655 GValue value = G_VALUE_INIT;
3656 GParamSpec *pspec;
3657 _ExtendedGDBusPropertyInfo *info;
3658 GVariant *ret;
3659 ret = NULL;
3660 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, property_name);
3661 g_assert (info != NULL);
3662 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3663 if (pspec == NULL)
3664 {
3665 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3666 }
3667 else
3668 {
3669 g_value_init (&value, pspec->value_type);
3670 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3671 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3672 g_value_unset (&value);
3673 }
3674 return ret;
3675}
3676
3677static gboolean
3678_sensor_string_skeleton_handle_set_property (
3679 GDBusConnection *connection G_GNUC_UNUSED,
3680 const gchar *sender G_GNUC_UNUSED,
3681 const gchar *object_path G_GNUC_UNUSED,
3682 const gchar *interface_name G_GNUC_UNUSED,
3683 const gchar *property_name,
3684 GVariant *variant,
3685 GError **error,
3686 gpointer user_data)
3687{
3688 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
3689 GValue value = G_VALUE_INIT;
3690 GParamSpec *pspec;
3691 _ExtendedGDBusPropertyInfo *info;
3692 gboolean ret;
3693 ret = FALSE;
3694 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_string_interface_info.parent_struct, property_name);
3695 g_assert (info != NULL);
3696 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3697 if (pspec == NULL)
3698 {
3699 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3700 }
3701 else
3702 {
3703 if (info->use_gvariant)
3704 g_value_set_variant (&value, variant);
3705 else
3706 g_dbus_gvariant_to_gvalue (variant, &value);
3707 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3708 g_value_unset (&value);
3709 ret = TRUE;
3710 }
3711 return ret;
3712}
3713
3714static const GDBusInterfaceVTable _sensor_string_skeleton_vtable =
3715{
3716 _sensor_string_skeleton_handle_method_call,
3717 _sensor_string_skeleton_handle_get_property,
3718 _sensor_string_skeleton_handle_set_property,
3719 {NULL}
3720};
3721
3722static GDBusInterfaceInfo *
3723sensor_string_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3724{
3725 return sensor_string_interface_info ();
3726}
3727
3728static GDBusInterfaceVTable *
3729sensor_string_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3730{
3731 return (GDBusInterfaceVTable *) &_sensor_string_skeleton_vtable;
3732}
3733
3734static GVariant *
3735sensor_string_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3736{
3737 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (_skeleton);
3738
3739 GVariantBuilder builder;
3740 guint n;
3741 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3742 if (_sensor_string_interface_info.parent_struct.properties == NULL)
3743 goto out;
3744 for (n = 0; _sensor_string_interface_info.parent_struct.properties[n] != NULL; n++)
3745 {
3746 GDBusPropertyInfo *info = _sensor_string_interface_info.parent_struct.properties[n];
3747 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3748 {
3749 GVariant *value;
3750 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);
3751 if (value != NULL)
3752 {
3753 g_variant_take_ref (value);
3754 g_variant_builder_add (&builder, "{sv}", info->name, value);
3755 g_variant_unref (value);
3756 }
3757 }
3758 }
3759out:
3760 return g_variant_builder_end (&builder);
3761}
3762
3763static gboolean _sensor_string_emit_changed (gpointer user_data);
3764
3765static void
3766sensor_string_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3767{
3768 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (_skeleton);
3769 gboolean emit_changed = FALSE;
3770
3771 g_mutex_lock (&skeleton->priv->lock);
3772 if (skeleton->priv->changed_properties_idle_source != NULL)
3773 {
3774 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3775 skeleton->priv->changed_properties_idle_source = NULL;
3776 emit_changed = TRUE;
3777 }
3778 g_mutex_unlock (&skeleton->priv->lock);
3779
3780 if (emit_changed)
3781 _sensor_string_emit_changed (skeleton);
3782}
3783
3784static void
3785_sensor_string_on_signal_changed (
3786 SensorString *object,
3787 const gchar *arg_value)
3788{
3789 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
3790
3791 GList *connections, *l;
3792 GVariant *signal_variant;
3793 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3794
3795 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
3796 arg_value));
3797 for (l = connections; l != NULL; l = l->next)
3798 {
3799 GDBusConnection *connection = l->data;
3800 g_dbus_connection_emit_signal (connection,
3801 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorString", "Changed",
3802 signal_variant, NULL);
3803 }
3804 g_variant_unref (signal_variant);
3805 g_list_free_full (connections, g_object_unref);
3806}
3807
3808static void sensor_string_skeleton_iface_init (SensorStringIface *iface);
3809#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3810G_DEFINE_TYPE_WITH_CODE (SensorStringSkeleton, sensor_string_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3811 G_ADD_PRIVATE (SensorStringSkeleton)
3812 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_skeleton_iface_init));
3813
3814#else
3815G_DEFINE_TYPE_WITH_CODE (SensorStringSkeleton, sensor_string_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3816 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_STRING, sensor_string_skeleton_iface_init));
3817
3818#endif
3819static void
3820sensor_string_skeleton_finalize (GObject *object)
3821{
3822 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
3823 guint n;
3824 for (n = 0; n < 2; n++)
3825 g_value_unset (&skeleton->priv->properties[n]);
3826 g_free (skeleton->priv->properties);
3827 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3828 if (skeleton->priv->changed_properties_idle_source != NULL)
3829 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3830 g_main_context_unref (skeleton->priv->context);
3831 g_mutex_clear (&skeleton->priv->lock);
3832 G_OBJECT_CLASS (sensor_string_skeleton_parent_class)->finalize (object);
3833}
3834
3835static void
3836sensor_string_skeleton_get_property (GObject *object,
3837 guint prop_id,
3838 GValue *value,
3839 GParamSpec *pspec G_GNUC_UNUSED)
3840{
3841 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
3842 g_assert (prop_id != 0 && prop_id - 1 < 2);
3843 g_mutex_lock (&skeleton->priv->lock);
3844 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3845 g_mutex_unlock (&skeleton->priv->lock);
3846}
3847
3848static gboolean
3849_sensor_string_emit_changed (gpointer user_data)
3850{
3851 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (user_data);
3852 GList *l;
3853 GVariantBuilder builder;
3854 GVariantBuilder invalidated_builder;
3855 guint num_changes;
3856
3857 g_mutex_lock (&skeleton->priv->lock);
3858 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3859 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3860 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3861 {
3862 ChangedProperty *cp = l->data;
3863 GVariant *variant;
3864 const GValue *cur_value;
3865
3866 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3867 if (!_g_value_equal (cur_value, &cp->orig_value))
3868 {
3869 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3870 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3871 g_variant_unref (variant);
3872 num_changes++;
3873 }
3874 }
3875 if (num_changes > 0)
3876 {
3877 GList *connections, *ll;
3878 GVariant *signal_variant;
3879 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorString",
3880 &builder, &invalidated_builder));
3881 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3882 for (ll = connections; ll != NULL; ll = ll->next)
3883 {
3884 GDBusConnection *connection = ll->data;
3885
3886 g_dbus_connection_emit_signal (connection,
3887 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3888 "org.freedesktop.DBus.Properties",
3889 "PropertiesChanged",
3890 signal_variant,
3891 NULL);
3892 }
3893 g_variant_unref (signal_variant);
3894 g_list_free_full (connections, g_object_unref);
3895 }
3896 else
3897 {
3898 g_variant_builder_clear (&builder);
3899 g_variant_builder_clear (&invalidated_builder);
3900 }
3901 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3902 skeleton->priv->changed_properties = NULL;
3903 skeleton->priv->changed_properties_idle_source = NULL;
3904 g_mutex_unlock (&skeleton->priv->lock);
3905 return FALSE;
3906}
3907
3908static void
3909_sensor_string_schedule_emit_changed (SensorStringSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3910{
3911 ChangedProperty *cp;
3912 GList *l;
3913 cp = NULL;
3914 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3915 {
3916 ChangedProperty *i_cp = l->data;
3917 if (i_cp->info == info)
3918 {
3919 cp = i_cp;
3920 break;
3921 }
3922 }
3923 if (cp == NULL)
3924 {
3925 cp = g_new0 (ChangedProperty, 1);
3926 cp->prop_id = prop_id;
3927 cp->info = info;
3928 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3929 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3930 g_value_copy (orig_value, &cp->orig_value);
3931 }
3932}
3933
3934static void
3935sensor_string_skeleton_notify (GObject *object,
3936 GParamSpec *pspec G_GNUC_UNUSED)
3937{
3938 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
3939 g_mutex_lock (&skeleton->priv->lock);
3940 if (skeleton->priv->changed_properties != NULL &&
3941 skeleton->priv->changed_properties_idle_source == NULL)
3942 {
3943 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3944 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3945 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_string_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3946 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3947 g_source_unref (skeleton->priv->changed_properties_idle_source);
3948 }
3949 g_mutex_unlock (&skeleton->priv->lock);
3950}
3951
3952static void
3953sensor_string_skeleton_set_property (GObject *object,
3954 guint prop_id,
3955 const GValue *value,
3956 GParamSpec *pspec)
3957{
3958 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
3959 g_assert (prop_id != 0 && prop_id - 1 < 2);
3960 g_mutex_lock (&skeleton->priv->lock);
3961 g_object_freeze_notify (object);
3962 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3963 {
3964 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3965 _sensor_string_schedule_emit_changed (skeleton, _sensor_string_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3966 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3967 g_object_notify_by_pspec (object, pspec);
3968 }
3969 g_mutex_unlock (&skeleton->priv->lock);
3970 g_object_thaw_notify (object);
3971}
3972
3973static void
3974sensor_string_skeleton_init (SensorStringSkeleton *skeleton)
3975{
3976#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3977 skeleton->priv = sensor_string_skeleton_get_instance_private (skeleton);
3978#else
3979 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_STRING_SKELETON, SensorStringSkeletonPrivate);
3980#endif
3981
3982 g_mutex_init (&skeleton->priv->lock);
3983 skeleton->priv->context = g_main_context_ref_thread_default ();
3984 skeleton->priv->properties = g_new0 (GValue, 2);
3985 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3986 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
3987}
3988
3989static gint
3990sensor_string_skeleton_get_value (SensorString *object)
3991{
3992 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
3993 gint value;
3994 g_mutex_lock (&skeleton->priv->lock);
3995 value = g_value_get_int (&(skeleton->priv->properties[0]));
3996 g_mutex_unlock (&skeleton->priv->lock);
3997 return value;
3998}
3999
4000static const gchar *
4001sensor_string_skeleton_get_units (SensorString *object)
4002{
4003 SensorStringSkeleton *skeleton = SENSOR_STRING_SKELETON (object);
4004 const gchar *value;
4005 g_mutex_lock (&skeleton->priv->lock);
4006 value = g_value_get_string (&(skeleton->priv->properties[1]));
4007 g_mutex_unlock (&skeleton->priv->lock);
4008 return value;
4009}
4010
4011static void
4012sensor_string_skeleton_class_init (SensorStringSkeletonClass *klass)
4013{
4014 GObjectClass *gobject_class;
4015 GDBusInterfaceSkeletonClass *skeleton_class;
4016
4017 gobject_class = G_OBJECT_CLASS (klass);
4018 gobject_class->finalize = sensor_string_skeleton_finalize;
4019 gobject_class->get_property = sensor_string_skeleton_get_property;
4020 gobject_class->set_property = sensor_string_skeleton_set_property;
4021 gobject_class->notify = sensor_string_skeleton_notify;
4022
4023
4024 sensor_string_override_properties (gobject_class, 1);
4025
4026 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4027 skeleton_class->get_info = sensor_string_skeleton_dbus_interface_get_info;
4028 skeleton_class->get_properties = sensor_string_skeleton_dbus_interface_get_properties;
4029 skeleton_class->flush = sensor_string_skeleton_dbus_interface_flush;
4030 skeleton_class->get_vtable = sensor_string_skeleton_dbus_interface_get_vtable;
4031
4032#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4033 g_type_class_add_private (klass, sizeof (SensorStringSkeletonPrivate));
4034#endif
4035}
4036
4037static void
4038sensor_string_skeleton_iface_init (SensorStringIface *iface)
4039{
4040 iface->changed = _sensor_string_on_signal_changed;
4041 iface->get_value = sensor_string_skeleton_get_value;
4042 iface->get_units = sensor_string_skeleton_get_units;
4043}
4044
4045/**
4046 * sensor_string_skeleton_new:
4047 *
4048 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorString.top_of_page">org.openbmc.SensorString</link>.
4049 *
4050 * Returns: (transfer full) (type SensorStringSkeleton): The skeleton object.
4051 */
4052SensorString *
4053sensor_string_skeleton_new (void)
4054{
4055 return SENSOR_STRING (g_object_new (TYPE_SENSOR_STRING_SKELETON, NULL));
4056}
4057
4058/* ------------------------------------------------------------------------
Norman Jamescc7ae122015-08-24 14:26:09 -05004059 * Code for interface org.openbmc.SensorIntegerThreshold
4060 * ------------------------------------------------------------------------
4061 */
4062
4063/**
4064 * SECTION:SensorIntegerThreshold
4065 * @title: SensorIntegerThreshold
4066 * @short_description: Generated C code for the org.openbmc.SensorIntegerThreshold D-Bus interface
4067 *
4068 * 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.
4069 */
4070
4071/* ---- Introspection data for org.openbmc.SensorIntegerThreshold ---- */
4072
Norman James90baede2015-09-02 20:32:49 -05004073static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_IN_ARG_lower_critical =
Norman Jamescc7ae122015-08-24 14:26:09 -05004074{
4075 {
4076 -1,
Norman James90baede2015-09-02 20:32:49 -05004077 (gchar *) "lower_critical",
Norman Jamescc7ae122015-08-24 14:26:09 -05004078 (gchar *) "i",
4079 NULL
4080 },
4081 FALSE
4082};
4083
Norman James90baede2015-09-02 20:32:49 -05004084static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_IN_ARG_lower_warning =
Norman Jamescc7ae122015-08-24 14:26:09 -05004085{
Norman James90baede2015-09-02 20:32:49 -05004086 {
4087 -1,
4088 (gchar *) "lower_warning",
4089 (gchar *) "i",
4090 NULL
4091 },
4092 FALSE
4093};
4094
4095static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_IN_ARG_upper_warning =
4096{
4097 {
4098 -1,
4099 (gchar *) "upper_warning",
4100 (gchar *) "i",
4101 NULL
4102 },
4103 FALSE
4104};
4105
4106static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_set_IN_ARG_upper_critical =
4107{
4108 {
4109 -1,
4110 (gchar *) "upper_critical",
4111 (gchar *) "i",
4112 NULL
4113 },
4114 FALSE
4115};
4116
4117static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_set_IN_ARG_pointers[] =
4118{
4119 &_sensor_integer_threshold_method_info_set_IN_ARG_lower_critical,
4120 &_sensor_integer_threshold_method_info_set_IN_ARG_lower_warning,
4121 &_sensor_integer_threshold_method_info_set_IN_ARG_upper_warning,
4122 &_sensor_integer_threshold_method_info_set_IN_ARG_upper_critical,
Norman Jamescc7ae122015-08-24 14:26:09 -05004123 NULL
4124};
4125
Norman James90baede2015-09-02 20:32:49 -05004126static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_set =
Norman Jamescc7ae122015-08-24 14:26:09 -05004127{
4128 {
4129 -1,
Norman James90baede2015-09-02 20:32:49 -05004130 (gchar *) "set",
4131 (GDBusArgInfo **) &_sensor_integer_threshold_method_info_set_IN_ARG_pointers,
Norman Jamescc7ae122015-08-24 14:26:09 -05004132 NULL,
4133 NULL
4134 },
Norman James90baede2015-09-02 20:32:49 -05004135 "handle-set",
Norman Jamescc7ae122015-08-24 14:26:09 -05004136 FALSE
4137};
4138
Norman James90baede2015-09-02 20:32:49 -05004139static const _ExtendedGDBusArgInfo _sensor_integer_threshold_method_info_get_state_OUT_ARG_state =
Norman Jamescc7ae122015-08-24 14:26:09 -05004140{
4141 {
4142 -1,
Norman James90baede2015-09-02 20:32:49 -05004143 (gchar *) "state",
Norman Jamescc7ae122015-08-24 14:26:09 -05004144 (gchar *) "i",
4145 NULL
4146 },
4147 FALSE
4148};
4149
Norman James90baede2015-09-02 20:32:49 -05004150static const _ExtendedGDBusArgInfo * const _sensor_integer_threshold_method_info_get_state_OUT_ARG_pointers[] =
Norman Jamescc7ae122015-08-24 14:26:09 -05004151{
Norman James90baede2015-09-02 20:32:49 -05004152 &_sensor_integer_threshold_method_info_get_state_OUT_ARG_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05004153 NULL
4154};
4155
Norman James90baede2015-09-02 20:32:49 -05004156static const _ExtendedGDBusMethodInfo _sensor_integer_threshold_method_info_get_state =
Norman Jamescc7ae122015-08-24 14:26:09 -05004157{
4158 {
4159 -1,
Norman James90baede2015-09-02 20:32:49 -05004160 (gchar *) "getState",
Norman Jamescc7ae122015-08-24 14:26:09 -05004161 NULL,
Norman James90baede2015-09-02 20:32:49 -05004162 (GDBusArgInfo **) &_sensor_integer_threshold_method_info_get_state_OUT_ARG_pointers,
Norman Jamescc7ae122015-08-24 14:26:09 -05004163 NULL
4164 },
Norman James90baede2015-09-02 20:32:49 -05004165 "handle-get-state",
Norman Jamescc7ae122015-08-24 14:26:09 -05004166 FALSE
4167};
4168
4169static const _ExtendedGDBusMethodInfo * const _sensor_integer_threshold_method_info_pointers[] =
4170{
Norman James90baede2015-09-02 20:32:49 -05004171 &_sensor_integer_threshold_method_info_set,
4172 &_sensor_integer_threshold_method_info_get_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05004173 NULL
4174};
4175
4176static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_warning =
4177{
4178 {
4179 -1,
Norman James90baede2015-09-02 20:32:49 -05004180 (gchar *) "Warning",
4181 NULL,
Norman Jamescc7ae122015-08-24 14:26:09 -05004182 NULL
4183 },
4184 "warning"
4185};
4186
Norman James90baede2015-09-02 20:32:49 -05004187static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_critical =
4188{
4189 {
4190 -1,
4191 (gchar *) "Critical",
4192 NULL,
4193 NULL
4194 },
4195 "critical"
4196};
4197
4198static const _ExtendedGDBusSignalInfo _sensor_integer_threshold_signal_info_normal =
4199{
4200 {
4201 -1,
4202 (gchar *) "Normal",
4203 NULL,
4204 NULL
4205 },
4206 "normal"
4207};
4208
Norman Jamescc7ae122015-08-24 14:26:09 -05004209static const _ExtendedGDBusSignalInfo * const _sensor_integer_threshold_signal_info_pointers[] =
4210{
Norman Jamescc7ae122015-08-24 14:26:09 -05004211 &_sensor_integer_threshold_signal_info_warning,
Norman James90baede2015-09-02 20:32:49 -05004212 &_sensor_integer_threshold_signal_info_critical,
4213 &_sensor_integer_threshold_signal_info_normal,
Norman Jamescc7ae122015-08-24 14:26:09 -05004214 NULL
4215};
4216
Norman James90baede2015-09-02 20:32:49 -05004217static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_lower_critical =
Norman Jamescc7ae122015-08-24 14:26:09 -05004218{
4219 {
4220 -1,
Norman James90baede2015-09-02 20:32:49 -05004221 (gchar *) "lower_critical",
Norman Jamescc7ae122015-08-24 14:26:09 -05004222 (gchar *) "i",
Norman James90baede2015-09-02 20:32:49 -05004223 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamescc7ae122015-08-24 14:26:09 -05004224 NULL
4225 },
Norman James90baede2015-09-02 20:32:49 -05004226 "lower-critical",
Norman Jamescc7ae122015-08-24 14:26:09 -05004227 FALSE
4228};
4229
Norman James90baede2015-09-02 20:32:49 -05004230static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_lower_warning =
Norman Jamescc7ae122015-08-24 14:26:09 -05004231{
4232 {
4233 -1,
Norman James90baede2015-09-02 20:32:49 -05004234 (gchar *) "lower_warning",
Norman Jamescc7ae122015-08-24 14:26:09 -05004235 (gchar *) "i",
Norman James90baede2015-09-02 20:32:49 -05004236 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamescc7ae122015-08-24 14:26:09 -05004237 NULL
4238 },
Norman James90baede2015-09-02 20:32:49 -05004239 "lower-warning",
Norman Jamescc7ae122015-08-24 14:26:09 -05004240 FALSE
4241};
4242
Norman James90baede2015-09-02 20:32:49 -05004243static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_upper_warning =
Norman Jamescc7ae122015-08-24 14:26:09 -05004244{
4245 {
4246 -1,
Norman James90baede2015-09-02 20:32:49 -05004247 (gchar *) "upper_warning",
Norman Jamescc7ae122015-08-24 14:26:09 -05004248 (gchar *) "i",
Norman James90baede2015-09-02 20:32:49 -05004249 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamescc7ae122015-08-24 14:26:09 -05004250 NULL
4251 },
Norman James90baede2015-09-02 20:32:49 -05004252 "upper-warning",
Norman Jamescc7ae122015-08-24 14:26:09 -05004253 FALSE
4254};
4255
Norman James90baede2015-09-02 20:32:49 -05004256static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_upper_critical =
Norman Jamescc7ae122015-08-24 14:26:09 -05004257{
4258 {
4259 -1,
Norman James90baede2015-09-02 20:32:49 -05004260 (gchar *) "upper_critical",
4261 (gchar *) "i",
4262 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4263 NULL
4264 },
4265 "upper-critical",
4266 FALSE
4267};
4268
4269static const _ExtendedGDBusPropertyInfo _sensor_integer_threshold_property_info_state =
4270{
4271 {
4272 -1,
4273 (gchar *) "state",
Norman Jamescc7ae122015-08-24 14:26:09 -05004274 (gchar *) "i",
4275 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4276 NULL
4277 },
Norman James90baede2015-09-02 20:32:49 -05004278 "state",
Norman Jamescc7ae122015-08-24 14:26:09 -05004279 FALSE
4280};
4281
4282static const _ExtendedGDBusPropertyInfo * const _sensor_integer_threshold_property_info_pointers[] =
4283{
Norman James90baede2015-09-02 20:32:49 -05004284 &_sensor_integer_threshold_property_info_lower_critical,
4285 &_sensor_integer_threshold_property_info_lower_warning,
4286 &_sensor_integer_threshold_property_info_upper_warning,
4287 &_sensor_integer_threshold_property_info_upper_critical,
4288 &_sensor_integer_threshold_property_info_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05004289 NULL
4290};
4291
4292static const _ExtendedGDBusInterfaceInfo _sensor_integer_threshold_interface_info =
4293{
4294 {
4295 -1,
4296 (gchar *) "org.openbmc.SensorIntegerThreshold",
4297 (GDBusMethodInfo **) &_sensor_integer_threshold_method_info_pointers,
4298 (GDBusSignalInfo **) &_sensor_integer_threshold_signal_info_pointers,
4299 (GDBusPropertyInfo **) &_sensor_integer_threshold_property_info_pointers,
4300 NULL
4301 },
4302 "sensor-integer-threshold",
4303};
4304
4305
4306/**
4307 * sensor_integer_threshold_interface_info:
4308 *
4309 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link> D-Bus interface.
4310 *
4311 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4312 */
4313GDBusInterfaceInfo *
4314sensor_integer_threshold_interface_info (void)
4315{
4316 return (GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct;
4317}
4318
4319/**
4320 * sensor_integer_threshold_override_properties:
4321 * @klass: The class structure for a #GObject<!-- -->-derived class.
4322 * @property_id_begin: The property id to assign to the first overridden property.
4323 *
4324 * Overrides all #GObject properties in the #SensorIntegerThreshold interface for a concrete class.
4325 * The properties are overridden in the order they are defined.
4326 *
4327 * Returns: The last property id.
4328 */
4329guint
4330sensor_integer_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
4331{
Norman James90baede2015-09-02 20:32:49 -05004332 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
4333 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
4334 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
4335 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
4336 g_object_class_override_property (klass, property_id_begin++, "state");
Norman Jamescc7ae122015-08-24 14:26:09 -05004337 return property_id_begin - 1;
4338}
4339
4340
4341
4342/**
4343 * SensorIntegerThreshold:
4344 *
4345 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
4346 */
4347
4348/**
4349 * SensorIntegerThresholdIface:
4350 * @parent_iface: The parent interface.
Norman James90baede2015-09-02 20:32:49 -05004351 * @handle_get_state: Handler for the #SensorIntegerThreshold::handle-get-state signal.
4352 * @handle_set: Handler for the #SensorIntegerThreshold::handle-set signal.
4353 * @get_lower_critical: Getter for the #SensorIntegerThreshold:lower-critical property.
4354 * @get_lower_warning: Getter for the #SensorIntegerThreshold:lower-warning property.
4355 * @get_state: Getter for the #SensorIntegerThreshold:state property.
4356 * @get_upper_critical: Getter for the #SensorIntegerThreshold:upper-critical property.
4357 * @get_upper_warning: Getter for the #SensorIntegerThreshold:upper-warning property.
Norman Jamescc7ae122015-08-24 14:26:09 -05004358 * @critical: Handler for the #SensorIntegerThreshold::critical signal.
Norman James90baede2015-09-02 20:32:49 -05004359 * @normal: Handler for the #SensorIntegerThreshold::normal signal.
Norman Jamescc7ae122015-08-24 14:26:09 -05004360 * @warning: Handler for the #SensorIntegerThreshold::warning signal.
4361 *
4362 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
4363 */
4364
4365typedef SensorIntegerThresholdIface SensorIntegerThresholdInterface;
4366G_DEFINE_INTERFACE (SensorIntegerThreshold, sensor_integer_threshold, G_TYPE_OBJECT);
4367
4368static void
4369sensor_integer_threshold_default_init (SensorIntegerThresholdIface *iface)
4370{
4371 /* GObject signals for incoming D-Bus method calls: */
4372 /**
Norman James90baede2015-09-02 20:32:49 -05004373 * SensorIntegerThreshold::handle-set:
Norman Jamescc7ae122015-08-24 14:26:09 -05004374 * @object: A #SensorIntegerThreshold.
4375 * @invocation: A #GDBusMethodInvocation.
Norman James90baede2015-09-02 20:32:49 -05004376 * @arg_lower_critical: Argument passed by remote caller.
4377 * @arg_lower_warning: Argument passed by remote caller.
4378 * @arg_upper_warning: Argument passed by remote caller.
4379 * @arg_upper_critical: Argument passed by remote caller.
Norman Jamescc7ae122015-08-24 14:26:09 -05004380 *
Norman James90baede2015-09-02 20:32:49 -05004381 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.set">set()</link> D-Bus method.
Norman Jamescc7ae122015-08-24 14:26:09 -05004382 *
Norman James90baede2015-09-02 20:32:49 -05004383 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_threshold_complete_set() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
Norman Jamescc7ae122015-08-24 14:26:09 -05004384 *
4385 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4386 */
Norman James90baede2015-09-02 20:32:49 -05004387 g_signal_new ("handle-set",
Norman Jamescc7ae122015-08-24 14:26:09 -05004388 G_TYPE_FROM_INTERFACE (iface),
4389 G_SIGNAL_RUN_LAST,
Norman James90baede2015-09-02 20:32:49 -05004390 G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_set),
Norman Jamescc7ae122015-08-24 14:26:09 -05004391 g_signal_accumulator_true_handled,
4392 NULL,
4393 g_cclosure_marshal_generic,
4394 G_TYPE_BOOLEAN,
4395 5,
4396 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
4397
Norman Jamescc7ae122015-08-24 14:26:09 -05004398 /**
Norman James90baede2015-09-02 20:32:49 -05004399 * SensorIntegerThreshold::handle-get-state:
Norman Jamescc7ae122015-08-24 14:26:09 -05004400 * @object: A #SensorIntegerThreshold.
Norman James90baede2015-09-02 20:32:49 -05004401 * @invocation: A #GDBusMethodInvocation.
Norman Jamescc7ae122015-08-24 14:26:09 -05004402 *
Norman James90baede2015-09-02 20:32:49 -05004403 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getState">getState()</link> D-Bus method.
Norman Jamescc7ae122015-08-24 14:26:09 -05004404 *
Norman James90baede2015-09-02 20:32:49 -05004405 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_integer_threshold_complete_get_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
4406 *
4407 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
Norman Jamescc7ae122015-08-24 14:26:09 -05004408 */
Norman James90baede2015-09-02 20:32:49 -05004409 g_signal_new ("handle-get-state",
Norman Jamescc7ae122015-08-24 14:26:09 -05004410 G_TYPE_FROM_INTERFACE (iface),
4411 G_SIGNAL_RUN_LAST,
Norman James90baede2015-09-02 20:32:49 -05004412 G_STRUCT_OFFSET (SensorIntegerThresholdIface, handle_get_state),
4413 g_signal_accumulator_true_handled,
Norman Jamescc7ae122015-08-24 14:26:09 -05004414 NULL,
4415 g_cclosure_marshal_generic,
Norman James90baede2015-09-02 20:32:49 -05004416 G_TYPE_BOOLEAN,
4417 1,
4418 G_TYPE_DBUS_METHOD_INVOCATION);
Norman Jamescc7ae122015-08-24 14:26:09 -05004419
Norman James90baede2015-09-02 20:32:49 -05004420 /* GObject signals for received D-Bus signals: */
Norman Jamescc7ae122015-08-24 14:26:09 -05004421 /**
4422 * SensorIntegerThreshold::warning:
4423 * @object: A #SensorIntegerThreshold.
Norman Jamescc7ae122015-08-24 14:26:09 -05004424 *
Norman James90baede2015-09-02 20:32:49 -05004425 * 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.
Norman Jamescc7ae122015-08-24 14:26:09 -05004426 *
4427 * 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.
4428 */
4429 g_signal_new ("warning",
4430 G_TYPE_FROM_INTERFACE (iface),
4431 G_SIGNAL_RUN_LAST,
4432 G_STRUCT_OFFSET (SensorIntegerThresholdIface, warning),
4433 NULL,
4434 NULL,
4435 g_cclosure_marshal_generic,
4436 G_TYPE_NONE,
Norman James90baede2015-09-02 20:32:49 -05004437 0);
4438
4439 /**
4440 * SensorIntegerThreshold::critical:
4441 * @object: A #SensorIntegerThreshold.
4442 *
4443 * 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.
4444 *
4445 * 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.
4446 */
4447 g_signal_new ("critical",
4448 G_TYPE_FROM_INTERFACE (iface),
4449 G_SIGNAL_RUN_LAST,
4450 G_STRUCT_OFFSET (SensorIntegerThresholdIface, critical),
4451 NULL,
4452 NULL,
4453 g_cclosure_marshal_generic,
4454 G_TYPE_NONE,
4455 0);
4456
4457 /**
4458 * SensorIntegerThreshold::normal:
4459 * @object: A #SensorIntegerThreshold.
4460 *
4461 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Normal">"Normal"</link> is received.
4462 *
4463 * 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.
4464 */
4465 g_signal_new ("normal",
4466 G_TYPE_FROM_INTERFACE (iface),
4467 G_SIGNAL_RUN_LAST,
4468 G_STRUCT_OFFSET (SensorIntegerThresholdIface, normal),
4469 NULL,
4470 NULL,
4471 g_cclosure_marshal_generic,
4472 G_TYPE_NONE,
4473 0);
Norman Jamescc7ae122015-08-24 14:26:09 -05004474
4475 /* GObject properties for D-Bus properties: */
4476 /**
Norman James90baede2015-09-02 20:32:49 -05004477 * SensorIntegerThreshold:lower-critical:
Norman Jamescc7ae122015-08-24 14:26:09 -05004478 *
Norman James90baede2015-09-02 20:32:49 -05004479 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_critical">"lower_critical"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05004480 *
Norman James90baede2015-09-02 20:32:49 -05004481 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamescc7ae122015-08-24 14:26:09 -05004482 */
4483 g_object_interface_install_property (iface,
Norman James90baede2015-09-02 20:32:49 -05004484 g_param_spec_int ("lower-critical", "lower_critical", "lower_critical", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -05004485 /**
Norman James90baede2015-09-02 20:32:49 -05004486 * SensorIntegerThreshold:lower-warning:
Norman Jamescc7ae122015-08-24 14:26:09 -05004487 *
Norman James90baede2015-09-02 20:32:49 -05004488 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_warning">"lower_warning"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05004489 *
Norman James90baede2015-09-02 20:32:49 -05004490 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamescc7ae122015-08-24 14:26:09 -05004491 */
4492 g_object_interface_install_property (iface,
Norman James90baede2015-09-02 20:32:49 -05004493 g_param_spec_int ("lower-warning", "lower_warning", "lower_warning", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -05004494 /**
Norman James90baede2015-09-02 20:32:49 -05004495 * SensorIntegerThreshold:upper-warning:
Norman Jamescc7ae122015-08-24 14:26:09 -05004496 *
Norman James90baede2015-09-02 20:32:49 -05004497 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_warning">"upper_warning"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05004498 *
Norman James90baede2015-09-02 20:32:49 -05004499 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamescc7ae122015-08-24 14:26:09 -05004500 */
4501 g_object_interface_install_property (iface,
Norman James90baede2015-09-02 20:32:49 -05004502 g_param_spec_int ("upper-warning", "upper_warning", "upper_warning", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -05004503 /**
Norman James90baede2015-09-02 20:32:49 -05004504 * SensorIntegerThreshold:upper-critical:
Norman Jamescc7ae122015-08-24 14:26:09 -05004505 *
Norman James90baede2015-09-02 20:32:49 -05004506 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_critical">"upper_critical"</link>.
4507 *
4508 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
4509 */
4510 g_object_interface_install_property (iface,
4511 g_param_spec_int ("upper-critical", "upper_critical", "upper_critical", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4512 /**
4513 * SensorIntegerThreshold:state:
4514 *
4515 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.state">"state"</link>.
Norman Jamescc7ae122015-08-24 14:26:09 -05004516 *
4517 * 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.
4518 */
4519 g_object_interface_install_property (iface,
Norman James90baede2015-09-02 20:32:49 -05004520 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman Jamescc7ae122015-08-24 14:26:09 -05004521}
4522
4523/**
Norman James90baede2015-09-02 20:32:49 -05004524 * sensor_integer_threshold_get_lower_critical: (skip)
Norman Jamescc7ae122015-08-24 14:26:09 -05004525 * @object: A #SensorIntegerThreshold.
4526 *
Norman James90baede2015-09-02 20:32:49 -05004527 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_critical">"lower_critical"</link> D-Bus property.
4528 *
4529 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4530 *
4531 * Returns: The property value.
4532 */
4533gint
4534sensor_integer_threshold_get_lower_critical (SensorIntegerThreshold *object)
4535{
4536 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
4537}
4538
4539/**
4540 * sensor_integer_threshold_set_lower_critical: (skip)
4541 * @object: A #SensorIntegerThreshold.
4542 * @value: The value to set.
4543 *
4544 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
4545 *
4546 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4547 */
4548void
4549sensor_integer_threshold_set_lower_critical (SensorIntegerThreshold *object, gint value)
4550{
4551 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
4552}
4553
4554/**
4555 * sensor_integer_threshold_get_lower_warning: (skip)
4556 * @object: A #SensorIntegerThreshold.
4557 *
4558 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_warning">"lower_warning"</link> D-Bus property.
4559 *
4560 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4561 *
4562 * Returns: The property value.
4563 */
4564gint
4565sensor_integer_threshold_get_lower_warning (SensorIntegerThreshold *object)
4566{
4567 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
4568}
4569
4570/**
4571 * sensor_integer_threshold_set_lower_warning: (skip)
4572 * @object: A #SensorIntegerThreshold.
4573 * @value: The value to set.
4574 *
4575 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
4576 *
4577 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4578 */
4579void
4580sensor_integer_threshold_set_lower_warning (SensorIntegerThreshold *object, gint value)
4581{
4582 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
4583}
4584
4585/**
4586 * sensor_integer_threshold_get_upper_warning: (skip)
4587 * @object: A #SensorIntegerThreshold.
4588 *
4589 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_warning">"upper_warning"</link> D-Bus property.
4590 *
4591 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4592 *
4593 * Returns: The property value.
4594 */
4595gint
4596sensor_integer_threshold_get_upper_warning (SensorIntegerThreshold *object)
4597{
4598 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
4599}
4600
4601/**
4602 * sensor_integer_threshold_set_upper_warning: (skip)
4603 * @object: A #SensorIntegerThreshold.
4604 * @value: The value to set.
4605 *
4606 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
4607 *
4608 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4609 */
4610void
4611sensor_integer_threshold_set_upper_warning (SensorIntegerThreshold *object, gint value)
4612{
4613 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
4614}
4615
4616/**
4617 * sensor_integer_threshold_get_upper_critical: (skip)
4618 * @object: A #SensorIntegerThreshold.
4619 *
4620 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_critical">"upper_critical"</link> D-Bus property.
4621 *
4622 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4623 *
4624 * Returns: The property value.
4625 */
4626gint
4627sensor_integer_threshold_get_upper_critical (SensorIntegerThreshold *object)
4628{
4629 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
4630}
4631
4632/**
4633 * sensor_integer_threshold_set_upper_critical: (skip)
4634 * @object: A #SensorIntegerThreshold.
4635 * @value: The value to set.
4636 *
4637 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
4638 *
4639 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4640 */
4641void
4642sensor_integer_threshold_set_upper_critical (SensorIntegerThreshold *object, gint value)
4643{
4644 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
4645}
4646
4647/**
4648 * sensor_integer_threshold_get_state: (skip)
4649 * @object: A #SensorIntegerThreshold.
4650 *
4651 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.state">"state"</link> D-Bus property.
Norman Jamescc7ae122015-08-24 14:26:09 -05004652 *
4653 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4654 *
4655 * Returns: The property value.
4656 */
4657gint
Norman James90baede2015-09-02 20:32:49 -05004658sensor_integer_threshold_get_state (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05004659{
Norman James90baede2015-09-02 20:32:49 -05004660 return SENSOR_INTEGER_THRESHOLD_GET_IFACE (object)->get_state (object);
Norman Jamescc7ae122015-08-24 14:26:09 -05004661}
4662
4663/**
Norman James90baede2015-09-02 20:32:49 -05004664 * sensor_integer_threshold_set_state: (skip)
Norman Jamescc7ae122015-08-24 14:26:09 -05004665 * @object: A #SensorIntegerThreshold.
4666 * @value: The value to set.
4667 *
Norman James90baede2015-09-02 20:32:49 -05004668 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIntegerThreshold.state">"state"</link> D-Bus property to @value.
Norman Jamescc7ae122015-08-24 14:26:09 -05004669 *
4670 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4671 */
4672void
Norman James90baede2015-09-02 20:32:49 -05004673sensor_integer_threshold_set_state (SensorIntegerThreshold *object, gint value)
Norman Jamescc7ae122015-08-24 14:26:09 -05004674{
Norman James90baede2015-09-02 20:32:49 -05004675 g_object_set (G_OBJECT (object), "state", value, NULL);
Norman Jamescc7ae122015-08-24 14:26:09 -05004676}
4677
4678/**
4679 * sensor_integer_threshold_emit_warning:
4680 * @object: A #SensorIntegerThreshold.
Norman Jamescc7ae122015-08-24 14:26:09 -05004681 *
Norman James90baede2015-09-02 20:32:49 -05004682 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Warning">"Warning"</link> D-Bus signal.
Norman Jamescc7ae122015-08-24 14:26:09 -05004683 */
4684void
4685sensor_integer_threshold_emit_warning (
Norman James90baede2015-09-02 20:32:49 -05004686 SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05004687{
Norman James90baede2015-09-02 20:32:49 -05004688 g_signal_emit_by_name (object, "warning");
Norman Jamescc7ae122015-08-24 14:26:09 -05004689}
4690
4691/**
Norman James90baede2015-09-02 20:32:49 -05004692 * sensor_integer_threshold_emit_critical:
4693 * @object: A #SensorIntegerThreshold.
4694 *
4695 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Critical">"Critical"</link> D-Bus signal.
4696 */
4697void
4698sensor_integer_threshold_emit_critical (
4699 SensorIntegerThreshold *object)
4700{
4701 g_signal_emit_by_name (object, "critical");
4702}
4703
4704/**
4705 * sensor_integer_threshold_emit_normal:
4706 * @object: A #SensorIntegerThreshold.
4707 *
4708 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorIntegerThreshold.Normal">"Normal"</link> D-Bus signal.
4709 */
4710void
4711sensor_integer_threshold_emit_normal (
4712 SensorIntegerThreshold *object)
4713{
4714 g_signal_emit_by_name (object, "normal");
4715}
4716
4717/**
4718 * sensor_integer_threshold_call_set:
Norman Jamescc7ae122015-08-24 14:26:09 -05004719 * @proxy: A #SensorIntegerThresholdProxy.
Norman James90baede2015-09-02 20:32:49 -05004720 * @arg_lower_critical: Argument to pass with the method invocation.
4721 * @arg_lower_warning: Argument to pass with the method invocation.
4722 * @arg_upper_warning: Argument to pass with the method invocation.
4723 * @arg_upper_critical: Argument to pass with the method invocation.
Norman Jamescc7ae122015-08-24 14:26:09 -05004724 * @cancellable: (allow-none): A #GCancellable or %NULL.
4725 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4726 * @user_data: User data to pass to @callback.
4727 *
Norman James90baede2015-09-02 20:32:49 -05004728 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.set">set()</link> D-Bus method on @proxy.
Norman Jamescc7ae122015-08-24 14:26:09 -05004729 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James90baede2015-09-02 20:32:49 -05004730 * You can then call sensor_integer_threshold_call_set_finish() to get the result of the operation.
Norman Jamescc7ae122015-08-24 14:26:09 -05004731 *
Norman James90baede2015-09-02 20:32:49 -05004732 * See sensor_integer_threshold_call_set_sync() for the synchronous, blocking version of this method.
Norman Jamescc7ae122015-08-24 14:26:09 -05004733 */
4734void
Norman James90baede2015-09-02 20:32:49 -05004735sensor_integer_threshold_call_set (
Norman Jamescc7ae122015-08-24 14:26:09 -05004736 SensorIntegerThreshold *proxy,
Norman James90baede2015-09-02 20:32:49 -05004737 gint arg_lower_critical,
4738 gint arg_lower_warning,
4739 gint arg_upper_warning,
4740 gint arg_upper_critical,
Norman Jamescc7ae122015-08-24 14:26:09 -05004741 GCancellable *cancellable,
4742 GAsyncReadyCallback callback,
4743 gpointer user_data)
4744{
4745 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James90baede2015-09-02 20:32:49 -05004746 "set",
4747 g_variant_new ("(iiii)",
4748 arg_lower_critical,
4749 arg_lower_warning,
4750 arg_upper_warning,
4751 arg_upper_critical),
Norman Jamescc7ae122015-08-24 14:26:09 -05004752 G_DBUS_CALL_FLAGS_NONE,
4753 -1,
4754 cancellable,
4755 callback,
4756 user_data);
4757}
4758
4759/**
Norman James90baede2015-09-02 20:32:49 -05004760 * sensor_integer_threshold_call_set_finish:
Norman Jamescc7ae122015-08-24 14:26:09 -05004761 * @proxy: A #SensorIntegerThresholdProxy.
Norman James90baede2015-09-02 20:32:49 -05004762 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_set().
Norman Jamescc7ae122015-08-24 14:26:09 -05004763 * @error: Return location for error or %NULL.
4764 *
Norman James90baede2015-09-02 20:32:49 -05004765 * Finishes an operation started with sensor_integer_threshold_call_set().
Norman Jamescc7ae122015-08-24 14:26:09 -05004766 *
4767 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4768 */
4769gboolean
Norman James90baede2015-09-02 20:32:49 -05004770sensor_integer_threshold_call_set_finish (
Norman Jamescc7ae122015-08-24 14:26:09 -05004771 SensorIntegerThreshold *proxy,
4772 GAsyncResult *res,
4773 GError **error)
4774{
4775 GVariant *_ret;
4776 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4777 if (_ret == NULL)
4778 goto _out;
4779 g_variant_get (_ret,
4780 "()");
4781 g_variant_unref (_ret);
4782_out:
4783 return _ret != NULL;
4784}
4785
4786/**
Norman James90baede2015-09-02 20:32:49 -05004787 * sensor_integer_threshold_call_set_sync:
Norman Jamescc7ae122015-08-24 14:26:09 -05004788 * @proxy: A #SensorIntegerThresholdProxy.
Norman James90baede2015-09-02 20:32:49 -05004789 * @arg_lower_critical: Argument to pass with the method invocation.
4790 * @arg_lower_warning: Argument to pass with the method invocation.
4791 * @arg_upper_warning: Argument to pass with the method invocation.
4792 * @arg_upper_critical: Argument to pass with the method invocation.
Norman Jamescc7ae122015-08-24 14:26:09 -05004793 * @cancellable: (allow-none): A #GCancellable or %NULL.
4794 * @error: Return location for error or %NULL.
4795 *
Norman James90baede2015-09-02 20:32:49 -05004796 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.set">set()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman Jamescc7ae122015-08-24 14:26:09 -05004797 *
Norman James90baede2015-09-02 20:32:49 -05004798 * See sensor_integer_threshold_call_set() for the asynchronous version of this method.
Norman Jamescc7ae122015-08-24 14:26:09 -05004799 *
4800 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4801 */
4802gboolean
Norman James90baede2015-09-02 20:32:49 -05004803sensor_integer_threshold_call_set_sync (
Norman Jamescc7ae122015-08-24 14:26:09 -05004804 SensorIntegerThreshold *proxy,
Norman James90baede2015-09-02 20:32:49 -05004805 gint arg_lower_critical,
4806 gint arg_lower_warning,
4807 gint arg_upper_warning,
4808 gint arg_upper_critical,
Norman Jamescc7ae122015-08-24 14:26:09 -05004809 GCancellable *cancellable,
4810 GError **error)
4811{
4812 GVariant *_ret;
4813 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James90baede2015-09-02 20:32:49 -05004814 "set",
4815 g_variant_new ("(iiii)",
4816 arg_lower_critical,
4817 arg_lower_warning,
4818 arg_upper_warning,
4819 arg_upper_critical),
Norman Jamescc7ae122015-08-24 14:26:09 -05004820 G_DBUS_CALL_FLAGS_NONE,
4821 -1,
4822 cancellable,
4823 error);
4824 if (_ret == NULL)
4825 goto _out;
4826 g_variant_get (_ret,
4827 "()");
4828 g_variant_unref (_ret);
4829_out:
4830 return _ret != NULL;
4831}
4832
4833/**
Norman James90baede2015-09-02 20:32:49 -05004834 * sensor_integer_threshold_call_get_state:
Norman Jamescc7ae122015-08-24 14:26:09 -05004835 * @proxy: A #SensorIntegerThresholdProxy.
Norman Jamescc7ae122015-08-24 14:26:09 -05004836 * @cancellable: (allow-none): A #GCancellable or %NULL.
4837 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4838 * @user_data: User data to pass to @callback.
4839 *
Norman James90baede2015-09-02 20:32:49 -05004840 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getState">getState()</link> D-Bus method on @proxy.
Norman Jamescc7ae122015-08-24 14:26:09 -05004841 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James90baede2015-09-02 20:32:49 -05004842 * You can then call sensor_integer_threshold_call_get_state_finish() to get the result of the operation.
Norman Jamescc7ae122015-08-24 14:26:09 -05004843 *
Norman James90baede2015-09-02 20:32:49 -05004844 * See sensor_integer_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
Norman Jamescc7ae122015-08-24 14:26:09 -05004845 */
4846void
Norman James90baede2015-09-02 20:32:49 -05004847sensor_integer_threshold_call_get_state (
Norman Jamescc7ae122015-08-24 14:26:09 -05004848 SensorIntegerThreshold *proxy,
Norman Jamescc7ae122015-08-24 14:26:09 -05004849 GCancellable *cancellable,
4850 GAsyncReadyCallback callback,
4851 gpointer user_data)
4852{
4853 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James90baede2015-09-02 20:32:49 -05004854 "getState",
4855 g_variant_new ("()"),
Norman Jamescc7ae122015-08-24 14:26:09 -05004856 G_DBUS_CALL_FLAGS_NONE,
4857 -1,
4858 cancellable,
4859 callback,
4860 user_data);
4861}
4862
4863/**
Norman James90baede2015-09-02 20:32:49 -05004864 * sensor_integer_threshold_call_get_state_finish:
Norman Jamescc7ae122015-08-24 14:26:09 -05004865 * @proxy: A #SensorIntegerThresholdProxy.
Norman James90baede2015-09-02 20:32:49 -05004866 * @out_state: (out): Return location for return parameter or %NULL to ignore.
4867 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_call_get_state().
Norman Jamescc7ae122015-08-24 14:26:09 -05004868 * @error: Return location for error or %NULL.
4869 *
Norman James90baede2015-09-02 20:32:49 -05004870 * Finishes an operation started with sensor_integer_threshold_call_get_state().
Norman Jamescc7ae122015-08-24 14:26:09 -05004871 *
4872 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4873 */
4874gboolean
Norman James90baede2015-09-02 20:32:49 -05004875sensor_integer_threshold_call_get_state_finish (
Norman Jamescc7ae122015-08-24 14:26:09 -05004876 SensorIntegerThreshold *proxy,
Norman James90baede2015-09-02 20:32:49 -05004877 gint *out_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05004878 GAsyncResult *res,
4879 GError **error)
4880{
4881 GVariant *_ret;
4882 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4883 if (_ret == NULL)
4884 goto _out;
4885 g_variant_get (_ret,
Norman James90baede2015-09-02 20:32:49 -05004886 "(i)",
4887 out_state);
Norman Jamescc7ae122015-08-24 14:26:09 -05004888 g_variant_unref (_ret);
4889_out:
4890 return _ret != NULL;
4891}
4892
4893/**
Norman James90baede2015-09-02 20:32:49 -05004894 * sensor_integer_threshold_call_get_state_sync:
Norman Jamescc7ae122015-08-24 14:26:09 -05004895 * @proxy: A #SensorIntegerThresholdProxy.
Norman James90baede2015-09-02 20:32:49 -05004896 * @out_state: (out): Return location for return parameter or %NULL to ignore.
Norman Jamescc7ae122015-08-24 14:26:09 -05004897 * @cancellable: (allow-none): A #GCancellable or %NULL.
4898 * @error: Return location for error or %NULL.
4899 *
Norman James90baede2015-09-02 20:32:49 -05004900 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getState">getState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman Jamescc7ae122015-08-24 14:26:09 -05004901 *
Norman James90baede2015-09-02 20:32:49 -05004902 * See sensor_integer_threshold_call_get_state() for the asynchronous version of this method.
Norman Jamescc7ae122015-08-24 14:26:09 -05004903 *
4904 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4905 */
4906gboolean
Norman James90baede2015-09-02 20:32:49 -05004907sensor_integer_threshold_call_get_state_sync (
Norman Jamescc7ae122015-08-24 14:26:09 -05004908 SensorIntegerThreshold *proxy,
Norman James90baede2015-09-02 20:32:49 -05004909 gint *out_state,
Norman Jamescc7ae122015-08-24 14:26:09 -05004910 GCancellable *cancellable,
4911 GError **error)
4912{
4913 GVariant *_ret;
4914 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James90baede2015-09-02 20:32:49 -05004915 "getState",
4916 g_variant_new ("()"),
Norman Jamescc7ae122015-08-24 14:26:09 -05004917 G_DBUS_CALL_FLAGS_NONE,
4918 -1,
4919 cancellable,
4920 error);
4921 if (_ret == NULL)
4922 goto _out;
4923 g_variant_get (_ret,
Norman James90baede2015-09-02 20:32:49 -05004924 "(i)",
4925 out_state);
Norman Jamescc7ae122015-08-24 14:26:09 -05004926 g_variant_unref (_ret);
4927_out:
4928 return _ret != NULL;
4929}
4930
4931/**
Norman James90baede2015-09-02 20:32:49 -05004932 * sensor_integer_threshold_complete_set:
Norman Jamescc7ae122015-08-24 14:26:09 -05004933 * @object: A #SensorIntegerThreshold.
4934 * @invocation: (transfer full): A #GDBusMethodInvocation.
4935 *
Norman James90baede2015-09-02 20:32:49 -05004936 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.set">set()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman Jamescc7ae122015-08-24 14:26:09 -05004937 *
4938 * This method will free @invocation, you cannot use it afterwards.
4939 */
4940void
Norman James90baede2015-09-02 20:32:49 -05004941sensor_integer_threshold_complete_set (
Norman Jamescc7ae122015-08-24 14:26:09 -05004942 SensorIntegerThreshold *object,
4943 GDBusMethodInvocation *invocation)
4944{
4945 g_dbus_method_invocation_return_value (invocation,
4946 g_variant_new ("()"));
4947}
4948
4949/**
Norman James90baede2015-09-02 20:32:49 -05004950 * sensor_integer_threshold_complete_get_state:
Norman Jamescc7ae122015-08-24 14:26:09 -05004951 * @object: A #SensorIntegerThreshold.
4952 * @invocation: (transfer full): A #GDBusMethodInvocation.
Norman James90baede2015-09-02 20:32:49 -05004953 * @state: Parameter to return.
Norman Jamescc7ae122015-08-24 14:26:09 -05004954 *
Norman James90baede2015-09-02 20:32:49 -05004955 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorIntegerThreshold.getState">getState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman Jamescc7ae122015-08-24 14:26:09 -05004956 *
4957 * This method will free @invocation, you cannot use it afterwards.
4958 */
4959void
Norman James90baede2015-09-02 20:32:49 -05004960sensor_integer_threshold_complete_get_state (
Norman Jamescc7ae122015-08-24 14:26:09 -05004961 SensorIntegerThreshold *object,
Norman James90baede2015-09-02 20:32:49 -05004962 GDBusMethodInvocation *invocation,
4963 gint state)
Norman Jamescc7ae122015-08-24 14:26:09 -05004964{
4965 g_dbus_method_invocation_return_value (invocation,
Norman James90baede2015-09-02 20:32:49 -05004966 g_variant_new ("(i)",
4967 state));
Norman Jamescc7ae122015-08-24 14:26:09 -05004968}
4969
4970/* ------------------------------------------------------------------------ */
4971
4972/**
4973 * SensorIntegerThresholdProxy:
4974 *
4975 * The #SensorIntegerThresholdProxy structure contains only private data and should only be accessed using the provided API.
4976 */
4977
4978/**
4979 * SensorIntegerThresholdProxyClass:
4980 * @parent_class: The parent class.
4981 *
4982 * Class structure for #SensorIntegerThresholdProxy.
4983 */
4984
4985struct _SensorIntegerThresholdProxyPrivate
4986{
4987 GData *qdata;
4988};
4989
4990static void sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface);
4991
4992#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4993G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY,
4994 G_ADD_PRIVATE (SensorIntegerThresholdProxy)
4995 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init));
4996
4997#else
4998G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdProxy, sensor_integer_threshold_proxy, G_TYPE_DBUS_PROXY,
4999 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_proxy_iface_init));
5000
5001#endif
5002static void
5003sensor_integer_threshold_proxy_finalize (GObject *object)
5004{
5005 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5006 g_datalist_clear (&proxy->priv->qdata);
5007 G_OBJECT_CLASS (sensor_integer_threshold_proxy_parent_class)->finalize (object);
5008}
5009
5010static void
5011sensor_integer_threshold_proxy_get_property (GObject *object,
5012 guint prop_id,
5013 GValue *value,
5014 GParamSpec *pspec G_GNUC_UNUSED)
5015{
5016 const _ExtendedGDBusPropertyInfo *info;
5017 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05005018 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman Jamescc7ae122015-08-24 14:26:09 -05005019 info = _sensor_integer_threshold_property_info_pointers[prop_id - 1];
5020 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5021 if (info->use_gvariant)
5022 {
5023 g_value_set_variant (value, variant);
5024 }
5025 else
5026 {
5027 if (variant != NULL)
5028 g_dbus_gvariant_to_gvalue (variant, value);
5029 }
5030 if (variant != NULL)
5031 g_variant_unref (variant);
5032}
5033
5034static void
5035sensor_integer_threshold_proxy_set_property_cb (GDBusProxy *proxy,
5036 GAsyncResult *res,
5037 gpointer user_data)
5038{
5039 const _ExtendedGDBusPropertyInfo *info = user_data;
5040 GError *error;
5041 GVariant *_ret;
5042 error = NULL;
5043 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5044 if (!_ret)
5045 {
5046 g_warning ("Error setting property '%s' on interface org.openbmc.SensorIntegerThreshold: %s (%s, %d)",
5047 info->parent_struct.name,
5048 error->message, g_quark_to_string (error->domain), error->code);
5049 g_error_free (error);
5050 }
5051 else
5052 {
5053 g_variant_unref (_ret);
5054 }
5055}
5056
5057static void
5058sensor_integer_threshold_proxy_set_property (GObject *object,
5059 guint prop_id,
5060 const GValue *value,
5061 GParamSpec *pspec G_GNUC_UNUSED)
5062{
5063 const _ExtendedGDBusPropertyInfo *info;
5064 GVariant *variant;
Norman James90baede2015-09-02 20:32:49 -05005065 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman Jamescc7ae122015-08-24 14:26:09 -05005066 info = _sensor_integer_threshold_property_info_pointers[prop_id - 1];
5067 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5068 g_dbus_proxy_call (G_DBUS_PROXY (object),
5069 "org.freedesktop.DBus.Properties.Set",
5070 g_variant_new ("(ssv)", "org.openbmc.SensorIntegerThreshold", info->parent_struct.name, variant),
5071 G_DBUS_CALL_FLAGS_NONE,
5072 -1,
5073 NULL, (GAsyncReadyCallback) sensor_integer_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5074 g_variant_unref (variant);
5075}
5076
5077static void
5078sensor_integer_threshold_proxy_g_signal (GDBusProxy *proxy,
5079 const gchar *sender_name G_GNUC_UNUSED,
5080 const gchar *signal_name,
5081 GVariant *parameters)
5082{
5083 _ExtendedGDBusSignalInfo *info;
5084 GVariantIter iter;
5085 GVariant *child;
5086 GValue *paramv;
5087 guint num_params;
5088 guint n;
5089 guint signal_id;
5090 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, signal_name);
5091 if (info == NULL)
5092 return;
5093 num_params = g_variant_n_children (parameters);
5094 paramv = g_new0 (GValue, num_params + 1);
5095 g_value_init (&paramv[0], TYPE_SENSOR_INTEGER_THRESHOLD);
5096 g_value_set_object (&paramv[0], proxy);
5097 g_variant_iter_init (&iter, parameters);
5098 n = 1;
5099 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5100 {
5101 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5102 if (arg_info->use_gvariant)
5103 {
5104 g_value_init (&paramv[n], G_TYPE_VARIANT);
5105 g_value_set_variant (&paramv[n], child);
5106 n++;
5107 }
5108 else
5109 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5110 g_variant_unref (child);
5111 }
5112 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD);
5113 g_signal_emitv (paramv, signal_id, 0, NULL);
5114 for (n = 0; n < num_params + 1; n++)
5115 g_value_unset (&paramv[n]);
5116 g_free (paramv);
5117}
5118
5119static void
5120sensor_integer_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
5121 GVariant *changed_properties,
5122 const gchar *const *invalidated_properties)
5123{
5124 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (_proxy);
5125 guint n;
5126 const gchar *key;
5127 GVariantIter *iter;
5128 _ExtendedGDBusPropertyInfo *info;
5129 g_variant_get (changed_properties, "a{sv}", &iter);
5130 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5131 {
5132 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, key);
5133 g_datalist_remove_data (&proxy->priv->qdata, key);
5134 if (info != NULL)
5135 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5136 }
5137 g_variant_iter_free (iter);
5138 for (n = 0; invalidated_properties[n] != NULL; n++)
5139 {
5140 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, invalidated_properties[n]);
5141 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5142 if (info != NULL)
5143 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5144 }
5145}
5146
5147static gint
Norman James90baede2015-09-02 20:32:49 -05005148sensor_integer_threshold_proxy_get_lower_critical (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005149{
5150 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5151 GVariant *variant;
5152 gint value = 0;
Norman James90baede2015-09-02 20:32:49 -05005153 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
Norman Jamescc7ae122015-08-24 14:26:09 -05005154 if (variant != NULL)
5155 {
5156 value = g_variant_get_int32 (variant);
5157 g_variant_unref (variant);
5158 }
5159 return value;
5160}
5161
5162static gint
Norman James90baede2015-09-02 20:32:49 -05005163sensor_integer_threshold_proxy_get_lower_warning (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005164{
5165 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5166 GVariant *variant;
5167 gint value = 0;
Norman James90baede2015-09-02 20:32:49 -05005168 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
Norman Jamescc7ae122015-08-24 14:26:09 -05005169 if (variant != NULL)
5170 {
5171 value = g_variant_get_int32 (variant);
5172 g_variant_unref (variant);
5173 }
5174 return value;
5175}
5176
5177static gint
Norman James90baede2015-09-02 20:32:49 -05005178sensor_integer_threshold_proxy_get_upper_warning (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005179{
5180 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5181 GVariant *variant;
5182 gint value = 0;
Norman James90baede2015-09-02 20:32:49 -05005183 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
Norman Jamescc7ae122015-08-24 14:26:09 -05005184 if (variant != NULL)
5185 {
5186 value = g_variant_get_int32 (variant);
5187 g_variant_unref (variant);
5188 }
5189 return value;
5190}
5191
5192static gint
Norman James90baede2015-09-02 20:32:49 -05005193sensor_integer_threshold_proxy_get_upper_critical (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005194{
5195 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5196 GVariant *variant;
5197 gint value = 0;
Norman James90baede2015-09-02 20:32:49 -05005198 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
5199 if (variant != NULL)
5200 {
5201 value = g_variant_get_int32 (variant);
5202 g_variant_unref (variant);
5203 }
5204 return value;
5205}
5206
5207static gint
5208sensor_integer_threshold_proxy_get_state (SensorIntegerThreshold *object)
5209{
5210 SensorIntegerThresholdProxy *proxy = SENSOR_INTEGER_THRESHOLD_PROXY (object);
5211 GVariant *variant;
5212 gint value = 0;
5213 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
Norman Jamescc7ae122015-08-24 14:26:09 -05005214 if (variant != NULL)
5215 {
5216 value = g_variant_get_int32 (variant);
5217 g_variant_unref (variant);
5218 }
5219 return value;
5220}
5221
5222static void
5223sensor_integer_threshold_proxy_init (SensorIntegerThresholdProxy *proxy)
5224{
5225#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5226 proxy->priv = sensor_integer_threshold_proxy_get_instance_private (proxy);
5227#else
5228 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_INTEGER_THRESHOLD_PROXY, SensorIntegerThresholdProxyPrivate);
5229#endif
5230
5231 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_integer_threshold_interface_info ());
5232}
5233
5234static void
5235sensor_integer_threshold_proxy_class_init (SensorIntegerThresholdProxyClass *klass)
5236{
5237 GObjectClass *gobject_class;
5238 GDBusProxyClass *proxy_class;
5239
5240 gobject_class = G_OBJECT_CLASS (klass);
5241 gobject_class->finalize = sensor_integer_threshold_proxy_finalize;
5242 gobject_class->get_property = sensor_integer_threshold_proxy_get_property;
5243 gobject_class->set_property = sensor_integer_threshold_proxy_set_property;
5244
5245 proxy_class = G_DBUS_PROXY_CLASS (klass);
5246 proxy_class->g_signal = sensor_integer_threshold_proxy_g_signal;
5247 proxy_class->g_properties_changed = sensor_integer_threshold_proxy_g_properties_changed;
5248
5249 sensor_integer_threshold_override_properties (gobject_class, 1);
5250
5251#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5252 g_type_class_add_private (klass, sizeof (SensorIntegerThresholdProxyPrivate));
5253#endif
5254}
5255
5256static void
5257sensor_integer_threshold_proxy_iface_init (SensorIntegerThresholdIface *iface)
5258{
Norman James90baede2015-09-02 20:32:49 -05005259 iface->get_lower_critical = sensor_integer_threshold_proxy_get_lower_critical;
5260 iface->get_lower_warning = sensor_integer_threshold_proxy_get_lower_warning;
5261 iface->get_upper_warning = sensor_integer_threshold_proxy_get_upper_warning;
5262 iface->get_upper_critical = sensor_integer_threshold_proxy_get_upper_critical;
5263 iface->get_state = sensor_integer_threshold_proxy_get_state;
Norman Jamescc7ae122015-08-24 14:26:09 -05005264}
5265
5266/**
5267 * sensor_integer_threshold_proxy_new:
5268 * @connection: A #GDBusConnection.
5269 * @flags: Flags from the #GDBusProxyFlags enumeration.
5270 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5271 * @object_path: An object path.
5272 * @cancellable: (allow-none): A #GCancellable or %NULL.
5273 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5274 * @user_data: User data to pass to @callback.
5275 *
5276 * 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.
5277 *
5278 * 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.
5279 * You can then call sensor_integer_threshold_proxy_new_finish() to get the result of the operation.
5280 *
5281 * See sensor_integer_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
5282 */
5283void
5284sensor_integer_threshold_proxy_new (
5285 GDBusConnection *connection,
5286 GDBusProxyFlags flags,
5287 const gchar *name,
5288 const gchar *object_path,
5289 GCancellable *cancellable,
5290 GAsyncReadyCallback callback,
5291 gpointer user_data)
5292{
5293 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);
5294}
5295
5296/**
5297 * sensor_integer_threshold_proxy_new_finish:
5298 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new().
5299 * @error: Return location for error or %NULL
5300 *
5301 * Finishes an operation started with sensor_integer_threshold_proxy_new().
5302 *
5303 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
5304 */
5305SensorIntegerThreshold *
5306sensor_integer_threshold_proxy_new_finish (
5307 GAsyncResult *res,
5308 GError **error)
5309{
5310 GObject *ret;
5311 GObject *source_object;
5312 source_object = g_async_result_get_source_object (res);
5313 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5314 g_object_unref (source_object);
5315 if (ret != NULL)
5316 return SENSOR_INTEGER_THRESHOLD (ret);
5317 else
5318 return NULL;
5319}
5320
5321/**
5322 * sensor_integer_threshold_proxy_new_sync:
5323 * @connection: A #GDBusConnection.
5324 * @flags: Flags from the #GDBusProxyFlags enumeration.
5325 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5326 * @object_path: An object path.
5327 * @cancellable: (allow-none): A #GCancellable or %NULL.
5328 * @error: Return location for error or %NULL
5329 *
5330 * 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.
5331 *
5332 * The calling thread is blocked until a reply is received.
5333 *
5334 * See sensor_integer_threshold_proxy_new() for the asynchronous version of this constructor.
5335 *
5336 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
5337 */
5338SensorIntegerThreshold *
5339sensor_integer_threshold_proxy_new_sync (
5340 GDBusConnection *connection,
5341 GDBusProxyFlags flags,
5342 const gchar *name,
5343 const gchar *object_path,
5344 GCancellable *cancellable,
5345 GError **error)
5346{
5347 GInitable *ret;
5348 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);
5349 if (ret != NULL)
5350 return SENSOR_INTEGER_THRESHOLD (ret);
5351 else
5352 return NULL;
5353}
5354
5355
5356/**
5357 * sensor_integer_threshold_proxy_new_for_bus:
5358 * @bus_type: A #GBusType.
5359 * @flags: Flags from the #GDBusProxyFlags enumeration.
5360 * @name: A bus name (well-known or unique).
5361 * @object_path: An object path.
5362 * @cancellable: (allow-none): A #GCancellable or %NULL.
5363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5364 * @user_data: User data to pass to @callback.
5365 *
5366 * Like sensor_integer_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5367 *
5368 * 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.
5369 * You can then call sensor_integer_threshold_proxy_new_for_bus_finish() to get the result of the operation.
5370 *
5371 * See sensor_integer_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5372 */
5373void
5374sensor_integer_threshold_proxy_new_for_bus (
5375 GBusType bus_type,
5376 GDBusProxyFlags flags,
5377 const gchar *name,
5378 const gchar *object_path,
5379 GCancellable *cancellable,
5380 GAsyncReadyCallback callback,
5381 gpointer user_data)
5382{
5383 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);
5384}
5385
5386/**
5387 * sensor_integer_threshold_proxy_new_for_bus_finish:
5388 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_integer_threshold_proxy_new_for_bus().
5389 * @error: Return location for error or %NULL
5390 *
5391 * Finishes an operation started with sensor_integer_threshold_proxy_new_for_bus().
5392 *
5393 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
5394 */
5395SensorIntegerThreshold *
5396sensor_integer_threshold_proxy_new_for_bus_finish (
5397 GAsyncResult *res,
5398 GError **error)
5399{
5400 GObject *ret;
5401 GObject *source_object;
5402 source_object = g_async_result_get_source_object (res);
5403 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5404 g_object_unref (source_object);
5405 if (ret != NULL)
5406 return SENSOR_INTEGER_THRESHOLD (ret);
5407 else
5408 return NULL;
5409}
5410
5411/**
5412 * sensor_integer_threshold_proxy_new_for_bus_sync:
5413 * @bus_type: A #GBusType.
5414 * @flags: Flags from the #GDBusProxyFlags enumeration.
5415 * @name: A bus name (well-known or unique).
5416 * @object_path: An object path.
5417 * @cancellable: (allow-none): A #GCancellable or %NULL.
5418 * @error: Return location for error or %NULL
5419 *
5420 * Like sensor_integer_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5421 *
5422 * The calling thread is blocked until a reply is received.
5423 *
5424 * See sensor_integer_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
5425 *
5426 * Returns: (transfer full) (type SensorIntegerThresholdProxy): The constructed proxy object or %NULL if @error is set.
5427 */
5428SensorIntegerThreshold *
5429sensor_integer_threshold_proxy_new_for_bus_sync (
5430 GBusType bus_type,
5431 GDBusProxyFlags flags,
5432 const gchar *name,
5433 const gchar *object_path,
5434 GCancellable *cancellable,
5435 GError **error)
5436{
5437 GInitable *ret;
5438 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);
5439 if (ret != NULL)
5440 return SENSOR_INTEGER_THRESHOLD (ret);
5441 else
5442 return NULL;
5443}
5444
5445
5446/* ------------------------------------------------------------------------ */
5447
5448/**
5449 * SensorIntegerThresholdSkeleton:
5450 *
5451 * The #SensorIntegerThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
5452 */
5453
5454/**
5455 * SensorIntegerThresholdSkeletonClass:
5456 * @parent_class: The parent class.
5457 *
5458 * Class structure for #SensorIntegerThresholdSkeleton.
5459 */
5460
5461struct _SensorIntegerThresholdSkeletonPrivate
5462{
5463 GValue *properties;
5464 GList *changed_properties;
5465 GSource *changed_properties_idle_source;
5466 GMainContext *context;
5467 GMutex lock;
5468};
5469
5470static void
5471_sensor_integer_threshold_skeleton_handle_method_call (
5472 GDBusConnection *connection G_GNUC_UNUSED,
5473 const gchar *sender G_GNUC_UNUSED,
5474 const gchar *object_path G_GNUC_UNUSED,
5475 const gchar *interface_name,
5476 const gchar *method_name,
5477 GVariant *parameters,
5478 GDBusMethodInvocation *invocation,
5479 gpointer user_data)
5480{
5481 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
5482 _ExtendedGDBusMethodInfo *info;
5483 GVariantIter iter;
5484 GVariant *child;
5485 GValue *paramv;
5486 guint num_params;
5487 guint num_extra;
5488 guint n;
5489 guint signal_id;
5490 GValue return_value = G_VALUE_INIT;
5491 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5492 g_assert (info != NULL);
5493 num_params = g_variant_n_children (parameters);
5494 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5495 n = 0;
5496 g_value_init (&paramv[n], TYPE_SENSOR_INTEGER_THRESHOLD);
5497 g_value_set_object (&paramv[n++], skeleton);
5498 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5499 g_value_set_object (&paramv[n++], invocation);
5500 if (info->pass_fdlist)
5501 {
5502#ifdef G_OS_UNIX
5503 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5504 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5505#else
5506 g_assert_not_reached ();
5507#endif
5508 }
5509 g_variant_iter_init (&iter, parameters);
5510 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5511 {
5512 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5513 if (arg_info->use_gvariant)
5514 {
5515 g_value_init (&paramv[n], G_TYPE_VARIANT);
5516 g_value_set_variant (&paramv[n], child);
5517 n++;
5518 }
5519 else
5520 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5521 g_variant_unref (child);
5522 }
5523 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_INTEGER_THRESHOLD);
5524 g_value_init (&return_value, G_TYPE_BOOLEAN);
5525 g_signal_emitv (paramv, signal_id, 0, &return_value);
5526 if (!g_value_get_boolean (&return_value))
5527 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);
5528 g_value_unset (&return_value);
5529 for (n = 0; n < num_params + num_extra; n++)
5530 g_value_unset (&paramv[n]);
5531 g_free (paramv);
5532}
5533
5534static GVariant *
5535_sensor_integer_threshold_skeleton_handle_get_property (
5536 GDBusConnection *connection G_GNUC_UNUSED,
5537 const gchar *sender G_GNUC_UNUSED,
5538 const gchar *object_path G_GNUC_UNUSED,
5539 const gchar *interface_name G_GNUC_UNUSED,
5540 const gchar *property_name,
5541 GError **error,
5542 gpointer user_data)
5543{
5544 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
5545 GValue value = G_VALUE_INIT;
5546 GParamSpec *pspec;
5547 _ExtendedGDBusPropertyInfo *info;
5548 GVariant *ret;
5549 ret = NULL;
5550 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name);
5551 g_assert (info != NULL);
5552 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5553 if (pspec == NULL)
5554 {
5555 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5556 }
5557 else
5558 {
5559 g_value_init (&value, pspec->value_type);
5560 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5561 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5562 g_value_unset (&value);
5563 }
5564 return ret;
5565}
5566
5567static gboolean
5568_sensor_integer_threshold_skeleton_handle_set_property (
5569 GDBusConnection *connection G_GNUC_UNUSED,
5570 const gchar *sender G_GNUC_UNUSED,
5571 const gchar *object_path G_GNUC_UNUSED,
5572 const gchar *interface_name G_GNUC_UNUSED,
5573 const gchar *property_name,
5574 GVariant *variant,
5575 GError **error,
5576 gpointer user_data)
5577{
5578 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
5579 GValue value = G_VALUE_INIT;
5580 GParamSpec *pspec;
5581 _ExtendedGDBusPropertyInfo *info;
5582 gboolean ret;
5583 ret = FALSE;
5584 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_integer_threshold_interface_info.parent_struct, property_name);
5585 g_assert (info != NULL);
5586 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5587 if (pspec == NULL)
5588 {
5589 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5590 }
5591 else
5592 {
5593 if (info->use_gvariant)
5594 g_value_set_variant (&value, variant);
5595 else
5596 g_dbus_gvariant_to_gvalue (variant, &value);
5597 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5598 g_value_unset (&value);
5599 ret = TRUE;
5600 }
5601 return ret;
5602}
5603
5604static const GDBusInterfaceVTable _sensor_integer_threshold_skeleton_vtable =
5605{
5606 _sensor_integer_threshold_skeleton_handle_method_call,
5607 _sensor_integer_threshold_skeleton_handle_get_property,
5608 _sensor_integer_threshold_skeleton_handle_set_property,
5609 {NULL}
5610};
5611
5612static GDBusInterfaceInfo *
5613sensor_integer_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5614{
5615 return sensor_integer_threshold_interface_info ();
5616}
5617
5618static GDBusInterfaceVTable *
5619sensor_integer_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5620{
5621 return (GDBusInterfaceVTable *) &_sensor_integer_threshold_skeleton_vtable;
5622}
5623
5624static GVariant *
5625sensor_integer_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5626{
5627 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton);
5628
5629 GVariantBuilder builder;
5630 guint n;
5631 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5632 if (_sensor_integer_threshold_interface_info.parent_struct.properties == NULL)
5633 goto out;
5634 for (n = 0; _sensor_integer_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
5635 {
5636 GDBusPropertyInfo *info = _sensor_integer_threshold_interface_info.parent_struct.properties[n];
5637 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5638 {
5639 GVariant *value;
5640 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);
5641 if (value != NULL)
5642 {
5643 g_variant_take_ref (value);
5644 g_variant_builder_add (&builder, "{sv}", info->name, value);
5645 g_variant_unref (value);
5646 }
5647 }
5648 }
5649out:
5650 return g_variant_builder_end (&builder);
5651}
5652
5653static gboolean _sensor_integer_threshold_emit_changed (gpointer user_data);
5654
5655static void
5656sensor_integer_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5657{
5658 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (_skeleton);
5659 gboolean emit_changed = FALSE;
5660
5661 g_mutex_lock (&skeleton->priv->lock);
5662 if (skeleton->priv->changed_properties_idle_source != NULL)
5663 {
5664 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5665 skeleton->priv->changed_properties_idle_source = NULL;
5666 emit_changed = TRUE;
5667 }
5668 g_mutex_unlock (&skeleton->priv->lock);
5669
5670 if (emit_changed)
5671 _sensor_integer_threshold_emit_changed (skeleton);
5672}
5673
5674static void
Norman James90baede2015-09-02 20:32:49 -05005675_sensor_integer_threshold_on_signal_warning (
5676 SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005677{
5678 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5679
5680 GList *connections, *l;
5681 GVariant *signal_variant;
5682 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5683
Norman James90baede2015-09-02 20:32:49 -05005684 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
Norman Jamescc7ae122015-08-24 14:26:09 -05005685 for (l = connections; l != NULL; l = l->next)
5686 {
5687 GDBusConnection *connection = l->data;
5688 g_dbus_connection_emit_signal (connection,
Norman James90baede2015-09-02 20:32:49 -05005689 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "Warning",
Norman Jamescc7ae122015-08-24 14:26:09 -05005690 signal_variant, NULL);
5691 }
5692 g_variant_unref (signal_variant);
5693 g_list_free_full (connections, g_object_unref);
5694}
5695
5696static void
Norman James90baede2015-09-02 20:32:49 -05005697_sensor_integer_threshold_on_signal_critical (
5698 SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005699{
5700 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5701
5702 GList *connections, *l;
5703 GVariant *signal_variant;
5704 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5705
Norman James90baede2015-09-02 20:32:49 -05005706 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
Norman Jamescc7ae122015-08-24 14:26:09 -05005707 for (l = connections; l != NULL; l = l->next)
5708 {
5709 GDBusConnection *connection = l->data;
5710 g_dbus_connection_emit_signal (connection,
Norman James90baede2015-09-02 20:32:49 -05005711 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "Critical",
5712 signal_variant, NULL);
5713 }
5714 g_variant_unref (signal_variant);
5715 g_list_free_full (connections, g_object_unref);
5716}
5717
5718static void
5719_sensor_integer_threshold_on_signal_normal (
5720 SensorIntegerThreshold *object)
5721{
5722 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5723
5724 GList *connections, *l;
5725 GVariant *signal_variant;
5726 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5727
5728 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5729 for (l = connections; l != NULL; l = l->next)
5730 {
5731 GDBusConnection *connection = l->data;
5732 g_dbus_connection_emit_signal (connection,
5733 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorIntegerThreshold", "Normal",
Norman Jamescc7ae122015-08-24 14:26:09 -05005734 signal_variant, NULL);
5735 }
5736 g_variant_unref (signal_variant);
5737 g_list_free_full (connections, g_object_unref);
5738}
5739
5740static void sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface);
5741#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5742G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5743 G_ADD_PRIVATE (SensorIntegerThresholdSkeleton)
5744 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init));
5745
5746#else
5747G_DEFINE_TYPE_WITH_CODE (SensorIntegerThresholdSkeleton, sensor_integer_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5748 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_INTEGER_THRESHOLD, sensor_integer_threshold_skeleton_iface_init));
5749
5750#endif
5751static void
5752sensor_integer_threshold_skeleton_finalize (GObject *object)
5753{
5754 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5755 guint n;
Norman James90baede2015-09-02 20:32:49 -05005756 for (n = 0; n < 5; n++)
Norman Jamescc7ae122015-08-24 14:26:09 -05005757 g_value_unset (&skeleton->priv->properties[n]);
5758 g_free (skeleton->priv->properties);
5759 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5760 if (skeleton->priv->changed_properties_idle_source != NULL)
5761 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5762 g_main_context_unref (skeleton->priv->context);
5763 g_mutex_clear (&skeleton->priv->lock);
5764 G_OBJECT_CLASS (sensor_integer_threshold_skeleton_parent_class)->finalize (object);
5765}
5766
5767static void
5768sensor_integer_threshold_skeleton_get_property (GObject *object,
5769 guint prop_id,
5770 GValue *value,
5771 GParamSpec *pspec G_GNUC_UNUSED)
5772{
5773 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05005774 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman Jamescc7ae122015-08-24 14:26:09 -05005775 g_mutex_lock (&skeleton->priv->lock);
5776 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5777 g_mutex_unlock (&skeleton->priv->lock);
5778}
5779
5780static gboolean
5781_sensor_integer_threshold_emit_changed (gpointer user_data)
5782{
5783 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (user_data);
5784 GList *l;
5785 GVariantBuilder builder;
5786 GVariantBuilder invalidated_builder;
5787 guint num_changes;
5788
5789 g_mutex_lock (&skeleton->priv->lock);
5790 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5791 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5792 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5793 {
5794 ChangedProperty *cp = l->data;
5795 GVariant *variant;
5796 const GValue *cur_value;
5797
5798 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5799 if (!_g_value_equal (cur_value, &cp->orig_value))
5800 {
5801 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5802 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5803 g_variant_unref (variant);
5804 num_changes++;
5805 }
5806 }
5807 if (num_changes > 0)
5808 {
5809 GList *connections, *ll;
5810 GVariant *signal_variant;
5811 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorIntegerThreshold",
5812 &builder, &invalidated_builder));
5813 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5814 for (ll = connections; ll != NULL; ll = ll->next)
5815 {
5816 GDBusConnection *connection = ll->data;
5817
5818 g_dbus_connection_emit_signal (connection,
5819 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5820 "org.freedesktop.DBus.Properties",
5821 "PropertiesChanged",
5822 signal_variant,
5823 NULL);
5824 }
5825 g_variant_unref (signal_variant);
5826 g_list_free_full (connections, g_object_unref);
5827 }
5828 else
5829 {
5830 g_variant_builder_clear (&builder);
5831 g_variant_builder_clear (&invalidated_builder);
5832 }
5833 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5834 skeleton->priv->changed_properties = NULL;
5835 skeleton->priv->changed_properties_idle_source = NULL;
5836 g_mutex_unlock (&skeleton->priv->lock);
5837 return FALSE;
5838}
5839
5840static void
5841_sensor_integer_threshold_schedule_emit_changed (SensorIntegerThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5842{
5843 ChangedProperty *cp;
5844 GList *l;
5845 cp = NULL;
5846 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5847 {
5848 ChangedProperty *i_cp = l->data;
5849 if (i_cp->info == info)
5850 {
5851 cp = i_cp;
5852 break;
5853 }
5854 }
5855 if (cp == NULL)
5856 {
5857 cp = g_new0 (ChangedProperty, 1);
5858 cp->prop_id = prop_id;
5859 cp->info = info;
5860 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5861 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5862 g_value_copy (orig_value, &cp->orig_value);
5863 }
5864}
5865
5866static void
5867sensor_integer_threshold_skeleton_notify (GObject *object,
5868 GParamSpec *pspec G_GNUC_UNUSED)
5869{
5870 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5871 g_mutex_lock (&skeleton->priv->lock);
5872 if (skeleton->priv->changed_properties != NULL &&
5873 skeleton->priv->changed_properties_idle_source == NULL)
5874 {
5875 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5876 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5877 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_integer_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5878 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5879 g_source_unref (skeleton->priv->changed_properties_idle_source);
5880 }
5881 g_mutex_unlock (&skeleton->priv->lock);
5882}
5883
5884static void
5885sensor_integer_threshold_skeleton_set_property (GObject *object,
5886 guint prop_id,
5887 const GValue *value,
5888 GParamSpec *pspec)
5889{
5890 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
Norman James90baede2015-09-02 20:32:49 -05005891 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman Jamescc7ae122015-08-24 14:26:09 -05005892 g_mutex_lock (&skeleton->priv->lock);
5893 g_object_freeze_notify (object);
5894 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5895 {
5896 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5897 _sensor_integer_threshold_schedule_emit_changed (skeleton, _sensor_integer_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5898 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5899 g_object_notify_by_pspec (object, pspec);
5900 }
5901 g_mutex_unlock (&skeleton->priv->lock);
5902 g_object_thaw_notify (object);
5903}
5904
5905static void
5906sensor_integer_threshold_skeleton_init (SensorIntegerThresholdSkeleton *skeleton)
5907{
5908#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5909 skeleton->priv = sensor_integer_threshold_skeleton_get_instance_private (skeleton);
5910#else
5911 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, SensorIntegerThresholdSkeletonPrivate);
5912#endif
5913
5914 g_mutex_init (&skeleton->priv->lock);
5915 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James90baede2015-09-02 20:32:49 -05005916 skeleton->priv->properties = g_new0 (GValue, 5);
Norman Jamescc7ae122015-08-24 14:26:09 -05005917 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
5918 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
5919 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5920 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
Norman James90baede2015-09-02 20:32:49 -05005921 g_value_init (&skeleton->priv->properties[4], G_TYPE_INT);
Norman Jamescc7ae122015-08-24 14:26:09 -05005922}
5923
5924static gint
Norman James90baede2015-09-02 20:32:49 -05005925sensor_integer_threshold_skeleton_get_lower_critical (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005926{
5927 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5928 gint value;
5929 g_mutex_lock (&skeleton->priv->lock);
5930 value = g_value_get_int (&(skeleton->priv->properties[0]));
5931 g_mutex_unlock (&skeleton->priv->lock);
5932 return value;
5933}
5934
5935static gint
Norman James90baede2015-09-02 20:32:49 -05005936sensor_integer_threshold_skeleton_get_lower_warning (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005937{
5938 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5939 gint value;
5940 g_mutex_lock (&skeleton->priv->lock);
5941 value = g_value_get_int (&(skeleton->priv->properties[1]));
5942 g_mutex_unlock (&skeleton->priv->lock);
5943 return value;
5944}
5945
5946static gint
Norman James90baede2015-09-02 20:32:49 -05005947sensor_integer_threshold_skeleton_get_upper_warning (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005948{
5949 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5950 gint value;
5951 g_mutex_lock (&skeleton->priv->lock);
5952 value = g_value_get_int (&(skeleton->priv->properties[2]));
5953 g_mutex_unlock (&skeleton->priv->lock);
5954 return value;
5955}
5956
5957static gint
Norman James90baede2015-09-02 20:32:49 -05005958sensor_integer_threshold_skeleton_get_upper_critical (SensorIntegerThreshold *object)
Norman Jamescc7ae122015-08-24 14:26:09 -05005959{
5960 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5961 gint value;
5962 g_mutex_lock (&skeleton->priv->lock);
5963 value = g_value_get_int (&(skeleton->priv->properties[3]));
5964 g_mutex_unlock (&skeleton->priv->lock);
5965 return value;
5966}
5967
Norman James90baede2015-09-02 20:32:49 -05005968static gint
5969sensor_integer_threshold_skeleton_get_state (SensorIntegerThreshold *object)
5970{
5971 SensorIntegerThresholdSkeleton *skeleton = SENSOR_INTEGER_THRESHOLD_SKELETON (object);
5972 gint value;
5973 g_mutex_lock (&skeleton->priv->lock);
5974 value = g_value_get_int (&(skeleton->priv->properties[4]));
5975 g_mutex_unlock (&skeleton->priv->lock);
5976 return value;
5977}
5978
Norman Jamescc7ae122015-08-24 14:26:09 -05005979static void
5980sensor_integer_threshold_skeleton_class_init (SensorIntegerThresholdSkeletonClass *klass)
5981{
5982 GObjectClass *gobject_class;
5983 GDBusInterfaceSkeletonClass *skeleton_class;
5984
5985 gobject_class = G_OBJECT_CLASS (klass);
5986 gobject_class->finalize = sensor_integer_threshold_skeleton_finalize;
5987 gobject_class->get_property = sensor_integer_threshold_skeleton_get_property;
5988 gobject_class->set_property = sensor_integer_threshold_skeleton_set_property;
5989 gobject_class->notify = sensor_integer_threshold_skeleton_notify;
5990
5991
5992 sensor_integer_threshold_override_properties (gobject_class, 1);
5993
5994 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5995 skeleton_class->get_info = sensor_integer_threshold_skeleton_dbus_interface_get_info;
5996 skeleton_class->get_properties = sensor_integer_threshold_skeleton_dbus_interface_get_properties;
5997 skeleton_class->flush = sensor_integer_threshold_skeleton_dbus_interface_flush;
5998 skeleton_class->get_vtable = sensor_integer_threshold_skeleton_dbus_interface_get_vtable;
5999
6000#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6001 g_type_class_add_private (klass, sizeof (SensorIntegerThresholdSkeletonPrivate));
6002#endif
6003}
6004
6005static void
6006sensor_integer_threshold_skeleton_iface_init (SensorIntegerThresholdIface *iface)
6007{
Norman Jamescc7ae122015-08-24 14:26:09 -05006008 iface->warning = _sensor_integer_threshold_on_signal_warning;
Norman James90baede2015-09-02 20:32:49 -05006009 iface->critical = _sensor_integer_threshold_on_signal_critical;
6010 iface->normal = _sensor_integer_threshold_on_signal_normal;
6011 iface->get_lower_critical = sensor_integer_threshold_skeleton_get_lower_critical;
6012 iface->get_lower_warning = sensor_integer_threshold_skeleton_get_lower_warning;
6013 iface->get_upper_warning = sensor_integer_threshold_skeleton_get_upper_warning;
6014 iface->get_upper_critical = sensor_integer_threshold_skeleton_get_upper_critical;
6015 iface->get_state = sensor_integer_threshold_skeleton_get_state;
Norman Jamescc7ae122015-08-24 14:26:09 -05006016}
6017
6018/**
6019 * sensor_integer_threshold_skeleton_new:
6020 *
6021 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIntegerThreshold.top_of_page">org.openbmc.SensorIntegerThreshold</link>.
6022 *
6023 * Returns: (transfer full) (type SensorIntegerThresholdSkeleton): The skeleton object.
6024 */
6025SensorIntegerThreshold *
6026sensor_integer_threshold_skeleton_new (void)
6027{
6028 return SENSOR_INTEGER_THRESHOLD (g_object_new (TYPE_SENSOR_INTEGER_THRESHOLD_SKELETON, NULL));
6029}
6030
6031/* ------------------------------------------------------------------------
Norman James90baede2015-09-02 20:32:49 -05006032 * Code for interface org.openbmc.SensorI2c
6033 * ------------------------------------------------------------------------
6034 */
6035
6036/**
6037 * SECTION:SensorI2c
6038 * @title: SensorI2c
6039 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
6040 *
6041 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface in C.
6042 */
6043
6044/* ---- Introspection data for org.openbmc.SensorI2c ---- */
6045
6046static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
6047{
6048 {
6049 -1,
6050 (gchar *) "dev_path",
6051 (gchar *) "s",
6052 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6053 NULL
6054 },
6055 "dev-path",
6056 FALSE
6057};
6058
6059static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
6060{
6061 {
6062 -1,
6063 (gchar *) "address",
6064 (gchar *) "s",
6065 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6066 NULL
6067 },
6068 "address",
6069 FALSE
6070};
6071
6072static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
6073{
6074 &_sensor_i2c_property_info_dev_path,
6075 &_sensor_i2c_property_info_address,
6076 NULL
6077};
6078
6079static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
6080{
6081 {
6082 -1,
6083 (gchar *) "org.openbmc.SensorI2c",
6084 NULL,
6085 NULL,
6086 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
6087 NULL
6088 },
6089 "sensor-i2c",
6090};
6091
6092
6093/**
6094 * sensor_i2c_interface_info:
6095 *
6096 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
6097 *
6098 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6099 */
6100GDBusInterfaceInfo *
6101sensor_i2c_interface_info (void)
6102{
6103 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
6104}
6105
6106/**
6107 * sensor_i2c_override_properties:
6108 * @klass: The class structure for a #GObject<!-- -->-derived class.
6109 * @property_id_begin: The property id to assign to the first overridden property.
6110 *
6111 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
6112 * The properties are overridden in the order they are defined.
6113 *
6114 * Returns: The last property id.
6115 */
6116guint
6117sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
6118{
6119 g_object_class_override_property (klass, property_id_begin++, "dev-path");
6120 g_object_class_override_property (klass, property_id_begin++, "address");
6121 return property_id_begin - 1;
6122}
6123
6124
6125
6126/**
6127 * SensorI2c:
6128 *
6129 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
6130 */
6131
6132/**
6133 * SensorI2cIface:
6134 * @parent_iface: The parent interface.
6135 * @get_address: Getter for the #SensorI2c:address property.
6136 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
6137 *
6138 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
6139 */
6140
6141typedef SensorI2cIface SensorI2cInterface;
6142G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
6143
6144static void
6145sensor_i2c_default_init (SensorI2cIface *iface)
6146{
6147 /* GObject properties for D-Bus properties: */
6148 /**
6149 * SensorI2c:dev-path:
6150 *
6151 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
6152 *
6153 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
6154 */
6155 g_object_interface_install_property (iface,
6156 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6157 /**
6158 * SensorI2c:address:
6159 *
6160 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
6161 *
6162 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
6163 */
6164 g_object_interface_install_property (iface,
6165 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6166}
6167
6168/**
6169 * sensor_i2c_get_dev_path: (skip)
6170 * @object: A #SensorI2c.
6171 *
6172 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
6173 *
6174 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6175 *
6176 * <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_i2c_dup_dev_path() if on another thread.</warning>
6177 *
6178 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6179 */
6180const gchar *
6181sensor_i2c_get_dev_path (SensorI2c *object)
6182{
6183 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
6184}
6185
6186/**
6187 * sensor_i2c_dup_dev_path: (skip)
6188 * @object: A #SensorI2c.
6189 *
6190 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
6191 *
6192 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6193 *
6194 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
6195 */
6196gchar *
6197sensor_i2c_dup_dev_path (SensorI2c *object)
6198{
6199 gchar *value;
6200 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
6201 return value;
6202}
6203
6204/**
6205 * sensor_i2c_set_dev_path: (skip)
6206 * @object: A #SensorI2c.
6207 * @value: The value to set.
6208 *
6209 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
6210 *
6211 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6212 */
6213void
6214sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
6215{
6216 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
6217}
6218
6219/**
6220 * sensor_i2c_get_address: (skip)
6221 * @object: A #SensorI2c.
6222 *
6223 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
6224 *
6225 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6226 *
6227 * <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_i2c_dup_address() if on another thread.</warning>
6228 *
6229 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6230 */
6231const gchar *
6232sensor_i2c_get_address (SensorI2c *object)
6233{
6234 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
6235}
6236
6237/**
6238 * sensor_i2c_dup_address: (skip)
6239 * @object: A #SensorI2c.
6240 *
6241 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
6242 *
6243 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6244 *
6245 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
6246 */
6247gchar *
6248sensor_i2c_dup_address (SensorI2c *object)
6249{
6250 gchar *value;
6251 g_object_get (G_OBJECT (object), "address", &value, NULL);
6252 return value;
6253}
6254
6255/**
6256 * sensor_i2c_set_address: (skip)
6257 * @object: A #SensorI2c.
6258 * @value: The value to set.
6259 *
6260 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
6261 *
6262 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6263 */
6264void
6265sensor_i2c_set_address (SensorI2c *object, const gchar *value)
6266{
6267 g_object_set (G_OBJECT (object), "address", value, NULL);
6268}
6269
6270/* ------------------------------------------------------------------------ */
6271
6272/**
6273 * SensorI2cProxy:
6274 *
6275 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
6276 */
6277
6278/**
6279 * SensorI2cProxyClass:
6280 * @parent_class: The parent class.
6281 *
6282 * Class structure for #SensorI2cProxy.
6283 */
6284
6285struct _SensorI2cProxyPrivate
6286{
6287 GData *qdata;
6288};
6289
6290static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
6291
6292#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6293G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
6294 G_ADD_PRIVATE (SensorI2cProxy)
6295 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
6296
6297#else
6298G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
6299 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
6300
6301#endif
6302static void
6303sensor_i2c_proxy_finalize (GObject *object)
6304{
6305 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
6306 g_datalist_clear (&proxy->priv->qdata);
6307 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
6308}
6309
6310static void
6311sensor_i2c_proxy_get_property (GObject *object,
6312 guint prop_id,
6313 GValue *value,
6314 GParamSpec *pspec G_GNUC_UNUSED)
6315{
6316 const _ExtendedGDBusPropertyInfo *info;
6317 GVariant *variant;
6318 g_assert (prop_id != 0 && prop_id - 1 < 2);
6319 info = _sensor_i2c_property_info_pointers[prop_id - 1];
6320 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6321 if (info->use_gvariant)
6322 {
6323 g_value_set_variant (value, variant);
6324 }
6325 else
6326 {
6327 if (variant != NULL)
6328 g_dbus_gvariant_to_gvalue (variant, value);
6329 }
6330 if (variant != NULL)
6331 g_variant_unref (variant);
6332}
6333
6334static void
6335sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
6336 GAsyncResult *res,
6337 gpointer user_data)
6338{
6339 const _ExtendedGDBusPropertyInfo *info = user_data;
6340 GError *error;
6341 GVariant *_ret;
6342 error = NULL;
6343 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6344 if (!_ret)
6345 {
6346 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
6347 info->parent_struct.name,
6348 error->message, g_quark_to_string (error->domain), error->code);
6349 g_error_free (error);
6350 }
6351 else
6352 {
6353 g_variant_unref (_ret);
6354 }
6355}
6356
6357static void
6358sensor_i2c_proxy_set_property (GObject *object,
6359 guint prop_id,
6360 const GValue *value,
6361 GParamSpec *pspec G_GNUC_UNUSED)
6362{
6363 const _ExtendedGDBusPropertyInfo *info;
6364 GVariant *variant;
6365 g_assert (prop_id != 0 && prop_id - 1 < 2);
6366 info = _sensor_i2c_property_info_pointers[prop_id - 1];
6367 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6368 g_dbus_proxy_call (G_DBUS_PROXY (object),
6369 "org.freedesktop.DBus.Properties.Set",
6370 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
6371 G_DBUS_CALL_FLAGS_NONE,
6372 -1,
6373 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6374 g_variant_unref (variant);
6375}
6376
6377static void
6378sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
6379 const gchar *sender_name G_GNUC_UNUSED,
6380 const gchar *signal_name,
6381 GVariant *parameters)
6382{
6383 _ExtendedGDBusSignalInfo *info;
6384 GVariantIter iter;
6385 GVariant *child;
6386 GValue *paramv;
6387 guint num_params;
6388 guint n;
6389 guint signal_id;
6390 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
6391 if (info == NULL)
6392 return;
6393 num_params = g_variant_n_children (parameters);
6394 paramv = g_new0 (GValue, num_params + 1);
6395 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
6396 g_value_set_object (&paramv[0], proxy);
6397 g_variant_iter_init (&iter, parameters);
6398 n = 1;
6399 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6400 {
6401 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6402 if (arg_info->use_gvariant)
6403 {
6404 g_value_init (&paramv[n], G_TYPE_VARIANT);
6405 g_value_set_variant (&paramv[n], child);
6406 n++;
6407 }
6408 else
6409 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6410 g_variant_unref (child);
6411 }
6412 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
6413 g_signal_emitv (paramv, signal_id, 0, NULL);
6414 for (n = 0; n < num_params + 1; n++)
6415 g_value_unset (&paramv[n]);
6416 g_free (paramv);
6417}
6418
6419static void
6420sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
6421 GVariant *changed_properties,
6422 const gchar *const *invalidated_properties)
6423{
6424 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
6425 guint n;
6426 const gchar *key;
6427 GVariantIter *iter;
6428 _ExtendedGDBusPropertyInfo *info;
6429 g_variant_get (changed_properties, "a{sv}", &iter);
6430 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6431 {
6432 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
6433 g_datalist_remove_data (&proxy->priv->qdata, key);
6434 if (info != NULL)
6435 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6436 }
6437 g_variant_iter_free (iter);
6438 for (n = 0; invalidated_properties[n] != NULL; n++)
6439 {
6440 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
6441 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6442 if (info != NULL)
6443 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6444 }
6445}
6446
6447static const gchar *
6448sensor_i2c_proxy_get_dev_path (SensorI2c *object)
6449{
6450 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
6451 GVariant *variant;
6452 const gchar *value = NULL;
6453 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
6454 if (variant != NULL)
6455 {
6456 value = g_variant_get_string (variant, NULL);
6457 g_variant_unref (variant);
6458 }
6459 return value;
6460}
6461
6462static const gchar *
6463sensor_i2c_proxy_get_address (SensorI2c *object)
6464{
6465 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
6466 GVariant *variant;
6467 const gchar *value = NULL;
6468 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
6469 if (variant != NULL)
6470 {
6471 value = g_variant_get_string (variant, NULL);
6472 g_variant_unref (variant);
6473 }
6474 return value;
6475}
6476
6477static void
6478sensor_i2c_proxy_init (SensorI2cProxy *proxy)
6479{
6480#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6481 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
6482#else
6483 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
6484#endif
6485
6486 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
6487}
6488
6489static void
6490sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
6491{
6492 GObjectClass *gobject_class;
6493 GDBusProxyClass *proxy_class;
6494
6495 gobject_class = G_OBJECT_CLASS (klass);
6496 gobject_class->finalize = sensor_i2c_proxy_finalize;
6497 gobject_class->get_property = sensor_i2c_proxy_get_property;
6498 gobject_class->set_property = sensor_i2c_proxy_set_property;
6499
6500 proxy_class = G_DBUS_PROXY_CLASS (klass);
6501 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
6502 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
6503
6504 sensor_i2c_override_properties (gobject_class, 1);
6505
6506#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6507 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
6508#endif
6509}
6510
6511static void
6512sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
6513{
6514 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
6515 iface->get_address = sensor_i2c_proxy_get_address;
6516}
6517
6518/**
6519 * sensor_i2c_proxy_new:
6520 * @connection: A #GDBusConnection.
6521 * @flags: Flags from the #GDBusProxyFlags enumeration.
6522 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6523 * @object_path: An object path.
6524 * @cancellable: (allow-none): A #GCancellable or %NULL.
6525 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6526 * @user_data: User data to pass to @callback.
6527 *
6528 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new() for more details.
6529 *
6530 * 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.
6531 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
6532 *
6533 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
6534 */
6535void
6536sensor_i2c_proxy_new (
6537 GDBusConnection *connection,
6538 GDBusProxyFlags flags,
6539 const gchar *name,
6540 const gchar *object_path,
6541 GCancellable *cancellable,
6542 GAsyncReadyCallback callback,
6543 gpointer user_data)
6544{
6545 g_async_initable_new_async (TYPE_SENSOR_I2C_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.SensorI2c", NULL);
6546}
6547
6548/**
6549 * sensor_i2c_proxy_new_finish:
6550 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
6551 * @error: Return location for error or %NULL
6552 *
6553 * Finishes an operation started with sensor_i2c_proxy_new().
6554 *
6555 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
6556 */
6557SensorI2c *
6558sensor_i2c_proxy_new_finish (
6559 GAsyncResult *res,
6560 GError **error)
6561{
6562 GObject *ret;
6563 GObject *source_object;
6564 source_object = g_async_result_get_source_object (res);
6565 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6566 g_object_unref (source_object);
6567 if (ret != NULL)
6568 return SENSOR_I2C (ret);
6569 else
6570 return NULL;
6571}
6572
6573/**
6574 * sensor_i2c_proxy_new_sync:
6575 * @connection: A #GDBusConnection.
6576 * @flags: Flags from the #GDBusProxyFlags enumeration.
6577 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6578 * @object_path: An object path.
6579 * @cancellable: (allow-none): A #GCancellable or %NULL.
6580 * @error: Return location for error or %NULL
6581 *
6582 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new_sync() for more details.
6583 *
6584 * The calling thread is blocked until a reply is received.
6585 *
6586 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
6587 *
6588 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
6589 */
6590SensorI2c *
6591sensor_i2c_proxy_new_sync (
6592 GDBusConnection *connection,
6593 GDBusProxyFlags flags,
6594 const gchar *name,
6595 const gchar *object_path,
6596 GCancellable *cancellable,
6597 GError **error)
6598{
6599 GInitable *ret;
6600 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
6601 if (ret != NULL)
6602 return SENSOR_I2C (ret);
6603 else
6604 return NULL;
6605}
6606
6607
6608/**
6609 * sensor_i2c_proxy_new_for_bus:
6610 * @bus_type: A #GBusType.
6611 * @flags: Flags from the #GDBusProxyFlags enumeration.
6612 * @name: A bus name (well-known or unique).
6613 * @object_path: An object path.
6614 * @cancellable: (allow-none): A #GCancellable or %NULL.
6615 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6616 * @user_data: User data to pass to @callback.
6617 *
6618 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6619 *
6620 * 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.
6621 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
6622 *
6623 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6624 */
6625void
6626sensor_i2c_proxy_new_for_bus (
6627 GBusType bus_type,
6628 GDBusProxyFlags flags,
6629 const gchar *name,
6630 const gchar *object_path,
6631 GCancellable *cancellable,
6632 GAsyncReadyCallback callback,
6633 gpointer user_data)
6634{
6635 g_async_initable_new_async (TYPE_SENSOR_I2C_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.SensorI2c", NULL);
6636}
6637
6638/**
6639 * sensor_i2c_proxy_new_for_bus_finish:
6640 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
6641 * @error: Return location for error or %NULL
6642 *
6643 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
6644 *
6645 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
6646 */
6647SensorI2c *
6648sensor_i2c_proxy_new_for_bus_finish (
6649 GAsyncResult *res,
6650 GError **error)
6651{
6652 GObject *ret;
6653 GObject *source_object;
6654 source_object = g_async_result_get_source_object (res);
6655 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6656 g_object_unref (source_object);
6657 if (ret != NULL)
6658 return SENSOR_I2C (ret);
6659 else
6660 return NULL;
6661}
6662
6663/**
6664 * sensor_i2c_proxy_new_for_bus_sync:
6665 * @bus_type: A #GBusType.
6666 * @flags: Flags from the #GDBusProxyFlags enumeration.
6667 * @name: A bus name (well-known or unique).
6668 * @object_path: An object path.
6669 * @cancellable: (allow-none): A #GCancellable or %NULL.
6670 * @error: Return location for error or %NULL
6671 *
6672 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6673 *
6674 * The calling thread is blocked until a reply is received.
6675 *
6676 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
6677 *
6678 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
6679 */
6680SensorI2c *
6681sensor_i2c_proxy_new_for_bus_sync (
6682 GBusType bus_type,
6683 GDBusProxyFlags flags,
6684 const gchar *name,
6685 const gchar *object_path,
6686 GCancellable *cancellable,
6687 GError **error)
6688{
6689 GInitable *ret;
6690 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
6691 if (ret != NULL)
6692 return SENSOR_I2C (ret);
6693 else
6694 return NULL;
6695}
6696
6697
6698/* ------------------------------------------------------------------------ */
6699
6700/**
6701 * SensorI2cSkeleton:
6702 *
6703 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
6704 */
6705
6706/**
6707 * SensorI2cSkeletonClass:
6708 * @parent_class: The parent class.
6709 *
6710 * Class structure for #SensorI2cSkeleton.
6711 */
6712
6713struct _SensorI2cSkeletonPrivate
6714{
6715 GValue *properties;
6716 GList *changed_properties;
6717 GSource *changed_properties_idle_source;
6718 GMainContext *context;
6719 GMutex lock;
6720};
6721
6722static void
6723_sensor_i2c_skeleton_handle_method_call (
6724 GDBusConnection *connection G_GNUC_UNUSED,
6725 const gchar *sender G_GNUC_UNUSED,
6726 const gchar *object_path G_GNUC_UNUSED,
6727 const gchar *interface_name,
6728 const gchar *method_name,
6729 GVariant *parameters,
6730 GDBusMethodInvocation *invocation,
6731 gpointer user_data)
6732{
6733 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
6734 _ExtendedGDBusMethodInfo *info;
6735 GVariantIter iter;
6736 GVariant *child;
6737 GValue *paramv;
6738 guint num_params;
6739 guint num_extra;
6740 guint n;
6741 guint signal_id;
6742 GValue return_value = G_VALUE_INIT;
6743 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6744 g_assert (info != NULL);
6745 num_params = g_variant_n_children (parameters);
6746 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6747 n = 0;
6748 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
6749 g_value_set_object (&paramv[n++], skeleton);
6750 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6751 g_value_set_object (&paramv[n++], invocation);
6752 if (info->pass_fdlist)
6753 {
6754#ifdef G_OS_UNIX
6755 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
6756 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
6757#else
6758 g_assert_not_reached ();
6759#endif
6760 }
6761 g_variant_iter_init (&iter, parameters);
6762 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6763 {
6764 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
6765 if (arg_info->use_gvariant)
6766 {
6767 g_value_init (&paramv[n], G_TYPE_VARIANT);
6768 g_value_set_variant (&paramv[n], child);
6769 n++;
6770 }
6771 else
6772 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6773 g_variant_unref (child);
6774 }
6775 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
6776 g_value_init (&return_value, G_TYPE_BOOLEAN);
6777 g_signal_emitv (paramv, signal_id, 0, &return_value);
6778 if (!g_value_get_boolean (&return_value))
6779 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);
6780 g_value_unset (&return_value);
6781 for (n = 0; n < num_params + num_extra; n++)
6782 g_value_unset (&paramv[n]);
6783 g_free (paramv);
6784}
6785
6786static GVariant *
6787_sensor_i2c_skeleton_handle_get_property (
6788 GDBusConnection *connection G_GNUC_UNUSED,
6789 const gchar *sender G_GNUC_UNUSED,
6790 const gchar *object_path G_GNUC_UNUSED,
6791 const gchar *interface_name G_GNUC_UNUSED,
6792 const gchar *property_name,
6793 GError **error,
6794 gpointer user_data)
6795{
6796 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
6797 GValue value = G_VALUE_INIT;
6798 GParamSpec *pspec;
6799 _ExtendedGDBusPropertyInfo *info;
6800 GVariant *ret;
6801 ret = NULL;
6802 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
6803 g_assert (info != NULL);
6804 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6805 if (pspec == NULL)
6806 {
6807 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6808 }
6809 else
6810 {
6811 g_value_init (&value, pspec->value_type);
6812 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6813 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
6814 g_value_unset (&value);
6815 }
6816 return ret;
6817}
6818
6819static gboolean
6820_sensor_i2c_skeleton_handle_set_property (
6821 GDBusConnection *connection G_GNUC_UNUSED,
6822 const gchar *sender G_GNUC_UNUSED,
6823 const gchar *object_path G_GNUC_UNUSED,
6824 const gchar *interface_name G_GNUC_UNUSED,
6825 const gchar *property_name,
6826 GVariant *variant,
6827 GError **error,
6828 gpointer user_data)
6829{
6830 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
6831 GValue value = G_VALUE_INIT;
6832 GParamSpec *pspec;
6833 _ExtendedGDBusPropertyInfo *info;
6834 gboolean ret;
6835 ret = FALSE;
6836 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
6837 g_assert (info != NULL);
6838 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6839 if (pspec == NULL)
6840 {
6841 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6842 }
6843 else
6844 {
6845 if (info->use_gvariant)
6846 g_value_set_variant (&value, variant);
6847 else
6848 g_dbus_gvariant_to_gvalue (variant, &value);
6849 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6850 g_value_unset (&value);
6851 ret = TRUE;
6852 }
6853 return ret;
6854}
6855
6856static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
6857{
6858 _sensor_i2c_skeleton_handle_method_call,
6859 _sensor_i2c_skeleton_handle_get_property,
6860 _sensor_i2c_skeleton_handle_set_property,
6861 {NULL}
6862};
6863
6864static GDBusInterfaceInfo *
6865sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6866{
6867 return sensor_i2c_interface_info ();
6868}
6869
6870static GDBusInterfaceVTable *
6871sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6872{
6873 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
6874}
6875
6876static GVariant *
6877sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
6878{
6879 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
6880
6881 GVariantBuilder builder;
6882 guint n;
6883 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6884 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
6885 goto out;
6886 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
6887 {
6888 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
6889 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
6890 {
6891 GVariant *value;
6892 value = _sensor_i2c_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.SensorI2c", info->name, NULL, skeleton);
6893 if (value != NULL)
6894 {
6895 g_variant_take_ref (value);
6896 g_variant_builder_add (&builder, "{sv}", info->name, value);
6897 g_variant_unref (value);
6898 }
6899 }
6900 }
6901out:
6902 return g_variant_builder_end (&builder);
6903}
6904
6905static gboolean _sensor_i2c_emit_changed (gpointer user_data);
6906
6907static void
6908sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
6909{
6910 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
6911 gboolean emit_changed = FALSE;
6912
6913 g_mutex_lock (&skeleton->priv->lock);
6914 if (skeleton->priv->changed_properties_idle_source != NULL)
6915 {
6916 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6917 skeleton->priv->changed_properties_idle_source = NULL;
6918 emit_changed = TRUE;
6919 }
6920 g_mutex_unlock (&skeleton->priv->lock);
6921
6922 if (emit_changed)
6923 _sensor_i2c_emit_changed (skeleton);
6924}
6925
6926static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
6927#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6928G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6929 G_ADD_PRIVATE (SensorI2cSkeleton)
6930 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
6931
6932#else
6933G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6934 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
6935
6936#endif
6937static void
6938sensor_i2c_skeleton_finalize (GObject *object)
6939{
6940 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
6941 guint n;
6942 for (n = 0; n < 2; n++)
6943 g_value_unset (&skeleton->priv->properties[n]);
6944 g_free (skeleton->priv->properties);
6945 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6946 if (skeleton->priv->changed_properties_idle_source != NULL)
6947 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6948 g_main_context_unref (skeleton->priv->context);
6949 g_mutex_clear (&skeleton->priv->lock);
6950 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
6951}
6952
6953static void
6954sensor_i2c_skeleton_get_property (GObject *object,
6955 guint prop_id,
6956 GValue *value,
6957 GParamSpec *pspec G_GNUC_UNUSED)
6958{
6959 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
6960 g_assert (prop_id != 0 && prop_id - 1 < 2);
6961 g_mutex_lock (&skeleton->priv->lock);
6962 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
6963 g_mutex_unlock (&skeleton->priv->lock);
6964}
6965
6966static gboolean
6967_sensor_i2c_emit_changed (gpointer user_data)
6968{
6969 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
6970 GList *l;
6971 GVariantBuilder builder;
6972 GVariantBuilder invalidated_builder;
6973 guint num_changes;
6974
6975 g_mutex_lock (&skeleton->priv->lock);
6976 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6977 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
6978 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
6979 {
6980 ChangedProperty *cp = l->data;
6981 GVariant *variant;
6982 const GValue *cur_value;
6983
6984 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6985 if (!_g_value_equal (cur_value, &cp->orig_value))
6986 {
6987 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6988 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6989 g_variant_unref (variant);
6990 num_changes++;
6991 }
6992 }
6993 if (num_changes > 0)
6994 {
6995 GList *connections, *ll;
6996 GVariant *signal_variant;
6997 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
6998 &builder, &invalidated_builder));
6999 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7000 for (ll = connections; ll != NULL; ll = ll->next)
7001 {
7002 GDBusConnection *connection = ll->data;
7003
7004 g_dbus_connection_emit_signal (connection,
7005 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7006 "org.freedesktop.DBus.Properties",
7007 "PropertiesChanged",
7008 signal_variant,
7009 NULL);
7010 }
7011 g_variant_unref (signal_variant);
7012 g_list_free_full (connections, g_object_unref);
7013 }
7014 else
7015 {
7016 g_variant_builder_clear (&builder);
7017 g_variant_builder_clear (&invalidated_builder);
7018 }
7019 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7020 skeleton->priv->changed_properties = NULL;
7021 skeleton->priv->changed_properties_idle_source = NULL;
7022 g_mutex_unlock (&skeleton->priv->lock);
7023 return FALSE;
7024}
7025
7026static void
7027_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7028{
7029 ChangedProperty *cp;
7030 GList *l;
7031 cp = NULL;
7032 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7033 {
7034 ChangedProperty *i_cp = l->data;
7035 if (i_cp->info == info)
7036 {
7037 cp = i_cp;
7038 break;
7039 }
7040 }
7041 if (cp == NULL)
7042 {
7043 cp = g_new0 (ChangedProperty, 1);
7044 cp->prop_id = prop_id;
7045 cp->info = info;
7046 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7047 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7048 g_value_copy (orig_value, &cp->orig_value);
7049 }
7050}
7051
7052static void
7053sensor_i2c_skeleton_notify (GObject *object,
7054 GParamSpec *pspec G_GNUC_UNUSED)
7055{
7056 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
7057 g_mutex_lock (&skeleton->priv->lock);
7058 if (skeleton->priv->changed_properties != NULL &&
7059 skeleton->priv->changed_properties_idle_source == NULL)
7060 {
7061 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7062 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7063 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7064 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7065 g_source_unref (skeleton->priv->changed_properties_idle_source);
7066 }
7067 g_mutex_unlock (&skeleton->priv->lock);
7068}
7069
7070static void
7071sensor_i2c_skeleton_set_property (GObject *object,
7072 guint prop_id,
7073 const GValue *value,
7074 GParamSpec *pspec)
7075{
7076 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
7077 g_assert (prop_id != 0 && prop_id - 1 < 2);
7078 g_mutex_lock (&skeleton->priv->lock);
7079 g_object_freeze_notify (object);
7080 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7081 {
7082 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7083 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7084 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7085 g_object_notify_by_pspec (object, pspec);
7086 }
7087 g_mutex_unlock (&skeleton->priv->lock);
7088 g_object_thaw_notify (object);
7089}
7090
7091static void
7092sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
7093{
7094#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7095 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
7096#else
7097 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
7098#endif
7099
7100 g_mutex_init (&skeleton->priv->lock);
7101 skeleton->priv->context = g_main_context_ref_thread_default ();
7102 skeleton->priv->properties = g_new0 (GValue, 2);
7103 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
7104 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
7105}
7106
7107static const gchar *
7108sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
7109{
7110 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
7111 const gchar *value;
7112 g_mutex_lock (&skeleton->priv->lock);
7113 value = g_value_get_string (&(skeleton->priv->properties[0]));
7114 g_mutex_unlock (&skeleton->priv->lock);
7115 return value;
7116}
7117
7118static const gchar *
7119sensor_i2c_skeleton_get_address (SensorI2c *object)
7120{
7121 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
7122 const gchar *value;
7123 g_mutex_lock (&skeleton->priv->lock);
7124 value = g_value_get_string (&(skeleton->priv->properties[1]));
7125 g_mutex_unlock (&skeleton->priv->lock);
7126 return value;
7127}
7128
7129static void
7130sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
7131{
7132 GObjectClass *gobject_class;
7133 GDBusInterfaceSkeletonClass *skeleton_class;
7134
7135 gobject_class = G_OBJECT_CLASS (klass);
7136 gobject_class->finalize = sensor_i2c_skeleton_finalize;
7137 gobject_class->get_property = sensor_i2c_skeleton_get_property;
7138 gobject_class->set_property = sensor_i2c_skeleton_set_property;
7139 gobject_class->notify = sensor_i2c_skeleton_notify;
7140
7141
7142 sensor_i2c_override_properties (gobject_class, 1);
7143
7144 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7145 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
7146 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
7147 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
7148 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
7149
7150#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7151 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
7152#endif
7153}
7154
7155static void
7156sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
7157{
7158 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
7159 iface->get_address = sensor_i2c_skeleton_get_address;
7160}
7161
7162/**
7163 * sensor_i2c_skeleton_new:
7164 *
7165 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7166 *
7167 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
7168 */
7169SensorI2c *
7170sensor_i2c_skeleton_new (void)
7171{
7172 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
7173}
7174
7175/* ------------------------------------------------------------------------
Norman Jamese2765102015-08-19 22:00:55 -05007176 * Code for Object, ObjectProxy and ObjectSkeleton
7177 * ------------------------------------------------------------------------
7178 */
7179
7180/**
7181 * SECTION:Object
7182 * @title: Object
7183 * @short_description: Specialized GDBusObject types
7184 *
7185 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
7186 */
7187
7188/**
7189 * Object:
7190 *
7191 * The #Object type is a specialized container of interfaces.
7192 */
7193
7194/**
7195 * ObjectIface:
7196 * @parent_iface: The parent interface.
7197 *
7198 * Virtual table for the #Object interface.
7199 */
7200
7201typedef ObjectIface ObjectInterface;
7202G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
7203
7204static void
7205object_default_init (ObjectIface *iface)
7206{
7207 /**
7208 * Object:sensor-integer:
7209 *
7210 * 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.
7211 *
7212 * Connect to the #GObject::notify signal to get informed of property changes.
7213 */
7214 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));
7215
7216 /**
7217 * Object:sensor-string:
7218 *
7219 * 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.
7220 *
7221 * Connect to the #GObject::notify signal to get informed of property changes.
7222 */
7223 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));
7224
7225 /**
Norman Jamescc7ae122015-08-24 14:26:09 -05007226 * Object:sensor-integer-threshold:
7227 *
7228 * 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.
7229 *
7230 * Connect to the #GObject::notify signal to get informed of property changes.
7231 */
7232 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));
7233
Norman James90baede2015-09-02 20:32:49 -05007234 /**
7235 * Object:sensor-i2c:
7236 *
7237 * The #SensorI2c instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>, if any.
7238 *
7239 * Connect to the #GObject::notify signal to get informed of property changes.
7240 */
7241 g_object_interface_install_property (iface, g_param_spec_object ("sensor-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
7242
Norman Jamese2765102015-08-19 22:00:55 -05007243}
7244
7245/**
7246 * object_get_sensor_integer:
7247 * @object: A #Object.
7248 *
7249 * 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.
7250 *
7251 * Returns: (transfer full): A #SensorInteger that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
7252 */
7253SensorInteger *object_get_sensor_integer (Object *object)
7254{
7255 GDBusInterface *ret;
7256 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
7257 if (ret == NULL)
7258 return NULL;
7259 return SENSOR_INTEGER (ret);
7260}
7261
7262/**
7263 * object_get_sensor_string:
7264 * @object: A #Object.
7265 *
7266 * 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.
7267 *
7268 * Returns: (transfer full): A #SensorString that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
7269 */
7270SensorString *object_get_sensor_string (Object *object)
7271{
7272 GDBusInterface *ret;
7273 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
7274 if (ret == NULL)
7275 return NULL;
7276 return SENSOR_STRING (ret);
7277}
7278
7279/**
Norman Jamescc7ae122015-08-24 14:26:09 -05007280 * object_get_sensor_integer_threshold:
7281 * @object: A #Object.
7282 *
7283 * 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.
7284 *
7285 * Returns: (transfer full): A #SensorIntegerThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
7286 */
7287SensorIntegerThreshold *object_get_sensor_integer_threshold (Object *object)
7288{
7289 GDBusInterface *ret;
7290 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
7291 if (ret == NULL)
7292 return NULL;
7293 return SENSOR_INTEGER_THRESHOLD (ret);
7294}
7295
Norman James90baede2015-09-02 20:32:49 -05007296/**
7297 * object_get_sensor_i2c:
7298 * @object: A #Object.
7299 *
7300 * Gets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object, if any.
7301 *
7302 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
7303 */
7304SensorI2c *object_get_sensor_i2c (Object *object)
7305{
7306 GDBusInterface *ret;
7307 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
7308 if (ret == NULL)
7309 return NULL;
7310 return SENSOR_I2C (ret);
7311}
7312
Norman Jamese2765102015-08-19 22:00:55 -05007313
7314/**
7315 * object_peek_sensor_integer: (skip)
7316 * @object: A #Object.
7317 *
7318 * Like object_get_sensor_integer() but doesn't increase the reference count on the returned object.
7319 *
7320 * <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>
7321 *
7322 * 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.
7323 */
7324SensorInteger *object_peek_sensor_integer (Object *object)
7325{
7326 GDBusInterface *ret;
7327 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
7328 if (ret == NULL)
7329 return NULL;
7330 g_object_unref (ret);
7331 return SENSOR_INTEGER (ret);
7332}
7333
7334/**
7335 * object_peek_sensor_string: (skip)
7336 * @object: A #Object.
7337 *
7338 * Like object_get_sensor_string() but doesn't increase the reference count on the returned object.
7339 *
7340 * <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>
7341 *
7342 * 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.
7343 */
7344SensorString *object_peek_sensor_string (Object *object)
7345{
7346 GDBusInterface *ret;
7347 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
7348 if (ret == NULL)
7349 return NULL;
7350 g_object_unref (ret);
7351 return SENSOR_STRING (ret);
7352}
7353
7354/**
Norman Jamescc7ae122015-08-24 14:26:09 -05007355 * object_peek_sensor_integer_threshold: (skip)
7356 * @object: A #Object.
7357 *
7358 * Like object_get_sensor_integer_threshold() but doesn't increase the reference count on the returned object.
7359 *
7360 * <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>
7361 *
7362 * 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.
7363 */
7364SensorIntegerThreshold *object_peek_sensor_integer_threshold (Object *object)
7365{
7366 GDBusInterface *ret;
7367 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
7368 if (ret == NULL)
7369 return NULL;
7370 g_object_unref (ret);
7371 return SENSOR_INTEGER_THRESHOLD (ret);
7372}
7373
Norman James90baede2015-09-02 20:32:49 -05007374/**
7375 * object_peek_sensor_i2c: (skip)
7376 * @object: A #Object.
7377 *
7378 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
7379 *
7380 * <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>
7381 *
7382 * Returns: (transfer none): A #SensorI2c or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
7383 */
7384SensorI2c *object_peek_sensor_i2c (Object *object)
7385{
7386 GDBusInterface *ret;
7387 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
7388 if (ret == NULL)
7389 return NULL;
7390 g_object_unref (ret);
7391 return SENSOR_I2C (ret);
7392}
7393
Norman Jamese2765102015-08-19 22:00:55 -05007394
7395static void
7396object_notify (GDBusObject *object, GDBusInterface *interface)
7397{
7398 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
7399 /* info can be NULL if the other end is using a D-Bus interface we don't know
7400 * anything about, for example old generated code in this process talking to
7401 * newer generated code in the other process. */
7402 if (info != NULL)
7403 g_object_notify (G_OBJECT (object), info->hyphen_name);
7404}
7405
7406/**
7407 * ObjectProxy:
7408 *
7409 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
7410 */
7411
7412/**
7413 * ObjectProxyClass:
7414 * @parent_class: The parent class.
7415 *
7416 * Class structure for #ObjectProxy.
7417 */
7418
7419static void
7420object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
7421{
7422}
7423
7424static void
7425object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
7426{
7427 iface->interface_added = object_notify;
7428 iface->interface_removed = object_notify;
7429}
7430
7431
7432G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
7433 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
7434 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
7435
7436static void
7437object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
7438{
7439}
7440
7441static void
7442object_proxy_set_property (GObject *gobject,
7443 guint prop_id,
7444 const GValue *value G_GNUC_UNUSED,
7445 GParamSpec *pspec)
7446{
7447 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
7448}
7449
7450static void
7451object_proxy_get_property (GObject *gobject,
7452 guint prop_id,
7453 GValue *value,
7454 GParamSpec *pspec)
7455{
7456 ObjectProxy *object = OBJECT_PROXY (gobject);
7457 GDBusInterface *interface;
7458
7459 switch (prop_id)
7460 {
7461 case 1:
7462 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
7463 g_value_take_object (value, interface);
7464 break;
7465
7466 case 2:
7467 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
7468 g_value_take_object (value, interface);
7469 break;
7470
7471 case 3:
Norman James90baede2015-09-02 20:32:49 -05007472 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
Norman Jamese2765102015-08-19 22:00:55 -05007473 g_value_take_object (value, interface);
7474 break;
7475
Norman Jamescc7ae122015-08-24 14:26:09 -05007476 case 4:
Norman James90baede2015-09-02 20:32:49 -05007477 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman Jamescc7ae122015-08-24 14:26:09 -05007478 g_value_take_object (value, interface);
7479 break;
7480
Norman Jamese2765102015-08-19 22:00:55 -05007481 default:
7482 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
7483 break;
7484 }
7485}
7486
7487static void
7488object_proxy_class_init (ObjectProxyClass *klass)
7489{
7490 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
7491
7492 gobject_class->set_property = object_proxy_set_property;
7493 gobject_class->get_property = object_proxy_get_property;
7494
7495 g_object_class_override_property (gobject_class, 1, "sensor-integer");
7496 g_object_class_override_property (gobject_class, 2, "sensor-string");
Norman James90baede2015-09-02 20:32:49 -05007497 g_object_class_override_property (gobject_class, 3, "sensor-integer-threshold");
7498 g_object_class_override_property (gobject_class, 4, "sensor-i2c");
Norman Jamese2765102015-08-19 22:00:55 -05007499}
7500
7501/**
7502 * object_proxy_new:
7503 * @connection: A #GDBusConnection.
7504 * @object_path: An object path.
7505 *
7506 * Creates a new proxy object.
7507 *
7508 * Returns: (transfer full): The proxy object.
7509 */
7510ObjectProxy *
7511object_proxy_new (GDBusConnection *connection,
7512 const gchar *object_path)
7513{
7514 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
7515 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
7516 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
7517}
7518
7519/**
7520 * ObjectSkeleton:
7521 *
7522 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
7523 */
7524
7525/**
7526 * ObjectSkeletonClass:
7527 * @parent_class: The parent class.
7528 *
7529 * Class structure for #ObjectSkeleton.
7530 */
7531
7532static void
7533object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
7534{
7535}
7536
7537
7538static void
7539object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
7540{
7541 iface->interface_added = object_notify;
7542 iface->interface_removed = object_notify;
7543}
7544
7545G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
7546 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
7547 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
7548
7549static void
7550object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
7551{
7552}
7553
7554static void
7555object_skeleton_set_property (GObject *gobject,
7556 guint prop_id,
7557 const GValue *value,
7558 GParamSpec *pspec)
7559{
7560 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
7561 GDBusInterfaceSkeleton *interface;
7562
7563 switch (prop_id)
7564 {
7565 case 1:
7566 interface = g_value_get_object (value);
7567 if (interface != NULL)
7568 {
7569 g_warn_if_fail (IS_SENSOR_INTEGER (interface));
7570 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
7571 }
7572 else
7573 {
7574 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorInteger");
7575 }
7576 break;
7577
7578 case 2:
7579 interface = g_value_get_object (value);
7580 if (interface != NULL)
7581 {
7582 g_warn_if_fail (IS_SENSOR_STRING (interface));
7583 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
7584 }
7585 else
7586 {
7587 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorString");
7588 }
7589 break;
7590
7591 case 3:
7592 interface = g_value_get_object (value);
7593 if (interface != NULL)
7594 {
Norman James90baede2015-09-02 20:32:49 -05007595 g_warn_if_fail (IS_SENSOR_INTEGER_THRESHOLD (interface));
Norman Jamese2765102015-08-19 22:00:55 -05007596 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
7597 }
7598 else
7599 {
Norman James90baede2015-09-02 20:32:49 -05007600 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorIntegerThreshold");
Norman Jamese2765102015-08-19 22:00:55 -05007601 }
7602 break;
7603
Norman Jamescc7ae122015-08-24 14:26:09 -05007604 case 4:
7605 interface = g_value_get_object (value);
7606 if (interface != NULL)
7607 {
Norman James90baede2015-09-02 20:32:49 -05007608 g_warn_if_fail (IS_SENSOR_I2C (interface));
Norman Jamescc7ae122015-08-24 14:26:09 -05007609 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
7610 }
7611 else
7612 {
Norman James90baede2015-09-02 20:32:49 -05007613 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
Norman Jamescc7ae122015-08-24 14:26:09 -05007614 }
7615 break;
7616
Norman Jamese2765102015-08-19 22:00:55 -05007617 default:
7618 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
7619 break;
7620 }
7621}
7622
7623static void
7624object_skeleton_get_property (GObject *gobject,
7625 guint prop_id,
7626 GValue *value,
7627 GParamSpec *pspec)
7628{
7629 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
7630 GDBusInterface *interface;
7631
7632 switch (prop_id)
7633 {
7634 case 1:
7635 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorInteger");
7636 g_value_take_object (value, interface);
7637 break;
7638
7639 case 2:
7640 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorString");
7641 g_value_take_object (value, interface);
7642 break;
7643
7644 case 3:
Norman James90baede2015-09-02 20:32:49 -05007645 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIntegerThreshold");
Norman Jamese2765102015-08-19 22:00:55 -05007646 g_value_take_object (value, interface);
7647 break;
7648
Norman Jamescc7ae122015-08-24 14:26:09 -05007649 case 4:
Norman James90baede2015-09-02 20:32:49 -05007650 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman Jamescc7ae122015-08-24 14:26:09 -05007651 g_value_take_object (value, interface);
7652 break;
7653
Norman Jamese2765102015-08-19 22:00:55 -05007654 default:
7655 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
7656 break;
7657 }
7658}
7659
7660static void
7661object_skeleton_class_init (ObjectSkeletonClass *klass)
7662{
7663 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
7664
7665 gobject_class->set_property = object_skeleton_set_property;
7666 gobject_class->get_property = object_skeleton_get_property;
7667
7668 g_object_class_override_property (gobject_class, 1, "sensor-integer");
7669 g_object_class_override_property (gobject_class, 2, "sensor-string");
Norman James90baede2015-09-02 20:32:49 -05007670 g_object_class_override_property (gobject_class, 3, "sensor-integer-threshold");
7671 g_object_class_override_property (gobject_class, 4, "sensor-i2c");
Norman Jamese2765102015-08-19 22:00:55 -05007672}
7673
7674/**
7675 * object_skeleton_new:
7676 * @object_path: An object path.
7677 *
7678 * Creates a new skeleton object.
7679 *
7680 * Returns: (transfer full): The skeleton object.
7681 */
7682ObjectSkeleton *
7683object_skeleton_new (const gchar *object_path)
7684{
7685 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
7686 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
7687}
7688
7689/**
7690 * object_skeleton_set_sensor_integer:
7691 * @object: A #ObjectSkeleton.
7692 * @interface_: (allow-none): A #SensorInteger or %NULL to clear the interface.
7693 *
7694 * 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.
7695 */
7696void object_skeleton_set_sensor_integer (ObjectSkeleton *object, SensorInteger *interface_)
7697{
7698 g_object_set (G_OBJECT (object), "sensor-integer", interface_, NULL);
7699}
7700
7701/**
7702 * object_skeleton_set_sensor_string:
7703 * @object: A #ObjectSkeleton.
7704 * @interface_: (allow-none): A #SensorString or %NULL to clear the interface.
7705 *
7706 * 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.
7707 */
7708void object_skeleton_set_sensor_string (ObjectSkeleton *object, SensorString *interface_)
7709{
7710 g_object_set (G_OBJECT (object), "sensor-string", interface_, NULL);
7711}
7712
7713/**
Norman Jamescc7ae122015-08-24 14:26:09 -05007714 * object_skeleton_set_sensor_integer_threshold:
7715 * @object: A #ObjectSkeleton.
7716 * @interface_: (allow-none): A #SensorIntegerThreshold or %NULL to clear the interface.
7717 *
7718 * 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.
7719 */
7720void object_skeleton_set_sensor_integer_threshold (ObjectSkeleton *object, SensorIntegerThreshold *interface_)
7721{
7722 g_object_set (G_OBJECT (object), "sensor-integer-threshold", interface_, NULL);
7723}
7724
Norman James90baede2015-09-02 20:32:49 -05007725/**
7726 * object_skeleton_set_sensor_i2c:
7727 * @object: A #ObjectSkeleton.
7728 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
7729 *
7730 * Sets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object.
7731 */
7732void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
7733{
7734 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
7735}
7736
Norman Jamese2765102015-08-19 22:00:55 -05007737
7738/* ------------------------------------------------------------------------
7739 * Code for ObjectManager client
7740 * ------------------------------------------------------------------------
7741 */
7742
7743/**
7744 * SECTION:ObjectManagerClient
7745 * @title: ObjectManagerClient
7746 * @short_description: Generated GDBusObjectManagerClient type
7747 *
7748 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
7749 */
7750
7751/**
7752 * ObjectManagerClient:
7753 *
7754 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
7755 */
7756
7757/**
7758 * ObjectManagerClientClass:
7759 * @parent_class: The parent class.
7760 *
7761 * Class structure for #ObjectManagerClient.
7762 */
7763
7764G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
7765
7766static void
7767object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
7768{
7769}
7770
7771static void
7772object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
7773{
7774}
7775
7776/**
7777 * object_manager_client_get_proxy_type:
7778 * @manager: A #GDBusObjectManagerClient.
7779 * @object_path: The object path of the remote object (unused).
7780 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
7781 * @user_data: User data (unused).
7782 *
7783 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
7784 *
7785 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
7786 */
7787GType
7788object_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)
7789{
7790 static gsize once_init_value = 0;
7791 static GHashTable *lookup_hash;
7792 GType ret;
7793
7794 if (interface_name == NULL)
7795 return TYPE_OBJECT_PROXY;
7796 if (g_once_init_enter (&once_init_value))
7797 {
7798 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
7799 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorInteger", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_PROXY));
7800 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorString", GSIZE_TO_POINTER (TYPE_SENSOR_STRING_PROXY));
Norman Jamescc7ae122015-08-24 14:26:09 -05007801 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorIntegerThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_INTEGER_THRESHOLD_PROXY));
Norman James90baede2015-09-02 20:32:49 -05007802 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
Norman Jamese2765102015-08-19 22:00:55 -05007803 g_once_init_leave (&once_init_value, 1);
7804 }
7805 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
7806 if (ret == (GType) 0)
7807 ret = G_TYPE_DBUS_PROXY;
7808 return ret;
7809}
7810
7811/**
7812 * object_manager_client_new:
7813 * @connection: A #GDBusConnection.
7814 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
7815 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7816 * @object_path: An object path.
7817 * @cancellable: (allow-none): A #GCancellable or %NULL.
7818 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7819 * @user_data: User data to pass to @callback.
7820 *
7821 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
7822 *
7823 * 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.
7824 * You can then call object_manager_client_new_finish() to get the result of the operation.
7825 *
7826 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
7827 */
7828void
7829object_manager_client_new (
7830 GDBusConnection *connection,
7831 GDBusObjectManagerClientFlags flags,
7832 const gchar *name,
7833 const gchar *object_path,
7834 GCancellable *cancellable,
7835 GAsyncReadyCallback callback,
7836 gpointer user_data)
7837{
7838 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);
7839}
7840
7841/**
7842 * object_manager_client_new_finish:
7843 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
7844 * @error: Return location for error or %NULL
7845 *
7846 * Finishes an operation started with object_manager_client_new().
7847 *
7848 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
7849 */
7850GDBusObjectManager *
7851object_manager_client_new_finish (
7852 GAsyncResult *res,
7853 GError **error)
7854{
7855 GObject *ret;
7856 GObject *source_object;
7857 source_object = g_async_result_get_source_object (res);
7858 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7859 g_object_unref (source_object);
7860 if (ret != NULL)
7861 return G_DBUS_OBJECT_MANAGER (ret);
7862 else
7863 return NULL;
7864}
7865
7866/**
7867 * object_manager_client_new_sync:
7868 * @connection: A #GDBusConnection.
7869 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
7870 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7871 * @object_path: An object path.
7872 * @cancellable: (allow-none): A #GCancellable or %NULL.
7873 * @error: Return location for error or %NULL
7874 *
7875 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
7876 *
7877 * The calling thread is blocked until a reply is received.
7878 *
7879 * See object_manager_client_new() for the asynchronous version of this constructor.
7880 *
7881 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
7882 */
7883GDBusObjectManager *
7884object_manager_client_new_sync (
7885 GDBusConnection *connection,
7886 GDBusObjectManagerClientFlags flags,
7887 const gchar *name,
7888 const gchar *object_path,
7889 GCancellable *cancellable,
7890 GError **error)
7891{
7892 GInitable *ret;
7893 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);
7894 if (ret != NULL)
7895 return G_DBUS_OBJECT_MANAGER (ret);
7896 else
7897 return NULL;
7898}
7899
7900
7901/**
7902 * object_manager_client_new_for_bus:
7903 * @bus_type: A #GBusType.
7904 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
7905 * @name: A bus name (well-known or unique).
7906 * @object_path: An object path.
7907 * @cancellable: (allow-none): A #GCancellable or %NULL.
7908 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7909 * @user_data: User data to pass to @callback.
7910 *
7911 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
7912 *
7913 * 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.
7914 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
7915 *
7916 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7917 */
7918void
7919object_manager_client_new_for_bus (
7920 GBusType bus_type,
7921 GDBusObjectManagerClientFlags flags,
7922 const gchar *name,
7923 const gchar *object_path,
7924 GCancellable *cancellable,
7925 GAsyncReadyCallback callback,
7926 gpointer user_data)
7927{
7928 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);
7929}
7930
7931/**
7932 * object_manager_client_new_for_bus_finish:
7933 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
7934 * @error: Return location for error or %NULL
7935 *
7936 * Finishes an operation started with object_manager_client_new_for_bus().
7937 *
7938 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
7939 */
7940GDBusObjectManager *
7941object_manager_client_new_for_bus_finish (
7942 GAsyncResult *res,
7943 GError **error)
7944{
7945 GObject *ret;
7946 GObject *source_object;
7947 source_object = g_async_result_get_source_object (res);
7948 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7949 g_object_unref (source_object);
7950 if (ret != NULL)
7951 return G_DBUS_OBJECT_MANAGER (ret);
7952 else
7953 return NULL;
7954}
7955
7956/**
7957 * object_manager_client_new_for_bus_sync:
7958 * @bus_type: A #GBusType.
7959 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
7960 * @name: A bus name (well-known or unique).
7961 * @object_path: An object path.
7962 * @cancellable: (allow-none): A #GCancellable or %NULL.
7963 * @error: Return location for error or %NULL
7964 *
7965 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7966 *
7967 * The calling thread is blocked until a reply is received.
7968 *
7969 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
7970 *
7971 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
7972 */
7973GDBusObjectManager *
7974object_manager_client_new_for_bus_sync (
7975 GBusType bus_type,
7976 GDBusObjectManagerClientFlags flags,
7977 const gchar *name,
7978 const gchar *object_path,
7979 GCancellable *cancellable,
7980 GError **error)
7981{
7982 GInitable *ret;
7983 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);
7984 if (ret != NULL)
7985 return G_DBUS_OBJECT_MANAGER (ret);
7986 else
7987 return NULL;
7988}
7989
7990