blob: 203a0e73a06630670504136decba2361858ecdd9 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -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/openbmc_intf.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.Occ
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:Occ
158 * @title: Occ
159 * @short_description: Generated C code for the org.openbmc.Occ D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.Occ ---- */
165
166static const _ExtendedGDBusMethodInfo _occ_method_info_init =
167{
168 {
169 -1,
170 (gchar *) "init",
171 NULL,
172 NULL,
173 NULL
174 },
175 "handle-init",
176 FALSE
177};
178
179static const _ExtendedGDBusMethodInfo _occ_method_info_collect =
180{
181 {
182 -1,
183 (gchar *) "collect",
184 NULL,
185 NULL,
186 NULL
187 },
188 "handle-collect",
189 FALSE
190};
191
192static const _ExtendedGDBusMethodInfo * const _occ_method_info_pointers[] =
193{
194 &_occ_method_info_init,
195 &_occ_method_info_collect,
196 NULL
197};
198
199static const _ExtendedGDBusPropertyInfo _occ_property_info_state =
200{
201 {
202 -1,
203 (gchar *) "state",
204 (gchar *) "s",
205 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
206 NULL
207 },
208 "state",
209 FALSE
210};
211
Norman James2d1ee892015-09-16 23:13:45 -0500212static const _ExtendedGDBusPropertyInfo _occ_property_info_instance_name =
213{
214 {
215 -1,
216 (gchar *) "instance_name",
217 (gchar *) "s",
218 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
219 NULL
220 },
221 "instance-name",
222 FALSE
223};
224
Norman James362a80f2015-09-14 14:04:39 -0500225static const _ExtendedGDBusPropertyInfo _occ_property_info_poll_interval =
226{
227 {
228 -1,
229 (gchar *) "poll_interval",
230 (gchar *) "i",
231 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
232 NULL
233 },
234 "poll-interval",
235 FALSE
236};
237
238static const _ExtendedGDBusPropertyInfo * const _occ_property_info_pointers[] =
239{
240 &_occ_property_info_state,
Norman James2d1ee892015-09-16 23:13:45 -0500241 &_occ_property_info_instance_name,
Norman James362a80f2015-09-14 14:04:39 -0500242 &_occ_property_info_poll_interval,
243 NULL
244};
245
246static const _ExtendedGDBusInterfaceInfo _occ_interface_info =
247{
248 {
249 -1,
250 (gchar *) "org.openbmc.Occ",
251 (GDBusMethodInfo **) &_occ_method_info_pointers,
252 NULL,
253 (GDBusPropertyInfo **) &_occ_property_info_pointers,
254 NULL
255 },
256 "occ",
257};
258
259
260/**
261 * occ_interface_info:
262 *
263 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface.
264 *
265 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
266 */
267GDBusInterfaceInfo *
268occ_interface_info (void)
269{
270 return (GDBusInterfaceInfo *) &_occ_interface_info.parent_struct;
271}
272
273/**
274 * occ_override_properties:
275 * @klass: The class structure for a #GObject<!-- -->-derived class.
276 * @property_id_begin: The property id to assign to the first overridden property.
277 *
278 * Overrides all #GObject properties in the #Occ interface for a concrete class.
279 * The properties are overridden in the order they are defined.
280 *
281 * Returns: The last property id.
282 */
283guint
284occ_override_properties (GObjectClass *klass, guint property_id_begin)
285{
286 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James2d1ee892015-09-16 23:13:45 -0500287 g_object_class_override_property (klass, property_id_begin++, "instance-name");
Norman James362a80f2015-09-14 14:04:39 -0500288 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
289 return property_id_begin - 1;
290}
291
292
293
294/**
295 * Occ:
296 *
297 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
298 */
299
300/**
301 * OccIface:
302 * @parent_iface: The parent interface.
303 * @handle_collect: Handler for the #Occ::handle-collect signal.
304 * @handle_init: Handler for the #Occ::handle-init signal.
Norman James2d1ee892015-09-16 23:13:45 -0500305 * @get_instance_name: Getter for the #Occ:instance-name property.
Norman James362a80f2015-09-14 14:04:39 -0500306 * @get_poll_interval: Getter for the #Occ:poll-interval property.
307 * @get_state: Getter for the #Occ:state property.
308 *
309 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
310 */
311
312typedef OccIface OccInterface;
313G_DEFINE_INTERFACE (Occ, occ, G_TYPE_OBJECT);
314
315static void
316occ_default_init (OccIface *iface)
317{
318 /* GObject signals for incoming D-Bus method calls: */
319 /**
320 * Occ::handle-init:
321 * @object: A #Occ.
322 * @invocation: A #GDBusMethodInvocation.
323 *
324 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method.
325 *
326 * 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 occ_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.
327 *
328 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
329 */
330 g_signal_new ("handle-init",
331 G_TYPE_FROM_INTERFACE (iface),
332 G_SIGNAL_RUN_LAST,
333 G_STRUCT_OFFSET (OccIface, handle_init),
334 g_signal_accumulator_true_handled,
335 NULL,
336 g_cclosure_marshal_generic,
337 G_TYPE_BOOLEAN,
338 1,
339 G_TYPE_DBUS_METHOD_INVOCATION);
340
341 /**
342 * Occ::handle-collect:
343 * @object: A #Occ.
344 * @invocation: A #GDBusMethodInvocation.
345 *
346 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method.
347 *
348 * 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 occ_complete_collect() 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.
349 *
350 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
351 */
352 g_signal_new ("handle-collect",
353 G_TYPE_FROM_INTERFACE (iface),
354 G_SIGNAL_RUN_LAST,
355 G_STRUCT_OFFSET (OccIface, handle_collect),
356 g_signal_accumulator_true_handled,
357 NULL,
358 g_cclosure_marshal_generic,
359 G_TYPE_BOOLEAN,
360 1,
361 G_TYPE_DBUS_METHOD_INVOCATION);
362
363 /* GObject properties for D-Bus properties: */
364 /**
365 * Occ:state:
366 *
367 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link>.
368 *
369 * 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.
370 */
371 g_object_interface_install_property (iface,
372 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
373 /**
Norman James2d1ee892015-09-16 23:13:45 -0500374 * Occ:instance-name:
375 *
376 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link>.
377 *
378 * 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.
379 */
380 g_object_interface_install_property (iface,
381 g_param_spec_string ("instance-name", "instance_name", "instance_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
382 /**
Norman James362a80f2015-09-14 14:04:39 -0500383 * Occ:poll-interval:
384 *
385 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link>.
386 *
387 * 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.
388 */
389 g_object_interface_install_property (iface,
390 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
391}
392
393/**
394 * occ_get_state: (skip)
395 * @object: A #Occ.
396 *
397 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
398 *
399 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
400 *
401 * <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 occ_dup_state() if on another thread.</warning>
402 *
403 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
404 */
405const gchar *
406occ_get_state (Occ *object)
407{
408 return OCC_GET_IFACE (object)->get_state (object);
409}
410
411/**
412 * occ_dup_state: (skip)
413 * @object: A #Occ.
414 *
415 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
416 *
417 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
418 *
419 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
420 */
421gchar *
422occ_dup_state (Occ *object)
423{
424 gchar *value;
425 g_object_get (G_OBJECT (object), "state", &value, NULL);
426 return value;
427}
428
429/**
430 * occ_set_state: (skip)
431 * @object: A #Occ.
432 * @value: The value to set.
433 *
434 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property to @value.
435 *
436 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
437 */
438void
439occ_set_state (Occ *object, const gchar *value)
440{
441 g_object_set (G_OBJECT (object), "state", value, NULL);
442}
443
444/**
Norman James2d1ee892015-09-16 23:13:45 -0500445 * occ_get_instance_name: (skip)
446 * @object: A #Occ.
447 *
448 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property.
449 *
450 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
451 *
452 * <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 occ_dup_instance_name() if on another thread.</warning>
453 *
454 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
455 */
456const gchar *
457occ_get_instance_name (Occ *object)
458{
459 return OCC_GET_IFACE (object)->get_instance_name (object);
460}
461
462/**
463 * occ_dup_instance_name: (skip)
464 * @object: A #Occ.
465 *
466 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property.
467 *
468 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
469 *
470 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
471 */
472gchar *
473occ_dup_instance_name (Occ *object)
474{
475 gchar *value;
476 g_object_get (G_OBJECT (object), "instance-name", &value, NULL);
477 return value;
478}
479
480/**
481 * occ_set_instance_name: (skip)
482 * @object: A #Occ.
483 * @value: The value to set.
484 *
485 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property to @value.
486 *
487 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
488 */
489void
490occ_set_instance_name (Occ *object, const gchar *value)
491{
492 g_object_set (G_OBJECT (object), "instance-name", value, NULL);
493}
494
495/**
Norman James362a80f2015-09-14 14:04:39 -0500496 * occ_get_poll_interval: (skip)
497 * @object: A #Occ.
498 *
499 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property.
500 *
501 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
502 *
503 * Returns: The property value.
504 */
505gint
506occ_get_poll_interval (Occ *object)
507{
508 return OCC_GET_IFACE (object)->get_poll_interval (object);
509}
510
511/**
512 * occ_set_poll_interval: (skip)
513 * @object: A #Occ.
514 * @value: The value to set.
515 *
516 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property to @value.
517 *
518 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
519 */
520void
521occ_set_poll_interval (Occ *object, gint value)
522{
523 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
524}
525
526/**
527 * occ_call_init:
528 * @proxy: A #OccProxy.
529 * @cancellable: (allow-none): A #GCancellable or %NULL.
530 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
531 * @user_data: User data to pass to @callback.
532 *
533 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy.
534 * 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.
535 * You can then call occ_call_init_finish() to get the result of the operation.
536 *
537 * See occ_call_init_sync() for the synchronous, blocking version of this method.
538 */
539void
540occ_call_init (
541 Occ *proxy,
542 GCancellable *cancellable,
543 GAsyncReadyCallback callback,
544 gpointer user_data)
545{
546 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
547 "init",
548 g_variant_new ("()"),
549 G_DBUS_CALL_FLAGS_NONE,
550 -1,
551 cancellable,
552 callback,
553 user_data);
554}
555
556/**
557 * occ_call_init_finish:
558 * @proxy: A #OccProxy.
559 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_init().
560 * @error: Return location for error or %NULL.
561 *
562 * Finishes an operation started with occ_call_init().
563 *
564 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
565 */
566gboolean
567occ_call_init_finish (
568 Occ *proxy,
569 GAsyncResult *res,
570 GError **error)
571{
572 GVariant *_ret;
573 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
574 if (_ret == NULL)
575 goto _out;
576 g_variant_get (_ret,
577 "()");
578 g_variant_unref (_ret);
579_out:
580 return _ret != NULL;
581}
582
583/**
584 * occ_call_init_sync:
585 * @proxy: A #OccProxy.
586 * @cancellable: (allow-none): A #GCancellable or %NULL.
587 * @error: Return location for error or %NULL.
588 *
589 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
590 *
591 * See occ_call_init() for the asynchronous version of this method.
592 *
593 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
594 */
595gboolean
596occ_call_init_sync (
597 Occ *proxy,
598 GCancellable *cancellable,
599 GError **error)
600{
601 GVariant *_ret;
602 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
603 "init",
604 g_variant_new ("()"),
605 G_DBUS_CALL_FLAGS_NONE,
606 -1,
607 cancellable,
608 error);
609 if (_ret == NULL)
610 goto _out;
611 g_variant_get (_ret,
612 "()");
613 g_variant_unref (_ret);
614_out:
615 return _ret != NULL;
616}
617
618/**
619 * occ_call_collect:
620 * @proxy: A #OccProxy.
621 * @cancellable: (allow-none): A #GCancellable or %NULL.
622 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
623 * @user_data: User data to pass to @callback.
624 *
625 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy.
626 * 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.
627 * You can then call occ_call_collect_finish() to get the result of the operation.
628 *
629 * See occ_call_collect_sync() for the synchronous, blocking version of this method.
630 */
631void
632occ_call_collect (
633 Occ *proxy,
634 GCancellable *cancellable,
635 GAsyncReadyCallback callback,
636 gpointer user_data)
637{
638 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
639 "collect",
640 g_variant_new ("()"),
641 G_DBUS_CALL_FLAGS_NONE,
642 -1,
643 cancellable,
644 callback,
645 user_data);
646}
647
648/**
649 * occ_call_collect_finish:
650 * @proxy: A #OccProxy.
651 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_collect().
652 * @error: Return location for error or %NULL.
653 *
654 * Finishes an operation started with occ_call_collect().
655 *
656 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
657 */
658gboolean
659occ_call_collect_finish (
660 Occ *proxy,
661 GAsyncResult *res,
662 GError **error)
663{
664 GVariant *_ret;
665 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
666 if (_ret == NULL)
667 goto _out;
668 g_variant_get (_ret,
669 "()");
670 g_variant_unref (_ret);
671_out:
672 return _ret != NULL;
673}
674
675/**
676 * occ_call_collect_sync:
677 * @proxy: A #OccProxy.
678 * @cancellable: (allow-none): A #GCancellable or %NULL.
679 * @error: Return location for error or %NULL.
680 *
681 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
682 *
683 * See occ_call_collect() for the asynchronous version of this method.
684 *
685 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
686 */
687gboolean
688occ_call_collect_sync (
689 Occ *proxy,
690 GCancellable *cancellable,
691 GError **error)
692{
693 GVariant *_ret;
694 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
695 "collect",
696 g_variant_new ("()"),
697 G_DBUS_CALL_FLAGS_NONE,
698 -1,
699 cancellable,
700 error);
701 if (_ret == NULL)
702 goto _out;
703 g_variant_get (_ret,
704 "()");
705 g_variant_unref (_ret);
706_out:
707 return _ret != NULL;
708}
709
710/**
711 * occ_complete_init:
712 * @object: A #Occ.
713 * @invocation: (transfer full): A #GDBusMethodInvocation.
714 *
715 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.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.
716 *
717 * This method will free @invocation, you cannot use it afterwards.
718 */
719void
720occ_complete_init (
721 Occ *object,
722 GDBusMethodInvocation *invocation)
723{
724 g_dbus_method_invocation_return_value (invocation,
725 g_variant_new ("()"));
726}
727
728/**
729 * occ_complete_collect:
730 * @object: A #Occ.
731 * @invocation: (transfer full): A #GDBusMethodInvocation.
732 *
733 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</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.
734 *
735 * This method will free @invocation, you cannot use it afterwards.
736 */
737void
738occ_complete_collect (
739 Occ *object,
740 GDBusMethodInvocation *invocation)
741{
742 g_dbus_method_invocation_return_value (invocation,
743 g_variant_new ("()"));
744}
745
746/* ------------------------------------------------------------------------ */
747
748/**
749 * OccProxy:
750 *
751 * The #OccProxy structure contains only private data and should only be accessed using the provided API.
752 */
753
754/**
755 * OccProxyClass:
756 * @parent_class: The parent class.
757 *
758 * Class structure for #OccProxy.
759 */
760
761struct _OccProxyPrivate
762{
763 GData *qdata;
764};
765
766static void occ_proxy_iface_init (OccIface *iface);
767
768#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
769G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
770 G_ADD_PRIVATE (OccProxy)
771 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
772
773#else
774G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
775 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
776
777#endif
778static void
779occ_proxy_finalize (GObject *object)
780{
781 OccProxy *proxy = OCC_PROXY (object);
782 g_datalist_clear (&proxy->priv->qdata);
783 G_OBJECT_CLASS (occ_proxy_parent_class)->finalize (object);
784}
785
786static void
787occ_proxy_get_property (GObject *object,
788 guint prop_id,
789 GValue *value,
790 GParamSpec *pspec G_GNUC_UNUSED)
791{
792 const _ExtendedGDBusPropertyInfo *info;
793 GVariant *variant;
Norman James2d1ee892015-09-16 23:13:45 -0500794 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -0500795 info = _occ_property_info_pointers[prop_id - 1];
796 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
797 if (info->use_gvariant)
798 {
799 g_value_set_variant (value, variant);
800 }
801 else
802 {
803 if (variant != NULL)
804 g_dbus_gvariant_to_gvalue (variant, value);
805 }
806 if (variant != NULL)
807 g_variant_unref (variant);
808}
809
810static void
811occ_proxy_set_property_cb (GDBusProxy *proxy,
812 GAsyncResult *res,
813 gpointer user_data)
814{
815 const _ExtendedGDBusPropertyInfo *info = user_data;
816 GError *error;
817 GVariant *_ret;
818 error = NULL;
819 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
820 if (!_ret)
821 {
822 g_warning ("Error setting property '%s' on interface org.openbmc.Occ: %s (%s, %d)",
823 info->parent_struct.name,
824 error->message, g_quark_to_string (error->domain), error->code);
825 g_error_free (error);
826 }
827 else
828 {
829 g_variant_unref (_ret);
830 }
831}
832
833static void
834occ_proxy_set_property (GObject *object,
835 guint prop_id,
836 const GValue *value,
837 GParamSpec *pspec G_GNUC_UNUSED)
838{
839 const _ExtendedGDBusPropertyInfo *info;
840 GVariant *variant;
Norman James2d1ee892015-09-16 23:13:45 -0500841 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -0500842 info = _occ_property_info_pointers[prop_id - 1];
843 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
844 g_dbus_proxy_call (G_DBUS_PROXY (object),
845 "org.freedesktop.DBus.Properties.Set",
846 g_variant_new ("(ssv)", "org.openbmc.Occ", info->parent_struct.name, variant),
847 G_DBUS_CALL_FLAGS_NONE,
848 -1,
849 NULL, (GAsyncReadyCallback) occ_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
850 g_variant_unref (variant);
851}
852
853static void
854occ_proxy_g_signal (GDBusProxy *proxy,
855 const gchar *sender_name G_GNUC_UNUSED,
856 const gchar *signal_name,
857 GVariant *parameters)
858{
859 _ExtendedGDBusSignalInfo *info;
860 GVariantIter iter;
861 GVariant *child;
862 GValue *paramv;
863 guint num_params;
864 guint n;
865 guint signal_id;
866 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, signal_name);
867 if (info == NULL)
868 return;
869 num_params = g_variant_n_children (parameters);
870 paramv = g_new0 (GValue, num_params + 1);
871 g_value_init (&paramv[0], TYPE_OCC);
872 g_value_set_object (&paramv[0], proxy);
873 g_variant_iter_init (&iter, parameters);
874 n = 1;
875 while ((child = g_variant_iter_next_value (&iter)) != NULL)
876 {
877 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
878 if (arg_info->use_gvariant)
879 {
880 g_value_init (&paramv[n], G_TYPE_VARIANT);
881 g_value_set_variant (&paramv[n], child);
882 n++;
883 }
884 else
885 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
886 g_variant_unref (child);
887 }
888 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
889 g_signal_emitv (paramv, signal_id, 0, NULL);
890 for (n = 0; n < num_params + 1; n++)
891 g_value_unset (&paramv[n]);
892 g_free (paramv);
893}
894
895static void
896occ_proxy_g_properties_changed (GDBusProxy *_proxy,
897 GVariant *changed_properties,
898 const gchar *const *invalidated_properties)
899{
900 OccProxy *proxy = OCC_PROXY (_proxy);
901 guint n;
902 const gchar *key;
903 GVariantIter *iter;
904 _ExtendedGDBusPropertyInfo *info;
905 g_variant_get (changed_properties, "a{sv}", &iter);
906 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
907 {
908 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, key);
909 g_datalist_remove_data (&proxy->priv->qdata, key);
910 if (info != NULL)
911 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
912 }
913 g_variant_iter_free (iter);
914 for (n = 0; invalidated_properties[n] != NULL; n++)
915 {
916 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, invalidated_properties[n]);
917 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
918 if (info != NULL)
919 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
920 }
921}
922
923static const gchar *
924occ_proxy_get_state (Occ *object)
925{
926 OccProxy *proxy = OCC_PROXY (object);
927 GVariant *variant;
928 const gchar *value = NULL;
929 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
930 if (variant != NULL)
931 {
932 value = g_variant_get_string (variant, NULL);
933 g_variant_unref (variant);
934 }
935 return value;
936}
937
Norman James2d1ee892015-09-16 23:13:45 -0500938static const gchar *
939occ_proxy_get_instance_name (Occ *object)
940{
941 OccProxy *proxy = OCC_PROXY (object);
942 GVariant *variant;
943 const gchar *value = NULL;
944 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "instance_name");
945 if (variant != NULL)
946 {
947 value = g_variant_get_string (variant, NULL);
948 g_variant_unref (variant);
949 }
950 return value;
951}
952
Norman James362a80f2015-09-14 14:04:39 -0500953static gint
954occ_proxy_get_poll_interval (Occ *object)
955{
956 OccProxy *proxy = OCC_PROXY (object);
957 GVariant *variant;
958 gint value = 0;
959 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
960 if (variant != NULL)
961 {
962 value = g_variant_get_int32 (variant);
963 g_variant_unref (variant);
964 }
965 return value;
966}
967
968static void
969occ_proxy_init (OccProxy *proxy)
970{
971#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
972 proxy->priv = occ_proxy_get_instance_private (proxy);
973#else
974 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OCC_PROXY, OccProxyPrivate);
975#endif
976
977 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), occ_interface_info ());
978}
979
980static void
981occ_proxy_class_init (OccProxyClass *klass)
982{
983 GObjectClass *gobject_class;
984 GDBusProxyClass *proxy_class;
985
986 gobject_class = G_OBJECT_CLASS (klass);
987 gobject_class->finalize = occ_proxy_finalize;
988 gobject_class->get_property = occ_proxy_get_property;
989 gobject_class->set_property = occ_proxy_set_property;
990
991 proxy_class = G_DBUS_PROXY_CLASS (klass);
992 proxy_class->g_signal = occ_proxy_g_signal;
993 proxy_class->g_properties_changed = occ_proxy_g_properties_changed;
994
995 occ_override_properties (gobject_class, 1);
996
997#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
998 g_type_class_add_private (klass, sizeof (OccProxyPrivate));
999#endif
1000}
1001
1002static void
1003occ_proxy_iface_init (OccIface *iface)
1004{
1005 iface->get_state = occ_proxy_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001006 iface->get_instance_name = occ_proxy_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001007 iface->get_poll_interval = occ_proxy_get_poll_interval;
1008}
1009
1010/**
1011 * occ_proxy_new:
1012 * @connection: A #GDBusConnection.
1013 * @flags: Flags from the #GDBusProxyFlags enumeration.
1014 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1015 * @object_path: An object path.
1016 * @cancellable: (allow-none): A #GCancellable or %NULL.
1017 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1018 * @user_data: User data to pass to @callback.
1019 *
1020 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new() for more details.
1021 *
1022 * 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.
1023 * You can then call occ_proxy_new_finish() to get the result of the operation.
1024 *
1025 * See occ_proxy_new_sync() for the synchronous, blocking version of this constructor.
1026 */
1027void
1028occ_proxy_new (
1029 GDBusConnection *connection,
1030 GDBusProxyFlags flags,
1031 const gchar *name,
1032 const gchar *object_path,
1033 GCancellable *cancellable,
1034 GAsyncReadyCallback callback,
1035 gpointer user_data)
1036{
1037 g_async_initable_new_async (TYPE_OCC_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.Occ", NULL);
1038}
1039
1040/**
1041 * occ_proxy_new_finish:
1042 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new().
1043 * @error: Return location for error or %NULL
1044 *
1045 * Finishes an operation started with occ_proxy_new().
1046 *
1047 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1048 */
1049Occ *
1050occ_proxy_new_finish (
1051 GAsyncResult *res,
1052 GError **error)
1053{
1054 GObject *ret;
1055 GObject *source_object;
1056 source_object = g_async_result_get_source_object (res);
1057 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1058 g_object_unref (source_object);
1059 if (ret != NULL)
1060 return OCC (ret);
1061 else
1062 return NULL;
1063}
1064
1065/**
1066 * occ_proxy_new_sync:
1067 * @connection: A #GDBusConnection.
1068 * @flags: Flags from the #GDBusProxyFlags enumeration.
1069 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1070 * @object_path: An object path.
1071 * @cancellable: (allow-none): A #GCancellable or %NULL.
1072 * @error: Return location for error or %NULL
1073 *
1074 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new_sync() for more details.
1075 *
1076 * The calling thread is blocked until a reply is received.
1077 *
1078 * See occ_proxy_new() for the asynchronous version of this constructor.
1079 *
1080 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1081 */
1082Occ *
1083occ_proxy_new_sync (
1084 GDBusConnection *connection,
1085 GDBusProxyFlags flags,
1086 const gchar *name,
1087 const gchar *object_path,
1088 GCancellable *cancellable,
1089 GError **error)
1090{
1091 GInitable *ret;
1092 ret = g_initable_new (TYPE_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL);
1093 if (ret != NULL)
1094 return OCC (ret);
1095 else
1096 return NULL;
1097}
1098
1099
1100/**
1101 * occ_proxy_new_for_bus:
1102 * @bus_type: A #GBusType.
1103 * @flags: Flags from the #GDBusProxyFlags enumeration.
1104 * @name: A bus name (well-known or unique).
1105 * @object_path: An object path.
1106 * @cancellable: (allow-none): A #GCancellable or %NULL.
1107 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1108 * @user_data: User data to pass to @callback.
1109 *
1110 * Like occ_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1111 *
1112 * 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.
1113 * You can then call occ_proxy_new_for_bus_finish() to get the result of the operation.
1114 *
1115 * See occ_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1116 */
1117void
1118occ_proxy_new_for_bus (
1119 GBusType bus_type,
1120 GDBusProxyFlags flags,
1121 const gchar *name,
1122 const gchar *object_path,
1123 GCancellable *cancellable,
1124 GAsyncReadyCallback callback,
1125 gpointer user_data)
1126{
1127 g_async_initable_new_async (TYPE_OCC_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.Occ", NULL);
1128}
1129
1130/**
1131 * occ_proxy_new_for_bus_finish:
1132 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new_for_bus().
1133 * @error: Return location for error or %NULL
1134 *
1135 * Finishes an operation started with occ_proxy_new_for_bus().
1136 *
1137 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1138 */
1139Occ *
1140occ_proxy_new_for_bus_finish (
1141 GAsyncResult *res,
1142 GError **error)
1143{
1144 GObject *ret;
1145 GObject *source_object;
1146 source_object = g_async_result_get_source_object (res);
1147 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1148 g_object_unref (source_object);
1149 if (ret != NULL)
1150 return OCC (ret);
1151 else
1152 return NULL;
1153}
1154
1155/**
1156 * occ_proxy_new_for_bus_sync:
1157 * @bus_type: A #GBusType.
1158 * @flags: Flags from the #GDBusProxyFlags enumeration.
1159 * @name: A bus name (well-known or unique).
1160 * @object_path: An object path.
1161 * @cancellable: (allow-none): A #GCancellable or %NULL.
1162 * @error: Return location for error or %NULL
1163 *
1164 * Like occ_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1165 *
1166 * The calling thread is blocked until a reply is received.
1167 *
1168 * See occ_proxy_new_for_bus() for the asynchronous version of this constructor.
1169 *
1170 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1171 */
1172Occ *
1173occ_proxy_new_for_bus_sync (
1174 GBusType bus_type,
1175 GDBusProxyFlags flags,
1176 const gchar *name,
1177 const gchar *object_path,
1178 GCancellable *cancellable,
1179 GError **error)
1180{
1181 GInitable *ret;
1182 ret = g_initable_new (TYPE_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL);
1183 if (ret != NULL)
1184 return OCC (ret);
1185 else
1186 return NULL;
1187}
1188
1189
1190/* ------------------------------------------------------------------------ */
1191
1192/**
1193 * OccSkeleton:
1194 *
1195 * The #OccSkeleton structure contains only private data and should only be accessed using the provided API.
1196 */
1197
1198/**
1199 * OccSkeletonClass:
1200 * @parent_class: The parent class.
1201 *
1202 * Class structure for #OccSkeleton.
1203 */
1204
1205struct _OccSkeletonPrivate
1206{
1207 GValue *properties;
1208 GList *changed_properties;
1209 GSource *changed_properties_idle_source;
1210 GMainContext *context;
1211 GMutex lock;
1212};
1213
1214static void
1215_occ_skeleton_handle_method_call (
1216 GDBusConnection *connection G_GNUC_UNUSED,
1217 const gchar *sender G_GNUC_UNUSED,
1218 const gchar *object_path G_GNUC_UNUSED,
1219 const gchar *interface_name,
1220 const gchar *method_name,
1221 GVariant *parameters,
1222 GDBusMethodInvocation *invocation,
1223 gpointer user_data)
1224{
1225 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1226 _ExtendedGDBusMethodInfo *info;
1227 GVariantIter iter;
1228 GVariant *child;
1229 GValue *paramv;
1230 guint num_params;
1231 guint num_extra;
1232 guint n;
1233 guint signal_id;
1234 GValue return_value = G_VALUE_INIT;
1235 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1236 g_assert (info != NULL);
1237 num_params = g_variant_n_children (parameters);
1238 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1239 n = 0;
1240 g_value_init (&paramv[n], TYPE_OCC);
1241 g_value_set_object (&paramv[n++], skeleton);
1242 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1243 g_value_set_object (&paramv[n++], invocation);
1244 if (info->pass_fdlist)
1245 {
1246#ifdef G_OS_UNIX
1247 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1248 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1249#else
1250 g_assert_not_reached ();
1251#endif
1252 }
1253 g_variant_iter_init (&iter, parameters);
1254 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1255 {
1256 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1257 if (arg_info->use_gvariant)
1258 {
1259 g_value_init (&paramv[n], G_TYPE_VARIANT);
1260 g_value_set_variant (&paramv[n], child);
1261 n++;
1262 }
1263 else
1264 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1265 g_variant_unref (child);
1266 }
1267 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
1268 g_value_init (&return_value, G_TYPE_BOOLEAN);
1269 g_signal_emitv (paramv, signal_id, 0, &return_value);
1270 if (!g_value_get_boolean (&return_value))
1271 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);
1272 g_value_unset (&return_value);
1273 for (n = 0; n < num_params + num_extra; n++)
1274 g_value_unset (&paramv[n]);
1275 g_free (paramv);
1276}
1277
1278static GVariant *
1279_occ_skeleton_handle_get_property (
1280 GDBusConnection *connection G_GNUC_UNUSED,
1281 const gchar *sender G_GNUC_UNUSED,
1282 const gchar *object_path G_GNUC_UNUSED,
1283 const gchar *interface_name G_GNUC_UNUSED,
1284 const gchar *property_name,
1285 GError **error,
1286 gpointer user_data)
1287{
1288 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1289 GValue value = G_VALUE_INIT;
1290 GParamSpec *pspec;
1291 _ExtendedGDBusPropertyInfo *info;
1292 GVariant *ret;
1293 ret = NULL;
1294 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1295 g_assert (info != NULL);
1296 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1297 if (pspec == NULL)
1298 {
1299 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1300 }
1301 else
1302 {
1303 g_value_init (&value, pspec->value_type);
1304 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1305 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1306 g_value_unset (&value);
1307 }
1308 return ret;
1309}
1310
1311static gboolean
1312_occ_skeleton_handle_set_property (
1313 GDBusConnection *connection G_GNUC_UNUSED,
1314 const gchar *sender G_GNUC_UNUSED,
1315 const gchar *object_path G_GNUC_UNUSED,
1316 const gchar *interface_name G_GNUC_UNUSED,
1317 const gchar *property_name,
1318 GVariant *variant,
1319 GError **error,
1320 gpointer user_data)
1321{
1322 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1323 GValue value = G_VALUE_INIT;
1324 GParamSpec *pspec;
1325 _ExtendedGDBusPropertyInfo *info;
1326 gboolean ret;
1327 ret = FALSE;
1328 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1329 g_assert (info != NULL);
1330 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1331 if (pspec == NULL)
1332 {
1333 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1334 }
1335 else
1336 {
1337 if (info->use_gvariant)
1338 g_value_set_variant (&value, variant);
1339 else
1340 g_dbus_gvariant_to_gvalue (variant, &value);
1341 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1342 g_value_unset (&value);
1343 ret = TRUE;
1344 }
1345 return ret;
1346}
1347
1348static const GDBusInterfaceVTable _occ_skeleton_vtable =
1349{
1350 _occ_skeleton_handle_method_call,
1351 _occ_skeleton_handle_get_property,
1352 _occ_skeleton_handle_set_property,
1353 {NULL}
1354};
1355
1356static GDBusInterfaceInfo *
1357occ_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1358{
1359 return occ_interface_info ();
1360}
1361
1362static GDBusInterfaceVTable *
1363occ_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1364{
1365 return (GDBusInterfaceVTable *) &_occ_skeleton_vtable;
1366}
1367
1368static GVariant *
1369occ_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1370{
1371 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1372
1373 GVariantBuilder builder;
1374 guint n;
1375 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1376 if (_occ_interface_info.parent_struct.properties == NULL)
1377 goto out;
1378 for (n = 0; _occ_interface_info.parent_struct.properties[n] != NULL; n++)
1379 {
1380 GDBusPropertyInfo *info = _occ_interface_info.parent_struct.properties[n];
1381 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1382 {
1383 GVariant *value;
1384 value = _occ_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.Occ", info->name, NULL, skeleton);
1385 if (value != NULL)
1386 {
1387 g_variant_take_ref (value);
1388 g_variant_builder_add (&builder, "{sv}", info->name, value);
1389 g_variant_unref (value);
1390 }
1391 }
1392 }
1393out:
1394 return g_variant_builder_end (&builder);
1395}
1396
1397static gboolean _occ_emit_changed (gpointer user_data);
1398
1399static void
1400occ_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1401{
1402 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1403 gboolean emit_changed = FALSE;
1404
1405 g_mutex_lock (&skeleton->priv->lock);
1406 if (skeleton->priv->changed_properties_idle_source != NULL)
1407 {
1408 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1409 skeleton->priv->changed_properties_idle_source = NULL;
1410 emit_changed = TRUE;
1411 }
1412 g_mutex_unlock (&skeleton->priv->lock);
1413
1414 if (emit_changed)
1415 _occ_emit_changed (skeleton);
1416}
1417
1418static void occ_skeleton_iface_init (OccIface *iface);
1419#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1420G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1421 G_ADD_PRIVATE (OccSkeleton)
1422 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1423
1424#else
1425G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1426 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1427
1428#endif
1429static void
1430occ_skeleton_finalize (GObject *object)
1431{
1432 OccSkeleton *skeleton = OCC_SKELETON (object);
1433 guint n;
Norman James2d1ee892015-09-16 23:13:45 -05001434 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -05001435 g_value_unset (&skeleton->priv->properties[n]);
1436 g_free (skeleton->priv->properties);
1437 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1438 if (skeleton->priv->changed_properties_idle_source != NULL)
1439 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1440 g_main_context_unref (skeleton->priv->context);
1441 g_mutex_clear (&skeleton->priv->lock);
1442 G_OBJECT_CLASS (occ_skeleton_parent_class)->finalize (object);
1443}
1444
1445static void
1446occ_skeleton_get_property (GObject *object,
1447 guint prop_id,
1448 GValue *value,
1449 GParamSpec *pspec G_GNUC_UNUSED)
1450{
1451 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001452 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001453 g_mutex_lock (&skeleton->priv->lock);
1454 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1455 g_mutex_unlock (&skeleton->priv->lock);
1456}
1457
1458static gboolean
1459_occ_emit_changed (gpointer user_data)
1460{
1461 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1462 GList *l;
1463 GVariantBuilder builder;
1464 GVariantBuilder invalidated_builder;
1465 guint num_changes;
1466
1467 g_mutex_lock (&skeleton->priv->lock);
1468 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1469 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1470 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1471 {
1472 ChangedProperty *cp = l->data;
1473 GVariant *variant;
1474 const GValue *cur_value;
1475
1476 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1477 if (!_g_value_equal (cur_value, &cp->orig_value))
1478 {
1479 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1480 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1481 g_variant_unref (variant);
1482 num_changes++;
1483 }
1484 }
1485 if (num_changes > 0)
1486 {
1487 GList *connections, *ll;
1488 GVariant *signal_variant;
1489 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Occ",
1490 &builder, &invalidated_builder));
1491 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1492 for (ll = connections; ll != NULL; ll = ll->next)
1493 {
1494 GDBusConnection *connection = ll->data;
1495
1496 g_dbus_connection_emit_signal (connection,
1497 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1498 "org.freedesktop.DBus.Properties",
1499 "PropertiesChanged",
1500 signal_variant,
1501 NULL);
1502 }
1503 g_variant_unref (signal_variant);
1504 g_list_free_full (connections, g_object_unref);
1505 }
1506 else
1507 {
1508 g_variant_builder_clear (&builder);
1509 g_variant_builder_clear (&invalidated_builder);
1510 }
1511 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1512 skeleton->priv->changed_properties = NULL;
1513 skeleton->priv->changed_properties_idle_source = NULL;
1514 g_mutex_unlock (&skeleton->priv->lock);
1515 return FALSE;
1516}
1517
1518static void
1519_occ_schedule_emit_changed (OccSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1520{
1521 ChangedProperty *cp;
1522 GList *l;
1523 cp = NULL;
1524 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1525 {
1526 ChangedProperty *i_cp = l->data;
1527 if (i_cp->info == info)
1528 {
1529 cp = i_cp;
1530 break;
1531 }
1532 }
1533 if (cp == NULL)
1534 {
1535 cp = g_new0 (ChangedProperty, 1);
1536 cp->prop_id = prop_id;
1537 cp->info = info;
1538 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1539 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1540 g_value_copy (orig_value, &cp->orig_value);
1541 }
1542}
1543
1544static void
1545occ_skeleton_notify (GObject *object,
1546 GParamSpec *pspec G_GNUC_UNUSED)
1547{
1548 OccSkeleton *skeleton = OCC_SKELETON (object);
1549 g_mutex_lock (&skeleton->priv->lock);
1550 if (skeleton->priv->changed_properties != NULL &&
1551 skeleton->priv->changed_properties_idle_source == NULL)
1552 {
1553 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1554 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1555 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _occ_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1556 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1557 g_source_unref (skeleton->priv->changed_properties_idle_source);
1558 }
1559 g_mutex_unlock (&skeleton->priv->lock);
1560}
1561
1562static void
1563occ_skeleton_set_property (GObject *object,
1564 guint prop_id,
1565 const GValue *value,
1566 GParamSpec *pspec)
1567{
1568 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001569 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001570 g_mutex_lock (&skeleton->priv->lock);
1571 g_object_freeze_notify (object);
1572 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1573 {
1574 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1575 _occ_schedule_emit_changed (skeleton, _occ_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1576 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1577 g_object_notify_by_pspec (object, pspec);
1578 }
1579 g_mutex_unlock (&skeleton->priv->lock);
1580 g_object_thaw_notify (object);
1581}
1582
1583static void
1584occ_skeleton_init (OccSkeleton *skeleton)
1585{
1586#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1587 skeleton->priv = occ_skeleton_get_instance_private (skeleton);
1588#else
1589 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OCC_SKELETON, OccSkeletonPrivate);
1590#endif
1591
1592 g_mutex_init (&skeleton->priv->lock);
1593 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James2d1ee892015-09-16 23:13:45 -05001594 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -05001595 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
Norman James2d1ee892015-09-16 23:13:45 -05001596 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
1597 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -05001598}
1599
1600static const gchar *
1601occ_skeleton_get_state (Occ *object)
1602{
1603 OccSkeleton *skeleton = OCC_SKELETON (object);
1604 const gchar *value;
1605 g_mutex_lock (&skeleton->priv->lock);
1606 value = g_value_get_string (&(skeleton->priv->properties[0]));
1607 g_mutex_unlock (&skeleton->priv->lock);
1608 return value;
1609}
1610
Norman James2d1ee892015-09-16 23:13:45 -05001611static const gchar *
1612occ_skeleton_get_instance_name (Occ *object)
1613{
1614 OccSkeleton *skeleton = OCC_SKELETON (object);
1615 const gchar *value;
1616 g_mutex_lock (&skeleton->priv->lock);
1617 value = g_value_get_string (&(skeleton->priv->properties[1]));
1618 g_mutex_unlock (&skeleton->priv->lock);
1619 return value;
1620}
1621
Norman James362a80f2015-09-14 14:04:39 -05001622static gint
1623occ_skeleton_get_poll_interval (Occ *object)
1624{
1625 OccSkeleton *skeleton = OCC_SKELETON (object);
1626 gint value;
1627 g_mutex_lock (&skeleton->priv->lock);
Norman James2d1ee892015-09-16 23:13:45 -05001628 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James362a80f2015-09-14 14:04:39 -05001629 g_mutex_unlock (&skeleton->priv->lock);
1630 return value;
1631}
1632
1633static void
1634occ_skeleton_class_init (OccSkeletonClass *klass)
1635{
1636 GObjectClass *gobject_class;
1637 GDBusInterfaceSkeletonClass *skeleton_class;
1638
1639 gobject_class = G_OBJECT_CLASS (klass);
1640 gobject_class->finalize = occ_skeleton_finalize;
1641 gobject_class->get_property = occ_skeleton_get_property;
1642 gobject_class->set_property = occ_skeleton_set_property;
1643 gobject_class->notify = occ_skeleton_notify;
1644
1645
1646 occ_override_properties (gobject_class, 1);
1647
1648 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1649 skeleton_class->get_info = occ_skeleton_dbus_interface_get_info;
1650 skeleton_class->get_properties = occ_skeleton_dbus_interface_get_properties;
1651 skeleton_class->flush = occ_skeleton_dbus_interface_flush;
1652 skeleton_class->get_vtable = occ_skeleton_dbus_interface_get_vtable;
1653
1654#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1655 g_type_class_add_private (klass, sizeof (OccSkeletonPrivate));
1656#endif
1657}
1658
1659static void
1660occ_skeleton_iface_init (OccIface *iface)
1661{
1662 iface->get_state = occ_skeleton_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001663 iface->get_instance_name = occ_skeleton_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001664 iface->get_poll_interval = occ_skeleton_get_poll_interval;
1665}
1666
1667/**
1668 * occ_skeleton_new:
1669 *
1670 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
1671 *
1672 * Returns: (transfer full) (type OccSkeleton): The skeleton object.
1673 */
1674Occ *
1675occ_skeleton_new (void)
1676{
1677 return OCC (g_object_new (TYPE_OCC_SKELETON, NULL));
1678}
1679
1680/* ------------------------------------------------------------------------
1681 * Code for interface org.openbmc.Fan
1682 * ------------------------------------------------------------------------
1683 */
1684
1685/**
1686 * SECTION:Fan
1687 * @title: Fan
1688 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1689 *
1690 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface in C.
1691 */
1692
1693/* ---- Introspection data for org.openbmc.Fan ---- */
1694
1695static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1696{
1697 {
1698 -1,
1699 (gchar *) "cooling_zone",
1700 (gchar *) "i",
1701 NULL
1702 },
1703 FALSE
1704};
1705
1706static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1707{
1708 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
1709 NULL
1710};
1711
1712static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1713{
1714 {
1715 -1,
1716 (gchar *) "setCoolingZone",
1717 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1718 NULL,
1719 NULL
1720 },
1721 "handle-set-cooling-zone",
1722 FALSE
1723};
1724
1725static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1726{
1727 {
1728 -1,
1729 (gchar *) "speed",
1730 (gchar *) "i",
1731 NULL
1732 },
1733 FALSE
1734};
1735
1736static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1737{
1738 &_fan_method_info_get_speed_OUT_ARG_speed,
1739 NULL
1740};
1741
1742static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1743{
1744 {
1745 -1,
1746 (gchar *) "getSpeed",
1747 NULL,
1748 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1749 NULL
1750 },
1751 "handle-get-speed",
1752 FALSE
1753};
1754
1755static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1756{
1757 {
1758 -1,
1759 (gchar *) "speed",
1760 (gchar *) "i",
1761 NULL
1762 },
1763 FALSE
1764};
1765
1766static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1767{
1768 &_fan_method_info_set_speed_IN_ARG_speed,
1769 NULL
1770};
1771
1772static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
1773{
1774 {
1775 -1,
1776 (gchar *) "setSpeed",
1777 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
1778 NULL,
1779 NULL
1780 },
1781 "handle-set-speed",
1782 FALSE
1783};
1784
1785static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
1786{
1787 &_fan_method_info_set_cooling_zone,
1788 &_fan_method_info_get_speed,
1789 &_fan_method_info_set_speed,
1790 NULL
1791};
1792
1793static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
1794{
1795 {
1796 -1,
1797 (gchar *) "speed",
1798 (gchar *) "i",
1799 NULL
1800 },
1801 FALSE
1802};
1803
1804static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
1805{
1806 &_fan_signal_info_speed_changed_ARG_speed,
1807 NULL
1808};
1809
1810static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
1811{
1812 {
1813 -1,
1814 (gchar *) "SpeedChanged",
1815 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
1816 NULL
1817 },
1818 "speed-changed"
1819};
1820
1821static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
1822{
1823 {
1824 -1,
1825 (gchar *) "TachError",
1826 NULL,
1827 NULL
1828 },
1829 "tach-error"
1830};
1831
1832static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
1833{
1834 &_fan_signal_info_speed_changed,
1835 &_fan_signal_info_tach_error,
1836 NULL
1837};
1838
1839static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
1840{
1841 {
1842 -1,
1843 (gchar *) "speed",
1844 (gchar *) "i",
1845 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1846 NULL
1847 },
1848 "speed",
1849 FALSE
1850};
1851
1852static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
1853{
1854 {
1855 -1,
1856 (gchar *) "cooling_zone",
1857 (gchar *) "i",
1858 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1859 NULL
1860 },
1861 "cooling-zone",
1862 FALSE
1863};
1864
1865static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
1866{
1867 {
1868 -1,
1869 (gchar *) "pwm_num",
1870 (gchar *) "i",
1871 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1872 NULL
1873 },
1874 "pwm-num",
1875 FALSE
1876};
1877
1878static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
1879{
1880 &_fan_property_info_speed,
1881 &_fan_property_info_cooling_zone,
1882 &_fan_property_info_pwm_num,
1883 NULL
1884};
1885
1886static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
1887{
1888 {
1889 -1,
1890 (gchar *) "org.openbmc.Fan",
1891 (GDBusMethodInfo **) &_fan_method_info_pointers,
1892 (GDBusSignalInfo **) &_fan_signal_info_pointers,
1893 (GDBusPropertyInfo **) &_fan_property_info_pointers,
1894 NULL
1895 },
1896 "fan",
1897};
1898
1899
1900/**
1901 * fan_interface_info:
1902 *
1903 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
1904 *
1905 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1906 */
1907GDBusInterfaceInfo *
1908fan_interface_info (void)
1909{
1910 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
1911}
1912
1913/**
1914 * fan_override_properties:
1915 * @klass: The class structure for a #GObject<!-- -->-derived class.
1916 * @property_id_begin: The property id to assign to the first overridden property.
1917 *
1918 * Overrides all #GObject properties in the #Fan interface for a concrete class.
1919 * The properties are overridden in the order they are defined.
1920 *
1921 * Returns: The last property id.
1922 */
1923guint
1924fan_override_properties (GObjectClass *klass, guint property_id_begin)
1925{
1926 g_object_class_override_property (klass, property_id_begin++, "speed");
1927 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
1928 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
1929 return property_id_begin - 1;
1930}
1931
1932
1933
1934/**
1935 * Fan:
1936 *
1937 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1938 */
1939
1940/**
1941 * FanIface:
1942 * @parent_iface: The parent interface.
1943 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
1944 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
1945 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
1946 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
1947 * @get_pwm_num: Getter for the #Fan:pwm-num property.
1948 * @get_speed: Getter for the #Fan:speed property.
1949 * @speed_changed: Handler for the #Fan::speed-changed signal.
1950 * @tach_error: Handler for the #Fan::tach-error signal.
1951 *
1952 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1953 */
1954
1955typedef FanIface FanInterface;
1956G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
1957
1958static void
1959fan_default_init (FanIface *iface)
1960{
1961 /* GObject signals for incoming D-Bus method calls: */
1962 /**
1963 * Fan::handle-set-cooling-zone:
1964 * @object: A #Fan.
1965 * @invocation: A #GDBusMethodInvocation.
1966 * @arg_cooling_zone: Argument passed by remote caller.
1967 *
1968 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
1969 *
1970 * 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 fan_complete_set_cooling_zone() 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.
1971 *
1972 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1973 */
1974 g_signal_new ("handle-set-cooling-zone",
1975 G_TYPE_FROM_INTERFACE (iface),
1976 G_SIGNAL_RUN_LAST,
1977 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
1978 g_signal_accumulator_true_handled,
1979 NULL,
1980 g_cclosure_marshal_generic,
1981 G_TYPE_BOOLEAN,
1982 2,
1983 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1984
1985 /**
1986 * Fan::handle-get-speed:
1987 * @object: A #Fan.
1988 * @invocation: A #GDBusMethodInvocation.
1989 *
1990 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
1991 *
1992 * 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 fan_complete_get_speed() 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.
1993 *
1994 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1995 */
1996 g_signal_new ("handle-get-speed",
1997 G_TYPE_FROM_INTERFACE (iface),
1998 G_SIGNAL_RUN_LAST,
1999 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2000 g_signal_accumulator_true_handled,
2001 NULL,
2002 g_cclosure_marshal_generic,
2003 G_TYPE_BOOLEAN,
2004 1,
2005 G_TYPE_DBUS_METHOD_INVOCATION);
2006
2007 /**
2008 * Fan::handle-set-speed:
2009 * @object: A #Fan.
2010 * @invocation: A #GDBusMethodInvocation.
2011 * @arg_speed: Argument passed by remote caller.
2012 *
2013 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2014 *
2015 * 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 fan_complete_set_speed() 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.
2016 *
2017 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2018 */
2019 g_signal_new ("handle-set-speed",
2020 G_TYPE_FROM_INTERFACE (iface),
2021 G_SIGNAL_RUN_LAST,
2022 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2023 g_signal_accumulator_true_handled,
2024 NULL,
2025 g_cclosure_marshal_generic,
2026 G_TYPE_BOOLEAN,
2027 2,
2028 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2029
2030 /* GObject signals for received D-Bus signals: */
2031 /**
2032 * Fan::speed-changed:
2033 * @object: A #Fan.
2034 * @arg_speed: Argument.
2035 *
2036 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> is received.
2037 *
2038 * 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.
2039 */
2040 g_signal_new ("speed-changed",
2041 G_TYPE_FROM_INTERFACE (iface),
2042 G_SIGNAL_RUN_LAST,
2043 G_STRUCT_OFFSET (FanIface, speed_changed),
2044 NULL,
2045 NULL,
2046 g_cclosure_marshal_generic,
2047 G_TYPE_NONE,
2048 1, G_TYPE_INT);
2049
2050 /**
2051 * Fan::tach-error:
2052 * @object: A #Fan.
2053 *
2054 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> is received.
2055 *
2056 * 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.
2057 */
2058 g_signal_new ("tach-error",
2059 G_TYPE_FROM_INTERFACE (iface),
2060 G_SIGNAL_RUN_LAST,
2061 G_STRUCT_OFFSET (FanIface, tach_error),
2062 NULL,
2063 NULL,
2064 g_cclosure_marshal_generic,
2065 G_TYPE_NONE,
2066 0);
2067
2068 /* GObject properties for D-Bus properties: */
2069 /**
2070 * Fan:speed:
2071 *
2072 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2073 *
2074 * 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.
2075 */
2076 g_object_interface_install_property (iface,
2077 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2078 /**
2079 * Fan:cooling-zone:
2080 *
2081 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2082 *
2083 * 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.
2084 */
2085 g_object_interface_install_property (iface,
2086 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2087 /**
2088 * Fan:pwm-num:
2089 *
2090 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
2091 *
2092 * 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.
2093 */
2094 g_object_interface_install_property (iface,
2095 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2096}
2097
2098/**
2099 * fan_get_speed: (skip)
2100 * @object: A #Fan.
2101 *
2102 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2103 *
2104 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2105 *
2106 * Returns: The property value.
2107 */
2108gint
2109fan_get_speed (Fan *object)
2110{
2111 return FAN_GET_IFACE (object)->get_speed (object);
2112}
2113
2114/**
2115 * fan_set_speed: (skip)
2116 * @object: A #Fan.
2117 * @value: The value to set.
2118 *
2119 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2120 *
2121 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2122 */
2123void
2124fan_set_speed (Fan *object, gint value)
2125{
2126 g_object_set (G_OBJECT (object), "speed", value, NULL);
2127}
2128
2129/**
2130 * fan_get_cooling_zone: (skip)
2131 * @object: A #Fan.
2132 *
2133 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2134 *
2135 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2136 *
2137 * Returns: The property value.
2138 */
2139gint
2140fan_get_cooling_zone (Fan *object)
2141{
2142 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2143}
2144
2145/**
2146 * fan_set_cooling_zone: (skip)
2147 * @object: A #Fan.
2148 * @value: The value to set.
2149 *
2150 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2151 *
2152 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2153 */
2154void
2155fan_set_cooling_zone (Fan *object, gint value)
2156{
2157 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2158}
2159
2160/**
2161 * fan_get_pwm_num: (skip)
2162 * @object: A #Fan.
2163 *
2164 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2165 *
2166 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2167 *
2168 * Returns: The property value.
2169 */
2170gint
2171fan_get_pwm_num (Fan *object)
2172{
2173 return FAN_GET_IFACE (object)->get_pwm_num (object);
2174}
2175
2176/**
2177 * fan_set_pwm_num: (skip)
2178 * @object: A #Fan.
2179 * @value: The value to set.
2180 *
2181 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2182 *
2183 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2184 */
2185void
2186fan_set_pwm_num (Fan *object, gint value)
2187{
2188 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2189}
2190
2191/**
2192 * fan_emit_speed_changed:
2193 * @object: A #Fan.
2194 * @arg_speed: Argument to pass with the signal.
2195 *
2196 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2197 */
2198void
2199fan_emit_speed_changed (
2200 Fan *object,
2201 gint arg_speed)
2202{
2203 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2204}
2205
2206/**
2207 * fan_emit_tach_error:
2208 * @object: A #Fan.
2209 *
2210 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2211 */
2212void
2213fan_emit_tach_error (
2214 Fan *object)
2215{
2216 g_signal_emit_by_name (object, "tach-error");
2217}
2218
2219/**
2220 * fan_call_set_cooling_zone:
2221 * @proxy: A #FanProxy.
2222 * @arg_cooling_zone: Argument to pass with the method invocation.
2223 * @cancellable: (allow-none): A #GCancellable or %NULL.
2224 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2225 * @user_data: User data to pass to @callback.
2226 *
2227 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2228 * 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.
2229 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2230 *
2231 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2232 */
2233void
2234fan_call_set_cooling_zone (
2235 Fan *proxy,
2236 gint arg_cooling_zone,
2237 GCancellable *cancellable,
2238 GAsyncReadyCallback callback,
2239 gpointer user_data)
2240{
2241 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2242 "setCoolingZone",
2243 g_variant_new ("(i)",
2244 arg_cooling_zone),
2245 G_DBUS_CALL_FLAGS_NONE,
2246 -1,
2247 cancellable,
2248 callback,
2249 user_data);
2250}
2251
2252/**
2253 * fan_call_set_cooling_zone_finish:
2254 * @proxy: A #FanProxy.
2255 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2256 * @error: Return location for error or %NULL.
2257 *
2258 * Finishes an operation started with fan_call_set_cooling_zone().
2259 *
2260 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2261 */
2262gboolean
2263fan_call_set_cooling_zone_finish (
2264 Fan *proxy,
2265 GAsyncResult *res,
2266 GError **error)
2267{
2268 GVariant *_ret;
2269 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2270 if (_ret == NULL)
2271 goto _out;
2272 g_variant_get (_ret,
2273 "()");
2274 g_variant_unref (_ret);
2275_out:
2276 return _ret != NULL;
2277}
2278
2279/**
2280 * fan_call_set_cooling_zone_sync:
2281 * @proxy: A #FanProxy.
2282 * @arg_cooling_zone: Argument to pass with the method invocation.
2283 * @cancellable: (allow-none): A #GCancellable or %NULL.
2284 * @error: Return location for error or %NULL.
2285 *
2286 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2287 *
2288 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2289 *
2290 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2291 */
2292gboolean
2293fan_call_set_cooling_zone_sync (
2294 Fan *proxy,
2295 gint arg_cooling_zone,
2296 GCancellable *cancellable,
2297 GError **error)
2298{
2299 GVariant *_ret;
2300 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2301 "setCoolingZone",
2302 g_variant_new ("(i)",
2303 arg_cooling_zone),
2304 G_DBUS_CALL_FLAGS_NONE,
2305 -1,
2306 cancellable,
2307 error);
2308 if (_ret == NULL)
2309 goto _out;
2310 g_variant_get (_ret,
2311 "()");
2312 g_variant_unref (_ret);
2313_out:
2314 return _ret != NULL;
2315}
2316
2317/**
2318 * fan_call_get_speed:
2319 * @proxy: A #FanProxy.
2320 * @cancellable: (allow-none): A #GCancellable or %NULL.
2321 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2322 * @user_data: User data to pass to @callback.
2323 *
2324 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2325 * 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.
2326 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2327 *
2328 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2329 */
2330void
2331fan_call_get_speed (
2332 Fan *proxy,
2333 GCancellable *cancellable,
2334 GAsyncReadyCallback callback,
2335 gpointer user_data)
2336{
2337 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2338 "getSpeed",
2339 g_variant_new ("()"),
2340 G_DBUS_CALL_FLAGS_NONE,
2341 -1,
2342 cancellable,
2343 callback,
2344 user_data);
2345}
2346
2347/**
2348 * fan_call_get_speed_finish:
2349 * @proxy: A #FanProxy.
2350 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2351 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2352 * @error: Return location for error or %NULL.
2353 *
2354 * Finishes an operation started with fan_call_get_speed().
2355 *
2356 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2357 */
2358gboolean
2359fan_call_get_speed_finish (
2360 Fan *proxy,
2361 gint *out_speed,
2362 GAsyncResult *res,
2363 GError **error)
2364{
2365 GVariant *_ret;
2366 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2367 if (_ret == NULL)
2368 goto _out;
2369 g_variant_get (_ret,
2370 "(i)",
2371 out_speed);
2372 g_variant_unref (_ret);
2373_out:
2374 return _ret != NULL;
2375}
2376
2377/**
2378 * fan_call_get_speed_sync:
2379 * @proxy: A #FanProxy.
2380 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2381 * @cancellable: (allow-none): A #GCancellable or %NULL.
2382 * @error: Return location for error or %NULL.
2383 *
2384 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2385 *
2386 * See fan_call_get_speed() for the asynchronous version of this method.
2387 *
2388 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2389 */
2390gboolean
2391fan_call_get_speed_sync (
2392 Fan *proxy,
2393 gint *out_speed,
2394 GCancellable *cancellable,
2395 GError **error)
2396{
2397 GVariant *_ret;
2398 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2399 "getSpeed",
2400 g_variant_new ("()"),
2401 G_DBUS_CALL_FLAGS_NONE,
2402 -1,
2403 cancellable,
2404 error);
2405 if (_ret == NULL)
2406 goto _out;
2407 g_variant_get (_ret,
2408 "(i)",
2409 out_speed);
2410 g_variant_unref (_ret);
2411_out:
2412 return _ret != NULL;
2413}
2414
2415/**
2416 * fan_call_set_speed:
2417 * @proxy: A #FanProxy.
2418 * @arg_speed: Argument to pass with the method invocation.
2419 * @cancellable: (allow-none): A #GCancellable or %NULL.
2420 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2421 * @user_data: User data to pass to @callback.
2422 *
2423 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2424 * 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.
2425 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2426 *
2427 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2428 */
2429void
2430fan_call_set_speed (
2431 Fan *proxy,
2432 gint arg_speed,
2433 GCancellable *cancellable,
2434 GAsyncReadyCallback callback,
2435 gpointer user_data)
2436{
2437 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2438 "setSpeed",
2439 g_variant_new ("(i)",
2440 arg_speed),
2441 G_DBUS_CALL_FLAGS_NONE,
2442 -1,
2443 cancellable,
2444 callback,
2445 user_data);
2446}
2447
2448/**
2449 * fan_call_set_speed_finish:
2450 * @proxy: A #FanProxy.
2451 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2452 * @error: Return location for error or %NULL.
2453 *
2454 * Finishes an operation started with fan_call_set_speed().
2455 *
2456 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2457 */
2458gboolean
2459fan_call_set_speed_finish (
2460 Fan *proxy,
2461 GAsyncResult *res,
2462 GError **error)
2463{
2464 GVariant *_ret;
2465 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2466 if (_ret == NULL)
2467 goto _out;
2468 g_variant_get (_ret,
2469 "()");
2470 g_variant_unref (_ret);
2471_out:
2472 return _ret != NULL;
2473}
2474
2475/**
2476 * fan_call_set_speed_sync:
2477 * @proxy: A #FanProxy.
2478 * @arg_speed: Argument to pass with the method invocation.
2479 * @cancellable: (allow-none): A #GCancellable or %NULL.
2480 * @error: Return location for error or %NULL.
2481 *
2482 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2483 *
2484 * See fan_call_set_speed() for the asynchronous version of this method.
2485 *
2486 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2487 */
2488gboolean
2489fan_call_set_speed_sync (
2490 Fan *proxy,
2491 gint arg_speed,
2492 GCancellable *cancellable,
2493 GError **error)
2494{
2495 GVariant *_ret;
2496 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2497 "setSpeed",
2498 g_variant_new ("(i)",
2499 arg_speed),
2500 G_DBUS_CALL_FLAGS_NONE,
2501 -1,
2502 cancellable,
2503 error);
2504 if (_ret == NULL)
2505 goto _out;
2506 g_variant_get (_ret,
2507 "()");
2508 g_variant_unref (_ret);
2509_out:
2510 return _ret != NULL;
2511}
2512
2513/**
2514 * fan_complete_set_cooling_zone:
2515 * @object: A #Fan.
2516 * @invocation: (transfer full): A #GDBusMethodInvocation.
2517 *
2518 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</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.
2519 *
2520 * This method will free @invocation, you cannot use it afterwards.
2521 */
2522void
2523fan_complete_set_cooling_zone (
2524 Fan *object,
2525 GDBusMethodInvocation *invocation)
2526{
2527 g_dbus_method_invocation_return_value (invocation,
2528 g_variant_new ("()"));
2529}
2530
2531/**
2532 * fan_complete_get_speed:
2533 * @object: A #Fan.
2534 * @invocation: (transfer full): A #GDBusMethodInvocation.
2535 * @speed: Parameter to return.
2536 *
2537 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</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.
2538 *
2539 * This method will free @invocation, you cannot use it afterwards.
2540 */
2541void
2542fan_complete_get_speed (
2543 Fan *object,
2544 GDBusMethodInvocation *invocation,
2545 gint speed)
2546{
2547 g_dbus_method_invocation_return_value (invocation,
2548 g_variant_new ("(i)",
2549 speed));
2550}
2551
2552/**
2553 * fan_complete_set_speed:
2554 * @object: A #Fan.
2555 * @invocation: (transfer full): A #GDBusMethodInvocation.
2556 *
2557 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</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.
2558 *
2559 * This method will free @invocation, you cannot use it afterwards.
2560 */
2561void
2562fan_complete_set_speed (
2563 Fan *object,
2564 GDBusMethodInvocation *invocation)
2565{
2566 g_dbus_method_invocation_return_value (invocation,
2567 g_variant_new ("()"));
2568}
2569
2570/* ------------------------------------------------------------------------ */
2571
2572/**
2573 * FanProxy:
2574 *
2575 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2576 */
2577
2578/**
2579 * FanProxyClass:
2580 * @parent_class: The parent class.
2581 *
2582 * Class structure for #FanProxy.
2583 */
2584
2585struct _FanProxyPrivate
2586{
2587 GData *qdata;
2588};
2589
2590static void fan_proxy_iface_init (FanIface *iface);
2591
2592#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2593G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2594 G_ADD_PRIVATE (FanProxy)
2595 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2596
2597#else
2598G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2599 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2600
2601#endif
2602static void
2603fan_proxy_finalize (GObject *object)
2604{
2605 FanProxy *proxy = FAN_PROXY (object);
2606 g_datalist_clear (&proxy->priv->qdata);
2607 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2608}
2609
2610static void
2611fan_proxy_get_property (GObject *object,
2612 guint prop_id,
2613 GValue *value,
2614 GParamSpec *pspec G_GNUC_UNUSED)
2615{
2616 const _ExtendedGDBusPropertyInfo *info;
2617 GVariant *variant;
2618 g_assert (prop_id != 0 && prop_id - 1 < 3);
2619 info = _fan_property_info_pointers[prop_id - 1];
2620 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2621 if (info->use_gvariant)
2622 {
2623 g_value_set_variant (value, variant);
2624 }
2625 else
2626 {
2627 if (variant != NULL)
2628 g_dbus_gvariant_to_gvalue (variant, value);
2629 }
2630 if (variant != NULL)
2631 g_variant_unref (variant);
2632}
2633
2634static void
2635fan_proxy_set_property_cb (GDBusProxy *proxy,
2636 GAsyncResult *res,
2637 gpointer user_data)
2638{
2639 const _ExtendedGDBusPropertyInfo *info = user_data;
2640 GError *error;
2641 GVariant *_ret;
2642 error = NULL;
2643 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2644 if (!_ret)
2645 {
2646 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2647 info->parent_struct.name,
2648 error->message, g_quark_to_string (error->domain), error->code);
2649 g_error_free (error);
2650 }
2651 else
2652 {
2653 g_variant_unref (_ret);
2654 }
2655}
2656
2657static void
2658fan_proxy_set_property (GObject *object,
2659 guint prop_id,
2660 const GValue *value,
2661 GParamSpec *pspec G_GNUC_UNUSED)
2662{
2663 const _ExtendedGDBusPropertyInfo *info;
2664 GVariant *variant;
2665 g_assert (prop_id != 0 && prop_id - 1 < 3);
2666 info = _fan_property_info_pointers[prop_id - 1];
2667 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2668 g_dbus_proxy_call (G_DBUS_PROXY (object),
2669 "org.freedesktop.DBus.Properties.Set",
2670 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2671 G_DBUS_CALL_FLAGS_NONE,
2672 -1,
2673 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2674 g_variant_unref (variant);
2675}
2676
2677static void
2678fan_proxy_g_signal (GDBusProxy *proxy,
2679 const gchar *sender_name G_GNUC_UNUSED,
2680 const gchar *signal_name,
2681 GVariant *parameters)
2682{
2683 _ExtendedGDBusSignalInfo *info;
2684 GVariantIter iter;
2685 GVariant *child;
2686 GValue *paramv;
2687 guint num_params;
2688 guint n;
2689 guint signal_id;
2690 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2691 if (info == NULL)
2692 return;
2693 num_params = g_variant_n_children (parameters);
2694 paramv = g_new0 (GValue, num_params + 1);
2695 g_value_init (&paramv[0], TYPE_FAN);
2696 g_value_set_object (&paramv[0], proxy);
2697 g_variant_iter_init (&iter, parameters);
2698 n = 1;
2699 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2700 {
2701 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2702 if (arg_info->use_gvariant)
2703 {
2704 g_value_init (&paramv[n], G_TYPE_VARIANT);
2705 g_value_set_variant (&paramv[n], child);
2706 n++;
2707 }
2708 else
2709 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2710 g_variant_unref (child);
2711 }
2712 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2713 g_signal_emitv (paramv, signal_id, 0, NULL);
2714 for (n = 0; n < num_params + 1; n++)
2715 g_value_unset (&paramv[n]);
2716 g_free (paramv);
2717}
2718
2719static void
2720fan_proxy_g_properties_changed (GDBusProxy *_proxy,
2721 GVariant *changed_properties,
2722 const gchar *const *invalidated_properties)
2723{
2724 FanProxy *proxy = FAN_PROXY (_proxy);
2725 guint n;
2726 const gchar *key;
2727 GVariantIter *iter;
2728 _ExtendedGDBusPropertyInfo *info;
2729 g_variant_get (changed_properties, "a{sv}", &iter);
2730 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2731 {
2732 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
2733 g_datalist_remove_data (&proxy->priv->qdata, key);
2734 if (info != NULL)
2735 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2736 }
2737 g_variant_iter_free (iter);
2738 for (n = 0; invalidated_properties[n] != NULL; n++)
2739 {
2740 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
2741 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2742 if (info != NULL)
2743 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2744 }
2745}
2746
2747static gint
2748fan_proxy_get_speed (Fan *object)
2749{
2750 FanProxy *proxy = FAN_PROXY (object);
2751 GVariant *variant;
2752 gint value = 0;
2753 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
2754 if (variant != NULL)
2755 {
2756 value = g_variant_get_int32 (variant);
2757 g_variant_unref (variant);
2758 }
2759 return value;
2760}
2761
2762static gint
2763fan_proxy_get_cooling_zone (Fan *object)
2764{
2765 FanProxy *proxy = FAN_PROXY (object);
2766 GVariant *variant;
2767 gint value = 0;
2768 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
2769 if (variant != NULL)
2770 {
2771 value = g_variant_get_int32 (variant);
2772 g_variant_unref (variant);
2773 }
2774 return value;
2775}
2776
2777static gint
2778fan_proxy_get_pwm_num (Fan *object)
2779{
2780 FanProxy *proxy = FAN_PROXY (object);
2781 GVariant *variant;
2782 gint value = 0;
2783 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
2784 if (variant != NULL)
2785 {
2786 value = g_variant_get_int32 (variant);
2787 g_variant_unref (variant);
2788 }
2789 return value;
2790}
2791
2792static void
2793fan_proxy_init (FanProxy *proxy)
2794{
2795#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2796 proxy->priv = fan_proxy_get_instance_private (proxy);
2797#else
2798 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
2799#endif
2800
2801 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
2802}
2803
2804static void
2805fan_proxy_class_init (FanProxyClass *klass)
2806{
2807 GObjectClass *gobject_class;
2808 GDBusProxyClass *proxy_class;
2809
2810 gobject_class = G_OBJECT_CLASS (klass);
2811 gobject_class->finalize = fan_proxy_finalize;
2812 gobject_class->get_property = fan_proxy_get_property;
2813 gobject_class->set_property = fan_proxy_set_property;
2814
2815 proxy_class = G_DBUS_PROXY_CLASS (klass);
2816 proxy_class->g_signal = fan_proxy_g_signal;
2817 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
2818
2819 fan_override_properties (gobject_class, 1);
2820
2821#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2822 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
2823#endif
2824}
2825
2826static void
2827fan_proxy_iface_init (FanIface *iface)
2828{
2829 iface->get_speed = fan_proxy_get_speed;
2830 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
2831 iface->get_pwm_num = fan_proxy_get_pwm_num;
2832}
2833
2834/**
2835 * fan_proxy_new:
2836 * @connection: A #GDBusConnection.
2837 * @flags: Flags from the #GDBusProxyFlags enumeration.
2838 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2839 * @object_path: An object path.
2840 * @cancellable: (allow-none): A #GCancellable or %NULL.
2841 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2842 * @user_data: User data to pass to @callback.
2843 *
2844 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new() for more details.
2845 *
2846 * 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.
2847 * You can then call fan_proxy_new_finish() to get the result of the operation.
2848 *
2849 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
2850 */
2851void
2852fan_proxy_new (
2853 GDBusConnection *connection,
2854 GDBusProxyFlags flags,
2855 const gchar *name,
2856 const gchar *object_path,
2857 GCancellable *cancellable,
2858 GAsyncReadyCallback callback,
2859 gpointer user_data)
2860{
2861 g_async_initable_new_async (TYPE_FAN_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.Fan", NULL);
2862}
2863
2864/**
2865 * fan_proxy_new_finish:
2866 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
2867 * @error: Return location for error or %NULL
2868 *
2869 * Finishes an operation started with fan_proxy_new().
2870 *
2871 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2872 */
2873Fan *
2874fan_proxy_new_finish (
2875 GAsyncResult *res,
2876 GError **error)
2877{
2878 GObject *ret;
2879 GObject *source_object;
2880 source_object = g_async_result_get_source_object (res);
2881 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2882 g_object_unref (source_object);
2883 if (ret != NULL)
2884 return FAN (ret);
2885 else
2886 return NULL;
2887}
2888
2889/**
2890 * fan_proxy_new_sync:
2891 * @connection: A #GDBusConnection.
2892 * @flags: Flags from the #GDBusProxyFlags enumeration.
2893 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2894 * @object_path: An object path.
2895 * @cancellable: (allow-none): A #GCancellable or %NULL.
2896 * @error: Return location for error or %NULL
2897 *
2898 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new_sync() for more details.
2899 *
2900 * The calling thread is blocked until a reply is received.
2901 *
2902 * See fan_proxy_new() for the asynchronous version of this constructor.
2903 *
2904 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2905 */
2906Fan *
2907fan_proxy_new_sync (
2908 GDBusConnection *connection,
2909 GDBusProxyFlags flags,
2910 const gchar *name,
2911 const gchar *object_path,
2912 GCancellable *cancellable,
2913 GError **error)
2914{
2915 GInitable *ret;
2916 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
2917 if (ret != NULL)
2918 return FAN (ret);
2919 else
2920 return NULL;
2921}
2922
2923
2924/**
2925 * fan_proxy_new_for_bus:
2926 * @bus_type: A #GBusType.
2927 * @flags: Flags from the #GDBusProxyFlags enumeration.
2928 * @name: A bus name (well-known or unique).
2929 * @object_path: An object path.
2930 * @cancellable: (allow-none): A #GCancellable or %NULL.
2931 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2932 * @user_data: User data to pass to @callback.
2933 *
2934 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2935 *
2936 * 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.
2937 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
2938 *
2939 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2940 */
2941void
2942fan_proxy_new_for_bus (
2943 GBusType bus_type,
2944 GDBusProxyFlags flags,
2945 const gchar *name,
2946 const gchar *object_path,
2947 GCancellable *cancellable,
2948 GAsyncReadyCallback callback,
2949 gpointer user_data)
2950{
2951 g_async_initable_new_async (TYPE_FAN_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.Fan", NULL);
2952}
2953
2954/**
2955 * fan_proxy_new_for_bus_finish:
2956 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
2957 * @error: Return location for error or %NULL
2958 *
2959 * Finishes an operation started with fan_proxy_new_for_bus().
2960 *
2961 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2962 */
2963Fan *
2964fan_proxy_new_for_bus_finish (
2965 GAsyncResult *res,
2966 GError **error)
2967{
2968 GObject *ret;
2969 GObject *source_object;
2970 source_object = g_async_result_get_source_object (res);
2971 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2972 g_object_unref (source_object);
2973 if (ret != NULL)
2974 return FAN (ret);
2975 else
2976 return NULL;
2977}
2978
2979/**
2980 * fan_proxy_new_for_bus_sync:
2981 * @bus_type: A #GBusType.
2982 * @flags: Flags from the #GDBusProxyFlags enumeration.
2983 * @name: A bus name (well-known or unique).
2984 * @object_path: An object path.
2985 * @cancellable: (allow-none): A #GCancellable or %NULL.
2986 * @error: Return location for error or %NULL
2987 *
2988 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2989 *
2990 * The calling thread is blocked until a reply is received.
2991 *
2992 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
2993 *
2994 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2995 */
2996Fan *
2997fan_proxy_new_for_bus_sync (
2998 GBusType bus_type,
2999 GDBusProxyFlags flags,
3000 const gchar *name,
3001 const gchar *object_path,
3002 GCancellable *cancellable,
3003 GError **error)
3004{
3005 GInitable *ret;
3006 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
3007 if (ret != NULL)
3008 return FAN (ret);
3009 else
3010 return NULL;
3011}
3012
3013
3014/* ------------------------------------------------------------------------ */
3015
3016/**
3017 * FanSkeleton:
3018 *
3019 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3020 */
3021
3022/**
3023 * FanSkeletonClass:
3024 * @parent_class: The parent class.
3025 *
3026 * Class structure for #FanSkeleton.
3027 */
3028
3029struct _FanSkeletonPrivate
3030{
3031 GValue *properties;
3032 GList *changed_properties;
3033 GSource *changed_properties_idle_source;
3034 GMainContext *context;
3035 GMutex lock;
3036};
3037
3038static void
3039_fan_skeleton_handle_method_call (
3040 GDBusConnection *connection G_GNUC_UNUSED,
3041 const gchar *sender G_GNUC_UNUSED,
3042 const gchar *object_path G_GNUC_UNUSED,
3043 const gchar *interface_name,
3044 const gchar *method_name,
3045 GVariant *parameters,
3046 GDBusMethodInvocation *invocation,
3047 gpointer user_data)
3048{
3049 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3050 _ExtendedGDBusMethodInfo *info;
3051 GVariantIter iter;
3052 GVariant *child;
3053 GValue *paramv;
3054 guint num_params;
3055 guint num_extra;
3056 guint n;
3057 guint signal_id;
3058 GValue return_value = G_VALUE_INIT;
3059 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3060 g_assert (info != NULL);
3061 num_params = g_variant_n_children (parameters);
3062 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3063 n = 0;
3064 g_value_init (&paramv[n], TYPE_FAN);
3065 g_value_set_object (&paramv[n++], skeleton);
3066 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3067 g_value_set_object (&paramv[n++], invocation);
3068 if (info->pass_fdlist)
3069 {
3070#ifdef G_OS_UNIX
3071 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3072 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3073#else
3074 g_assert_not_reached ();
3075#endif
3076 }
3077 g_variant_iter_init (&iter, parameters);
3078 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3079 {
3080 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3081 if (arg_info->use_gvariant)
3082 {
3083 g_value_init (&paramv[n], G_TYPE_VARIANT);
3084 g_value_set_variant (&paramv[n], child);
3085 n++;
3086 }
3087 else
3088 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3089 g_variant_unref (child);
3090 }
3091 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3092 g_value_init (&return_value, G_TYPE_BOOLEAN);
3093 g_signal_emitv (paramv, signal_id, 0, &return_value);
3094 if (!g_value_get_boolean (&return_value))
3095 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);
3096 g_value_unset (&return_value);
3097 for (n = 0; n < num_params + num_extra; n++)
3098 g_value_unset (&paramv[n]);
3099 g_free (paramv);
3100}
3101
3102static GVariant *
3103_fan_skeleton_handle_get_property (
3104 GDBusConnection *connection G_GNUC_UNUSED,
3105 const gchar *sender G_GNUC_UNUSED,
3106 const gchar *object_path G_GNUC_UNUSED,
3107 const gchar *interface_name G_GNUC_UNUSED,
3108 const gchar *property_name,
3109 GError **error,
3110 gpointer user_data)
3111{
3112 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3113 GValue value = G_VALUE_INIT;
3114 GParamSpec *pspec;
3115 _ExtendedGDBusPropertyInfo *info;
3116 GVariant *ret;
3117 ret = NULL;
3118 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3119 g_assert (info != NULL);
3120 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3121 if (pspec == NULL)
3122 {
3123 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3124 }
3125 else
3126 {
3127 g_value_init (&value, pspec->value_type);
3128 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3129 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3130 g_value_unset (&value);
3131 }
3132 return ret;
3133}
3134
3135static gboolean
3136_fan_skeleton_handle_set_property (
3137 GDBusConnection *connection G_GNUC_UNUSED,
3138 const gchar *sender G_GNUC_UNUSED,
3139 const gchar *object_path G_GNUC_UNUSED,
3140 const gchar *interface_name G_GNUC_UNUSED,
3141 const gchar *property_name,
3142 GVariant *variant,
3143 GError **error,
3144 gpointer user_data)
3145{
3146 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3147 GValue value = G_VALUE_INIT;
3148 GParamSpec *pspec;
3149 _ExtendedGDBusPropertyInfo *info;
3150 gboolean ret;
3151 ret = FALSE;
3152 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3153 g_assert (info != NULL);
3154 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3155 if (pspec == NULL)
3156 {
3157 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3158 }
3159 else
3160 {
3161 if (info->use_gvariant)
3162 g_value_set_variant (&value, variant);
3163 else
3164 g_dbus_gvariant_to_gvalue (variant, &value);
3165 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3166 g_value_unset (&value);
3167 ret = TRUE;
3168 }
3169 return ret;
3170}
3171
3172static const GDBusInterfaceVTable _fan_skeleton_vtable =
3173{
3174 _fan_skeleton_handle_method_call,
3175 _fan_skeleton_handle_get_property,
3176 _fan_skeleton_handle_set_property,
3177 {NULL}
3178};
3179
3180static GDBusInterfaceInfo *
3181fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3182{
3183 return fan_interface_info ();
3184}
3185
3186static GDBusInterfaceVTable *
3187fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3188{
3189 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3190}
3191
3192static GVariant *
3193fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3194{
3195 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3196
3197 GVariantBuilder builder;
3198 guint n;
3199 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3200 if (_fan_interface_info.parent_struct.properties == NULL)
3201 goto out;
3202 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3203 {
3204 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3205 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3206 {
3207 GVariant *value;
3208 value = _fan_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.Fan", info->name, NULL, skeleton);
3209 if (value != NULL)
3210 {
3211 g_variant_take_ref (value);
3212 g_variant_builder_add (&builder, "{sv}", info->name, value);
3213 g_variant_unref (value);
3214 }
3215 }
3216 }
3217out:
3218 return g_variant_builder_end (&builder);
3219}
3220
3221static gboolean _fan_emit_changed (gpointer user_data);
3222
3223static void
3224fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3225{
3226 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3227 gboolean emit_changed = FALSE;
3228
3229 g_mutex_lock (&skeleton->priv->lock);
3230 if (skeleton->priv->changed_properties_idle_source != NULL)
3231 {
3232 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3233 skeleton->priv->changed_properties_idle_source = NULL;
3234 emit_changed = TRUE;
3235 }
3236 g_mutex_unlock (&skeleton->priv->lock);
3237
3238 if (emit_changed)
3239 _fan_emit_changed (skeleton);
3240}
3241
3242static void
3243_fan_on_signal_speed_changed (
3244 Fan *object,
3245 gint arg_speed)
3246{
3247 FanSkeleton *skeleton = FAN_SKELETON (object);
3248
3249 GList *connections, *l;
3250 GVariant *signal_variant;
3251 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3252
3253 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3254 arg_speed));
3255 for (l = connections; l != NULL; l = l->next)
3256 {
3257 GDBusConnection *connection = l->data;
3258 g_dbus_connection_emit_signal (connection,
3259 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3260 signal_variant, NULL);
3261 }
3262 g_variant_unref (signal_variant);
3263 g_list_free_full (connections, g_object_unref);
3264}
3265
3266static void
3267_fan_on_signal_tach_error (
3268 Fan *object)
3269{
3270 FanSkeleton *skeleton = FAN_SKELETON (object);
3271
3272 GList *connections, *l;
3273 GVariant *signal_variant;
3274 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3275
3276 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3277 for (l = connections; l != NULL; l = l->next)
3278 {
3279 GDBusConnection *connection = l->data;
3280 g_dbus_connection_emit_signal (connection,
3281 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3282 signal_variant, NULL);
3283 }
3284 g_variant_unref (signal_variant);
3285 g_list_free_full (connections, g_object_unref);
3286}
3287
3288static void fan_skeleton_iface_init (FanIface *iface);
3289#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3290G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3291 G_ADD_PRIVATE (FanSkeleton)
3292 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3293
3294#else
3295G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3296 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3297
3298#endif
3299static void
3300fan_skeleton_finalize (GObject *object)
3301{
3302 FanSkeleton *skeleton = FAN_SKELETON (object);
3303 guint n;
3304 for (n = 0; n < 3; n++)
3305 g_value_unset (&skeleton->priv->properties[n]);
3306 g_free (skeleton->priv->properties);
3307 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3308 if (skeleton->priv->changed_properties_idle_source != NULL)
3309 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3310 g_main_context_unref (skeleton->priv->context);
3311 g_mutex_clear (&skeleton->priv->lock);
3312 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3313}
3314
3315static void
3316fan_skeleton_get_property (GObject *object,
3317 guint prop_id,
3318 GValue *value,
3319 GParamSpec *pspec G_GNUC_UNUSED)
3320{
3321 FanSkeleton *skeleton = FAN_SKELETON (object);
3322 g_assert (prop_id != 0 && prop_id - 1 < 3);
3323 g_mutex_lock (&skeleton->priv->lock);
3324 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3325 g_mutex_unlock (&skeleton->priv->lock);
3326}
3327
3328static gboolean
3329_fan_emit_changed (gpointer user_data)
3330{
3331 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3332 GList *l;
3333 GVariantBuilder builder;
3334 GVariantBuilder invalidated_builder;
3335 guint num_changes;
3336
3337 g_mutex_lock (&skeleton->priv->lock);
3338 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3339 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3340 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3341 {
3342 ChangedProperty *cp = l->data;
3343 GVariant *variant;
3344 const GValue *cur_value;
3345
3346 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3347 if (!_g_value_equal (cur_value, &cp->orig_value))
3348 {
3349 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3350 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3351 g_variant_unref (variant);
3352 num_changes++;
3353 }
3354 }
3355 if (num_changes > 0)
3356 {
3357 GList *connections, *ll;
3358 GVariant *signal_variant;
3359 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3360 &builder, &invalidated_builder));
3361 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3362 for (ll = connections; ll != NULL; ll = ll->next)
3363 {
3364 GDBusConnection *connection = ll->data;
3365
3366 g_dbus_connection_emit_signal (connection,
3367 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3368 "org.freedesktop.DBus.Properties",
3369 "PropertiesChanged",
3370 signal_variant,
3371 NULL);
3372 }
3373 g_variant_unref (signal_variant);
3374 g_list_free_full (connections, g_object_unref);
3375 }
3376 else
3377 {
3378 g_variant_builder_clear (&builder);
3379 g_variant_builder_clear (&invalidated_builder);
3380 }
3381 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3382 skeleton->priv->changed_properties = NULL;
3383 skeleton->priv->changed_properties_idle_source = NULL;
3384 g_mutex_unlock (&skeleton->priv->lock);
3385 return FALSE;
3386}
3387
3388static void
3389_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3390{
3391 ChangedProperty *cp;
3392 GList *l;
3393 cp = NULL;
3394 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3395 {
3396 ChangedProperty *i_cp = l->data;
3397 if (i_cp->info == info)
3398 {
3399 cp = i_cp;
3400 break;
3401 }
3402 }
3403 if (cp == NULL)
3404 {
3405 cp = g_new0 (ChangedProperty, 1);
3406 cp->prop_id = prop_id;
3407 cp->info = info;
3408 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3409 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3410 g_value_copy (orig_value, &cp->orig_value);
3411 }
3412}
3413
3414static void
3415fan_skeleton_notify (GObject *object,
3416 GParamSpec *pspec G_GNUC_UNUSED)
3417{
3418 FanSkeleton *skeleton = FAN_SKELETON (object);
3419 g_mutex_lock (&skeleton->priv->lock);
3420 if (skeleton->priv->changed_properties != NULL &&
3421 skeleton->priv->changed_properties_idle_source == NULL)
3422 {
3423 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3424 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3425 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3426 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3427 g_source_unref (skeleton->priv->changed_properties_idle_source);
3428 }
3429 g_mutex_unlock (&skeleton->priv->lock);
3430}
3431
3432static void
3433fan_skeleton_set_property (GObject *object,
3434 guint prop_id,
3435 const GValue *value,
3436 GParamSpec *pspec)
3437{
3438 FanSkeleton *skeleton = FAN_SKELETON (object);
3439 g_assert (prop_id != 0 && prop_id - 1 < 3);
3440 g_mutex_lock (&skeleton->priv->lock);
3441 g_object_freeze_notify (object);
3442 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3443 {
3444 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3445 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3446 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3447 g_object_notify_by_pspec (object, pspec);
3448 }
3449 g_mutex_unlock (&skeleton->priv->lock);
3450 g_object_thaw_notify (object);
3451}
3452
3453static void
3454fan_skeleton_init (FanSkeleton *skeleton)
3455{
3456#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3457 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3458#else
3459 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3460#endif
3461
3462 g_mutex_init (&skeleton->priv->lock);
3463 skeleton->priv->context = g_main_context_ref_thread_default ();
3464 skeleton->priv->properties = g_new0 (GValue, 3);
3465 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3466 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3467 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3468}
3469
3470static gint
3471fan_skeleton_get_speed (Fan *object)
3472{
3473 FanSkeleton *skeleton = FAN_SKELETON (object);
3474 gint value;
3475 g_mutex_lock (&skeleton->priv->lock);
3476 value = g_value_get_int (&(skeleton->priv->properties[0]));
3477 g_mutex_unlock (&skeleton->priv->lock);
3478 return value;
3479}
3480
3481static gint
3482fan_skeleton_get_cooling_zone (Fan *object)
3483{
3484 FanSkeleton *skeleton = FAN_SKELETON (object);
3485 gint value;
3486 g_mutex_lock (&skeleton->priv->lock);
3487 value = g_value_get_int (&(skeleton->priv->properties[1]));
3488 g_mutex_unlock (&skeleton->priv->lock);
3489 return value;
3490}
3491
3492static gint
3493fan_skeleton_get_pwm_num (Fan *object)
3494{
3495 FanSkeleton *skeleton = FAN_SKELETON (object);
3496 gint value;
3497 g_mutex_lock (&skeleton->priv->lock);
3498 value = g_value_get_int (&(skeleton->priv->properties[2]));
3499 g_mutex_unlock (&skeleton->priv->lock);
3500 return value;
3501}
3502
3503static void
3504fan_skeleton_class_init (FanSkeletonClass *klass)
3505{
3506 GObjectClass *gobject_class;
3507 GDBusInterfaceSkeletonClass *skeleton_class;
3508
3509 gobject_class = G_OBJECT_CLASS (klass);
3510 gobject_class->finalize = fan_skeleton_finalize;
3511 gobject_class->get_property = fan_skeleton_get_property;
3512 gobject_class->set_property = fan_skeleton_set_property;
3513 gobject_class->notify = fan_skeleton_notify;
3514
3515
3516 fan_override_properties (gobject_class, 1);
3517
3518 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3519 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3520 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3521 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3522 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3523
3524#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3525 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3526#endif
3527}
3528
3529static void
3530fan_skeleton_iface_init (FanIface *iface)
3531{
3532 iface->speed_changed = _fan_on_signal_speed_changed;
3533 iface->tach_error = _fan_on_signal_tach_error;
3534 iface->get_speed = fan_skeleton_get_speed;
3535 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3536 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3537}
3538
3539/**
3540 * fan_skeleton_new:
3541 *
3542 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3543 *
3544 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3545 */
3546Fan *
3547fan_skeleton_new (void)
3548{
3549 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3550}
3551
3552/* ------------------------------------------------------------------------
3553 * Code for interface org.openbmc.SensorValue
3554 * ------------------------------------------------------------------------
3555 */
3556
3557/**
3558 * SECTION:SensorValue
3559 * @title: SensorValue
3560 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3561 *
3562 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface in C.
3563 */
3564
3565/* ---- Introspection data for org.openbmc.SensorValue ---- */
3566
3567static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3568{
3569 {
3570 -1,
3571 (gchar *) "init",
3572 NULL,
3573 NULL,
3574 NULL
3575 },
3576 "handle-init",
3577 FALSE
3578};
3579
3580static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3581{
3582 {
3583 -1,
3584 (gchar *) "value",
3585 (gchar *) "v",
3586 NULL
3587 },
3588 FALSE
3589};
3590
3591static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3592{
3593 &_sensor_value_method_info_get_value_OUT_ARG_value,
3594 NULL
3595};
3596
3597static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3598{
3599 {
3600 -1,
3601 (gchar *) "getValue",
3602 NULL,
3603 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3604 NULL
3605 },
3606 "handle-get-value",
3607 FALSE
3608};
3609
Norman James362a80f2015-09-14 14:04:39 -05003610static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3611{
3612 &_sensor_value_method_info_init,
3613 &_sensor_value_method_info_get_value,
Norman James362a80f2015-09-14 14:04:39 -05003614 NULL
3615};
3616
3617static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3618{
3619 {
3620 -1,
3621 (gchar *) "value",
3622 (gchar *) "v",
3623 NULL
3624 },
3625 FALSE
3626};
3627
3628static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3629{
3630 {
3631 -1,
3632 (gchar *) "units",
3633 (gchar *) "s",
3634 NULL
3635 },
3636 FALSE
3637};
3638
3639static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3640{
3641 &_sensor_value_signal_info_changed_ARG_value,
3642 &_sensor_value_signal_info_changed_ARG_units,
3643 NULL
3644};
3645
3646static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3647{
3648 {
3649 -1,
3650 (gchar *) "Changed",
3651 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3652 NULL
3653 },
3654 "changed"
3655};
3656
Norman James32e74e22015-09-15 21:28:06 -05003657static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
3658{
3659 {
3660 -1,
3661 (gchar *) "Error",
3662 NULL,
3663 NULL
3664 },
3665 "error"
3666};
3667
Norman James362a80f2015-09-14 14:04:39 -05003668static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3669{
3670 {
3671 -1,
3672 (gchar *) "bus_name",
3673 (gchar *) "s",
3674 NULL
3675 },
3676 FALSE
3677};
3678
3679static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3680{
3681 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3682 NULL
3683};
3684
3685static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3686{
3687 {
3688 -1,
3689 (gchar *) "Heartbeat",
3690 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3691 NULL
3692 },
3693 "heartbeat"
3694};
3695
3696static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3697{
3698 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05003699 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05003700 &_sensor_value_signal_info_heartbeat,
3701 NULL
3702};
3703
3704static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3705{
3706 {
3707 -1,
3708 (gchar *) "value",
3709 (gchar *) "v",
3710 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3711 NULL
3712 },
3713 "value",
3714 FALSE
3715};
3716
3717static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3718{
3719 {
3720 -1,
3721 (gchar *) "units",
3722 (gchar *) "s",
3723 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3724 NULL
3725 },
3726 "units",
3727 FALSE
3728};
3729
3730static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3731{
3732 {
3733 -1,
3734 (gchar *) "poll_interval",
3735 (gchar *) "i",
3736 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3737 NULL
3738 },
3739 "poll-interval",
3740 FALSE
3741};
3742
3743static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3744{
3745 {
3746 -1,
3747 (gchar *) "heatbeat",
3748 (gchar *) "i",
3749 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3750 NULL
3751 },
3752 "heatbeat",
3753 FALSE
3754};
3755
3756static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3757{
3758 {
3759 -1,
3760 (gchar *) "settable",
3761 (gchar *) "b",
3762 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3763 NULL
3764 },
3765 "settable",
3766 FALSE
3767};
3768
Norman James362a80f2015-09-14 14:04:39 -05003769static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3770{
3771 &_sensor_value_property_info_value,
3772 &_sensor_value_property_info_units,
3773 &_sensor_value_property_info_poll_interval,
3774 &_sensor_value_property_info_heatbeat,
3775 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05003776 NULL
3777};
3778
3779static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3780{
3781 {
3782 -1,
3783 (gchar *) "org.openbmc.SensorValue",
3784 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3785 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3786 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3787 NULL
3788 },
3789 "sensor-value",
3790};
3791
3792
3793/**
3794 * sensor_value_interface_info:
3795 *
3796 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3797 *
3798 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3799 */
3800GDBusInterfaceInfo *
3801sensor_value_interface_info (void)
3802{
3803 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3804}
3805
3806/**
3807 * sensor_value_override_properties:
3808 * @klass: The class structure for a #GObject<!-- -->-derived class.
3809 * @property_id_begin: The property id to assign to the first overridden property.
3810 *
3811 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3812 * The properties are overridden in the order they are defined.
3813 *
3814 * Returns: The last property id.
3815 */
3816guint
3817sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3818{
3819 g_object_class_override_property (klass, property_id_begin++, "value");
3820 g_object_class_override_property (klass, property_id_begin++, "units");
3821 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3822 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3823 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05003824 return property_id_begin - 1;
3825}
3826
3827
3828
3829/**
3830 * SensorValue:
3831 *
3832 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3833 */
3834
3835/**
3836 * SensorValueIface:
3837 * @parent_iface: The parent interface.
3838 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3839 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James362a80f2015-09-14 14:04:39 -05003840 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05003841 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3842 * @get_settable: Getter for the #SensorValue:settable property.
3843 * @get_units: Getter for the #SensorValue:units property.
3844 * @get_value: Getter for the #SensorValue:value property.
3845 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003846 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003847 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3848 *
3849 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3850 */
3851
3852typedef SensorValueIface SensorValueInterface;
3853G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3854
3855static void
3856sensor_value_default_init (SensorValueIface *iface)
3857{
3858 /* GObject signals for incoming D-Bus method calls: */
3859 /**
3860 * SensorValue::handle-init:
3861 * @object: A #SensorValue.
3862 * @invocation: A #GDBusMethodInvocation.
3863 *
3864 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3865 *
3866 * 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_value_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.
3867 *
3868 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3869 */
3870 g_signal_new ("handle-init",
3871 G_TYPE_FROM_INTERFACE (iface),
3872 G_SIGNAL_RUN_LAST,
3873 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3874 g_signal_accumulator_true_handled,
3875 NULL,
3876 g_cclosure_marshal_generic,
3877 G_TYPE_BOOLEAN,
3878 1,
3879 G_TYPE_DBUS_METHOD_INVOCATION);
3880
3881 /**
3882 * SensorValue::handle-get-value:
3883 * @object: A #SensorValue.
3884 * @invocation: A #GDBusMethodInvocation.
3885 *
3886 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3887 *
3888 * 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_value_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.
3889 *
3890 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3891 */
3892 g_signal_new ("handle-get-value",
3893 G_TYPE_FROM_INTERFACE (iface),
3894 G_SIGNAL_RUN_LAST,
3895 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3896 g_signal_accumulator_true_handled,
3897 NULL,
3898 g_cclosure_marshal_generic,
3899 G_TYPE_BOOLEAN,
3900 1,
3901 G_TYPE_DBUS_METHOD_INVOCATION);
3902
Norman James362a80f2015-09-14 14:04:39 -05003903 /* GObject signals for received D-Bus signals: */
3904 /**
3905 * SensorValue::changed:
3906 * @object: A #SensorValue.
3907 * @arg_value: Argument.
3908 * @arg_units: Argument.
3909 *
3910 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> is received.
3911 *
3912 * 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.
3913 */
3914 g_signal_new ("changed",
3915 G_TYPE_FROM_INTERFACE (iface),
3916 G_SIGNAL_RUN_LAST,
3917 G_STRUCT_OFFSET (SensorValueIface, changed),
3918 NULL,
3919 NULL,
3920 g_cclosure_marshal_generic,
3921 G_TYPE_NONE,
3922 2, G_TYPE_VARIANT, G_TYPE_STRING);
3923
3924 /**
Norman James32e74e22015-09-15 21:28:06 -05003925 * SensorValue::error:
3926 * @object: A #SensorValue.
3927 *
3928 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> is received.
3929 *
3930 * 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.
3931 */
3932 g_signal_new ("error",
3933 G_TYPE_FROM_INTERFACE (iface),
3934 G_SIGNAL_RUN_LAST,
3935 G_STRUCT_OFFSET (SensorValueIface, error),
3936 NULL,
3937 NULL,
3938 g_cclosure_marshal_generic,
3939 G_TYPE_NONE,
3940 0);
3941
3942 /**
Norman James362a80f2015-09-14 14:04:39 -05003943 * SensorValue::heartbeat:
3944 * @object: A #SensorValue.
3945 * @arg_bus_name: Argument.
3946 *
3947 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> is received.
3948 *
3949 * 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.
3950 */
3951 g_signal_new ("heartbeat",
3952 G_TYPE_FROM_INTERFACE (iface),
3953 G_SIGNAL_RUN_LAST,
3954 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
3955 NULL,
3956 NULL,
3957 g_cclosure_marshal_generic,
3958 G_TYPE_NONE,
3959 1, G_TYPE_STRING);
3960
3961 /* GObject properties for D-Bus properties: */
3962 /**
3963 * SensorValue:value:
3964 *
3965 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
3966 *
3967 * 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.
3968 */
3969 g_object_interface_install_property (iface,
3970 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3971 /**
3972 * SensorValue:units:
3973 *
3974 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
3975 *
3976 * 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.
3977 */
3978 g_object_interface_install_property (iface,
3979 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3980 /**
3981 * SensorValue:poll-interval:
3982 *
3983 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
3984 *
3985 * 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.
3986 */
3987 g_object_interface_install_property (iface,
3988 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3989 /**
3990 * SensorValue:heatbeat:
3991 *
3992 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
3993 *
3994 * 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.
3995 */
3996 g_object_interface_install_property (iface,
3997 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3998 /**
3999 * SensorValue:settable:
4000 *
4001 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4002 *
4003 * 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.
4004 */
4005 g_object_interface_install_property (iface,
4006 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004007}
4008
4009/**
4010 * sensor_value_get_value: (skip)
4011 * @object: A #SensorValue.
4012 *
4013 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4014 *
4015 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4016 *
4017 * <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_value_dup_value() if on another thread.</warning>
4018 *
4019 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4020 */
4021GVariant *
4022sensor_value_get_value (SensorValue *object)
4023{
4024 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4025}
4026
4027/**
4028 * sensor_value_dup_value: (skip)
4029 * @object: A #SensorValue.
4030 *
4031 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4032 *
4033 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4034 *
4035 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4036 */
4037GVariant *
4038sensor_value_dup_value (SensorValue *object)
4039{
4040 GVariant *value;
4041 g_object_get (G_OBJECT (object), "value", &value, NULL);
4042 return value;
4043}
4044
4045/**
4046 * sensor_value_set_value: (skip)
4047 * @object: A #SensorValue.
4048 * @value: The value to set.
4049 *
4050 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4051 *
4052 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4053 */
4054void
4055sensor_value_set_value (SensorValue *object, GVariant *value)
4056{
4057 g_object_set (G_OBJECT (object), "value", value, NULL);
4058}
4059
4060/**
4061 * sensor_value_get_units: (skip)
4062 * @object: A #SensorValue.
4063 *
4064 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4065 *
4066 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4067 *
4068 * <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_value_dup_units() if on another thread.</warning>
4069 *
4070 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4071 */
4072const gchar *
4073sensor_value_get_units (SensorValue *object)
4074{
4075 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4076}
4077
4078/**
4079 * sensor_value_dup_units: (skip)
4080 * @object: A #SensorValue.
4081 *
4082 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4083 *
4084 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4085 *
4086 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4087 */
4088gchar *
4089sensor_value_dup_units (SensorValue *object)
4090{
4091 gchar *value;
4092 g_object_get (G_OBJECT (object), "units", &value, NULL);
4093 return value;
4094}
4095
4096/**
4097 * sensor_value_set_units: (skip)
4098 * @object: A #SensorValue.
4099 * @value: The value to set.
4100 *
4101 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4102 *
4103 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4104 */
4105void
4106sensor_value_set_units (SensorValue *object, const gchar *value)
4107{
4108 g_object_set (G_OBJECT (object), "units", value, NULL);
4109}
4110
4111/**
4112 * sensor_value_get_poll_interval: (skip)
4113 * @object: A #SensorValue.
4114 *
4115 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4116 *
4117 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4118 *
4119 * Returns: The property value.
4120 */
4121gint
4122sensor_value_get_poll_interval (SensorValue *object)
4123{
4124 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4125}
4126
4127/**
4128 * sensor_value_set_poll_interval: (skip)
4129 * @object: A #SensorValue.
4130 * @value: The value to set.
4131 *
4132 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4133 *
4134 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4135 */
4136void
4137sensor_value_set_poll_interval (SensorValue *object, gint value)
4138{
4139 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4140}
4141
4142/**
4143 * sensor_value_get_heatbeat: (skip)
4144 * @object: A #SensorValue.
4145 *
4146 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4147 *
4148 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4149 *
4150 * Returns: The property value.
4151 */
4152gint
4153sensor_value_get_heatbeat (SensorValue *object)
4154{
4155 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4156}
4157
4158/**
4159 * sensor_value_set_heatbeat: (skip)
4160 * @object: A #SensorValue.
4161 * @value: The value to set.
4162 *
4163 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4164 *
4165 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4166 */
4167void
4168sensor_value_set_heatbeat (SensorValue *object, gint value)
4169{
4170 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4171}
4172
4173/**
4174 * sensor_value_get_settable: (skip)
4175 * @object: A #SensorValue.
4176 *
4177 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4178 *
4179 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4180 *
4181 * Returns: The property value.
4182 */
4183gboolean
4184sensor_value_get_settable (SensorValue *object)
4185{
4186 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4187}
4188
4189/**
4190 * sensor_value_set_settable: (skip)
4191 * @object: A #SensorValue.
4192 * @value: The value to set.
4193 *
4194 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4195 *
4196 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4197 */
4198void
4199sensor_value_set_settable (SensorValue *object, gboolean value)
4200{
4201 g_object_set (G_OBJECT (object), "settable", value, NULL);
4202}
4203
4204/**
Norman James362a80f2015-09-14 14:04:39 -05004205 * sensor_value_emit_changed:
4206 * @object: A #SensorValue.
4207 * @arg_value: Argument to pass with the signal.
4208 * @arg_units: Argument to pass with the signal.
4209 *
4210 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4211 */
4212void
4213sensor_value_emit_changed (
4214 SensorValue *object,
4215 GVariant *arg_value,
4216 const gchar *arg_units)
4217{
4218 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4219}
4220
4221/**
Norman James32e74e22015-09-15 21:28:06 -05004222 * sensor_value_emit_error:
4223 * @object: A #SensorValue.
4224 *
4225 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4226 */
4227void
4228sensor_value_emit_error (
4229 SensorValue *object)
4230{
4231 g_signal_emit_by_name (object, "error");
4232}
4233
4234/**
Norman James362a80f2015-09-14 14:04:39 -05004235 * sensor_value_emit_heartbeat:
4236 * @object: A #SensorValue.
4237 * @arg_bus_name: Argument to pass with the signal.
4238 *
4239 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4240 */
4241void
4242sensor_value_emit_heartbeat (
4243 SensorValue *object,
4244 const gchar *arg_bus_name)
4245{
4246 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4247}
4248
4249/**
4250 * sensor_value_call_init:
4251 * @proxy: A #SensorValueProxy.
4252 * @cancellable: (allow-none): A #GCancellable or %NULL.
4253 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4254 * @user_data: User data to pass to @callback.
4255 *
4256 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4257 * 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.
4258 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4259 *
4260 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4261 */
4262void
4263sensor_value_call_init (
4264 SensorValue *proxy,
4265 GCancellable *cancellable,
4266 GAsyncReadyCallback callback,
4267 gpointer user_data)
4268{
4269 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4270 "init",
4271 g_variant_new ("()"),
4272 G_DBUS_CALL_FLAGS_NONE,
4273 -1,
4274 cancellable,
4275 callback,
4276 user_data);
4277}
4278
4279/**
4280 * sensor_value_call_init_finish:
4281 * @proxy: A #SensorValueProxy.
4282 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4283 * @error: Return location for error or %NULL.
4284 *
4285 * Finishes an operation started with sensor_value_call_init().
4286 *
4287 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4288 */
4289gboolean
4290sensor_value_call_init_finish (
4291 SensorValue *proxy,
4292 GAsyncResult *res,
4293 GError **error)
4294{
4295 GVariant *_ret;
4296 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4297 if (_ret == NULL)
4298 goto _out;
4299 g_variant_get (_ret,
4300 "()");
4301 g_variant_unref (_ret);
4302_out:
4303 return _ret != NULL;
4304}
4305
4306/**
4307 * sensor_value_call_init_sync:
4308 * @proxy: A #SensorValueProxy.
4309 * @cancellable: (allow-none): A #GCancellable or %NULL.
4310 * @error: Return location for error or %NULL.
4311 *
4312 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4313 *
4314 * See sensor_value_call_init() for the asynchronous version of this method.
4315 *
4316 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4317 */
4318gboolean
4319sensor_value_call_init_sync (
4320 SensorValue *proxy,
4321 GCancellable *cancellable,
4322 GError **error)
4323{
4324 GVariant *_ret;
4325 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4326 "init",
4327 g_variant_new ("()"),
4328 G_DBUS_CALL_FLAGS_NONE,
4329 -1,
4330 cancellable,
4331 error);
4332 if (_ret == NULL)
4333 goto _out;
4334 g_variant_get (_ret,
4335 "()");
4336 g_variant_unref (_ret);
4337_out:
4338 return _ret != NULL;
4339}
4340
4341/**
4342 * sensor_value_call_get_value:
4343 * @proxy: A #SensorValueProxy.
4344 * @cancellable: (allow-none): A #GCancellable or %NULL.
4345 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4346 * @user_data: User data to pass to @callback.
4347 *
4348 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4349 * 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.
4350 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4351 *
4352 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4353 */
4354void
4355sensor_value_call_get_value (
4356 SensorValue *proxy,
4357 GCancellable *cancellable,
4358 GAsyncReadyCallback callback,
4359 gpointer user_data)
4360{
4361 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4362 "getValue",
4363 g_variant_new ("()"),
4364 G_DBUS_CALL_FLAGS_NONE,
4365 -1,
4366 cancellable,
4367 callback,
4368 user_data);
4369}
4370
4371/**
4372 * sensor_value_call_get_value_finish:
4373 * @proxy: A #SensorValueProxy.
4374 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4375 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4376 * @error: Return location for error or %NULL.
4377 *
4378 * Finishes an operation started with sensor_value_call_get_value().
4379 *
4380 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4381 */
4382gboolean
4383sensor_value_call_get_value_finish (
4384 SensorValue *proxy,
4385 GVariant **out_value,
4386 GAsyncResult *res,
4387 GError **error)
4388{
4389 GVariant *_ret;
4390 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4391 if (_ret == NULL)
4392 goto _out;
4393 g_variant_get (_ret,
4394 "(@v)",
4395 out_value);
4396 g_variant_unref (_ret);
4397_out:
4398 return _ret != NULL;
4399}
4400
4401/**
4402 * sensor_value_call_get_value_sync:
4403 * @proxy: A #SensorValueProxy.
4404 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4405 * @cancellable: (allow-none): A #GCancellable or %NULL.
4406 * @error: Return location for error or %NULL.
4407 *
4408 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4409 *
4410 * See sensor_value_call_get_value() for the asynchronous version of this method.
4411 *
4412 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4413 */
4414gboolean
4415sensor_value_call_get_value_sync (
4416 SensorValue *proxy,
4417 GVariant **out_value,
4418 GCancellable *cancellable,
4419 GError **error)
4420{
4421 GVariant *_ret;
4422 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4423 "getValue",
4424 g_variant_new ("()"),
4425 G_DBUS_CALL_FLAGS_NONE,
4426 -1,
4427 cancellable,
4428 error);
4429 if (_ret == NULL)
4430 goto _out;
4431 g_variant_get (_ret,
4432 "(@v)",
4433 out_value);
4434 g_variant_unref (_ret);
4435_out:
4436 return _ret != NULL;
4437}
4438
4439/**
Norman James362a80f2015-09-14 14:04:39 -05004440 * sensor_value_complete_init:
4441 * @object: A #SensorValue.
4442 * @invocation: (transfer full): A #GDBusMethodInvocation.
4443 *
4444 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.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.
4445 *
4446 * This method will free @invocation, you cannot use it afterwards.
4447 */
4448void
4449sensor_value_complete_init (
4450 SensorValue *object,
4451 GDBusMethodInvocation *invocation)
4452{
4453 g_dbus_method_invocation_return_value (invocation,
4454 g_variant_new ("()"));
4455}
4456
4457/**
4458 * sensor_value_complete_get_value:
4459 * @object: A #SensorValue.
4460 * @invocation: (transfer full): A #GDBusMethodInvocation.
4461 * @value: Parameter to return.
4462 *
4463 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.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.
4464 *
4465 * This method will free @invocation, you cannot use it afterwards.
4466 */
4467void
4468sensor_value_complete_get_value (
4469 SensorValue *object,
4470 GDBusMethodInvocation *invocation,
4471 GVariant *value)
4472{
4473 g_dbus_method_invocation_return_value (invocation,
4474 g_variant_new ("(@v)",
4475 value));
4476}
4477
Norman James362a80f2015-09-14 14:04:39 -05004478/* ------------------------------------------------------------------------ */
4479
4480/**
4481 * SensorValueProxy:
4482 *
4483 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4484 */
4485
4486/**
4487 * SensorValueProxyClass:
4488 * @parent_class: The parent class.
4489 *
4490 * Class structure for #SensorValueProxy.
4491 */
4492
4493struct _SensorValueProxyPrivate
4494{
4495 GData *qdata;
4496};
4497
4498static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4499
4500#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4501G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4502 G_ADD_PRIVATE (SensorValueProxy)
4503 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4504
4505#else
4506G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4507 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4508
4509#endif
4510static void
4511sensor_value_proxy_finalize (GObject *object)
4512{
4513 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4514 g_datalist_clear (&proxy->priv->qdata);
4515 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4516}
4517
4518static void
4519sensor_value_proxy_get_property (GObject *object,
4520 guint prop_id,
4521 GValue *value,
4522 GParamSpec *pspec G_GNUC_UNUSED)
4523{
4524 const _ExtendedGDBusPropertyInfo *info;
4525 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004526 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004527 info = _sensor_value_property_info_pointers[prop_id - 1];
4528 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4529 if (info->use_gvariant)
4530 {
4531 g_value_set_variant (value, variant);
4532 }
4533 else
4534 {
4535 if (variant != NULL)
4536 g_dbus_gvariant_to_gvalue (variant, value);
4537 }
4538 if (variant != NULL)
4539 g_variant_unref (variant);
4540}
4541
4542static void
4543sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4544 GAsyncResult *res,
4545 gpointer user_data)
4546{
4547 const _ExtendedGDBusPropertyInfo *info = user_data;
4548 GError *error;
4549 GVariant *_ret;
4550 error = NULL;
4551 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4552 if (!_ret)
4553 {
4554 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4555 info->parent_struct.name,
4556 error->message, g_quark_to_string (error->domain), error->code);
4557 g_error_free (error);
4558 }
4559 else
4560 {
4561 g_variant_unref (_ret);
4562 }
4563}
4564
4565static void
4566sensor_value_proxy_set_property (GObject *object,
4567 guint prop_id,
4568 const GValue *value,
4569 GParamSpec *pspec G_GNUC_UNUSED)
4570{
4571 const _ExtendedGDBusPropertyInfo *info;
4572 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004573 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004574 info = _sensor_value_property_info_pointers[prop_id - 1];
4575 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4576 g_dbus_proxy_call (G_DBUS_PROXY (object),
4577 "org.freedesktop.DBus.Properties.Set",
4578 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4579 G_DBUS_CALL_FLAGS_NONE,
4580 -1,
4581 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4582 g_variant_unref (variant);
4583}
4584
4585static void
4586sensor_value_proxy_g_signal (GDBusProxy *proxy,
4587 const gchar *sender_name G_GNUC_UNUSED,
4588 const gchar *signal_name,
4589 GVariant *parameters)
4590{
4591 _ExtendedGDBusSignalInfo *info;
4592 GVariantIter iter;
4593 GVariant *child;
4594 GValue *paramv;
4595 guint num_params;
4596 guint n;
4597 guint signal_id;
4598 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4599 if (info == NULL)
4600 return;
4601 num_params = g_variant_n_children (parameters);
4602 paramv = g_new0 (GValue, num_params + 1);
4603 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4604 g_value_set_object (&paramv[0], proxy);
4605 g_variant_iter_init (&iter, parameters);
4606 n = 1;
4607 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4608 {
4609 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4610 if (arg_info->use_gvariant)
4611 {
4612 g_value_init (&paramv[n], G_TYPE_VARIANT);
4613 g_value_set_variant (&paramv[n], child);
4614 n++;
4615 }
4616 else
4617 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4618 g_variant_unref (child);
4619 }
4620 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4621 g_signal_emitv (paramv, signal_id, 0, NULL);
4622 for (n = 0; n < num_params + 1; n++)
4623 g_value_unset (&paramv[n]);
4624 g_free (paramv);
4625}
4626
4627static void
4628sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4629 GVariant *changed_properties,
4630 const gchar *const *invalidated_properties)
4631{
4632 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4633 guint n;
4634 const gchar *key;
4635 GVariantIter *iter;
4636 _ExtendedGDBusPropertyInfo *info;
4637 g_variant_get (changed_properties, "a{sv}", &iter);
4638 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4639 {
4640 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4641 g_datalist_remove_data (&proxy->priv->qdata, key);
4642 if (info != NULL)
4643 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4644 }
4645 g_variant_iter_free (iter);
4646 for (n = 0; invalidated_properties[n] != NULL; n++)
4647 {
4648 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4649 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4650 if (info != NULL)
4651 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4652 }
4653}
4654
4655static GVariant *
4656sensor_value_proxy_get_value (SensorValue *object)
4657{
4658 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4659 GVariant *variant;
4660 GVariant *value = NULL;
4661 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4662 value = variant;
4663 if (variant != NULL)
4664 g_variant_unref (variant);
4665 return value;
4666}
4667
4668static const gchar *
4669sensor_value_proxy_get_units (SensorValue *object)
4670{
4671 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4672 GVariant *variant;
4673 const gchar *value = NULL;
4674 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4675 if (variant != NULL)
4676 {
4677 value = g_variant_get_string (variant, NULL);
4678 g_variant_unref (variant);
4679 }
4680 return value;
4681}
4682
4683static gint
4684sensor_value_proxy_get_poll_interval (SensorValue *object)
4685{
4686 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4687 GVariant *variant;
4688 gint value = 0;
4689 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4690 if (variant != NULL)
4691 {
4692 value = g_variant_get_int32 (variant);
4693 g_variant_unref (variant);
4694 }
4695 return value;
4696}
4697
4698static gint
4699sensor_value_proxy_get_heatbeat (SensorValue *object)
4700{
4701 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4702 GVariant *variant;
4703 gint value = 0;
4704 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4705 if (variant != NULL)
4706 {
4707 value = g_variant_get_int32 (variant);
4708 g_variant_unref (variant);
4709 }
4710 return value;
4711}
4712
4713static gboolean
4714sensor_value_proxy_get_settable (SensorValue *object)
4715{
4716 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4717 GVariant *variant;
4718 gboolean value = 0;
4719 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4720 if (variant != NULL)
4721 {
4722 value = g_variant_get_boolean (variant);
4723 g_variant_unref (variant);
4724 }
4725 return value;
4726}
4727
Norman James362a80f2015-09-14 14:04:39 -05004728static void
4729sensor_value_proxy_init (SensorValueProxy *proxy)
4730{
4731#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4732 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4733#else
4734 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4735#endif
4736
4737 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4738}
4739
4740static void
4741sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4742{
4743 GObjectClass *gobject_class;
4744 GDBusProxyClass *proxy_class;
4745
4746 gobject_class = G_OBJECT_CLASS (klass);
4747 gobject_class->finalize = sensor_value_proxy_finalize;
4748 gobject_class->get_property = sensor_value_proxy_get_property;
4749 gobject_class->set_property = sensor_value_proxy_set_property;
4750
4751 proxy_class = G_DBUS_PROXY_CLASS (klass);
4752 proxy_class->g_signal = sensor_value_proxy_g_signal;
4753 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4754
4755 sensor_value_override_properties (gobject_class, 1);
4756
4757#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4758 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4759#endif
4760}
4761
4762static void
4763sensor_value_proxy_iface_init (SensorValueIface *iface)
4764{
4765 iface->get_value = sensor_value_proxy_get_value;
4766 iface->get_units = sensor_value_proxy_get_units;
4767 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4768 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4769 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004770}
4771
4772/**
4773 * sensor_value_proxy_new:
4774 * @connection: A #GDBusConnection.
4775 * @flags: Flags from the #GDBusProxyFlags enumeration.
4776 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4777 * @object_path: An object path.
4778 * @cancellable: (allow-none): A #GCancellable or %NULL.
4779 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4780 * @user_data: User data to pass to @callback.
4781 *
4782 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new() for more details.
4783 *
4784 * 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.
4785 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4786 *
4787 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4788 */
4789void
4790sensor_value_proxy_new (
4791 GDBusConnection *connection,
4792 GDBusProxyFlags flags,
4793 const gchar *name,
4794 const gchar *object_path,
4795 GCancellable *cancellable,
4796 GAsyncReadyCallback callback,
4797 gpointer user_data)
4798{
4799 g_async_initable_new_async (TYPE_SENSOR_VALUE_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.SensorValue", NULL);
4800}
4801
4802/**
4803 * sensor_value_proxy_new_finish:
4804 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4805 * @error: Return location for error or %NULL
4806 *
4807 * Finishes an operation started with sensor_value_proxy_new().
4808 *
4809 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4810 */
4811SensorValue *
4812sensor_value_proxy_new_finish (
4813 GAsyncResult *res,
4814 GError **error)
4815{
4816 GObject *ret;
4817 GObject *source_object;
4818 source_object = g_async_result_get_source_object (res);
4819 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4820 g_object_unref (source_object);
4821 if (ret != NULL)
4822 return SENSOR_VALUE (ret);
4823 else
4824 return NULL;
4825}
4826
4827/**
4828 * sensor_value_proxy_new_sync:
4829 * @connection: A #GDBusConnection.
4830 * @flags: Flags from the #GDBusProxyFlags enumeration.
4831 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4832 * @object_path: An object path.
4833 * @cancellable: (allow-none): A #GCancellable or %NULL.
4834 * @error: Return location for error or %NULL
4835 *
4836 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new_sync() for more details.
4837 *
4838 * The calling thread is blocked until a reply is received.
4839 *
4840 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
4841 *
4842 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4843 */
4844SensorValue *
4845sensor_value_proxy_new_sync (
4846 GDBusConnection *connection,
4847 GDBusProxyFlags flags,
4848 const gchar *name,
4849 const gchar *object_path,
4850 GCancellable *cancellable,
4851 GError **error)
4852{
4853 GInitable *ret;
4854 ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL);
4855 if (ret != NULL)
4856 return SENSOR_VALUE (ret);
4857 else
4858 return NULL;
4859}
4860
4861
4862/**
4863 * sensor_value_proxy_new_for_bus:
4864 * @bus_type: A #GBusType.
4865 * @flags: Flags from the #GDBusProxyFlags enumeration.
4866 * @name: A bus name (well-known or unique).
4867 * @object_path: An object path.
4868 * @cancellable: (allow-none): A #GCancellable or %NULL.
4869 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4870 * @user_data: User data to pass to @callback.
4871 *
4872 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
4873 *
4874 * 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.
4875 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
4876 *
4877 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4878 */
4879void
4880sensor_value_proxy_new_for_bus (
4881 GBusType bus_type,
4882 GDBusProxyFlags flags,
4883 const gchar *name,
4884 const gchar *object_path,
4885 GCancellable *cancellable,
4886 GAsyncReadyCallback callback,
4887 gpointer user_data)
4888{
4889 g_async_initable_new_async (TYPE_SENSOR_VALUE_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.SensorValue", NULL);
4890}
4891
4892/**
4893 * sensor_value_proxy_new_for_bus_finish:
4894 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
4895 * @error: Return location for error or %NULL
4896 *
4897 * Finishes an operation started with sensor_value_proxy_new_for_bus().
4898 *
4899 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4900 */
4901SensorValue *
4902sensor_value_proxy_new_for_bus_finish (
4903 GAsyncResult *res,
4904 GError **error)
4905{
4906 GObject *ret;
4907 GObject *source_object;
4908 source_object = g_async_result_get_source_object (res);
4909 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4910 g_object_unref (source_object);
4911 if (ret != NULL)
4912 return SENSOR_VALUE (ret);
4913 else
4914 return NULL;
4915}
4916
4917/**
4918 * sensor_value_proxy_new_for_bus_sync:
4919 * @bus_type: A #GBusType.
4920 * @flags: Flags from the #GDBusProxyFlags enumeration.
4921 * @name: A bus name (well-known or unique).
4922 * @object_path: An object path.
4923 * @cancellable: (allow-none): A #GCancellable or %NULL.
4924 * @error: Return location for error or %NULL
4925 *
4926 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4927 *
4928 * The calling thread is blocked until a reply is received.
4929 *
4930 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
4931 *
4932 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4933 */
4934SensorValue *
4935sensor_value_proxy_new_for_bus_sync (
4936 GBusType bus_type,
4937 GDBusProxyFlags flags,
4938 const gchar *name,
4939 const gchar *object_path,
4940 GCancellable *cancellable,
4941 GError **error)
4942{
4943 GInitable *ret;
4944 ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL);
4945 if (ret != NULL)
4946 return SENSOR_VALUE (ret);
4947 else
4948 return NULL;
4949}
4950
4951
4952/* ------------------------------------------------------------------------ */
4953
4954/**
4955 * SensorValueSkeleton:
4956 *
4957 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
4958 */
4959
4960/**
4961 * SensorValueSkeletonClass:
4962 * @parent_class: The parent class.
4963 *
4964 * Class structure for #SensorValueSkeleton.
4965 */
4966
4967struct _SensorValueSkeletonPrivate
4968{
4969 GValue *properties;
4970 GList *changed_properties;
4971 GSource *changed_properties_idle_source;
4972 GMainContext *context;
4973 GMutex lock;
4974};
4975
4976static void
4977_sensor_value_skeleton_handle_method_call (
4978 GDBusConnection *connection G_GNUC_UNUSED,
4979 const gchar *sender G_GNUC_UNUSED,
4980 const gchar *object_path G_GNUC_UNUSED,
4981 const gchar *interface_name,
4982 const gchar *method_name,
4983 GVariant *parameters,
4984 GDBusMethodInvocation *invocation,
4985 gpointer user_data)
4986{
4987 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
4988 _ExtendedGDBusMethodInfo *info;
4989 GVariantIter iter;
4990 GVariant *child;
4991 GValue *paramv;
4992 guint num_params;
4993 guint num_extra;
4994 guint n;
4995 guint signal_id;
4996 GValue return_value = G_VALUE_INIT;
4997 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
4998 g_assert (info != NULL);
4999 num_params = g_variant_n_children (parameters);
5000 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5001 n = 0;
5002 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5003 g_value_set_object (&paramv[n++], skeleton);
5004 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5005 g_value_set_object (&paramv[n++], invocation);
5006 if (info->pass_fdlist)
5007 {
5008#ifdef G_OS_UNIX
5009 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5010 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5011#else
5012 g_assert_not_reached ();
5013#endif
5014 }
5015 g_variant_iter_init (&iter, parameters);
5016 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5017 {
5018 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5019 if (arg_info->use_gvariant)
5020 {
5021 g_value_init (&paramv[n], G_TYPE_VARIANT);
5022 g_value_set_variant (&paramv[n], child);
5023 n++;
5024 }
5025 else
5026 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5027 g_variant_unref (child);
5028 }
5029 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5030 g_value_init (&return_value, G_TYPE_BOOLEAN);
5031 g_signal_emitv (paramv, signal_id, 0, &return_value);
5032 if (!g_value_get_boolean (&return_value))
5033 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);
5034 g_value_unset (&return_value);
5035 for (n = 0; n < num_params + num_extra; n++)
5036 g_value_unset (&paramv[n]);
5037 g_free (paramv);
5038}
5039
5040static GVariant *
5041_sensor_value_skeleton_handle_get_property (
5042 GDBusConnection *connection G_GNUC_UNUSED,
5043 const gchar *sender G_GNUC_UNUSED,
5044 const gchar *object_path G_GNUC_UNUSED,
5045 const gchar *interface_name G_GNUC_UNUSED,
5046 const gchar *property_name,
5047 GError **error,
5048 gpointer user_data)
5049{
5050 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5051 GValue value = G_VALUE_INIT;
5052 GParamSpec *pspec;
5053 _ExtendedGDBusPropertyInfo *info;
5054 GVariant *ret;
5055 ret = NULL;
5056 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5057 g_assert (info != NULL);
5058 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5059 if (pspec == NULL)
5060 {
5061 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5062 }
5063 else
5064 {
5065 g_value_init (&value, pspec->value_type);
5066 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5067 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5068 g_value_unset (&value);
5069 }
5070 return ret;
5071}
5072
5073static gboolean
5074_sensor_value_skeleton_handle_set_property (
5075 GDBusConnection *connection G_GNUC_UNUSED,
5076 const gchar *sender G_GNUC_UNUSED,
5077 const gchar *object_path G_GNUC_UNUSED,
5078 const gchar *interface_name G_GNUC_UNUSED,
5079 const gchar *property_name,
5080 GVariant *variant,
5081 GError **error,
5082 gpointer user_data)
5083{
5084 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5085 GValue value = G_VALUE_INIT;
5086 GParamSpec *pspec;
5087 _ExtendedGDBusPropertyInfo *info;
5088 gboolean ret;
5089 ret = FALSE;
5090 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5091 g_assert (info != NULL);
5092 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5093 if (pspec == NULL)
5094 {
5095 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5096 }
5097 else
5098 {
5099 if (info->use_gvariant)
5100 g_value_set_variant (&value, variant);
5101 else
5102 g_dbus_gvariant_to_gvalue (variant, &value);
5103 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5104 g_value_unset (&value);
5105 ret = TRUE;
5106 }
5107 return ret;
5108}
5109
5110static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5111{
5112 _sensor_value_skeleton_handle_method_call,
5113 _sensor_value_skeleton_handle_get_property,
5114 _sensor_value_skeleton_handle_set_property,
5115 {NULL}
5116};
5117
5118static GDBusInterfaceInfo *
5119sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5120{
5121 return sensor_value_interface_info ();
5122}
5123
5124static GDBusInterfaceVTable *
5125sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5126{
5127 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5128}
5129
5130static GVariant *
5131sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5132{
5133 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5134
5135 GVariantBuilder builder;
5136 guint n;
5137 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5138 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5139 goto out;
5140 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5141 {
5142 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5143 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5144 {
5145 GVariant *value;
5146 value = _sensor_value_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.SensorValue", info->name, NULL, skeleton);
5147 if (value != NULL)
5148 {
5149 g_variant_take_ref (value);
5150 g_variant_builder_add (&builder, "{sv}", info->name, value);
5151 g_variant_unref (value);
5152 }
5153 }
5154 }
5155out:
5156 return g_variant_builder_end (&builder);
5157}
5158
5159static gboolean _sensor_value_emit_changed (gpointer user_data);
5160
5161static void
5162sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5163{
5164 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5165 gboolean emit_changed = FALSE;
5166
5167 g_mutex_lock (&skeleton->priv->lock);
5168 if (skeleton->priv->changed_properties_idle_source != NULL)
5169 {
5170 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5171 skeleton->priv->changed_properties_idle_source = NULL;
5172 emit_changed = TRUE;
5173 }
5174 g_mutex_unlock (&skeleton->priv->lock);
5175
5176 if (emit_changed)
5177 _sensor_value_emit_changed (skeleton);
5178}
5179
5180static void
5181_sensor_value_on_signal_changed (
5182 SensorValue *object,
5183 GVariant *arg_value,
5184 const gchar *arg_units)
5185{
5186 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5187
5188 GList *connections, *l;
5189 GVariant *signal_variant;
5190 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5191
5192 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5193 arg_value,
5194 arg_units));
5195 for (l = connections; l != NULL; l = l->next)
5196 {
5197 GDBusConnection *connection = l->data;
5198 g_dbus_connection_emit_signal (connection,
5199 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5200 signal_variant, NULL);
5201 }
5202 g_variant_unref (signal_variant);
5203 g_list_free_full (connections, g_object_unref);
5204}
5205
5206static void
Norman James32e74e22015-09-15 21:28:06 -05005207_sensor_value_on_signal_error (
5208 SensorValue *object)
5209{
5210 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5211
5212 GList *connections, *l;
5213 GVariant *signal_variant;
5214 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5215
5216 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5217 for (l = connections; l != NULL; l = l->next)
5218 {
5219 GDBusConnection *connection = l->data;
5220 g_dbus_connection_emit_signal (connection,
5221 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5222 signal_variant, NULL);
5223 }
5224 g_variant_unref (signal_variant);
5225 g_list_free_full (connections, g_object_unref);
5226}
5227
5228static void
Norman James362a80f2015-09-14 14:04:39 -05005229_sensor_value_on_signal_heartbeat (
5230 SensorValue *object,
5231 const gchar *arg_bus_name)
5232{
5233 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5234
5235 GList *connections, *l;
5236 GVariant *signal_variant;
5237 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5238
5239 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5240 arg_bus_name));
5241 for (l = connections; l != NULL; l = l->next)
5242 {
5243 GDBusConnection *connection = l->data;
5244 g_dbus_connection_emit_signal (connection,
5245 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5246 signal_variant, NULL);
5247 }
5248 g_variant_unref (signal_variant);
5249 g_list_free_full (connections, g_object_unref);
5250}
5251
5252static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5253#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5254G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5255 G_ADD_PRIVATE (SensorValueSkeleton)
5256 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5257
5258#else
5259G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5260 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5261
5262#endif
5263static void
5264sensor_value_skeleton_finalize (GObject *object)
5265{
5266 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5267 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005268 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005269 g_value_unset (&skeleton->priv->properties[n]);
5270 g_free (skeleton->priv->properties);
5271 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5272 if (skeleton->priv->changed_properties_idle_source != NULL)
5273 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5274 g_main_context_unref (skeleton->priv->context);
5275 g_mutex_clear (&skeleton->priv->lock);
5276 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5277}
5278
5279static void
5280sensor_value_skeleton_get_property (GObject *object,
5281 guint prop_id,
5282 GValue *value,
5283 GParamSpec *pspec G_GNUC_UNUSED)
5284{
5285 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005286 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005287 g_mutex_lock (&skeleton->priv->lock);
5288 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5289 g_mutex_unlock (&skeleton->priv->lock);
5290}
5291
5292static gboolean
5293_sensor_value_emit_changed (gpointer user_data)
5294{
5295 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5296 GList *l;
5297 GVariantBuilder builder;
5298 GVariantBuilder invalidated_builder;
5299 guint num_changes;
5300
5301 g_mutex_lock (&skeleton->priv->lock);
5302 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5303 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5304 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5305 {
5306 ChangedProperty *cp = l->data;
5307 GVariant *variant;
5308 const GValue *cur_value;
5309
5310 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5311 if (!_g_value_equal (cur_value, &cp->orig_value))
5312 {
5313 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5314 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5315 g_variant_unref (variant);
5316 num_changes++;
5317 }
5318 }
5319 if (num_changes > 0)
5320 {
5321 GList *connections, *ll;
5322 GVariant *signal_variant;
5323 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5324 &builder, &invalidated_builder));
5325 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5326 for (ll = connections; ll != NULL; ll = ll->next)
5327 {
5328 GDBusConnection *connection = ll->data;
5329
5330 g_dbus_connection_emit_signal (connection,
5331 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5332 "org.freedesktop.DBus.Properties",
5333 "PropertiesChanged",
5334 signal_variant,
5335 NULL);
5336 }
5337 g_variant_unref (signal_variant);
5338 g_list_free_full (connections, g_object_unref);
5339 }
5340 else
5341 {
5342 g_variant_builder_clear (&builder);
5343 g_variant_builder_clear (&invalidated_builder);
5344 }
5345 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5346 skeleton->priv->changed_properties = NULL;
5347 skeleton->priv->changed_properties_idle_source = NULL;
5348 g_mutex_unlock (&skeleton->priv->lock);
5349 return FALSE;
5350}
5351
5352static void
5353_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5354{
5355 ChangedProperty *cp;
5356 GList *l;
5357 cp = NULL;
5358 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5359 {
5360 ChangedProperty *i_cp = l->data;
5361 if (i_cp->info == info)
5362 {
5363 cp = i_cp;
5364 break;
5365 }
5366 }
5367 if (cp == NULL)
5368 {
5369 cp = g_new0 (ChangedProperty, 1);
5370 cp->prop_id = prop_id;
5371 cp->info = info;
5372 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5373 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5374 g_value_copy (orig_value, &cp->orig_value);
5375 }
5376}
5377
5378static void
5379sensor_value_skeleton_notify (GObject *object,
5380 GParamSpec *pspec G_GNUC_UNUSED)
5381{
5382 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5383 g_mutex_lock (&skeleton->priv->lock);
5384 if (skeleton->priv->changed_properties != NULL &&
5385 skeleton->priv->changed_properties_idle_source == NULL)
5386 {
5387 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5388 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5389 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5390 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5391 g_source_unref (skeleton->priv->changed_properties_idle_source);
5392 }
5393 g_mutex_unlock (&skeleton->priv->lock);
5394}
5395
5396static void
5397sensor_value_skeleton_set_property (GObject *object,
5398 guint prop_id,
5399 const GValue *value,
5400 GParamSpec *pspec)
5401{
5402 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005403 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005404 g_mutex_lock (&skeleton->priv->lock);
5405 g_object_freeze_notify (object);
5406 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5407 {
5408 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5409 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5410 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5411 g_object_notify_by_pspec (object, pspec);
5412 }
5413 g_mutex_unlock (&skeleton->priv->lock);
5414 g_object_thaw_notify (object);
5415}
5416
5417static void
5418sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5419{
5420#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5421 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5422#else
5423 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5424#endif
5425
5426 g_mutex_init (&skeleton->priv->lock);
5427 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05005428 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05005429 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5430 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5431 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5432 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5433 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05005434}
5435
5436static GVariant *
5437sensor_value_skeleton_get_value (SensorValue *object)
5438{
5439 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5440 GVariant *value;
5441 g_mutex_lock (&skeleton->priv->lock);
5442 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5443 g_mutex_unlock (&skeleton->priv->lock);
5444 return value;
5445}
5446
5447static const gchar *
5448sensor_value_skeleton_get_units (SensorValue *object)
5449{
5450 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5451 const gchar *value;
5452 g_mutex_lock (&skeleton->priv->lock);
5453 value = g_value_get_string (&(skeleton->priv->properties[1]));
5454 g_mutex_unlock (&skeleton->priv->lock);
5455 return value;
5456}
5457
5458static gint
5459sensor_value_skeleton_get_poll_interval (SensorValue *object)
5460{
5461 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5462 gint value;
5463 g_mutex_lock (&skeleton->priv->lock);
5464 value = g_value_get_int (&(skeleton->priv->properties[2]));
5465 g_mutex_unlock (&skeleton->priv->lock);
5466 return value;
5467}
5468
5469static gint
5470sensor_value_skeleton_get_heatbeat (SensorValue *object)
5471{
5472 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5473 gint value;
5474 g_mutex_lock (&skeleton->priv->lock);
5475 value = g_value_get_int (&(skeleton->priv->properties[3]));
5476 g_mutex_unlock (&skeleton->priv->lock);
5477 return value;
5478}
5479
5480static gboolean
5481sensor_value_skeleton_get_settable (SensorValue *object)
5482{
5483 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5484 gboolean value;
5485 g_mutex_lock (&skeleton->priv->lock);
5486 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5487 g_mutex_unlock (&skeleton->priv->lock);
5488 return value;
5489}
5490
Norman James362a80f2015-09-14 14:04:39 -05005491static void
5492sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5493{
5494 GObjectClass *gobject_class;
5495 GDBusInterfaceSkeletonClass *skeleton_class;
5496
5497 gobject_class = G_OBJECT_CLASS (klass);
5498 gobject_class->finalize = sensor_value_skeleton_finalize;
5499 gobject_class->get_property = sensor_value_skeleton_get_property;
5500 gobject_class->set_property = sensor_value_skeleton_set_property;
5501 gobject_class->notify = sensor_value_skeleton_notify;
5502
5503
5504 sensor_value_override_properties (gobject_class, 1);
5505
5506 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5507 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5508 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5509 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5510 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5511
5512#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5513 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5514#endif
5515}
5516
5517static void
5518sensor_value_skeleton_iface_init (SensorValueIface *iface)
5519{
5520 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005521 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005522 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5523 iface->get_value = sensor_value_skeleton_get_value;
5524 iface->get_units = sensor_value_skeleton_get_units;
5525 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5526 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5527 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005528}
5529
5530/**
5531 * sensor_value_skeleton_new:
5532 *
5533 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5534 *
5535 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5536 */
5537SensorValue *
5538sensor_value_skeleton_new (void)
5539{
5540 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5541}
5542
5543/* ------------------------------------------------------------------------
Norman Jamesdfdaca92015-09-27 22:11:15 -05005544 * Code for interface org.openbmc.SensorIpmi
5545 * ------------------------------------------------------------------------
5546 */
5547
5548/**
5549 * SECTION:SensorIpmi
5550 * @title: SensorIpmi
5551 * @short_description: Generated C code for the org.openbmc.SensorIpmi D-Bus interface
5552 *
5553 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link> D-Bus interface in C.
5554 */
5555
5556/* ---- Introspection data for org.openbmc.SensorIpmi ---- */
5557
5558static const _ExtendedGDBusPropertyInfo _sensor_ipmi_property_info_sensor_id =
5559{
5560 {
5561 -1,
5562 (gchar *) "sensor_id",
5563 (gchar *) "y",
5564 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5565 NULL
5566 },
5567 "sensor-id",
5568 FALSE
5569};
5570
5571static const _ExtendedGDBusPropertyInfo _sensor_ipmi_property_info_entity_id =
5572{
5573 {
5574 -1,
5575 (gchar *) "entity_id",
5576 (gchar *) "y",
5577 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5578 NULL
5579 },
5580 "entity-id",
5581 FALSE
5582};
5583
5584static const _ExtendedGDBusPropertyInfo * const _sensor_ipmi_property_info_pointers[] =
5585{
5586 &_sensor_ipmi_property_info_sensor_id,
5587 &_sensor_ipmi_property_info_entity_id,
5588 NULL
5589};
5590
5591static const _ExtendedGDBusInterfaceInfo _sensor_ipmi_interface_info =
5592{
5593 {
5594 -1,
5595 (gchar *) "org.openbmc.SensorIpmi",
5596 NULL,
5597 NULL,
5598 (GDBusPropertyInfo **) &_sensor_ipmi_property_info_pointers,
5599 NULL
5600 },
5601 "sensor-ipmi",
5602};
5603
5604
5605/**
5606 * sensor_ipmi_interface_info:
5607 *
5608 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link> D-Bus interface.
5609 *
5610 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5611 */
5612GDBusInterfaceInfo *
5613sensor_ipmi_interface_info (void)
5614{
5615 return (GDBusInterfaceInfo *) &_sensor_ipmi_interface_info.parent_struct;
5616}
5617
5618/**
5619 * sensor_ipmi_override_properties:
5620 * @klass: The class structure for a #GObject<!-- -->-derived class.
5621 * @property_id_begin: The property id to assign to the first overridden property.
5622 *
5623 * Overrides all #GObject properties in the #SensorIpmi interface for a concrete class.
5624 * The properties are overridden in the order they are defined.
5625 *
5626 * Returns: The last property id.
5627 */
5628guint
5629sensor_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
5630{
5631 g_object_class_override_property (klass, property_id_begin++, "sensor-id");
5632 g_object_class_override_property (klass, property_id_begin++, "entity-id");
5633 return property_id_begin - 1;
5634}
5635
5636
5637
5638/**
5639 * SensorIpmi:
5640 *
5641 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link>.
5642 */
5643
5644/**
5645 * SensorIpmiIface:
5646 * @parent_iface: The parent interface.
5647 * @get_entity_id: Getter for the #SensorIpmi:entity-id property.
5648 * @get_sensor_id: Getter for the #SensorIpmi:sensor-id property.
5649 *
5650 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link>.
5651 */
5652
5653typedef SensorIpmiIface SensorIpmiInterface;
5654G_DEFINE_INTERFACE (SensorIpmi, sensor_ipmi, G_TYPE_OBJECT);
5655
5656static void
5657sensor_ipmi_default_init (SensorIpmiIface *iface)
5658{
5659 /* GObject properties for D-Bus properties: */
5660 /**
5661 * SensorIpmi:sensor-id:
5662 *
5663 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIpmi.sensor_id">"sensor_id"</link>.
5664 *
5665 * 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.
5666 */
5667 g_object_interface_install_property (iface,
5668 g_param_spec_uchar ("sensor-id", "sensor_id", "sensor_id", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5669 /**
5670 * SensorIpmi:entity-id:
5671 *
5672 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorIpmi.entity_id">"entity_id"</link>.
5673 *
5674 * 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.
5675 */
5676 g_object_interface_install_property (iface,
5677 g_param_spec_uchar ("entity-id", "entity_id", "entity_id", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5678}
5679
5680/**
5681 * sensor_ipmi_get_sensor_id: (skip)
5682 * @object: A #SensorIpmi.
5683 *
5684 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIpmi.sensor_id">"sensor_id"</link> D-Bus property.
5685 *
5686 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5687 *
5688 * Returns: The property value.
5689 */
5690guchar
5691sensor_ipmi_get_sensor_id (SensorIpmi *object)
5692{
5693 return SENSOR_IPMI_GET_IFACE (object)->get_sensor_id (object);
5694}
5695
5696/**
5697 * sensor_ipmi_set_sensor_id: (skip)
5698 * @object: A #SensorIpmi.
5699 * @value: The value to set.
5700 *
5701 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIpmi.sensor_id">"sensor_id"</link> D-Bus property to @value.
5702 *
5703 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5704 */
5705void
5706sensor_ipmi_set_sensor_id (SensorIpmi *object, guchar value)
5707{
5708 g_object_set (G_OBJECT (object), "sensor-id", value, NULL);
5709}
5710
5711/**
5712 * sensor_ipmi_get_entity_id: (skip)
5713 * @object: A #SensorIpmi.
5714 *
5715 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorIpmi.entity_id">"entity_id"</link> D-Bus property.
5716 *
5717 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5718 *
5719 * Returns: The property value.
5720 */
5721guchar
5722sensor_ipmi_get_entity_id (SensorIpmi *object)
5723{
5724 return SENSOR_IPMI_GET_IFACE (object)->get_entity_id (object);
5725}
5726
5727/**
5728 * sensor_ipmi_set_entity_id: (skip)
5729 * @object: A #SensorIpmi.
5730 * @value: The value to set.
5731 *
5732 * Sets the <link linkend="gdbus-property-org-openbmc-SensorIpmi.entity_id">"entity_id"</link> D-Bus property to @value.
5733 *
5734 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5735 */
5736void
5737sensor_ipmi_set_entity_id (SensorIpmi *object, guchar value)
5738{
5739 g_object_set (G_OBJECT (object), "entity-id", value, NULL);
5740}
5741
5742/* ------------------------------------------------------------------------ */
5743
5744/**
5745 * SensorIpmiProxy:
5746 *
5747 * The #SensorIpmiProxy structure contains only private data and should only be accessed using the provided API.
5748 */
5749
5750/**
5751 * SensorIpmiProxyClass:
5752 * @parent_class: The parent class.
5753 *
5754 * Class structure for #SensorIpmiProxy.
5755 */
5756
5757struct _SensorIpmiProxyPrivate
5758{
5759 GData *qdata;
5760};
5761
5762static void sensor_ipmi_proxy_iface_init (SensorIpmiIface *iface);
5763
5764#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5765G_DEFINE_TYPE_WITH_CODE (SensorIpmiProxy, sensor_ipmi_proxy, G_TYPE_DBUS_PROXY,
5766 G_ADD_PRIVATE (SensorIpmiProxy)
5767 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_IPMI, sensor_ipmi_proxy_iface_init));
5768
5769#else
5770G_DEFINE_TYPE_WITH_CODE (SensorIpmiProxy, sensor_ipmi_proxy, G_TYPE_DBUS_PROXY,
5771 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_IPMI, sensor_ipmi_proxy_iface_init));
5772
5773#endif
5774static void
5775sensor_ipmi_proxy_finalize (GObject *object)
5776{
5777 SensorIpmiProxy *proxy = SENSOR_IPMI_PROXY (object);
5778 g_datalist_clear (&proxy->priv->qdata);
5779 G_OBJECT_CLASS (sensor_ipmi_proxy_parent_class)->finalize (object);
5780}
5781
5782static void
5783sensor_ipmi_proxy_get_property (GObject *object,
5784 guint prop_id,
5785 GValue *value,
5786 GParamSpec *pspec G_GNUC_UNUSED)
5787{
5788 const _ExtendedGDBusPropertyInfo *info;
5789 GVariant *variant;
5790 g_assert (prop_id != 0 && prop_id - 1 < 2);
5791 info = _sensor_ipmi_property_info_pointers[prop_id - 1];
5792 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5793 if (info->use_gvariant)
5794 {
5795 g_value_set_variant (value, variant);
5796 }
5797 else
5798 {
5799 if (variant != NULL)
5800 g_dbus_gvariant_to_gvalue (variant, value);
5801 }
5802 if (variant != NULL)
5803 g_variant_unref (variant);
5804}
5805
5806static void
5807sensor_ipmi_proxy_set_property_cb (GDBusProxy *proxy,
5808 GAsyncResult *res,
5809 gpointer user_data)
5810{
5811 const _ExtendedGDBusPropertyInfo *info = user_data;
5812 GError *error;
5813 GVariant *_ret;
5814 error = NULL;
5815 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5816 if (!_ret)
5817 {
5818 g_warning ("Error setting property '%s' on interface org.openbmc.SensorIpmi: %s (%s, %d)",
5819 info->parent_struct.name,
5820 error->message, g_quark_to_string (error->domain), error->code);
5821 g_error_free (error);
5822 }
5823 else
5824 {
5825 g_variant_unref (_ret);
5826 }
5827}
5828
5829static void
5830sensor_ipmi_proxy_set_property (GObject *object,
5831 guint prop_id,
5832 const GValue *value,
5833 GParamSpec *pspec G_GNUC_UNUSED)
5834{
5835 const _ExtendedGDBusPropertyInfo *info;
5836 GVariant *variant;
5837 g_assert (prop_id != 0 && prop_id - 1 < 2);
5838 info = _sensor_ipmi_property_info_pointers[prop_id - 1];
5839 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5840 g_dbus_proxy_call (G_DBUS_PROXY (object),
5841 "org.freedesktop.DBus.Properties.Set",
5842 g_variant_new ("(ssv)", "org.openbmc.SensorIpmi", info->parent_struct.name, variant),
5843 G_DBUS_CALL_FLAGS_NONE,
5844 -1,
5845 NULL, (GAsyncReadyCallback) sensor_ipmi_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5846 g_variant_unref (variant);
5847}
5848
5849static void
5850sensor_ipmi_proxy_g_signal (GDBusProxy *proxy,
5851 const gchar *sender_name G_GNUC_UNUSED,
5852 const gchar *signal_name,
5853 GVariant *parameters)
5854{
5855 _ExtendedGDBusSignalInfo *info;
5856 GVariantIter iter;
5857 GVariant *child;
5858 GValue *paramv;
5859 guint num_params;
5860 guint n;
5861 guint signal_id;
5862 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_ipmi_interface_info.parent_struct, signal_name);
5863 if (info == NULL)
5864 return;
5865 num_params = g_variant_n_children (parameters);
5866 paramv = g_new0 (GValue, num_params + 1);
5867 g_value_init (&paramv[0], TYPE_SENSOR_IPMI);
5868 g_value_set_object (&paramv[0], proxy);
5869 g_variant_iter_init (&iter, parameters);
5870 n = 1;
5871 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5872 {
5873 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5874 if (arg_info->use_gvariant)
5875 {
5876 g_value_init (&paramv[n], G_TYPE_VARIANT);
5877 g_value_set_variant (&paramv[n], child);
5878 n++;
5879 }
5880 else
5881 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5882 g_variant_unref (child);
5883 }
5884 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_IPMI);
5885 g_signal_emitv (paramv, signal_id, 0, NULL);
5886 for (n = 0; n < num_params + 1; n++)
5887 g_value_unset (&paramv[n]);
5888 g_free (paramv);
5889}
5890
5891static void
5892sensor_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
5893 GVariant *changed_properties,
5894 const gchar *const *invalidated_properties)
5895{
5896 SensorIpmiProxy *proxy = SENSOR_IPMI_PROXY (_proxy);
5897 guint n;
5898 const gchar *key;
5899 GVariantIter *iter;
5900 _ExtendedGDBusPropertyInfo *info;
5901 g_variant_get (changed_properties, "a{sv}", &iter);
5902 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5903 {
5904 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_ipmi_interface_info.parent_struct, key);
5905 g_datalist_remove_data (&proxy->priv->qdata, key);
5906 if (info != NULL)
5907 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5908 }
5909 g_variant_iter_free (iter);
5910 for (n = 0; invalidated_properties[n] != NULL; n++)
5911 {
5912 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_ipmi_interface_info.parent_struct, invalidated_properties[n]);
5913 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5914 if (info != NULL)
5915 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5916 }
5917}
5918
5919static guchar
5920sensor_ipmi_proxy_get_sensor_id (SensorIpmi *object)
5921{
5922 SensorIpmiProxy *proxy = SENSOR_IPMI_PROXY (object);
5923 GVariant *variant;
5924 guchar value = 0;
5925 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "sensor_id");
5926 if (variant != NULL)
5927 {
5928 value = g_variant_get_byte (variant);
5929 g_variant_unref (variant);
5930 }
5931 return value;
5932}
5933
5934static guchar
5935sensor_ipmi_proxy_get_entity_id (SensorIpmi *object)
5936{
5937 SensorIpmiProxy *proxy = SENSOR_IPMI_PROXY (object);
5938 GVariant *variant;
5939 guchar value = 0;
5940 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "entity_id");
5941 if (variant != NULL)
5942 {
5943 value = g_variant_get_byte (variant);
5944 g_variant_unref (variant);
5945 }
5946 return value;
5947}
5948
5949static void
5950sensor_ipmi_proxy_init (SensorIpmiProxy *proxy)
5951{
5952#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5953 proxy->priv = sensor_ipmi_proxy_get_instance_private (proxy);
5954#else
5955 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_IPMI_PROXY, SensorIpmiProxyPrivate);
5956#endif
5957
5958 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_ipmi_interface_info ());
5959}
5960
5961static void
5962sensor_ipmi_proxy_class_init (SensorIpmiProxyClass *klass)
5963{
5964 GObjectClass *gobject_class;
5965 GDBusProxyClass *proxy_class;
5966
5967 gobject_class = G_OBJECT_CLASS (klass);
5968 gobject_class->finalize = sensor_ipmi_proxy_finalize;
5969 gobject_class->get_property = sensor_ipmi_proxy_get_property;
5970 gobject_class->set_property = sensor_ipmi_proxy_set_property;
5971
5972 proxy_class = G_DBUS_PROXY_CLASS (klass);
5973 proxy_class->g_signal = sensor_ipmi_proxy_g_signal;
5974 proxy_class->g_properties_changed = sensor_ipmi_proxy_g_properties_changed;
5975
5976 sensor_ipmi_override_properties (gobject_class, 1);
5977
5978#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5979 g_type_class_add_private (klass, sizeof (SensorIpmiProxyPrivate));
5980#endif
5981}
5982
5983static void
5984sensor_ipmi_proxy_iface_init (SensorIpmiIface *iface)
5985{
5986 iface->get_sensor_id = sensor_ipmi_proxy_get_sensor_id;
5987 iface->get_entity_id = sensor_ipmi_proxy_get_entity_id;
5988}
5989
5990/**
5991 * sensor_ipmi_proxy_new:
5992 * @connection: A #GDBusConnection.
5993 * @flags: Flags from the #GDBusProxyFlags enumeration.
5994 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5995 * @object_path: An object path.
5996 * @cancellable: (allow-none): A #GCancellable or %NULL.
5997 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5998 * @user_data: User data to pass to @callback.
5999 *
6000 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link>. See g_dbus_proxy_new() for more details.
6001 *
6002 * 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.
6003 * You can then call sensor_ipmi_proxy_new_finish() to get the result of the operation.
6004 *
6005 * See sensor_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
6006 */
6007void
6008sensor_ipmi_proxy_new (
6009 GDBusConnection *connection,
6010 GDBusProxyFlags flags,
6011 const gchar *name,
6012 const gchar *object_path,
6013 GCancellable *cancellable,
6014 GAsyncReadyCallback callback,
6015 gpointer user_data)
6016{
6017 g_async_initable_new_async (TYPE_SENSOR_IPMI_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.SensorIpmi", NULL);
6018}
6019
6020/**
6021 * sensor_ipmi_proxy_new_finish:
6022 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_ipmi_proxy_new().
6023 * @error: Return location for error or %NULL
6024 *
6025 * Finishes an operation started with sensor_ipmi_proxy_new().
6026 *
6027 * Returns: (transfer full) (type SensorIpmiProxy): The constructed proxy object or %NULL if @error is set.
6028 */
6029SensorIpmi *
6030sensor_ipmi_proxy_new_finish (
6031 GAsyncResult *res,
6032 GError **error)
6033{
6034 GObject *ret;
6035 GObject *source_object;
6036 source_object = g_async_result_get_source_object (res);
6037 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6038 g_object_unref (source_object);
6039 if (ret != NULL)
6040 return SENSOR_IPMI (ret);
6041 else
6042 return NULL;
6043}
6044
6045/**
6046 * sensor_ipmi_proxy_new_sync:
6047 * @connection: A #GDBusConnection.
6048 * @flags: Flags from the #GDBusProxyFlags enumeration.
6049 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6050 * @object_path: An object path.
6051 * @cancellable: (allow-none): A #GCancellable or %NULL.
6052 * @error: Return location for error or %NULL
6053 *
6054 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link>. See g_dbus_proxy_new_sync() for more details.
6055 *
6056 * The calling thread is blocked until a reply is received.
6057 *
6058 * See sensor_ipmi_proxy_new() for the asynchronous version of this constructor.
6059 *
6060 * Returns: (transfer full) (type SensorIpmiProxy): The constructed proxy object or %NULL if @error is set.
6061 */
6062SensorIpmi *
6063sensor_ipmi_proxy_new_sync (
6064 GDBusConnection *connection,
6065 GDBusProxyFlags flags,
6066 const gchar *name,
6067 const gchar *object_path,
6068 GCancellable *cancellable,
6069 GError **error)
6070{
6071 GInitable *ret;
6072 ret = g_initable_new (TYPE_SENSOR_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIpmi", NULL);
6073 if (ret != NULL)
6074 return SENSOR_IPMI (ret);
6075 else
6076 return NULL;
6077}
6078
6079
6080/**
6081 * sensor_ipmi_proxy_new_for_bus:
6082 * @bus_type: A #GBusType.
6083 * @flags: Flags from the #GDBusProxyFlags enumeration.
6084 * @name: A bus name (well-known or unique).
6085 * @object_path: An object path.
6086 * @cancellable: (allow-none): A #GCancellable or %NULL.
6087 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6088 * @user_data: User data to pass to @callback.
6089 *
6090 * Like sensor_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6091 *
6092 * 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.
6093 * You can then call sensor_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
6094 *
6095 * See sensor_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6096 */
6097void
6098sensor_ipmi_proxy_new_for_bus (
6099 GBusType bus_type,
6100 GDBusProxyFlags flags,
6101 const gchar *name,
6102 const gchar *object_path,
6103 GCancellable *cancellable,
6104 GAsyncReadyCallback callback,
6105 gpointer user_data)
6106{
6107 g_async_initable_new_async (TYPE_SENSOR_IPMI_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.SensorIpmi", NULL);
6108}
6109
6110/**
6111 * sensor_ipmi_proxy_new_for_bus_finish:
6112 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_ipmi_proxy_new_for_bus().
6113 * @error: Return location for error or %NULL
6114 *
6115 * Finishes an operation started with sensor_ipmi_proxy_new_for_bus().
6116 *
6117 * Returns: (transfer full) (type SensorIpmiProxy): The constructed proxy object or %NULL if @error is set.
6118 */
6119SensorIpmi *
6120sensor_ipmi_proxy_new_for_bus_finish (
6121 GAsyncResult *res,
6122 GError **error)
6123{
6124 GObject *ret;
6125 GObject *source_object;
6126 source_object = g_async_result_get_source_object (res);
6127 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6128 g_object_unref (source_object);
6129 if (ret != NULL)
6130 return SENSOR_IPMI (ret);
6131 else
6132 return NULL;
6133}
6134
6135/**
6136 * sensor_ipmi_proxy_new_for_bus_sync:
6137 * @bus_type: A #GBusType.
6138 * @flags: Flags from the #GDBusProxyFlags enumeration.
6139 * @name: A bus name (well-known or unique).
6140 * @object_path: An object path.
6141 * @cancellable: (allow-none): A #GCancellable or %NULL.
6142 * @error: Return location for error or %NULL
6143 *
6144 * Like sensor_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6145 *
6146 * The calling thread is blocked until a reply is received.
6147 *
6148 * See sensor_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
6149 *
6150 * Returns: (transfer full) (type SensorIpmiProxy): The constructed proxy object or %NULL if @error is set.
6151 */
6152SensorIpmi *
6153sensor_ipmi_proxy_new_for_bus_sync (
6154 GBusType bus_type,
6155 GDBusProxyFlags flags,
6156 const gchar *name,
6157 const gchar *object_path,
6158 GCancellable *cancellable,
6159 GError **error)
6160{
6161 GInitable *ret;
6162 ret = g_initable_new (TYPE_SENSOR_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorIpmi", NULL);
6163 if (ret != NULL)
6164 return SENSOR_IPMI (ret);
6165 else
6166 return NULL;
6167}
6168
6169
6170/* ------------------------------------------------------------------------ */
6171
6172/**
6173 * SensorIpmiSkeleton:
6174 *
6175 * The #SensorIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
6176 */
6177
6178/**
6179 * SensorIpmiSkeletonClass:
6180 * @parent_class: The parent class.
6181 *
6182 * Class structure for #SensorIpmiSkeleton.
6183 */
6184
6185struct _SensorIpmiSkeletonPrivate
6186{
6187 GValue *properties;
6188 GList *changed_properties;
6189 GSource *changed_properties_idle_source;
6190 GMainContext *context;
6191 GMutex lock;
6192};
6193
6194static void
6195_sensor_ipmi_skeleton_handle_method_call (
6196 GDBusConnection *connection G_GNUC_UNUSED,
6197 const gchar *sender G_GNUC_UNUSED,
6198 const gchar *object_path G_GNUC_UNUSED,
6199 const gchar *interface_name,
6200 const gchar *method_name,
6201 GVariant *parameters,
6202 GDBusMethodInvocation *invocation,
6203 gpointer user_data)
6204{
6205 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (user_data);
6206 _ExtendedGDBusMethodInfo *info;
6207 GVariantIter iter;
6208 GVariant *child;
6209 GValue *paramv;
6210 guint num_params;
6211 guint num_extra;
6212 guint n;
6213 guint signal_id;
6214 GValue return_value = G_VALUE_INIT;
6215 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6216 g_assert (info != NULL);
6217 num_params = g_variant_n_children (parameters);
6218 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6219 n = 0;
6220 g_value_init (&paramv[n], TYPE_SENSOR_IPMI);
6221 g_value_set_object (&paramv[n++], skeleton);
6222 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6223 g_value_set_object (&paramv[n++], invocation);
6224 if (info->pass_fdlist)
6225 {
6226#ifdef G_OS_UNIX
6227 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
6228 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
6229#else
6230 g_assert_not_reached ();
6231#endif
6232 }
6233 g_variant_iter_init (&iter, parameters);
6234 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6235 {
6236 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
6237 if (arg_info->use_gvariant)
6238 {
6239 g_value_init (&paramv[n], G_TYPE_VARIANT);
6240 g_value_set_variant (&paramv[n], child);
6241 n++;
6242 }
6243 else
6244 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6245 g_variant_unref (child);
6246 }
6247 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_IPMI);
6248 g_value_init (&return_value, G_TYPE_BOOLEAN);
6249 g_signal_emitv (paramv, signal_id, 0, &return_value);
6250 if (!g_value_get_boolean (&return_value))
6251 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);
6252 g_value_unset (&return_value);
6253 for (n = 0; n < num_params + num_extra; n++)
6254 g_value_unset (&paramv[n]);
6255 g_free (paramv);
6256}
6257
6258static GVariant *
6259_sensor_ipmi_skeleton_handle_get_property (
6260 GDBusConnection *connection G_GNUC_UNUSED,
6261 const gchar *sender G_GNUC_UNUSED,
6262 const gchar *object_path G_GNUC_UNUSED,
6263 const gchar *interface_name G_GNUC_UNUSED,
6264 const gchar *property_name,
6265 GError **error,
6266 gpointer user_data)
6267{
6268 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (user_data);
6269 GValue value = G_VALUE_INIT;
6270 GParamSpec *pspec;
6271 _ExtendedGDBusPropertyInfo *info;
6272 GVariant *ret;
6273 ret = NULL;
6274 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_ipmi_interface_info.parent_struct, property_name);
6275 g_assert (info != NULL);
6276 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6277 if (pspec == NULL)
6278 {
6279 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6280 }
6281 else
6282 {
6283 g_value_init (&value, pspec->value_type);
6284 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6285 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
6286 g_value_unset (&value);
6287 }
6288 return ret;
6289}
6290
6291static gboolean
6292_sensor_ipmi_skeleton_handle_set_property (
6293 GDBusConnection *connection G_GNUC_UNUSED,
6294 const gchar *sender G_GNUC_UNUSED,
6295 const gchar *object_path G_GNUC_UNUSED,
6296 const gchar *interface_name G_GNUC_UNUSED,
6297 const gchar *property_name,
6298 GVariant *variant,
6299 GError **error,
6300 gpointer user_data)
6301{
6302 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (user_data);
6303 GValue value = G_VALUE_INIT;
6304 GParamSpec *pspec;
6305 _ExtendedGDBusPropertyInfo *info;
6306 gboolean ret;
6307 ret = FALSE;
6308 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_ipmi_interface_info.parent_struct, property_name);
6309 g_assert (info != NULL);
6310 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6311 if (pspec == NULL)
6312 {
6313 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6314 }
6315 else
6316 {
6317 if (info->use_gvariant)
6318 g_value_set_variant (&value, variant);
6319 else
6320 g_dbus_gvariant_to_gvalue (variant, &value);
6321 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6322 g_value_unset (&value);
6323 ret = TRUE;
6324 }
6325 return ret;
6326}
6327
6328static const GDBusInterfaceVTable _sensor_ipmi_skeleton_vtable =
6329{
6330 _sensor_ipmi_skeleton_handle_method_call,
6331 _sensor_ipmi_skeleton_handle_get_property,
6332 _sensor_ipmi_skeleton_handle_set_property,
6333 {NULL}
6334};
6335
6336static GDBusInterfaceInfo *
6337sensor_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6338{
6339 return sensor_ipmi_interface_info ();
6340}
6341
6342static GDBusInterfaceVTable *
6343sensor_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6344{
6345 return (GDBusInterfaceVTable *) &_sensor_ipmi_skeleton_vtable;
6346}
6347
6348static GVariant *
6349sensor_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
6350{
6351 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (_skeleton);
6352
6353 GVariantBuilder builder;
6354 guint n;
6355 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6356 if (_sensor_ipmi_interface_info.parent_struct.properties == NULL)
6357 goto out;
6358 for (n = 0; _sensor_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
6359 {
6360 GDBusPropertyInfo *info = _sensor_ipmi_interface_info.parent_struct.properties[n];
6361 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
6362 {
6363 GVariant *value;
6364 value = _sensor_ipmi_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.SensorIpmi", info->name, NULL, skeleton);
6365 if (value != NULL)
6366 {
6367 g_variant_take_ref (value);
6368 g_variant_builder_add (&builder, "{sv}", info->name, value);
6369 g_variant_unref (value);
6370 }
6371 }
6372 }
6373out:
6374 return g_variant_builder_end (&builder);
6375}
6376
6377static gboolean _sensor_ipmi_emit_changed (gpointer user_data);
6378
6379static void
6380sensor_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
6381{
6382 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (_skeleton);
6383 gboolean emit_changed = FALSE;
6384
6385 g_mutex_lock (&skeleton->priv->lock);
6386 if (skeleton->priv->changed_properties_idle_source != NULL)
6387 {
6388 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6389 skeleton->priv->changed_properties_idle_source = NULL;
6390 emit_changed = TRUE;
6391 }
6392 g_mutex_unlock (&skeleton->priv->lock);
6393
6394 if (emit_changed)
6395 _sensor_ipmi_emit_changed (skeleton);
6396}
6397
6398static void sensor_ipmi_skeleton_iface_init (SensorIpmiIface *iface);
6399#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6400G_DEFINE_TYPE_WITH_CODE (SensorIpmiSkeleton, sensor_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6401 G_ADD_PRIVATE (SensorIpmiSkeleton)
6402 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_IPMI, sensor_ipmi_skeleton_iface_init));
6403
6404#else
6405G_DEFINE_TYPE_WITH_CODE (SensorIpmiSkeleton, sensor_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6406 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_IPMI, sensor_ipmi_skeleton_iface_init));
6407
6408#endif
6409static void
6410sensor_ipmi_skeleton_finalize (GObject *object)
6411{
6412 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (object);
6413 guint n;
6414 for (n = 0; n < 2; n++)
6415 g_value_unset (&skeleton->priv->properties[n]);
6416 g_free (skeleton->priv->properties);
6417 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6418 if (skeleton->priv->changed_properties_idle_source != NULL)
6419 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6420 g_main_context_unref (skeleton->priv->context);
6421 g_mutex_clear (&skeleton->priv->lock);
6422 G_OBJECT_CLASS (sensor_ipmi_skeleton_parent_class)->finalize (object);
6423}
6424
6425static void
6426sensor_ipmi_skeleton_get_property (GObject *object,
6427 guint prop_id,
6428 GValue *value,
6429 GParamSpec *pspec G_GNUC_UNUSED)
6430{
6431 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (object);
6432 g_assert (prop_id != 0 && prop_id - 1 < 2);
6433 g_mutex_lock (&skeleton->priv->lock);
6434 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
6435 g_mutex_unlock (&skeleton->priv->lock);
6436}
6437
6438static gboolean
6439_sensor_ipmi_emit_changed (gpointer user_data)
6440{
6441 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (user_data);
6442 GList *l;
6443 GVariantBuilder builder;
6444 GVariantBuilder invalidated_builder;
6445 guint num_changes;
6446
6447 g_mutex_lock (&skeleton->priv->lock);
6448 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6449 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
6450 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
6451 {
6452 ChangedProperty *cp = l->data;
6453 GVariant *variant;
6454 const GValue *cur_value;
6455
6456 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6457 if (!_g_value_equal (cur_value, &cp->orig_value))
6458 {
6459 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6460 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6461 g_variant_unref (variant);
6462 num_changes++;
6463 }
6464 }
6465 if (num_changes > 0)
6466 {
6467 GList *connections, *ll;
6468 GVariant *signal_variant;
6469 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorIpmi",
6470 &builder, &invalidated_builder));
6471 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6472 for (ll = connections; ll != NULL; ll = ll->next)
6473 {
6474 GDBusConnection *connection = ll->data;
6475
6476 g_dbus_connection_emit_signal (connection,
6477 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6478 "org.freedesktop.DBus.Properties",
6479 "PropertiesChanged",
6480 signal_variant,
6481 NULL);
6482 }
6483 g_variant_unref (signal_variant);
6484 g_list_free_full (connections, g_object_unref);
6485 }
6486 else
6487 {
6488 g_variant_builder_clear (&builder);
6489 g_variant_builder_clear (&invalidated_builder);
6490 }
6491 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6492 skeleton->priv->changed_properties = NULL;
6493 skeleton->priv->changed_properties_idle_source = NULL;
6494 g_mutex_unlock (&skeleton->priv->lock);
6495 return FALSE;
6496}
6497
6498static void
6499_sensor_ipmi_schedule_emit_changed (SensorIpmiSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6500{
6501 ChangedProperty *cp;
6502 GList *l;
6503 cp = NULL;
6504 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
6505 {
6506 ChangedProperty *i_cp = l->data;
6507 if (i_cp->info == info)
6508 {
6509 cp = i_cp;
6510 break;
6511 }
6512 }
6513 if (cp == NULL)
6514 {
6515 cp = g_new0 (ChangedProperty, 1);
6516 cp->prop_id = prop_id;
6517 cp->info = info;
6518 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
6519 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
6520 g_value_copy (orig_value, &cp->orig_value);
6521 }
6522}
6523
6524static void
6525sensor_ipmi_skeleton_notify (GObject *object,
6526 GParamSpec *pspec G_GNUC_UNUSED)
6527{
6528 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (object);
6529 g_mutex_lock (&skeleton->priv->lock);
6530 if (skeleton->priv->changed_properties != NULL &&
6531 skeleton->priv->changed_properties_idle_source == NULL)
6532 {
6533 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
6534 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
6535 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_ipmi_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
6536 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
6537 g_source_unref (skeleton->priv->changed_properties_idle_source);
6538 }
6539 g_mutex_unlock (&skeleton->priv->lock);
6540}
6541
6542static void
6543sensor_ipmi_skeleton_set_property (GObject *object,
6544 guint prop_id,
6545 const GValue *value,
6546 GParamSpec *pspec)
6547{
6548 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (object);
6549 g_assert (prop_id != 0 && prop_id - 1 < 2);
6550 g_mutex_lock (&skeleton->priv->lock);
6551 g_object_freeze_notify (object);
6552 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
6553 {
6554 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
6555 _sensor_ipmi_schedule_emit_changed (skeleton, _sensor_ipmi_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
6556 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6557 g_object_notify_by_pspec (object, pspec);
6558 }
6559 g_mutex_unlock (&skeleton->priv->lock);
6560 g_object_thaw_notify (object);
6561}
6562
6563static void
6564sensor_ipmi_skeleton_init (SensorIpmiSkeleton *skeleton)
6565{
6566#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6567 skeleton->priv = sensor_ipmi_skeleton_get_instance_private (skeleton);
6568#else
6569 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_IPMI_SKELETON, SensorIpmiSkeletonPrivate);
6570#endif
6571
6572 g_mutex_init (&skeleton->priv->lock);
6573 skeleton->priv->context = g_main_context_ref_thread_default ();
6574 skeleton->priv->properties = g_new0 (GValue, 2);
6575 g_value_init (&skeleton->priv->properties[0], G_TYPE_UCHAR);
6576 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
6577}
6578
6579static guchar
6580sensor_ipmi_skeleton_get_sensor_id (SensorIpmi *object)
6581{
6582 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (object);
6583 guchar value;
6584 g_mutex_lock (&skeleton->priv->lock);
6585 value = g_value_get_uchar (&(skeleton->priv->properties[0]));
6586 g_mutex_unlock (&skeleton->priv->lock);
6587 return value;
6588}
6589
6590static guchar
6591sensor_ipmi_skeleton_get_entity_id (SensorIpmi *object)
6592{
6593 SensorIpmiSkeleton *skeleton = SENSOR_IPMI_SKELETON (object);
6594 guchar value;
6595 g_mutex_lock (&skeleton->priv->lock);
6596 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
6597 g_mutex_unlock (&skeleton->priv->lock);
6598 return value;
6599}
6600
6601static void
6602sensor_ipmi_skeleton_class_init (SensorIpmiSkeletonClass *klass)
6603{
6604 GObjectClass *gobject_class;
6605 GDBusInterfaceSkeletonClass *skeleton_class;
6606
6607 gobject_class = G_OBJECT_CLASS (klass);
6608 gobject_class->finalize = sensor_ipmi_skeleton_finalize;
6609 gobject_class->get_property = sensor_ipmi_skeleton_get_property;
6610 gobject_class->set_property = sensor_ipmi_skeleton_set_property;
6611 gobject_class->notify = sensor_ipmi_skeleton_notify;
6612
6613
6614 sensor_ipmi_override_properties (gobject_class, 1);
6615
6616 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6617 skeleton_class->get_info = sensor_ipmi_skeleton_dbus_interface_get_info;
6618 skeleton_class->get_properties = sensor_ipmi_skeleton_dbus_interface_get_properties;
6619 skeleton_class->flush = sensor_ipmi_skeleton_dbus_interface_flush;
6620 skeleton_class->get_vtable = sensor_ipmi_skeleton_dbus_interface_get_vtable;
6621
6622#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6623 g_type_class_add_private (klass, sizeof (SensorIpmiSkeletonPrivate));
6624#endif
6625}
6626
6627static void
6628sensor_ipmi_skeleton_iface_init (SensorIpmiIface *iface)
6629{
6630 iface->get_sensor_id = sensor_ipmi_skeleton_get_sensor_id;
6631 iface->get_entity_id = sensor_ipmi_skeleton_get_entity_id;
6632}
6633
6634/**
6635 * sensor_ipmi_skeleton_new:
6636 *
6637 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link>.
6638 *
6639 * Returns: (transfer full) (type SensorIpmiSkeleton): The skeleton object.
6640 */
6641SensorIpmi *
6642sensor_ipmi_skeleton_new (void)
6643{
6644 return SENSOR_IPMI (g_object_new (TYPE_SENSOR_IPMI_SKELETON, NULL));
6645}
6646
6647/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -05006648 * Code for interface org.openbmc.SensorThreshold
6649 * ------------------------------------------------------------------------
6650 */
6651
6652/**
6653 * SECTION:SensorThreshold
6654 * @title: SensorThreshold
6655 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
6656 *
6657 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface in C.
6658 */
6659
6660/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
6661
6662static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
6663{
6664 {
6665 -1,
6666 (gchar *) "state",
6667 (gchar *) "y",
6668 NULL
6669 },
6670 FALSE
6671};
6672
6673static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
6674{
6675 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
6676 NULL
6677};
6678
6679static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
6680{
6681 {
6682 -1,
6683 (gchar *) "getState",
6684 NULL,
6685 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
6686 NULL
6687 },
6688 "handle-get-state",
6689 FALSE
6690};
6691
6692static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
6693{
6694 &_sensor_threshold_method_info_get_state,
6695 NULL
6696};
6697
6698static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
6699{
6700 {
6701 -1,
6702 (gchar *) "Warning",
6703 NULL,
6704 NULL
6705 },
6706 "warning"
6707};
6708
6709static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
6710{
6711 {
6712 -1,
6713 (gchar *) "Critical",
6714 NULL,
6715 NULL
6716 },
6717 "critical"
6718};
6719
6720static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
6721{
6722 {
6723 -1,
6724 (gchar *) "Normal",
6725 NULL,
6726 NULL
6727 },
6728 "normal"
6729};
6730
6731static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
6732{
6733 &_sensor_threshold_signal_info_warning,
6734 &_sensor_threshold_signal_info_critical,
6735 &_sensor_threshold_signal_info_normal,
6736 NULL
6737};
6738
6739static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
6740{
6741 {
6742 -1,
6743 (gchar *) "lower_critical",
6744 (gchar *) "v",
6745 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6746 NULL
6747 },
6748 "lower-critical",
6749 FALSE
6750};
6751
6752static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
6753{
6754 {
6755 -1,
6756 (gchar *) "lower_warning",
6757 (gchar *) "v",
6758 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6759 NULL
6760 },
6761 "lower-warning",
6762 FALSE
6763};
6764
6765static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
6766{
6767 {
6768 -1,
6769 (gchar *) "upper_warning",
6770 (gchar *) "v",
6771 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6772 NULL
6773 },
6774 "upper-warning",
6775 FALSE
6776};
6777
6778static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
6779{
6780 {
6781 -1,
6782 (gchar *) "upper_critical",
6783 (gchar *) "v",
6784 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6785 NULL
6786 },
6787 "upper-critical",
6788 FALSE
6789};
6790
6791static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
6792{
6793 {
6794 -1,
6795 (gchar *) "state",
6796 (gchar *) "y",
6797 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6798 NULL
6799 },
6800 "state",
6801 FALSE
6802};
6803
6804static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
6805{
6806 &_sensor_threshold_property_info_lower_critical,
6807 &_sensor_threshold_property_info_lower_warning,
6808 &_sensor_threshold_property_info_upper_warning,
6809 &_sensor_threshold_property_info_upper_critical,
6810 &_sensor_threshold_property_info_state,
6811 NULL
6812};
6813
6814static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
6815{
6816 {
6817 -1,
6818 (gchar *) "org.openbmc.SensorThreshold",
6819 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
6820 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
6821 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
6822 NULL
6823 },
6824 "sensor-threshold",
6825};
6826
6827
6828/**
6829 * sensor_threshold_interface_info:
6830 *
6831 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
6832 *
6833 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6834 */
6835GDBusInterfaceInfo *
6836sensor_threshold_interface_info (void)
6837{
6838 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
6839}
6840
6841/**
6842 * sensor_threshold_override_properties:
6843 * @klass: The class structure for a #GObject<!-- -->-derived class.
6844 * @property_id_begin: The property id to assign to the first overridden property.
6845 *
6846 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
6847 * The properties are overridden in the order they are defined.
6848 *
6849 * Returns: The last property id.
6850 */
6851guint
6852sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
6853{
6854 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
6855 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
6856 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
6857 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
6858 g_object_class_override_property (klass, property_id_begin++, "state");
6859 return property_id_begin - 1;
6860}
6861
6862
6863
6864/**
6865 * SensorThreshold:
6866 *
6867 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6868 */
6869
6870/**
6871 * SensorThresholdIface:
6872 * @parent_iface: The parent interface.
6873 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
6874 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
6875 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
6876 * @get_state: Getter for the #SensorThreshold:state property.
6877 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
6878 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
6879 * @critical: Handler for the #SensorThreshold::critical signal.
6880 * @normal: Handler for the #SensorThreshold::normal signal.
6881 * @warning: Handler for the #SensorThreshold::warning signal.
6882 *
6883 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6884 */
6885
6886typedef SensorThresholdIface SensorThresholdInterface;
6887G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
6888
6889static void
6890sensor_threshold_default_init (SensorThresholdIface *iface)
6891{
6892 /* GObject signals for incoming D-Bus method calls: */
6893 /**
6894 * SensorThreshold::handle-get-state:
6895 * @object: A #SensorThreshold.
6896 * @invocation: A #GDBusMethodInvocation.
6897 *
6898 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
6899 *
6900 * 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_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.
6901 *
6902 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
6903 */
6904 g_signal_new ("handle-get-state",
6905 G_TYPE_FROM_INTERFACE (iface),
6906 G_SIGNAL_RUN_LAST,
6907 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
6908 g_signal_accumulator_true_handled,
6909 NULL,
6910 g_cclosure_marshal_generic,
6911 G_TYPE_BOOLEAN,
6912 1,
6913 G_TYPE_DBUS_METHOD_INVOCATION);
6914
6915 /* GObject signals for received D-Bus signals: */
6916 /**
6917 * SensorThreshold::warning:
6918 * @object: A #SensorThreshold.
6919 *
6920 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> is received.
6921 *
6922 * 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.
6923 */
6924 g_signal_new ("warning",
6925 G_TYPE_FROM_INTERFACE (iface),
6926 G_SIGNAL_RUN_LAST,
6927 G_STRUCT_OFFSET (SensorThresholdIface, warning),
6928 NULL,
6929 NULL,
6930 g_cclosure_marshal_generic,
6931 G_TYPE_NONE,
6932 0);
6933
6934 /**
6935 * SensorThreshold::critical:
6936 * @object: A #SensorThreshold.
6937 *
6938 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> is received.
6939 *
6940 * 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.
6941 */
6942 g_signal_new ("critical",
6943 G_TYPE_FROM_INTERFACE (iface),
6944 G_SIGNAL_RUN_LAST,
6945 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6946 NULL,
6947 NULL,
6948 g_cclosure_marshal_generic,
6949 G_TYPE_NONE,
6950 0);
6951
6952 /**
6953 * SensorThreshold::normal:
6954 * @object: A #SensorThreshold.
6955 *
6956 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> is received.
6957 *
6958 * 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.
6959 */
6960 g_signal_new ("normal",
6961 G_TYPE_FROM_INTERFACE (iface),
6962 G_SIGNAL_RUN_LAST,
6963 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6964 NULL,
6965 NULL,
6966 g_cclosure_marshal_generic,
6967 G_TYPE_NONE,
6968 0);
6969
6970 /* GObject properties for D-Bus properties: */
6971 /**
6972 * SensorThreshold:lower-critical:
6973 *
6974 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6975 *
6976 * 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.
6977 */
6978 g_object_interface_install_property (iface,
6979 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6980 /**
6981 * SensorThreshold:lower-warning:
6982 *
6983 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6984 *
6985 * 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.
6986 */
6987 g_object_interface_install_property (iface,
6988 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6989 /**
6990 * SensorThreshold:upper-warning:
6991 *
6992 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6993 *
6994 * 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.
6995 */
6996 g_object_interface_install_property (iface,
6997 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6998 /**
6999 * SensorThreshold:upper-critical:
7000 *
7001 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
7002 *
7003 * 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.
7004 */
7005 g_object_interface_install_property (iface,
7006 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7007 /**
7008 * SensorThreshold:state:
7009 *
7010 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
7011 *
7012 * 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.
7013 */
7014 g_object_interface_install_property (iface,
7015 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7016}
7017
7018/**
7019 * sensor_threshold_get_lower_critical: (skip)
7020 * @object: A #SensorThreshold.
7021 *
7022 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
7023 *
7024 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7025 *
7026 * <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_threshold_dup_lower_critical() if on another thread.</warning>
7027 *
7028 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7029 */
7030GVariant *
7031sensor_threshold_get_lower_critical (SensorThreshold *object)
7032{
7033 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
7034}
7035
7036/**
7037 * sensor_threshold_dup_lower_critical: (skip)
7038 * @object: A #SensorThreshold.
7039 *
7040 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
7041 *
7042 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7043 *
7044 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
7045 */
7046GVariant *
7047sensor_threshold_dup_lower_critical (SensorThreshold *object)
7048{
7049 GVariant *value;
7050 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
7051 return value;
7052}
7053
7054/**
7055 * sensor_threshold_set_lower_critical: (skip)
7056 * @object: A #SensorThreshold.
7057 * @value: The value to set.
7058 *
7059 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
7060 *
7061 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7062 */
7063void
7064sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
7065{
7066 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
7067}
7068
7069/**
7070 * sensor_threshold_get_lower_warning: (skip)
7071 * @object: A #SensorThreshold.
7072 *
7073 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
7074 *
7075 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7076 *
7077 * <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_threshold_dup_lower_warning() if on another thread.</warning>
7078 *
7079 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7080 */
7081GVariant *
7082sensor_threshold_get_lower_warning (SensorThreshold *object)
7083{
7084 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
7085}
7086
7087/**
7088 * sensor_threshold_dup_lower_warning: (skip)
7089 * @object: A #SensorThreshold.
7090 *
7091 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
7092 *
7093 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7094 *
7095 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
7096 */
7097GVariant *
7098sensor_threshold_dup_lower_warning (SensorThreshold *object)
7099{
7100 GVariant *value;
7101 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
7102 return value;
7103}
7104
7105/**
7106 * sensor_threshold_set_lower_warning: (skip)
7107 * @object: A #SensorThreshold.
7108 * @value: The value to set.
7109 *
7110 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
7111 *
7112 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7113 */
7114void
7115sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
7116{
7117 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
7118}
7119
7120/**
7121 * sensor_threshold_get_upper_warning: (skip)
7122 * @object: A #SensorThreshold.
7123 *
7124 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
7125 *
7126 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7127 *
7128 * <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_threshold_dup_upper_warning() if on another thread.</warning>
7129 *
7130 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7131 */
7132GVariant *
7133sensor_threshold_get_upper_warning (SensorThreshold *object)
7134{
7135 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
7136}
7137
7138/**
7139 * sensor_threshold_dup_upper_warning: (skip)
7140 * @object: A #SensorThreshold.
7141 *
7142 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
7143 *
7144 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7145 *
7146 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
7147 */
7148GVariant *
7149sensor_threshold_dup_upper_warning (SensorThreshold *object)
7150{
7151 GVariant *value;
7152 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
7153 return value;
7154}
7155
7156/**
7157 * sensor_threshold_set_upper_warning: (skip)
7158 * @object: A #SensorThreshold.
7159 * @value: The value to set.
7160 *
7161 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
7162 *
7163 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7164 */
7165void
7166sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
7167{
7168 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
7169}
7170
7171/**
7172 * sensor_threshold_get_upper_critical: (skip)
7173 * @object: A #SensorThreshold.
7174 *
7175 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
7176 *
7177 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7178 *
7179 * <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_threshold_dup_upper_critical() if on another thread.</warning>
7180 *
7181 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7182 */
7183GVariant *
7184sensor_threshold_get_upper_critical (SensorThreshold *object)
7185{
7186 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
7187}
7188
7189/**
7190 * sensor_threshold_dup_upper_critical: (skip)
7191 * @object: A #SensorThreshold.
7192 *
7193 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
7194 *
7195 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7196 *
7197 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
7198 */
7199GVariant *
7200sensor_threshold_dup_upper_critical (SensorThreshold *object)
7201{
7202 GVariant *value;
7203 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
7204 return value;
7205}
7206
7207/**
7208 * sensor_threshold_set_upper_critical: (skip)
7209 * @object: A #SensorThreshold.
7210 * @value: The value to set.
7211 *
7212 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
7213 *
7214 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7215 */
7216void
7217sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
7218{
7219 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
7220}
7221
7222/**
7223 * sensor_threshold_get_state: (skip)
7224 * @object: A #SensorThreshold.
7225 *
7226 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
7227 *
7228 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
7229 *
7230 * Returns: The property value.
7231 */
7232guchar
7233sensor_threshold_get_state (SensorThreshold *object)
7234{
7235 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
7236}
7237
7238/**
7239 * sensor_threshold_set_state: (skip)
7240 * @object: A #SensorThreshold.
7241 * @value: The value to set.
7242 *
7243 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
7244 *
7245 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
7246 */
7247void
7248sensor_threshold_set_state (SensorThreshold *object, guchar value)
7249{
7250 g_object_set (G_OBJECT (object), "state", value, NULL);
7251}
7252
7253/**
7254 * sensor_threshold_emit_warning:
7255 * @object: A #SensorThreshold.
7256 *
7257 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
7258 */
7259void
7260sensor_threshold_emit_warning (
7261 SensorThreshold *object)
7262{
7263 g_signal_emit_by_name (object, "warning");
7264}
7265
7266/**
7267 * sensor_threshold_emit_critical:
7268 * @object: A #SensorThreshold.
7269 *
7270 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
7271 */
7272void
7273sensor_threshold_emit_critical (
7274 SensorThreshold *object)
7275{
7276 g_signal_emit_by_name (object, "critical");
7277}
7278
7279/**
7280 * sensor_threshold_emit_normal:
7281 * @object: A #SensorThreshold.
7282 *
7283 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
7284 */
7285void
7286sensor_threshold_emit_normal (
7287 SensorThreshold *object)
7288{
7289 g_signal_emit_by_name (object, "normal");
7290}
7291
7292/**
7293 * sensor_threshold_call_get_state:
7294 * @proxy: A #SensorThresholdProxy.
7295 * @cancellable: (allow-none): A #GCancellable or %NULL.
7296 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
7297 * @user_data: User data to pass to @callback.
7298 *
7299 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
7300 * 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.
7301 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
7302 *
7303 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
7304 */
7305void
7306sensor_threshold_call_get_state (
7307 SensorThreshold *proxy,
7308 GCancellable *cancellable,
7309 GAsyncReadyCallback callback,
7310 gpointer user_data)
7311{
7312 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
7313 "getState",
7314 g_variant_new ("()"),
7315 G_DBUS_CALL_FLAGS_NONE,
7316 -1,
7317 cancellable,
7318 callback,
7319 user_data);
7320}
7321
7322/**
7323 * sensor_threshold_call_get_state_finish:
7324 * @proxy: A #SensorThresholdProxy.
7325 * @out_state: (out): Return location for return parameter or %NULL to ignore.
7326 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
7327 * @error: Return location for error or %NULL.
7328 *
7329 * Finishes an operation started with sensor_threshold_call_get_state().
7330 *
7331 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
7332 */
7333gboolean
7334sensor_threshold_call_get_state_finish (
7335 SensorThreshold *proxy,
7336 guchar *out_state,
7337 GAsyncResult *res,
7338 GError **error)
7339{
7340 GVariant *_ret;
7341 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
7342 if (_ret == NULL)
7343 goto _out;
7344 g_variant_get (_ret,
7345 "(y)",
7346 out_state);
7347 g_variant_unref (_ret);
7348_out:
7349 return _ret != NULL;
7350}
7351
7352/**
7353 * sensor_threshold_call_get_state_sync:
7354 * @proxy: A #SensorThresholdProxy.
7355 * @out_state: (out): Return location for return parameter or %NULL to ignore.
7356 * @cancellable: (allow-none): A #GCancellable or %NULL.
7357 * @error: Return location for error or %NULL.
7358 *
7359 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
7360 *
7361 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
7362 *
7363 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
7364 */
7365gboolean
7366sensor_threshold_call_get_state_sync (
7367 SensorThreshold *proxy,
7368 guchar *out_state,
7369 GCancellable *cancellable,
7370 GError **error)
7371{
7372 GVariant *_ret;
7373 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
7374 "getState",
7375 g_variant_new ("()"),
7376 G_DBUS_CALL_FLAGS_NONE,
7377 -1,
7378 cancellable,
7379 error);
7380 if (_ret == NULL)
7381 goto _out;
7382 g_variant_get (_ret,
7383 "(y)",
7384 out_state);
7385 g_variant_unref (_ret);
7386_out:
7387 return _ret != NULL;
7388}
7389
7390/**
7391 * sensor_threshold_complete_get_state:
7392 * @object: A #SensorThreshold.
7393 * @invocation: (transfer full): A #GDBusMethodInvocation.
7394 * @state: Parameter to return.
7395 *
7396 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorThreshold.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.
7397 *
7398 * This method will free @invocation, you cannot use it afterwards.
7399 */
7400void
7401sensor_threshold_complete_get_state (
7402 SensorThreshold *object,
7403 GDBusMethodInvocation *invocation,
7404 guchar state)
7405{
7406 g_dbus_method_invocation_return_value (invocation,
7407 g_variant_new ("(y)",
7408 state));
7409}
7410
7411/* ------------------------------------------------------------------------ */
7412
7413/**
7414 * SensorThresholdProxy:
7415 *
7416 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
7417 */
7418
7419/**
7420 * SensorThresholdProxyClass:
7421 * @parent_class: The parent class.
7422 *
7423 * Class structure for #SensorThresholdProxy.
7424 */
7425
7426struct _SensorThresholdProxyPrivate
7427{
7428 GData *qdata;
7429};
7430
7431static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
7432
7433#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7434G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7435 G_ADD_PRIVATE (SensorThresholdProxy)
7436 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
7437
7438#else
7439G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7440 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
7441
7442#endif
7443static void
7444sensor_threshold_proxy_finalize (GObject *object)
7445{
7446 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7447 g_datalist_clear (&proxy->priv->qdata);
7448 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
7449}
7450
7451static void
7452sensor_threshold_proxy_get_property (GObject *object,
7453 guint prop_id,
7454 GValue *value,
7455 GParamSpec *pspec G_GNUC_UNUSED)
7456{
7457 const _ExtendedGDBusPropertyInfo *info;
7458 GVariant *variant;
7459 g_assert (prop_id != 0 && prop_id - 1 < 5);
7460 info = _sensor_threshold_property_info_pointers[prop_id - 1];
7461 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7462 if (info->use_gvariant)
7463 {
7464 g_value_set_variant (value, variant);
7465 }
7466 else
7467 {
7468 if (variant != NULL)
7469 g_dbus_gvariant_to_gvalue (variant, value);
7470 }
7471 if (variant != NULL)
7472 g_variant_unref (variant);
7473}
7474
7475static void
7476sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
7477 GAsyncResult *res,
7478 gpointer user_data)
7479{
7480 const _ExtendedGDBusPropertyInfo *info = user_data;
7481 GError *error;
7482 GVariant *_ret;
7483 error = NULL;
7484 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7485 if (!_ret)
7486 {
7487 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
7488 info->parent_struct.name,
7489 error->message, g_quark_to_string (error->domain), error->code);
7490 g_error_free (error);
7491 }
7492 else
7493 {
7494 g_variant_unref (_ret);
7495 }
7496}
7497
7498static void
7499sensor_threshold_proxy_set_property (GObject *object,
7500 guint prop_id,
7501 const GValue *value,
7502 GParamSpec *pspec G_GNUC_UNUSED)
7503{
7504 const _ExtendedGDBusPropertyInfo *info;
7505 GVariant *variant;
7506 g_assert (prop_id != 0 && prop_id - 1 < 5);
7507 info = _sensor_threshold_property_info_pointers[prop_id - 1];
7508 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7509 g_dbus_proxy_call (G_DBUS_PROXY (object),
7510 "org.freedesktop.DBus.Properties.Set",
7511 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
7512 G_DBUS_CALL_FLAGS_NONE,
7513 -1,
7514 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7515 g_variant_unref (variant);
7516}
7517
7518static void
7519sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
7520 const gchar *sender_name G_GNUC_UNUSED,
7521 const gchar *signal_name,
7522 GVariant *parameters)
7523{
7524 _ExtendedGDBusSignalInfo *info;
7525 GVariantIter iter;
7526 GVariant *child;
7527 GValue *paramv;
7528 guint num_params;
7529 guint n;
7530 guint signal_id;
7531 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
7532 if (info == NULL)
7533 return;
7534 num_params = g_variant_n_children (parameters);
7535 paramv = g_new0 (GValue, num_params + 1);
7536 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
7537 g_value_set_object (&paramv[0], proxy);
7538 g_variant_iter_init (&iter, parameters);
7539 n = 1;
7540 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7541 {
7542 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7543 if (arg_info->use_gvariant)
7544 {
7545 g_value_init (&paramv[n], G_TYPE_VARIANT);
7546 g_value_set_variant (&paramv[n], child);
7547 n++;
7548 }
7549 else
7550 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7551 g_variant_unref (child);
7552 }
7553 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7554 g_signal_emitv (paramv, signal_id, 0, NULL);
7555 for (n = 0; n < num_params + 1; n++)
7556 g_value_unset (&paramv[n]);
7557 g_free (paramv);
7558}
7559
7560static void
7561sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
7562 GVariant *changed_properties,
7563 const gchar *const *invalidated_properties)
7564{
7565 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
7566 guint n;
7567 const gchar *key;
7568 GVariantIter *iter;
7569 _ExtendedGDBusPropertyInfo *info;
7570 g_variant_get (changed_properties, "a{sv}", &iter);
7571 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7572 {
7573 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
7574 g_datalist_remove_data (&proxy->priv->qdata, key);
7575 if (info != NULL)
7576 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7577 }
7578 g_variant_iter_free (iter);
7579 for (n = 0; invalidated_properties[n] != NULL; n++)
7580 {
7581 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
7582 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7583 if (info != NULL)
7584 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7585 }
7586}
7587
7588static GVariant *
7589sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
7590{
7591 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7592 GVariant *variant;
7593 GVariant *value = NULL;
7594 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
7595 value = variant;
7596 if (variant != NULL)
7597 g_variant_unref (variant);
7598 return value;
7599}
7600
7601static GVariant *
7602sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
7603{
7604 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7605 GVariant *variant;
7606 GVariant *value = NULL;
7607 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
7608 value = variant;
7609 if (variant != NULL)
7610 g_variant_unref (variant);
7611 return value;
7612}
7613
7614static GVariant *
7615sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
7616{
7617 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7618 GVariant *variant;
7619 GVariant *value = NULL;
7620 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
7621 value = variant;
7622 if (variant != NULL)
7623 g_variant_unref (variant);
7624 return value;
7625}
7626
7627static GVariant *
7628sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
7629{
7630 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7631 GVariant *variant;
7632 GVariant *value = NULL;
7633 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
7634 value = variant;
7635 if (variant != NULL)
7636 g_variant_unref (variant);
7637 return value;
7638}
7639
7640static guchar
7641sensor_threshold_proxy_get_state (SensorThreshold *object)
7642{
7643 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7644 GVariant *variant;
7645 guchar value = 0;
7646 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
7647 if (variant != NULL)
7648 {
7649 value = g_variant_get_byte (variant);
7650 g_variant_unref (variant);
7651 }
7652 return value;
7653}
7654
7655static void
7656sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
7657{
7658#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7659 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
7660#else
7661 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
7662#endif
7663
7664 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
7665}
7666
7667static void
7668sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
7669{
7670 GObjectClass *gobject_class;
7671 GDBusProxyClass *proxy_class;
7672
7673 gobject_class = G_OBJECT_CLASS (klass);
7674 gobject_class->finalize = sensor_threshold_proxy_finalize;
7675 gobject_class->get_property = sensor_threshold_proxy_get_property;
7676 gobject_class->set_property = sensor_threshold_proxy_set_property;
7677
7678 proxy_class = G_DBUS_PROXY_CLASS (klass);
7679 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
7680 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
7681
7682 sensor_threshold_override_properties (gobject_class, 1);
7683
7684#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7685 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
7686#endif
7687}
7688
7689static void
7690sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
7691{
7692 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
7693 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
7694 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
7695 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
7696 iface->get_state = sensor_threshold_proxy_get_state;
7697}
7698
7699/**
7700 * sensor_threshold_proxy_new:
7701 * @connection: A #GDBusConnection.
7702 * @flags: Flags from the #GDBusProxyFlags enumeration.
7703 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7704 * @object_path: An object path.
7705 * @cancellable: (allow-none): A #GCancellable or %NULL.
7706 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7707 * @user_data: User data to pass to @callback.
7708 *
7709 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new() for more details.
7710 *
7711 * 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.
7712 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
7713 *
7714 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
7715 */
7716void
7717sensor_threshold_proxy_new (
7718 GDBusConnection *connection,
7719 GDBusProxyFlags flags,
7720 const gchar *name,
7721 const gchar *object_path,
7722 GCancellable *cancellable,
7723 GAsyncReadyCallback callback,
7724 gpointer user_data)
7725{
7726 g_async_initable_new_async (TYPE_SENSOR_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.SensorThreshold", NULL);
7727}
7728
7729/**
7730 * sensor_threshold_proxy_new_finish:
7731 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
7732 * @error: Return location for error or %NULL
7733 *
7734 * Finishes an operation started with sensor_threshold_proxy_new().
7735 *
7736 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7737 */
7738SensorThreshold *
7739sensor_threshold_proxy_new_finish (
7740 GAsyncResult *res,
7741 GError **error)
7742{
7743 GObject *ret;
7744 GObject *source_object;
7745 source_object = g_async_result_get_source_object (res);
7746 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7747 g_object_unref (source_object);
7748 if (ret != NULL)
7749 return SENSOR_THRESHOLD (ret);
7750 else
7751 return NULL;
7752}
7753
7754/**
7755 * sensor_threshold_proxy_new_sync:
7756 * @connection: A #GDBusConnection.
7757 * @flags: Flags from the #GDBusProxyFlags enumeration.
7758 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7759 * @object_path: An object path.
7760 * @cancellable: (allow-none): A #GCancellable or %NULL.
7761 * @error: Return location for error or %NULL
7762 *
7763 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new_sync() for more details.
7764 *
7765 * The calling thread is blocked until a reply is received.
7766 *
7767 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
7768 *
7769 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7770 */
7771SensorThreshold *
7772sensor_threshold_proxy_new_sync (
7773 GDBusConnection *connection,
7774 GDBusProxyFlags flags,
7775 const gchar *name,
7776 const gchar *object_path,
7777 GCancellable *cancellable,
7778 GError **error)
7779{
7780 GInitable *ret;
7781 ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL);
7782 if (ret != NULL)
7783 return SENSOR_THRESHOLD (ret);
7784 else
7785 return NULL;
7786}
7787
7788
7789/**
7790 * sensor_threshold_proxy_new_for_bus:
7791 * @bus_type: A #GBusType.
7792 * @flags: Flags from the #GDBusProxyFlags enumeration.
7793 * @name: A bus name (well-known or unique).
7794 * @object_path: An object path.
7795 * @cancellable: (allow-none): A #GCancellable or %NULL.
7796 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7797 * @user_data: User data to pass to @callback.
7798 *
7799 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7800 *
7801 * 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.
7802 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
7803 *
7804 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7805 */
7806void
7807sensor_threshold_proxy_new_for_bus (
7808 GBusType bus_type,
7809 GDBusProxyFlags flags,
7810 const gchar *name,
7811 const gchar *object_path,
7812 GCancellable *cancellable,
7813 GAsyncReadyCallback callback,
7814 gpointer user_data)
7815{
7816 g_async_initable_new_async (TYPE_SENSOR_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.SensorThreshold", NULL);
7817}
7818
7819/**
7820 * sensor_threshold_proxy_new_for_bus_finish:
7821 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
7822 * @error: Return location for error or %NULL
7823 *
7824 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
7825 *
7826 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7827 */
7828SensorThreshold *
7829sensor_threshold_proxy_new_for_bus_finish (
7830 GAsyncResult *res,
7831 GError **error)
7832{
7833 GObject *ret;
7834 GObject *source_object;
7835 source_object = g_async_result_get_source_object (res);
7836 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7837 g_object_unref (source_object);
7838 if (ret != NULL)
7839 return SENSOR_THRESHOLD (ret);
7840 else
7841 return NULL;
7842}
7843
7844/**
7845 * sensor_threshold_proxy_new_for_bus_sync:
7846 * @bus_type: A #GBusType.
7847 * @flags: Flags from the #GDBusProxyFlags enumeration.
7848 * @name: A bus name (well-known or unique).
7849 * @object_path: An object path.
7850 * @cancellable: (allow-none): A #GCancellable or %NULL.
7851 * @error: Return location for error or %NULL
7852 *
7853 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7854 *
7855 * The calling thread is blocked until a reply is received.
7856 *
7857 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
7858 *
7859 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7860 */
7861SensorThreshold *
7862sensor_threshold_proxy_new_for_bus_sync (
7863 GBusType bus_type,
7864 GDBusProxyFlags flags,
7865 const gchar *name,
7866 const gchar *object_path,
7867 GCancellable *cancellable,
7868 GError **error)
7869{
7870 GInitable *ret;
7871 ret = g_initable_new (TYPE_SENSOR_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.SensorThreshold", NULL);
7872 if (ret != NULL)
7873 return SENSOR_THRESHOLD (ret);
7874 else
7875 return NULL;
7876}
7877
7878
7879/* ------------------------------------------------------------------------ */
7880
7881/**
7882 * SensorThresholdSkeleton:
7883 *
7884 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
7885 */
7886
7887/**
7888 * SensorThresholdSkeletonClass:
7889 * @parent_class: The parent class.
7890 *
7891 * Class structure for #SensorThresholdSkeleton.
7892 */
7893
7894struct _SensorThresholdSkeletonPrivate
7895{
7896 GValue *properties;
7897 GList *changed_properties;
7898 GSource *changed_properties_idle_source;
7899 GMainContext *context;
7900 GMutex lock;
7901};
7902
7903static void
7904_sensor_threshold_skeleton_handle_method_call (
7905 GDBusConnection *connection G_GNUC_UNUSED,
7906 const gchar *sender G_GNUC_UNUSED,
7907 const gchar *object_path G_GNUC_UNUSED,
7908 const gchar *interface_name,
7909 const gchar *method_name,
7910 GVariant *parameters,
7911 GDBusMethodInvocation *invocation,
7912 gpointer user_data)
7913{
7914 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7915 _ExtendedGDBusMethodInfo *info;
7916 GVariantIter iter;
7917 GVariant *child;
7918 GValue *paramv;
7919 guint num_params;
7920 guint num_extra;
7921 guint n;
7922 guint signal_id;
7923 GValue return_value = G_VALUE_INIT;
7924 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7925 g_assert (info != NULL);
7926 num_params = g_variant_n_children (parameters);
7927 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7928 n = 0;
7929 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
7930 g_value_set_object (&paramv[n++], skeleton);
7931 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7932 g_value_set_object (&paramv[n++], invocation);
7933 if (info->pass_fdlist)
7934 {
7935#ifdef G_OS_UNIX
7936 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7937 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7938#else
7939 g_assert_not_reached ();
7940#endif
7941 }
7942 g_variant_iter_init (&iter, parameters);
7943 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7944 {
7945 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7946 if (arg_info->use_gvariant)
7947 {
7948 g_value_init (&paramv[n], G_TYPE_VARIANT);
7949 g_value_set_variant (&paramv[n], child);
7950 n++;
7951 }
7952 else
7953 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7954 g_variant_unref (child);
7955 }
7956 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7957 g_value_init (&return_value, G_TYPE_BOOLEAN);
7958 g_signal_emitv (paramv, signal_id, 0, &return_value);
7959 if (!g_value_get_boolean (&return_value))
7960 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);
7961 g_value_unset (&return_value);
7962 for (n = 0; n < num_params + num_extra; n++)
7963 g_value_unset (&paramv[n]);
7964 g_free (paramv);
7965}
7966
7967static GVariant *
7968_sensor_threshold_skeleton_handle_get_property (
7969 GDBusConnection *connection G_GNUC_UNUSED,
7970 const gchar *sender G_GNUC_UNUSED,
7971 const gchar *object_path G_GNUC_UNUSED,
7972 const gchar *interface_name G_GNUC_UNUSED,
7973 const gchar *property_name,
7974 GError **error,
7975 gpointer user_data)
7976{
7977 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7978 GValue value = G_VALUE_INIT;
7979 GParamSpec *pspec;
7980 _ExtendedGDBusPropertyInfo *info;
7981 GVariant *ret;
7982 ret = NULL;
7983 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7984 g_assert (info != NULL);
7985 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7986 if (pspec == NULL)
7987 {
7988 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7989 }
7990 else
7991 {
7992 g_value_init (&value, pspec->value_type);
7993 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7994 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7995 g_value_unset (&value);
7996 }
7997 return ret;
7998}
7999
8000static gboolean
8001_sensor_threshold_skeleton_handle_set_property (
8002 GDBusConnection *connection G_GNUC_UNUSED,
8003 const gchar *sender G_GNUC_UNUSED,
8004 const gchar *object_path G_GNUC_UNUSED,
8005 const gchar *interface_name G_GNUC_UNUSED,
8006 const gchar *property_name,
8007 GVariant *variant,
8008 GError **error,
8009 gpointer user_data)
8010{
8011 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
8012 GValue value = G_VALUE_INIT;
8013 GParamSpec *pspec;
8014 _ExtendedGDBusPropertyInfo *info;
8015 gboolean ret;
8016 ret = FALSE;
8017 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
8018 g_assert (info != NULL);
8019 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8020 if (pspec == NULL)
8021 {
8022 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8023 }
8024 else
8025 {
8026 if (info->use_gvariant)
8027 g_value_set_variant (&value, variant);
8028 else
8029 g_dbus_gvariant_to_gvalue (variant, &value);
8030 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8031 g_value_unset (&value);
8032 ret = TRUE;
8033 }
8034 return ret;
8035}
8036
8037static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
8038{
8039 _sensor_threshold_skeleton_handle_method_call,
8040 _sensor_threshold_skeleton_handle_get_property,
8041 _sensor_threshold_skeleton_handle_set_property,
8042 {NULL}
8043};
8044
8045static GDBusInterfaceInfo *
8046sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8047{
8048 return sensor_threshold_interface_info ();
8049}
8050
8051static GDBusInterfaceVTable *
8052sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8053{
8054 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
8055}
8056
8057static GVariant *
8058sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8059{
8060 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
8061
8062 GVariantBuilder builder;
8063 guint n;
8064 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8065 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
8066 goto out;
8067 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
8068 {
8069 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
8070 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8071 {
8072 GVariant *value;
8073 value = _sensor_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.SensorThreshold", info->name, NULL, skeleton);
8074 if (value != NULL)
8075 {
8076 g_variant_take_ref (value);
8077 g_variant_builder_add (&builder, "{sv}", info->name, value);
8078 g_variant_unref (value);
8079 }
8080 }
8081 }
8082out:
8083 return g_variant_builder_end (&builder);
8084}
8085
8086static gboolean _sensor_threshold_emit_changed (gpointer user_data);
8087
8088static void
8089sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8090{
8091 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
8092 gboolean emit_changed = FALSE;
8093
8094 g_mutex_lock (&skeleton->priv->lock);
8095 if (skeleton->priv->changed_properties_idle_source != NULL)
8096 {
8097 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8098 skeleton->priv->changed_properties_idle_source = NULL;
8099 emit_changed = TRUE;
8100 }
8101 g_mutex_unlock (&skeleton->priv->lock);
8102
8103 if (emit_changed)
8104 _sensor_threshold_emit_changed (skeleton);
8105}
8106
8107static void
8108_sensor_threshold_on_signal_warning (
8109 SensorThreshold *object)
8110{
8111 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8112
8113 GList *connections, *l;
8114 GVariant *signal_variant;
8115 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8116
8117 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
8118 for (l = connections; l != NULL; l = l->next)
8119 {
8120 GDBusConnection *connection = l->data;
8121 g_dbus_connection_emit_signal (connection,
8122 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
8123 signal_variant, NULL);
8124 }
8125 g_variant_unref (signal_variant);
8126 g_list_free_full (connections, g_object_unref);
8127}
8128
8129static void
8130_sensor_threshold_on_signal_critical (
8131 SensorThreshold *object)
8132{
8133 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8134
8135 GList *connections, *l;
8136 GVariant *signal_variant;
8137 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8138
8139 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
8140 for (l = connections; l != NULL; l = l->next)
8141 {
8142 GDBusConnection *connection = l->data;
8143 g_dbus_connection_emit_signal (connection,
8144 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
8145 signal_variant, NULL);
8146 }
8147 g_variant_unref (signal_variant);
8148 g_list_free_full (connections, g_object_unref);
8149}
8150
8151static void
8152_sensor_threshold_on_signal_normal (
8153 SensorThreshold *object)
8154{
8155 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8156
8157 GList *connections, *l;
8158 GVariant *signal_variant;
8159 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8160
8161 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
8162 for (l = connections; l != NULL; l = l->next)
8163 {
8164 GDBusConnection *connection = l->data;
8165 g_dbus_connection_emit_signal (connection,
8166 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
8167 signal_variant, NULL);
8168 }
8169 g_variant_unref (signal_variant);
8170 g_list_free_full (connections, g_object_unref);
8171}
8172
8173static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
8174#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8175G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8176 G_ADD_PRIVATE (SensorThresholdSkeleton)
8177 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
8178
8179#else
8180G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8181 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
8182
8183#endif
8184static void
8185sensor_threshold_skeleton_finalize (GObject *object)
8186{
8187 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8188 guint n;
8189 for (n = 0; n < 5; n++)
8190 g_value_unset (&skeleton->priv->properties[n]);
8191 g_free (skeleton->priv->properties);
8192 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8193 if (skeleton->priv->changed_properties_idle_source != NULL)
8194 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8195 g_main_context_unref (skeleton->priv->context);
8196 g_mutex_clear (&skeleton->priv->lock);
8197 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
8198}
8199
8200static void
8201sensor_threshold_skeleton_get_property (GObject *object,
8202 guint prop_id,
8203 GValue *value,
8204 GParamSpec *pspec G_GNUC_UNUSED)
8205{
8206 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8207 g_assert (prop_id != 0 && prop_id - 1 < 5);
8208 g_mutex_lock (&skeleton->priv->lock);
8209 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8210 g_mutex_unlock (&skeleton->priv->lock);
8211}
8212
8213static gboolean
8214_sensor_threshold_emit_changed (gpointer user_data)
8215{
8216 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
8217 GList *l;
8218 GVariantBuilder builder;
8219 GVariantBuilder invalidated_builder;
8220 guint num_changes;
8221
8222 g_mutex_lock (&skeleton->priv->lock);
8223 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8224 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8225 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8226 {
8227 ChangedProperty *cp = l->data;
8228 GVariant *variant;
8229 const GValue *cur_value;
8230
8231 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8232 if (!_g_value_equal (cur_value, &cp->orig_value))
8233 {
8234 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8235 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8236 g_variant_unref (variant);
8237 num_changes++;
8238 }
8239 }
8240 if (num_changes > 0)
8241 {
8242 GList *connections, *ll;
8243 GVariant *signal_variant;
8244 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
8245 &builder, &invalidated_builder));
8246 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8247 for (ll = connections; ll != NULL; ll = ll->next)
8248 {
8249 GDBusConnection *connection = ll->data;
8250
8251 g_dbus_connection_emit_signal (connection,
8252 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8253 "org.freedesktop.DBus.Properties",
8254 "PropertiesChanged",
8255 signal_variant,
8256 NULL);
8257 }
8258 g_variant_unref (signal_variant);
8259 g_list_free_full (connections, g_object_unref);
8260 }
8261 else
8262 {
8263 g_variant_builder_clear (&builder);
8264 g_variant_builder_clear (&invalidated_builder);
8265 }
8266 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8267 skeleton->priv->changed_properties = NULL;
8268 skeleton->priv->changed_properties_idle_source = NULL;
8269 g_mutex_unlock (&skeleton->priv->lock);
8270 return FALSE;
8271}
8272
8273static void
8274_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8275{
8276 ChangedProperty *cp;
8277 GList *l;
8278 cp = NULL;
8279 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8280 {
8281 ChangedProperty *i_cp = l->data;
8282 if (i_cp->info == info)
8283 {
8284 cp = i_cp;
8285 break;
8286 }
8287 }
8288 if (cp == NULL)
8289 {
8290 cp = g_new0 (ChangedProperty, 1);
8291 cp->prop_id = prop_id;
8292 cp->info = info;
8293 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8294 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8295 g_value_copy (orig_value, &cp->orig_value);
8296 }
8297}
8298
8299static void
8300sensor_threshold_skeleton_notify (GObject *object,
8301 GParamSpec *pspec G_GNUC_UNUSED)
8302{
8303 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8304 g_mutex_lock (&skeleton->priv->lock);
8305 if (skeleton->priv->changed_properties != NULL &&
8306 skeleton->priv->changed_properties_idle_source == NULL)
8307 {
8308 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8309 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8310 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8311 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8312 g_source_unref (skeleton->priv->changed_properties_idle_source);
8313 }
8314 g_mutex_unlock (&skeleton->priv->lock);
8315}
8316
8317static void
8318sensor_threshold_skeleton_set_property (GObject *object,
8319 guint prop_id,
8320 const GValue *value,
8321 GParamSpec *pspec)
8322{
8323 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8324 g_assert (prop_id != 0 && prop_id - 1 < 5);
8325 g_mutex_lock (&skeleton->priv->lock);
8326 g_object_freeze_notify (object);
8327 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8328 {
8329 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8330 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8331 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8332 g_object_notify_by_pspec (object, pspec);
8333 }
8334 g_mutex_unlock (&skeleton->priv->lock);
8335 g_object_thaw_notify (object);
8336}
8337
8338static void
8339sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
8340{
8341#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8342 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
8343#else
8344 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
8345#endif
8346
8347 g_mutex_init (&skeleton->priv->lock);
8348 skeleton->priv->context = g_main_context_ref_thread_default ();
8349 skeleton->priv->properties = g_new0 (GValue, 5);
8350 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
8351 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
8352 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
8353 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
8354 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
8355}
8356
8357static GVariant *
8358sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
8359{
8360 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8361 GVariant *value;
8362 g_mutex_lock (&skeleton->priv->lock);
8363 value = g_value_get_variant (&(skeleton->priv->properties[0]));
8364 g_mutex_unlock (&skeleton->priv->lock);
8365 return value;
8366}
8367
8368static GVariant *
8369sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
8370{
8371 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8372 GVariant *value;
8373 g_mutex_lock (&skeleton->priv->lock);
8374 value = g_value_get_variant (&(skeleton->priv->properties[1]));
8375 g_mutex_unlock (&skeleton->priv->lock);
8376 return value;
8377}
8378
8379static GVariant *
8380sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
8381{
8382 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8383 GVariant *value;
8384 g_mutex_lock (&skeleton->priv->lock);
8385 value = g_value_get_variant (&(skeleton->priv->properties[2]));
8386 g_mutex_unlock (&skeleton->priv->lock);
8387 return value;
8388}
8389
8390static GVariant *
8391sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
8392{
8393 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8394 GVariant *value;
8395 g_mutex_lock (&skeleton->priv->lock);
8396 value = g_value_get_variant (&(skeleton->priv->properties[3]));
8397 g_mutex_unlock (&skeleton->priv->lock);
8398 return value;
8399}
8400
8401static guchar
8402sensor_threshold_skeleton_get_state (SensorThreshold *object)
8403{
8404 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
8405 guchar value;
8406 g_mutex_lock (&skeleton->priv->lock);
8407 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
8408 g_mutex_unlock (&skeleton->priv->lock);
8409 return value;
8410}
8411
8412static void
8413sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
8414{
8415 GObjectClass *gobject_class;
8416 GDBusInterfaceSkeletonClass *skeleton_class;
8417
8418 gobject_class = G_OBJECT_CLASS (klass);
8419 gobject_class->finalize = sensor_threshold_skeleton_finalize;
8420 gobject_class->get_property = sensor_threshold_skeleton_get_property;
8421 gobject_class->set_property = sensor_threshold_skeleton_set_property;
8422 gobject_class->notify = sensor_threshold_skeleton_notify;
8423
8424
8425 sensor_threshold_override_properties (gobject_class, 1);
8426
8427 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8428 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
8429 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
8430 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
8431 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
8432
8433#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8434 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
8435#endif
8436}
8437
8438static void
8439sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
8440{
8441 iface->warning = _sensor_threshold_on_signal_warning;
8442 iface->critical = _sensor_threshold_on_signal_critical;
8443 iface->normal = _sensor_threshold_on_signal_normal;
8444 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
8445 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
8446 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
8447 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
8448 iface->get_state = sensor_threshold_skeleton_get_state;
8449}
8450
8451/**
8452 * sensor_threshold_skeleton_new:
8453 *
8454 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
8455 *
8456 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
8457 */
8458SensorThreshold *
8459sensor_threshold_skeleton_new (void)
8460{
8461 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
8462}
8463
8464/* ------------------------------------------------------------------------
8465 * Code for interface org.openbmc.SensorI2c
8466 * ------------------------------------------------------------------------
8467 */
8468
8469/**
8470 * SECTION:SensorI2c
8471 * @title: SensorI2c
8472 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
8473 *
8474 * 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.
8475 */
8476
8477/* ---- Introspection data for org.openbmc.SensorI2c ---- */
8478
8479static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
8480{
8481 {
8482 -1,
8483 (gchar *) "dev_path",
8484 (gchar *) "s",
8485 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8486 NULL
8487 },
8488 "dev-path",
8489 FALSE
8490};
8491
8492static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
8493{
8494 {
8495 -1,
8496 (gchar *) "address",
8497 (gchar *) "s",
8498 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8499 NULL
8500 },
8501 "address",
8502 FALSE
8503};
8504
8505static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
8506{
8507 &_sensor_i2c_property_info_dev_path,
8508 &_sensor_i2c_property_info_address,
8509 NULL
8510};
8511
8512static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
8513{
8514 {
8515 -1,
8516 (gchar *) "org.openbmc.SensorI2c",
8517 NULL,
8518 NULL,
8519 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
8520 NULL
8521 },
8522 "sensor-i2c",
8523};
8524
8525
8526/**
8527 * sensor_i2c_interface_info:
8528 *
8529 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
8530 *
8531 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8532 */
8533GDBusInterfaceInfo *
8534sensor_i2c_interface_info (void)
8535{
8536 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
8537}
8538
8539/**
8540 * sensor_i2c_override_properties:
8541 * @klass: The class structure for a #GObject<!-- -->-derived class.
8542 * @property_id_begin: The property id to assign to the first overridden property.
8543 *
8544 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
8545 * The properties are overridden in the order they are defined.
8546 *
8547 * Returns: The last property id.
8548 */
8549guint
8550sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
8551{
8552 g_object_class_override_property (klass, property_id_begin++, "dev-path");
8553 g_object_class_override_property (klass, property_id_begin++, "address");
8554 return property_id_begin - 1;
8555}
8556
8557
8558
8559/**
8560 * SensorI2c:
8561 *
8562 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8563 */
8564
8565/**
8566 * SensorI2cIface:
8567 * @parent_iface: The parent interface.
8568 * @get_address: Getter for the #SensorI2c:address property.
8569 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
8570 *
8571 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8572 */
8573
8574typedef SensorI2cIface SensorI2cInterface;
8575G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
8576
8577static void
8578sensor_i2c_default_init (SensorI2cIface *iface)
8579{
8580 /* GObject properties for D-Bus properties: */
8581 /**
8582 * SensorI2c:dev-path:
8583 *
8584 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
8585 *
8586 * 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.
8587 */
8588 g_object_interface_install_property (iface,
8589 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8590 /**
8591 * SensorI2c:address:
8592 *
8593 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
8594 *
8595 * 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.
8596 */
8597 g_object_interface_install_property (iface,
8598 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8599}
8600
8601/**
8602 * sensor_i2c_get_dev_path: (skip)
8603 * @object: A #SensorI2c.
8604 *
8605 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8606 *
8607 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8608 *
8609 * <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>
8610 *
8611 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8612 */
8613const gchar *
8614sensor_i2c_get_dev_path (SensorI2c *object)
8615{
8616 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
8617}
8618
8619/**
8620 * sensor_i2c_dup_dev_path: (skip)
8621 * @object: A #SensorI2c.
8622 *
8623 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8624 *
8625 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8626 *
8627 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8628 */
8629gchar *
8630sensor_i2c_dup_dev_path (SensorI2c *object)
8631{
8632 gchar *value;
8633 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
8634 return value;
8635}
8636
8637/**
8638 * sensor_i2c_set_dev_path: (skip)
8639 * @object: A #SensorI2c.
8640 * @value: The value to set.
8641 *
8642 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
8643 *
8644 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8645 */
8646void
8647sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
8648{
8649 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
8650}
8651
8652/**
8653 * sensor_i2c_get_address: (skip)
8654 * @object: A #SensorI2c.
8655 *
8656 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8657 *
8658 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8659 *
8660 * <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>
8661 *
8662 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8663 */
8664const gchar *
8665sensor_i2c_get_address (SensorI2c *object)
8666{
8667 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
8668}
8669
8670/**
8671 * sensor_i2c_dup_address: (skip)
8672 * @object: A #SensorI2c.
8673 *
8674 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8675 *
8676 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8677 *
8678 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8679 */
8680gchar *
8681sensor_i2c_dup_address (SensorI2c *object)
8682{
8683 gchar *value;
8684 g_object_get (G_OBJECT (object), "address", &value, NULL);
8685 return value;
8686}
8687
8688/**
8689 * sensor_i2c_set_address: (skip)
8690 * @object: A #SensorI2c.
8691 * @value: The value to set.
8692 *
8693 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
8694 *
8695 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8696 */
8697void
8698sensor_i2c_set_address (SensorI2c *object, const gchar *value)
8699{
8700 g_object_set (G_OBJECT (object), "address", value, NULL);
8701}
8702
8703/* ------------------------------------------------------------------------ */
8704
8705/**
8706 * SensorI2cProxy:
8707 *
8708 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
8709 */
8710
8711/**
8712 * SensorI2cProxyClass:
8713 * @parent_class: The parent class.
8714 *
8715 * Class structure for #SensorI2cProxy.
8716 */
8717
8718struct _SensorI2cProxyPrivate
8719{
8720 GData *qdata;
8721};
8722
8723static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
8724
8725#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8726G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8727 G_ADD_PRIVATE (SensorI2cProxy)
8728 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
8729
8730#else
8731G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8732 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
8733
8734#endif
8735static void
8736sensor_i2c_proxy_finalize (GObject *object)
8737{
8738 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8739 g_datalist_clear (&proxy->priv->qdata);
8740 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
8741}
8742
8743static void
8744sensor_i2c_proxy_get_property (GObject *object,
8745 guint prop_id,
8746 GValue *value,
8747 GParamSpec *pspec G_GNUC_UNUSED)
8748{
8749 const _ExtendedGDBusPropertyInfo *info;
8750 GVariant *variant;
8751 g_assert (prop_id != 0 && prop_id - 1 < 2);
8752 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8753 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
8754 if (info->use_gvariant)
8755 {
8756 g_value_set_variant (value, variant);
8757 }
8758 else
8759 {
8760 if (variant != NULL)
8761 g_dbus_gvariant_to_gvalue (variant, value);
8762 }
8763 if (variant != NULL)
8764 g_variant_unref (variant);
8765}
8766
8767static void
8768sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
8769 GAsyncResult *res,
8770 gpointer user_data)
8771{
8772 const _ExtendedGDBusPropertyInfo *info = user_data;
8773 GError *error;
8774 GVariant *_ret;
8775 error = NULL;
8776 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
8777 if (!_ret)
8778 {
8779 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
8780 info->parent_struct.name,
8781 error->message, g_quark_to_string (error->domain), error->code);
8782 g_error_free (error);
8783 }
8784 else
8785 {
8786 g_variant_unref (_ret);
8787 }
8788}
8789
8790static void
8791sensor_i2c_proxy_set_property (GObject *object,
8792 guint prop_id,
8793 const GValue *value,
8794 GParamSpec *pspec G_GNUC_UNUSED)
8795{
8796 const _ExtendedGDBusPropertyInfo *info;
8797 GVariant *variant;
8798 g_assert (prop_id != 0 && prop_id - 1 < 2);
8799 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8800 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
8801 g_dbus_proxy_call (G_DBUS_PROXY (object),
8802 "org.freedesktop.DBus.Properties.Set",
8803 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
8804 G_DBUS_CALL_FLAGS_NONE,
8805 -1,
8806 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
8807 g_variant_unref (variant);
8808}
8809
8810static void
8811sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
8812 const gchar *sender_name G_GNUC_UNUSED,
8813 const gchar *signal_name,
8814 GVariant *parameters)
8815{
8816 _ExtendedGDBusSignalInfo *info;
8817 GVariantIter iter;
8818 GVariant *child;
8819 GValue *paramv;
8820 guint num_params;
8821 guint n;
8822 guint signal_id;
8823 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
8824 if (info == NULL)
8825 return;
8826 num_params = g_variant_n_children (parameters);
8827 paramv = g_new0 (GValue, num_params + 1);
8828 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
8829 g_value_set_object (&paramv[0], proxy);
8830 g_variant_iter_init (&iter, parameters);
8831 n = 1;
8832 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8833 {
8834 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8835 if (arg_info->use_gvariant)
8836 {
8837 g_value_init (&paramv[n], G_TYPE_VARIANT);
8838 g_value_set_variant (&paramv[n], child);
8839 n++;
8840 }
8841 else
8842 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8843 g_variant_unref (child);
8844 }
8845 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8846 g_signal_emitv (paramv, signal_id, 0, NULL);
8847 for (n = 0; n < num_params + 1; n++)
8848 g_value_unset (&paramv[n]);
8849 g_free (paramv);
8850}
8851
8852static void
8853sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
8854 GVariant *changed_properties,
8855 const gchar *const *invalidated_properties)
8856{
8857 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
8858 guint n;
8859 const gchar *key;
8860 GVariantIter *iter;
8861 _ExtendedGDBusPropertyInfo *info;
8862 g_variant_get (changed_properties, "a{sv}", &iter);
8863 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8864 {
8865 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
8866 g_datalist_remove_data (&proxy->priv->qdata, key);
8867 if (info != NULL)
8868 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8869 }
8870 g_variant_iter_free (iter);
8871 for (n = 0; invalidated_properties[n] != NULL; n++)
8872 {
8873 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
8874 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8875 if (info != NULL)
8876 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8877 }
8878}
8879
8880static const gchar *
8881sensor_i2c_proxy_get_dev_path (SensorI2c *object)
8882{
8883 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8884 GVariant *variant;
8885 const gchar *value = NULL;
8886 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
8887 if (variant != NULL)
8888 {
8889 value = g_variant_get_string (variant, NULL);
8890 g_variant_unref (variant);
8891 }
8892 return value;
8893}
8894
8895static const gchar *
8896sensor_i2c_proxy_get_address (SensorI2c *object)
8897{
8898 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8899 GVariant *variant;
8900 const gchar *value = NULL;
8901 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
8902 if (variant != NULL)
8903 {
8904 value = g_variant_get_string (variant, NULL);
8905 g_variant_unref (variant);
8906 }
8907 return value;
8908}
8909
8910static void
8911sensor_i2c_proxy_init (SensorI2cProxy *proxy)
8912{
8913#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8914 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
8915#else
8916 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
8917#endif
8918
8919 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
8920}
8921
8922static void
8923sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
8924{
8925 GObjectClass *gobject_class;
8926 GDBusProxyClass *proxy_class;
8927
8928 gobject_class = G_OBJECT_CLASS (klass);
8929 gobject_class->finalize = sensor_i2c_proxy_finalize;
8930 gobject_class->get_property = sensor_i2c_proxy_get_property;
8931 gobject_class->set_property = sensor_i2c_proxy_set_property;
8932
8933 proxy_class = G_DBUS_PROXY_CLASS (klass);
8934 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8935 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8936
8937 sensor_i2c_override_properties (gobject_class, 1);
8938
8939#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8940 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8941#endif
8942}
8943
8944static void
8945sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8946{
8947 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8948 iface->get_address = sensor_i2c_proxy_get_address;
8949}
8950
8951/**
8952 * sensor_i2c_proxy_new:
8953 * @connection: A #GDBusConnection.
8954 * @flags: Flags from the #GDBusProxyFlags enumeration.
8955 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8956 * @object_path: An object path.
8957 * @cancellable: (allow-none): A #GCancellable or %NULL.
8958 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8959 * @user_data: User data to pass to @callback.
8960 *
8961 * 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.
8962 *
8963 * 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.
8964 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8965 *
8966 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8967 */
8968void
8969sensor_i2c_proxy_new (
8970 GDBusConnection *connection,
8971 GDBusProxyFlags flags,
8972 const gchar *name,
8973 const gchar *object_path,
8974 GCancellable *cancellable,
8975 GAsyncReadyCallback callback,
8976 gpointer user_data)
8977{
8978 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);
8979}
8980
8981/**
8982 * sensor_i2c_proxy_new_finish:
8983 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8984 * @error: Return location for error or %NULL
8985 *
8986 * Finishes an operation started with sensor_i2c_proxy_new().
8987 *
8988 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8989 */
8990SensorI2c *
8991sensor_i2c_proxy_new_finish (
8992 GAsyncResult *res,
8993 GError **error)
8994{
8995 GObject *ret;
8996 GObject *source_object;
8997 source_object = g_async_result_get_source_object (res);
8998 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8999 g_object_unref (source_object);
9000 if (ret != NULL)
9001 return SENSOR_I2C (ret);
9002 else
9003 return NULL;
9004}
9005
9006/**
9007 * sensor_i2c_proxy_new_sync:
9008 * @connection: A #GDBusConnection.
9009 * @flags: Flags from the #GDBusProxyFlags enumeration.
9010 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9011 * @object_path: An object path.
9012 * @cancellable: (allow-none): A #GCancellable or %NULL.
9013 * @error: Return location for error or %NULL
9014 *
9015 * 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.
9016 *
9017 * The calling thread is blocked until a reply is received.
9018 *
9019 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
9020 *
9021 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
9022 */
9023SensorI2c *
9024sensor_i2c_proxy_new_sync (
9025 GDBusConnection *connection,
9026 GDBusProxyFlags flags,
9027 const gchar *name,
9028 const gchar *object_path,
9029 GCancellable *cancellable,
9030 GError **error)
9031{
9032 GInitable *ret;
9033 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);
9034 if (ret != NULL)
9035 return SENSOR_I2C (ret);
9036 else
9037 return NULL;
9038}
9039
9040
9041/**
9042 * sensor_i2c_proxy_new_for_bus:
9043 * @bus_type: A #GBusType.
9044 * @flags: Flags from the #GDBusProxyFlags enumeration.
9045 * @name: A bus name (well-known or unique).
9046 * @object_path: An object path.
9047 * @cancellable: (allow-none): A #GCancellable or %NULL.
9048 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9049 * @user_data: User data to pass to @callback.
9050 *
9051 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9052 *
9053 * 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.
9054 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
9055 *
9056 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9057 */
9058void
9059sensor_i2c_proxy_new_for_bus (
9060 GBusType bus_type,
9061 GDBusProxyFlags flags,
9062 const gchar *name,
9063 const gchar *object_path,
9064 GCancellable *cancellable,
9065 GAsyncReadyCallback callback,
9066 gpointer user_data)
9067{
9068 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);
9069}
9070
9071/**
9072 * sensor_i2c_proxy_new_for_bus_finish:
9073 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
9074 * @error: Return location for error or %NULL
9075 *
9076 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
9077 *
9078 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
9079 */
9080SensorI2c *
9081sensor_i2c_proxy_new_for_bus_finish (
9082 GAsyncResult *res,
9083 GError **error)
9084{
9085 GObject *ret;
9086 GObject *source_object;
9087 source_object = g_async_result_get_source_object (res);
9088 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9089 g_object_unref (source_object);
9090 if (ret != NULL)
9091 return SENSOR_I2C (ret);
9092 else
9093 return NULL;
9094}
9095
9096/**
9097 * sensor_i2c_proxy_new_for_bus_sync:
9098 * @bus_type: A #GBusType.
9099 * @flags: Flags from the #GDBusProxyFlags enumeration.
9100 * @name: A bus name (well-known or unique).
9101 * @object_path: An object path.
9102 * @cancellable: (allow-none): A #GCancellable or %NULL.
9103 * @error: Return location for error or %NULL
9104 *
9105 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9106 *
9107 * The calling thread is blocked until a reply is received.
9108 *
9109 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
9110 *
9111 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
9112 */
9113SensorI2c *
9114sensor_i2c_proxy_new_for_bus_sync (
9115 GBusType bus_type,
9116 GDBusProxyFlags flags,
9117 const gchar *name,
9118 const gchar *object_path,
9119 GCancellable *cancellable,
9120 GError **error)
9121{
9122 GInitable *ret;
9123 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);
9124 if (ret != NULL)
9125 return SENSOR_I2C (ret);
9126 else
9127 return NULL;
9128}
9129
9130
9131/* ------------------------------------------------------------------------ */
9132
9133/**
9134 * SensorI2cSkeleton:
9135 *
9136 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
9137 */
9138
9139/**
9140 * SensorI2cSkeletonClass:
9141 * @parent_class: The parent class.
9142 *
9143 * Class structure for #SensorI2cSkeleton.
9144 */
9145
9146struct _SensorI2cSkeletonPrivate
9147{
9148 GValue *properties;
9149 GList *changed_properties;
9150 GSource *changed_properties_idle_source;
9151 GMainContext *context;
9152 GMutex lock;
9153};
9154
9155static void
9156_sensor_i2c_skeleton_handle_method_call (
9157 GDBusConnection *connection G_GNUC_UNUSED,
9158 const gchar *sender G_GNUC_UNUSED,
9159 const gchar *object_path G_GNUC_UNUSED,
9160 const gchar *interface_name,
9161 const gchar *method_name,
9162 GVariant *parameters,
9163 GDBusMethodInvocation *invocation,
9164 gpointer user_data)
9165{
9166 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
9167 _ExtendedGDBusMethodInfo *info;
9168 GVariantIter iter;
9169 GVariant *child;
9170 GValue *paramv;
9171 guint num_params;
9172 guint num_extra;
9173 guint n;
9174 guint signal_id;
9175 GValue return_value = G_VALUE_INIT;
9176 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9177 g_assert (info != NULL);
9178 num_params = g_variant_n_children (parameters);
9179 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9180 n = 0;
9181 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
9182 g_value_set_object (&paramv[n++], skeleton);
9183 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9184 g_value_set_object (&paramv[n++], invocation);
9185 if (info->pass_fdlist)
9186 {
9187#ifdef G_OS_UNIX
9188 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9189 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9190#else
9191 g_assert_not_reached ();
9192#endif
9193 }
9194 g_variant_iter_init (&iter, parameters);
9195 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9196 {
9197 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9198 if (arg_info->use_gvariant)
9199 {
9200 g_value_init (&paramv[n], G_TYPE_VARIANT);
9201 g_value_set_variant (&paramv[n], child);
9202 n++;
9203 }
9204 else
9205 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9206 g_variant_unref (child);
9207 }
9208 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
9209 g_value_init (&return_value, G_TYPE_BOOLEAN);
9210 g_signal_emitv (paramv, signal_id, 0, &return_value);
9211 if (!g_value_get_boolean (&return_value))
9212 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);
9213 g_value_unset (&return_value);
9214 for (n = 0; n < num_params + num_extra; n++)
9215 g_value_unset (&paramv[n]);
9216 g_free (paramv);
9217}
9218
9219static GVariant *
9220_sensor_i2c_skeleton_handle_get_property (
9221 GDBusConnection *connection G_GNUC_UNUSED,
9222 const gchar *sender G_GNUC_UNUSED,
9223 const gchar *object_path G_GNUC_UNUSED,
9224 const gchar *interface_name G_GNUC_UNUSED,
9225 const gchar *property_name,
9226 GError **error,
9227 gpointer user_data)
9228{
9229 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
9230 GValue value = G_VALUE_INIT;
9231 GParamSpec *pspec;
9232 _ExtendedGDBusPropertyInfo *info;
9233 GVariant *ret;
9234 ret = NULL;
9235 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
9236 g_assert (info != NULL);
9237 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9238 if (pspec == NULL)
9239 {
9240 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9241 }
9242 else
9243 {
9244 g_value_init (&value, pspec->value_type);
9245 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9246 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9247 g_value_unset (&value);
9248 }
9249 return ret;
9250}
9251
9252static gboolean
9253_sensor_i2c_skeleton_handle_set_property (
9254 GDBusConnection *connection G_GNUC_UNUSED,
9255 const gchar *sender G_GNUC_UNUSED,
9256 const gchar *object_path G_GNUC_UNUSED,
9257 const gchar *interface_name G_GNUC_UNUSED,
9258 const gchar *property_name,
9259 GVariant *variant,
9260 GError **error,
9261 gpointer user_data)
9262{
9263 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
9264 GValue value = G_VALUE_INIT;
9265 GParamSpec *pspec;
9266 _ExtendedGDBusPropertyInfo *info;
9267 gboolean ret;
9268 ret = FALSE;
9269 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
9270 g_assert (info != NULL);
9271 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9272 if (pspec == NULL)
9273 {
9274 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9275 }
9276 else
9277 {
9278 if (info->use_gvariant)
9279 g_value_set_variant (&value, variant);
9280 else
9281 g_dbus_gvariant_to_gvalue (variant, &value);
9282 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9283 g_value_unset (&value);
9284 ret = TRUE;
9285 }
9286 return ret;
9287}
9288
9289static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
9290{
9291 _sensor_i2c_skeleton_handle_method_call,
9292 _sensor_i2c_skeleton_handle_get_property,
9293 _sensor_i2c_skeleton_handle_set_property,
9294 {NULL}
9295};
9296
9297static GDBusInterfaceInfo *
9298sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9299{
9300 return sensor_i2c_interface_info ();
9301}
9302
9303static GDBusInterfaceVTable *
9304sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9305{
9306 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
9307}
9308
9309static GVariant *
9310sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9311{
9312 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
9313
9314 GVariantBuilder builder;
9315 guint n;
9316 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9317 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
9318 goto out;
9319 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
9320 {
9321 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
9322 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9323 {
9324 GVariant *value;
9325 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);
9326 if (value != NULL)
9327 {
9328 g_variant_take_ref (value);
9329 g_variant_builder_add (&builder, "{sv}", info->name, value);
9330 g_variant_unref (value);
9331 }
9332 }
9333 }
9334out:
9335 return g_variant_builder_end (&builder);
9336}
9337
9338static gboolean _sensor_i2c_emit_changed (gpointer user_data);
9339
9340static void
9341sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9342{
9343 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
9344 gboolean emit_changed = FALSE;
9345
9346 g_mutex_lock (&skeleton->priv->lock);
9347 if (skeleton->priv->changed_properties_idle_source != NULL)
9348 {
9349 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9350 skeleton->priv->changed_properties_idle_source = NULL;
9351 emit_changed = TRUE;
9352 }
9353 g_mutex_unlock (&skeleton->priv->lock);
9354
9355 if (emit_changed)
9356 _sensor_i2c_emit_changed (skeleton);
9357}
9358
9359static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
9360#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9361G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9362 G_ADD_PRIVATE (SensorI2cSkeleton)
9363 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
9364
9365#else
9366G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9367 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
9368
9369#endif
9370static void
9371sensor_i2c_skeleton_finalize (GObject *object)
9372{
9373 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9374 guint n;
9375 for (n = 0; n < 2; n++)
9376 g_value_unset (&skeleton->priv->properties[n]);
9377 g_free (skeleton->priv->properties);
9378 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9379 if (skeleton->priv->changed_properties_idle_source != NULL)
9380 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9381 g_main_context_unref (skeleton->priv->context);
9382 g_mutex_clear (&skeleton->priv->lock);
9383 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
9384}
9385
9386static void
9387sensor_i2c_skeleton_get_property (GObject *object,
9388 guint prop_id,
9389 GValue *value,
9390 GParamSpec *pspec G_GNUC_UNUSED)
9391{
9392 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9393 g_assert (prop_id != 0 && prop_id - 1 < 2);
9394 g_mutex_lock (&skeleton->priv->lock);
9395 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9396 g_mutex_unlock (&skeleton->priv->lock);
9397}
9398
9399static gboolean
9400_sensor_i2c_emit_changed (gpointer user_data)
9401{
9402 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
9403 GList *l;
9404 GVariantBuilder builder;
9405 GVariantBuilder invalidated_builder;
9406 guint num_changes;
9407
9408 g_mutex_lock (&skeleton->priv->lock);
9409 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9410 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9411 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9412 {
9413 ChangedProperty *cp = l->data;
9414 GVariant *variant;
9415 const GValue *cur_value;
9416
9417 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9418 if (!_g_value_equal (cur_value, &cp->orig_value))
9419 {
9420 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9421 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9422 g_variant_unref (variant);
9423 num_changes++;
9424 }
9425 }
9426 if (num_changes > 0)
9427 {
9428 GList *connections, *ll;
9429 GVariant *signal_variant;
9430 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
9431 &builder, &invalidated_builder));
9432 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9433 for (ll = connections; ll != NULL; ll = ll->next)
9434 {
9435 GDBusConnection *connection = ll->data;
9436
9437 g_dbus_connection_emit_signal (connection,
9438 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9439 "org.freedesktop.DBus.Properties",
9440 "PropertiesChanged",
9441 signal_variant,
9442 NULL);
9443 }
9444 g_variant_unref (signal_variant);
9445 g_list_free_full (connections, g_object_unref);
9446 }
9447 else
9448 {
9449 g_variant_builder_clear (&builder);
9450 g_variant_builder_clear (&invalidated_builder);
9451 }
9452 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9453 skeleton->priv->changed_properties = NULL;
9454 skeleton->priv->changed_properties_idle_source = NULL;
9455 g_mutex_unlock (&skeleton->priv->lock);
9456 return FALSE;
9457}
9458
9459static void
9460_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9461{
9462 ChangedProperty *cp;
9463 GList *l;
9464 cp = NULL;
9465 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9466 {
9467 ChangedProperty *i_cp = l->data;
9468 if (i_cp->info == info)
9469 {
9470 cp = i_cp;
9471 break;
9472 }
9473 }
9474 if (cp == NULL)
9475 {
9476 cp = g_new0 (ChangedProperty, 1);
9477 cp->prop_id = prop_id;
9478 cp->info = info;
9479 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9480 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9481 g_value_copy (orig_value, &cp->orig_value);
9482 }
9483}
9484
9485static void
9486sensor_i2c_skeleton_notify (GObject *object,
9487 GParamSpec *pspec G_GNUC_UNUSED)
9488{
9489 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9490 g_mutex_lock (&skeleton->priv->lock);
9491 if (skeleton->priv->changed_properties != NULL &&
9492 skeleton->priv->changed_properties_idle_source == NULL)
9493 {
9494 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9495 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9496 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9497 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9498 g_source_unref (skeleton->priv->changed_properties_idle_source);
9499 }
9500 g_mutex_unlock (&skeleton->priv->lock);
9501}
9502
9503static void
9504sensor_i2c_skeleton_set_property (GObject *object,
9505 guint prop_id,
9506 const GValue *value,
9507 GParamSpec *pspec)
9508{
9509 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9510 g_assert (prop_id != 0 && prop_id - 1 < 2);
9511 g_mutex_lock (&skeleton->priv->lock);
9512 g_object_freeze_notify (object);
9513 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9514 {
9515 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9516 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9517 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9518 g_object_notify_by_pspec (object, pspec);
9519 }
9520 g_mutex_unlock (&skeleton->priv->lock);
9521 g_object_thaw_notify (object);
9522}
9523
9524static void
9525sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
9526{
9527#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9528 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
9529#else
9530 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
9531#endif
9532
9533 g_mutex_init (&skeleton->priv->lock);
9534 skeleton->priv->context = g_main_context_ref_thread_default ();
9535 skeleton->priv->properties = g_new0 (GValue, 2);
9536 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
9537 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
9538}
9539
9540static const gchar *
9541sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
9542{
9543 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9544 const gchar *value;
9545 g_mutex_lock (&skeleton->priv->lock);
9546 value = g_value_get_string (&(skeleton->priv->properties[0]));
9547 g_mutex_unlock (&skeleton->priv->lock);
9548 return value;
9549}
9550
9551static const gchar *
9552sensor_i2c_skeleton_get_address (SensorI2c *object)
9553{
9554 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9555 const gchar *value;
9556 g_mutex_lock (&skeleton->priv->lock);
9557 value = g_value_get_string (&(skeleton->priv->properties[1]));
9558 g_mutex_unlock (&skeleton->priv->lock);
9559 return value;
9560}
9561
9562static void
9563sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
9564{
9565 GObjectClass *gobject_class;
9566 GDBusInterfaceSkeletonClass *skeleton_class;
9567
9568 gobject_class = G_OBJECT_CLASS (klass);
9569 gobject_class->finalize = sensor_i2c_skeleton_finalize;
9570 gobject_class->get_property = sensor_i2c_skeleton_get_property;
9571 gobject_class->set_property = sensor_i2c_skeleton_set_property;
9572 gobject_class->notify = sensor_i2c_skeleton_notify;
9573
9574
9575 sensor_i2c_override_properties (gobject_class, 1);
9576
9577 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9578 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
9579 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
9580 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
9581 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
9582
9583#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9584 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
9585#endif
9586}
9587
9588static void
9589sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
9590{
9591 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
9592 iface->get_address = sensor_i2c_skeleton_get_address;
9593}
9594
9595/**
9596 * sensor_i2c_skeleton_new:
9597 *
9598 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
9599 *
9600 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
9601 */
9602SensorI2c *
9603sensor_i2c_skeleton_new (void)
9604{
9605 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
9606}
9607
9608/* ------------------------------------------------------------------------
9609 * Code for interface org.openbmc.SensorMatch
9610 * ------------------------------------------------------------------------
9611 */
9612
9613/**
9614 * SECTION:SensorMatch
9615 * @title: SensorMatch
9616 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
9617 *
9618 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface in C.
9619 */
9620
9621/* ---- Introspection data for org.openbmc.SensorMatch ---- */
9622
9623static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
9624{
9625 {
9626 -1,
9627 (gchar *) "state",
9628 (gchar *) "y",
9629 NULL
9630 },
9631 FALSE
9632};
9633
9634static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
9635{
9636 &_sensor_match_signal_info_sensor_match_ARG_state,
9637 NULL
9638};
9639
9640static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
9641{
9642 {
9643 -1,
9644 (gchar *) "SensorMatch",
9645 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
9646 NULL
9647 },
9648 "sensor-match"
9649};
9650
9651static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
9652{
9653 &_sensor_match_signal_info_sensor_match,
9654 NULL
9655};
9656
9657static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
9658{
9659 {
9660 -1,
9661 (gchar *) "match_value",
9662 (gchar *) "v",
9663 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9664 NULL
9665 },
9666 "match-value",
9667 FALSE
9668};
9669
9670static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
9671{
9672 {
9673 -1,
9674 (gchar *) "state",
9675 (gchar *) "y",
9676 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9677 NULL
9678 },
9679 "state",
9680 FALSE
9681};
9682
9683static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
9684{
9685 &_sensor_match_property_info_match_value,
9686 &_sensor_match_property_info_state,
9687 NULL
9688};
9689
9690static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
9691{
9692 {
9693 -1,
9694 (gchar *) "org.openbmc.SensorMatch",
9695 NULL,
9696 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
9697 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
9698 NULL
9699 },
9700 "sensor-match",
9701};
9702
9703
9704/**
9705 * sensor_match_interface_info:
9706 *
9707 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
9708 *
9709 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9710 */
9711GDBusInterfaceInfo *
9712sensor_match_interface_info (void)
9713{
9714 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
9715}
9716
9717/**
9718 * sensor_match_override_properties:
9719 * @klass: The class structure for a #GObject<!-- -->-derived class.
9720 * @property_id_begin: The property id to assign to the first overridden property.
9721 *
9722 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
9723 * The properties are overridden in the order they are defined.
9724 *
9725 * Returns: The last property id.
9726 */
9727guint
9728sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
9729{
9730 g_object_class_override_property (klass, property_id_begin++, "match-value");
9731 g_object_class_override_property (klass, property_id_begin++, "state");
9732 return property_id_begin - 1;
9733}
9734
9735
9736
9737/**
9738 * SensorMatch:
9739 *
9740 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9741 */
9742
9743/**
9744 * SensorMatchIface:
9745 * @parent_iface: The parent interface.
9746 * @get_match_value: Getter for the #SensorMatch:match-value property.
9747 * @get_state: Getter for the #SensorMatch:state property.
9748 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
9749 *
9750 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9751 */
9752
9753typedef SensorMatchIface SensorMatchInterface;
9754G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
9755
9756static void
9757sensor_match_default_init (SensorMatchIface *iface)
9758{
9759 /* GObject signals for received D-Bus signals: */
9760 /**
9761 * SensorMatch::sensor-match:
9762 * @object: A #SensorMatch.
9763 * @arg_state: Argument.
9764 *
9765 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> is received.
9766 *
9767 * 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.
9768 */
9769 g_signal_new ("sensor-match",
9770 G_TYPE_FROM_INTERFACE (iface),
9771 G_SIGNAL_RUN_LAST,
9772 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
9773 NULL,
9774 NULL,
9775 g_cclosure_marshal_generic,
9776 G_TYPE_NONE,
9777 1, G_TYPE_UCHAR);
9778
9779 /* GObject properties for D-Bus properties: */
9780 /**
9781 * SensorMatch:match-value:
9782 *
9783 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
9784 *
9785 * 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.
9786 */
9787 g_object_interface_install_property (iface,
9788 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9789 /**
9790 * SensorMatch:state:
9791 *
9792 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
9793 *
9794 * 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.
9795 */
9796 g_object_interface_install_property (iface,
9797 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9798}
9799
9800/**
9801 * sensor_match_get_match_value: (skip)
9802 * @object: A #SensorMatch.
9803 *
9804 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9805 *
9806 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9807 *
9808 * <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_match_dup_match_value() if on another thread.</warning>
9809 *
9810 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
9811 */
9812GVariant *
9813sensor_match_get_match_value (SensorMatch *object)
9814{
9815 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
9816}
9817
9818/**
9819 * sensor_match_dup_match_value: (skip)
9820 * @object: A #SensorMatch.
9821 *
9822 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9823 *
9824 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9825 *
9826 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
9827 */
9828GVariant *
9829sensor_match_dup_match_value (SensorMatch *object)
9830{
9831 GVariant *value;
9832 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
9833 return value;
9834}
9835
9836/**
9837 * sensor_match_set_match_value: (skip)
9838 * @object: A #SensorMatch.
9839 * @value: The value to set.
9840 *
9841 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
9842 *
9843 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9844 */
9845void
9846sensor_match_set_match_value (SensorMatch *object, GVariant *value)
9847{
9848 g_object_set (G_OBJECT (object), "match-value", value, NULL);
9849}
9850
9851/**
9852 * sensor_match_get_state: (skip)
9853 * @object: A #SensorMatch.
9854 *
9855 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
9856 *
9857 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9858 *
9859 * Returns: The property value.
9860 */
9861guchar
9862sensor_match_get_state (SensorMatch *object)
9863{
9864 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
9865}
9866
9867/**
9868 * sensor_match_set_state: (skip)
9869 * @object: A #SensorMatch.
9870 * @value: The value to set.
9871 *
9872 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
9873 *
9874 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9875 */
9876void
9877sensor_match_set_state (SensorMatch *object, guchar value)
9878{
9879 g_object_set (G_OBJECT (object), "state", value, NULL);
9880}
9881
9882/**
9883 * sensor_match_emit_sensor_match:
9884 * @object: A #SensorMatch.
9885 * @arg_state: Argument to pass with the signal.
9886 *
9887 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
9888 */
9889void
9890sensor_match_emit_sensor_match (
9891 SensorMatch *object,
9892 guchar arg_state)
9893{
9894 g_signal_emit_by_name (object, "sensor-match", arg_state);
9895}
9896
9897/* ------------------------------------------------------------------------ */
9898
9899/**
9900 * SensorMatchProxy:
9901 *
9902 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
9903 */
9904
9905/**
9906 * SensorMatchProxyClass:
9907 * @parent_class: The parent class.
9908 *
9909 * Class structure for #SensorMatchProxy.
9910 */
9911
9912struct _SensorMatchProxyPrivate
9913{
9914 GData *qdata;
9915};
9916
9917static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
9918
9919#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9920G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9921 G_ADD_PRIVATE (SensorMatchProxy)
9922 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9923
9924#else
9925G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9926 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9927
9928#endif
9929static void
9930sensor_match_proxy_finalize (GObject *object)
9931{
9932 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9933 g_datalist_clear (&proxy->priv->qdata);
9934 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9935}
9936
9937static void
9938sensor_match_proxy_get_property (GObject *object,
9939 guint prop_id,
9940 GValue *value,
9941 GParamSpec *pspec G_GNUC_UNUSED)
9942{
9943 const _ExtendedGDBusPropertyInfo *info;
9944 GVariant *variant;
9945 g_assert (prop_id != 0 && prop_id - 1 < 2);
9946 info = _sensor_match_property_info_pointers[prop_id - 1];
9947 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9948 if (info->use_gvariant)
9949 {
9950 g_value_set_variant (value, variant);
9951 }
9952 else
9953 {
9954 if (variant != NULL)
9955 g_dbus_gvariant_to_gvalue (variant, value);
9956 }
9957 if (variant != NULL)
9958 g_variant_unref (variant);
9959}
9960
9961static void
9962sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9963 GAsyncResult *res,
9964 gpointer user_data)
9965{
9966 const _ExtendedGDBusPropertyInfo *info = user_data;
9967 GError *error;
9968 GVariant *_ret;
9969 error = NULL;
9970 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9971 if (!_ret)
9972 {
9973 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9974 info->parent_struct.name,
9975 error->message, g_quark_to_string (error->domain), error->code);
9976 g_error_free (error);
9977 }
9978 else
9979 {
9980 g_variant_unref (_ret);
9981 }
9982}
9983
9984static void
9985sensor_match_proxy_set_property (GObject *object,
9986 guint prop_id,
9987 const GValue *value,
9988 GParamSpec *pspec G_GNUC_UNUSED)
9989{
9990 const _ExtendedGDBusPropertyInfo *info;
9991 GVariant *variant;
9992 g_assert (prop_id != 0 && prop_id - 1 < 2);
9993 info = _sensor_match_property_info_pointers[prop_id - 1];
9994 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9995 g_dbus_proxy_call (G_DBUS_PROXY (object),
9996 "org.freedesktop.DBus.Properties.Set",
9997 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9998 G_DBUS_CALL_FLAGS_NONE,
9999 -1,
10000 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
10001 g_variant_unref (variant);
10002}
10003
10004static void
10005sensor_match_proxy_g_signal (GDBusProxy *proxy,
10006 const gchar *sender_name G_GNUC_UNUSED,
10007 const gchar *signal_name,
10008 GVariant *parameters)
10009{
10010 _ExtendedGDBusSignalInfo *info;
10011 GVariantIter iter;
10012 GVariant *child;
10013 GValue *paramv;
10014 guint num_params;
10015 guint n;
10016 guint signal_id;
10017 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
10018 if (info == NULL)
10019 return;
10020 num_params = g_variant_n_children (parameters);
10021 paramv = g_new0 (GValue, num_params + 1);
10022 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
10023 g_value_set_object (&paramv[0], proxy);
10024 g_variant_iter_init (&iter, parameters);
10025 n = 1;
10026 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10027 {
10028 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10029 if (arg_info->use_gvariant)
10030 {
10031 g_value_init (&paramv[n], G_TYPE_VARIANT);
10032 g_value_set_variant (&paramv[n], child);
10033 n++;
10034 }
10035 else
10036 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10037 g_variant_unref (child);
10038 }
10039 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
10040 g_signal_emitv (paramv, signal_id, 0, NULL);
10041 for (n = 0; n < num_params + 1; n++)
10042 g_value_unset (&paramv[n]);
10043 g_free (paramv);
10044}
10045
10046static void
10047sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
10048 GVariant *changed_properties,
10049 const gchar *const *invalidated_properties)
10050{
10051 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
10052 guint n;
10053 const gchar *key;
10054 GVariantIter *iter;
10055 _ExtendedGDBusPropertyInfo *info;
10056 g_variant_get (changed_properties, "a{sv}", &iter);
10057 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10058 {
10059 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
10060 g_datalist_remove_data (&proxy->priv->qdata, key);
10061 if (info != NULL)
10062 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10063 }
10064 g_variant_iter_free (iter);
10065 for (n = 0; invalidated_properties[n] != NULL; n++)
10066 {
10067 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
10068 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10069 if (info != NULL)
10070 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10071 }
10072}
10073
10074static GVariant *
10075sensor_match_proxy_get_match_value (SensorMatch *object)
10076{
10077 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
10078 GVariant *variant;
10079 GVariant *value = NULL;
10080 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
10081 value = variant;
10082 if (variant != NULL)
10083 g_variant_unref (variant);
10084 return value;
10085}
10086
10087static guchar
10088sensor_match_proxy_get_state (SensorMatch *object)
10089{
10090 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
10091 GVariant *variant;
10092 guchar value = 0;
10093 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
10094 if (variant != NULL)
10095 {
10096 value = g_variant_get_byte (variant);
10097 g_variant_unref (variant);
10098 }
10099 return value;
10100}
10101
10102static void
10103sensor_match_proxy_init (SensorMatchProxy *proxy)
10104{
10105#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10106 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
10107#else
10108 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
10109#endif
10110
10111 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
10112}
10113
10114static void
10115sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
10116{
10117 GObjectClass *gobject_class;
10118 GDBusProxyClass *proxy_class;
10119
10120 gobject_class = G_OBJECT_CLASS (klass);
10121 gobject_class->finalize = sensor_match_proxy_finalize;
10122 gobject_class->get_property = sensor_match_proxy_get_property;
10123 gobject_class->set_property = sensor_match_proxy_set_property;
10124
10125 proxy_class = G_DBUS_PROXY_CLASS (klass);
10126 proxy_class->g_signal = sensor_match_proxy_g_signal;
10127 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
10128
10129 sensor_match_override_properties (gobject_class, 1);
10130
10131#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10132 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
10133#endif
10134}
10135
10136static void
10137sensor_match_proxy_iface_init (SensorMatchIface *iface)
10138{
10139 iface->get_match_value = sensor_match_proxy_get_match_value;
10140 iface->get_state = sensor_match_proxy_get_state;
10141}
10142
10143/**
10144 * sensor_match_proxy_new:
10145 * @connection: A #GDBusConnection.
10146 * @flags: Flags from the #GDBusProxyFlags enumeration.
10147 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10148 * @object_path: An object path.
10149 * @cancellable: (allow-none): A #GCancellable or %NULL.
10150 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10151 * @user_data: User data to pass to @callback.
10152 *
10153 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new() for more details.
10154 *
10155 * 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.
10156 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
10157 *
10158 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
10159 */
10160void
10161sensor_match_proxy_new (
10162 GDBusConnection *connection,
10163 GDBusProxyFlags flags,
10164 const gchar *name,
10165 const gchar *object_path,
10166 GCancellable *cancellable,
10167 GAsyncReadyCallback callback,
10168 gpointer user_data)
10169{
10170 g_async_initable_new_async (TYPE_SENSOR_MATCH_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.SensorMatch", NULL);
10171}
10172
10173/**
10174 * sensor_match_proxy_new_finish:
10175 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
10176 * @error: Return location for error or %NULL
10177 *
10178 * Finishes an operation started with sensor_match_proxy_new().
10179 *
10180 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
10181 */
10182SensorMatch *
10183sensor_match_proxy_new_finish (
10184 GAsyncResult *res,
10185 GError **error)
10186{
10187 GObject *ret;
10188 GObject *source_object;
10189 source_object = g_async_result_get_source_object (res);
10190 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10191 g_object_unref (source_object);
10192 if (ret != NULL)
10193 return SENSOR_MATCH (ret);
10194 else
10195 return NULL;
10196}
10197
10198/**
10199 * sensor_match_proxy_new_sync:
10200 * @connection: A #GDBusConnection.
10201 * @flags: Flags from the #GDBusProxyFlags enumeration.
10202 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10203 * @object_path: An object path.
10204 * @cancellable: (allow-none): A #GCancellable or %NULL.
10205 * @error: Return location for error or %NULL
10206 *
10207 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new_sync() for more details.
10208 *
10209 * The calling thread is blocked until a reply is received.
10210 *
10211 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
10212 *
10213 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
10214 */
10215SensorMatch *
10216sensor_match_proxy_new_sync (
10217 GDBusConnection *connection,
10218 GDBusProxyFlags flags,
10219 const gchar *name,
10220 const gchar *object_path,
10221 GCancellable *cancellable,
10222 GError **error)
10223{
10224 GInitable *ret;
10225 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
10226 if (ret != NULL)
10227 return SENSOR_MATCH (ret);
10228 else
10229 return NULL;
10230}
10231
10232
10233/**
10234 * sensor_match_proxy_new_for_bus:
10235 * @bus_type: A #GBusType.
10236 * @flags: Flags from the #GDBusProxyFlags enumeration.
10237 * @name: A bus name (well-known or unique).
10238 * @object_path: An object path.
10239 * @cancellable: (allow-none): A #GCancellable or %NULL.
10240 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10241 * @user_data: User data to pass to @callback.
10242 *
10243 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10244 *
10245 * 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.
10246 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
10247 *
10248 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10249 */
10250void
10251sensor_match_proxy_new_for_bus (
10252 GBusType bus_type,
10253 GDBusProxyFlags flags,
10254 const gchar *name,
10255 const gchar *object_path,
10256 GCancellable *cancellable,
10257 GAsyncReadyCallback callback,
10258 gpointer user_data)
10259{
10260 g_async_initable_new_async (TYPE_SENSOR_MATCH_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.SensorMatch", NULL);
10261}
10262
10263/**
10264 * sensor_match_proxy_new_for_bus_finish:
10265 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
10266 * @error: Return location for error or %NULL
10267 *
10268 * Finishes an operation started with sensor_match_proxy_new_for_bus().
10269 *
10270 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
10271 */
10272SensorMatch *
10273sensor_match_proxy_new_for_bus_finish (
10274 GAsyncResult *res,
10275 GError **error)
10276{
10277 GObject *ret;
10278 GObject *source_object;
10279 source_object = g_async_result_get_source_object (res);
10280 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10281 g_object_unref (source_object);
10282 if (ret != NULL)
10283 return SENSOR_MATCH (ret);
10284 else
10285 return NULL;
10286}
10287
10288/**
10289 * sensor_match_proxy_new_for_bus_sync:
10290 * @bus_type: A #GBusType.
10291 * @flags: Flags from the #GDBusProxyFlags enumeration.
10292 * @name: A bus name (well-known or unique).
10293 * @object_path: An object path.
10294 * @cancellable: (allow-none): A #GCancellable or %NULL.
10295 * @error: Return location for error or %NULL
10296 *
10297 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10298 *
10299 * The calling thread is blocked until a reply is received.
10300 *
10301 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
10302 *
10303 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
10304 */
10305SensorMatch *
10306sensor_match_proxy_new_for_bus_sync (
10307 GBusType bus_type,
10308 GDBusProxyFlags flags,
10309 const gchar *name,
10310 const gchar *object_path,
10311 GCancellable *cancellable,
10312 GError **error)
10313{
10314 GInitable *ret;
10315 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
10316 if (ret != NULL)
10317 return SENSOR_MATCH (ret);
10318 else
10319 return NULL;
10320}
10321
10322
10323/* ------------------------------------------------------------------------ */
10324
10325/**
10326 * SensorMatchSkeleton:
10327 *
10328 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
10329 */
10330
10331/**
10332 * SensorMatchSkeletonClass:
10333 * @parent_class: The parent class.
10334 *
10335 * Class structure for #SensorMatchSkeleton.
10336 */
10337
10338struct _SensorMatchSkeletonPrivate
10339{
10340 GValue *properties;
10341 GList *changed_properties;
10342 GSource *changed_properties_idle_source;
10343 GMainContext *context;
10344 GMutex lock;
10345};
10346
10347static void
10348_sensor_match_skeleton_handle_method_call (
10349 GDBusConnection *connection G_GNUC_UNUSED,
10350 const gchar *sender G_GNUC_UNUSED,
10351 const gchar *object_path G_GNUC_UNUSED,
10352 const gchar *interface_name,
10353 const gchar *method_name,
10354 GVariant *parameters,
10355 GDBusMethodInvocation *invocation,
10356 gpointer user_data)
10357{
10358 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10359 _ExtendedGDBusMethodInfo *info;
10360 GVariantIter iter;
10361 GVariant *child;
10362 GValue *paramv;
10363 guint num_params;
10364 guint num_extra;
10365 guint n;
10366 guint signal_id;
10367 GValue return_value = G_VALUE_INIT;
10368 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10369 g_assert (info != NULL);
10370 num_params = g_variant_n_children (parameters);
10371 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10372 n = 0;
10373 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
10374 g_value_set_object (&paramv[n++], skeleton);
10375 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10376 g_value_set_object (&paramv[n++], invocation);
10377 if (info->pass_fdlist)
10378 {
10379#ifdef G_OS_UNIX
10380 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10381 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10382#else
10383 g_assert_not_reached ();
10384#endif
10385 }
10386 g_variant_iter_init (&iter, parameters);
10387 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10388 {
10389 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10390 if (arg_info->use_gvariant)
10391 {
10392 g_value_init (&paramv[n], G_TYPE_VARIANT);
10393 g_value_set_variant (&paramv[n], child);
10394 n++;
10395 }
10396 else
10397 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10398 g_variant_unref (child);
10399 }
10400 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
10401 g_value_init (&return_value, G_TYPE_BOOLEAN);
10402 g_signal_emitv (paramv, signal_id, 0, &return_value);
10403 if (!g_value_get_boolean (&return_value))
10404 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);
10405 g_value_unset (&return_value);
10406 for (n = 0; n < num_params + num_extra; n++)
10407 g_value_unset (&paramv[n]);
10408 g_free (paramv);
10409}
10410
10411static GVariant *
10412_sensor_match_skeleton_handle_get_property (
10413 GDBusConnection *connection G_GNUC_UNUSED,
10414 const gchar *sender G_GNUC_UNUSED,
10415 const gchar *object_path G_GNUC_UNUSED,
10416 const gchar *interface_name G_GNUC_UNUSED,
10417 const gchar *property_name,
10418 GError **error,
10419 gpointer user_data)
10420{
10421 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10422 GValue value = G_VALUE_INIT;
10423 GParamSpec *pspec;
10424 _ExtendedGDBusPropertyInfo *info;
10425 GVariant *ret;
10426 ret = NULL;
10427 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10428 g_assert (info != NULL);
10429 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10430 if (pspec == NULL)
10431 {
10432 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10433 }
10434 else
10435 {
10436 g_value_init (&value, pspec->value_type);
10437 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10438 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10439 g_value_unset (&value);
10440 }
10441 return ret;
10442}
10443
10444static gboolean
10445_sensor_match_skeleton_handle_set_property (
10446 GDBusConnection *connection G_GNUC_UNUSED,
10447 const gchar *sender G_GNUC_UNUSED,
10448 const gchar *object_path G_GNUC_UNUSED,
10449 const gchar *interface_name G_GNUC_UNUSED,
10450 const gchar *property_name,
10451 GVariant *variant,
10452 GError **error,
10453 gpointer user_data)
10454{
10455 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10456 GValue value = G_VALUE_INIT;
10457 GParamSpec *pspec;
10458 _ExtendedGDBusPropertyInfo *info;
10459 gboolean ret;
10460 ret = FALSE;
10461 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10462 g_assert (info != NULL);
10463 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10464 if (pspec == NULL)
10465 {
10466 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10467 }
10468 else
10469 {
10470 if (info->use_gvariant)
10471 g_value_set_variant (&value, variant);
10472 else
10473 g_dbus_gvariant_to_gvalue (variant, &value);
10474 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10475 g_value_unset (&value);
10476 ret = TRUE;
10477 }
10478 return ret;
10479}
10480
10481static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
10482{
10483 _sensor_match_skeleton_handle_method_call,
10484 _sensor_match_skeleton_handle_get_property,
10485 _sensor_match_skeleton_handle_set_property,
10486 {NULL}
10487};
10488
10489static GDBusInterfaceInfo *
10490sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10491{
10492 return sensor_match_interface_info ();
10493}
10494
10495static GDBusInterfaceVTable *
10496sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10497{
10498 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
10499}
10500
10501static GVariant *
10502sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10503{
10504 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10505
10506 GVariantBuilder builder;
10507 guint n;
10508 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10509 if (_sensor_match_interface_info.parent_struct.properties == NULL)
10510 goto out;
10511 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
10512 {
10513 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
10514 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10515 {
10516 GVariant *value;
10517 value = _sensor_match_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.SensorMatch", info->name, NULL, skeleton);
10518 if (value != NULL)
10519 {
10520 g_variant_take_ref (value);
10521 g_variant_builder_add (&builder, "{sv}", info->name, value);
10522 g_variant_unref (value);
10523 }
10524 }
10525 }
10526out:
10527 return g_variant_builder_end (&builder);
10528}
10529
10530static gboolean _sensor_match_emit_changed (gpointer user_data);
10531
10532static void
10533sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10534{
10535 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10536 gboolean emit_changed = FALSE;
10537
10538 g_mutex_lock (&skeleton->priv->lock);
10539 if (skeleton->priv->changed_properties_idle_source != NULL)
10540 {
10541 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10542 skeleton->priv->changed_properties_idle_source = NULL;
10543 emit_changed = TRUE;
10544 }
10545 g_mutex_unlock (&skeleton->priv->lock);
10546
10547 if (emit_changed)
10548 _sensor_match_emit_changed (skeleton);
10549}
10550
10551static void
10552_sensor_match_on_signal_sensor_match (
10553 SensorMatch *object,
10554 guchar arg_state)
10555{
10556 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10557
10558 GList *connections, *l;
10559 GVariant *signal_variant;
10560 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10561
10562 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
10563 arg_state));
10564 for (l = connections; l != NULL; l = l->next)
10565 {
10566 GDBusConnection *connection = l->data;
10567 g_dbus_connection_emit_signal (connection,
10568 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
10569 signal_variant, NULL);
10570 }
10571 g_variant_unref (signal_variant);
10572 g_list_free_full (connections, g_object_unref);
10573}
10574
10575static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
10576#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10577G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10578 G_ADD_PRIVATE (SensorMatchSkeleton)
10579 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
10580
10581#else
10582G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10583 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
10584
10585#endif
10586static void
10587sensor_match_skeleton_finalize (GObject *object)
10588{
10589 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10590 guint n;
10591 for (n = 0; n < 2; n++)
10592 g_value_unset (&skeleton->priv->properties[n]);
10593 g_free (skeleton->priv->properties);
10594 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10595 if (skeleton->priv->changed_properties_idle_source != NULL)
10596 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10597 g_main_context_unref (skeleton->priv->context);
10598 g_mutex_clear (&skeleton->priv->lock);
10599 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
10600}
10601
10602static void
10603sensor_match_skeleton_get_property (GObject *object,
10604 guint prop_id,
10605 GValue *value,
10606 GParamSpec *pspec G_GNUC_UNUSED)
10607{
10608 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10609 g_assert (prop_id != 0 && prop_id - 1 < 2);
10610 g_mutex_lock (&skeleton->priv->lock);
10611 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
10612 g_mutex_unlock (&skeleton->priv->lock);
10613}
10614
10615static gboolean
10616_sensor_match_emit_changed (gpointer user_data)
10617{
10618 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10619 GList *l;
10620 GVariantBuilder builder;
10621 GVariantBuilder invalidated_builder;
10622 guint num_changes;
10623
10624 g_mutex_lock (&skeleton->priv->lock);
10625 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10626 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
10627 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
10628 {
10629 ChangedProperty *cp = l->data;
10630 GVariant *variant;
10631 const GValue *cur_value;
10632
10633 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
10634 if (!_g_value_equal (cur_value, &cp->orig_value))
10635 {
10636 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
10637 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
10638 g_variant_unref (variant);
10639 num_changes++;
10640 }
10641 }
10642 if (num_changes > 0)
10643 {
10644 GList *connections, *ll;
10645 GVariant *signal_variant;
10646 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
10647 &builder, &invalidated_builder));
10648 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10649 for (ll = connections; ll != NULL; ll = ll->next)
10650 {
10651 GDBusConnection *connection = ll->data;
10652
10653 g_dbus_connection_emit_signal (connection,
10654 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
10655 "org.freedesktop.DBus.Properties",
10656 "PropertiesChanged",
10657 signal_variant,
10658 NULL);
10659 }
10660 g_variant_unref (signal_variant);
10661 g_list_free_full (connections, g_object_unref);
10662 }
10663 else
10664 {
10665 g_variant_builder_clear (&builder);
10666 g_variant_builder_clear (&invalidated_builder);
10667 }
10668 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10669 skeleton->priv->changed_properties = NULL;
10670 skeleton->priv->changed_properties_idle_source = NULL;
10671 g_mutex_unlock (&skeleton->priv->lock);
10672 return FALSE;
10673}
10674
10675static void
10676_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
10677{
10678 ChangedProperty *cp;
10679 GList *l;
10680 cp = NULL;
10681 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
10682 {
10683 ChangedProperty *i_cp = l->data;
10684 if (i_cp->info == info)
10685 {
10686 cp = i_cp;
10687 break;
10688 }
10689 }
10690 if (cp == NULL)
10691 {
10692 cp = g_new0 (ChangedProperty, 1);
10693 cp->prop_id = prop_id;
10694 cp->info = info;
10695 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
10696 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
10697 g_value_copy (orig_value, &cp->orig_value);
10698 }
10699}
10700
10701static void
10702sensor_match_skeleton_notify (GObject *object,
10703 GParamSpec *pspec G_GNUC_UNUSED)
10704{
10705 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10706 g_mutex_lock (&skeleton->priv->lock);
10707 if (skeleton->priv->changed_properties != NULL &&
10708 skeleton->priv->changed_properties_idle_source == NULL)
10709 {
10710 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
10711 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
10712 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
10713 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
10714 g_source_unref (skeleton->priv->changed_properties_idle_source);
10715 }
10716 g_mutex_unlock (&skeleton->priv->lock);
10717}
10718
10719static void
10720sensor_match_skeleton_set_property (GObject *object,
10721 guint prop_id,
10722 const GValue *value,
10723 GParamSpec *pspec)
10724{
10725 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10726 g_assert (prop_id != 0 && prop_id - 1 < 2);
10727 g_mutex_lock (&skeleton->priv->lock);
10728 g_object_freeze_notify (object);
10729 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
10730 {
10731 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
10732 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
10733 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
10734 g_object_notify_by_pspec (object, pspec);
10735 }
10736 g_mutex_unlock (&skeleton->priv->lock);
10737 g_object_thaw_notify (object);
10738}
10739
10740static void
10741sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
10742{
10743#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10744 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
10745#else
10746 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
10747#endif
10748
10749 g_mutex_init (&skeleton->priv->lock);
10750 skeleton->priv->context = g_main_context_ref_thread_default ();
10751 skeleton->priv->properties = g_new0 (GValue, 2);
10752 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
10753 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
10754}
10755
10756static GVariant *
10757sensor_match_skeleton_get_match_value (SensorMatch *object)
10758{
10759 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10760 GVariant *value;
10761 g_mutex_lock (&skeleton->priv->lock);
10762 value = g_value_get_variant (&(skeleton->priv->properties[0]));
10763 g_mutex_unlock (&skeleton->priv->lock);
10764 return value;
10765}
10766
10767static guchar
10768sensor_match_skeleton_get_state (SensorMatch *object)
10769{
10770 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10771 guchar value;
10772 g_mutex_lock (&skeleton->priv->lock);
10773 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
10774 g_mutex_unlock (&skeleton->priv->lock);
10775 return value;
10776}
10777
10778static void
10779sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
10780{
10781 GObjectClass *gobject_class;
10782 GDBusInterfaceSkeletonClass *skeleton_class;
10783
10784 gobject_class = G_OBJECT_CLASS (klass);
10785 gobject_class->finalize = sensor_match_skeleton_finalize;
10786 gobject_class->get_property = sensor_match_skeleton_get_property;
10787 gobject_class->set_property = sensor_match_skeleton_set_property;
10788 gobject_class->notify = sensor_match_skeleton_notify;
10789
10790
10791 sensor_match_override_properties (gobject_class, 1);
10792
10793 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10794 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
10795 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
10796 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
10797 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
10798
10799#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10800 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
10801#endif
10802}
10803
10804static void
10805sensor_match_skeleton_iface_init (SensorMatchIface *iface)
10806{
10807 iface->sensor_match = _sensor_match_on_signal_sensor_match;
10808 iface->get_match_value = sensor_match_skeleton_get_match_value;
10809 iface->get_state = sensor_match_skeleton_get_state;
10810}
10811
10812/**
10813 * sensor_match_skeleton_new:
10814 *
10815 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
10816 *
10817 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
10818 */
10819SensorMatch *
10820sensor_match_skeleton_new (void)
10821{
10822 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
10823}
10824
10825/* ------------------------------------------------------------------------
10826 * Code for interface org.openbmc.Process
10827 * ------------------------------------------------------------------------
10828 */
10829
10830/**
10831 * SECTION:Process
10832 * @title: Process
10833 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
10834 *
10835 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface in C.
10836 */
10837
10838/* ---- Introspection data for org.openbmc.Process ---- */
10839
10840static const _ExtendedGDBusMethodInfo _process_method_info_stop =
10841{
10842 {
10843 -1,
10844 (gchar *) "stop",
10845 NULL,
10846 NULL,
10847 NULL
10848 },
10849 "handle-stop",
10850 FALSE
10851};
10852
10853static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
10854{
10855 &_process_method_info_stop,
10856 NULL
10857};
10858
10859static const _ExtendedGDBusInterfaceInfo _process_interface_info =
10860{
10861 {
10862 -1,
10863 (gchar *) "org.openbmc.Process",
10864 (GDBusMethodInfo **) &_process_method_info_pointers,
10865 NULL,
10866 NULL,
10867 NULL
10868 },
10869 "process",
10870};
10871
10872
10873/**
10874 * process_interface_info:
10875 *
10876 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
10877 *
10878 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10879 */
10880GDBusInterfaceInfo *
10881process_interface_info (void)
10882{
10883 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
10884}
10885
10886/**
10887 * process_override_properties:
10888 * @klass: The class structure for a #GObject<!-- -->-derived class.
10889 * @property_id_begin: The property id to assign to the first overridden property.
10890 *
10891 * Overrides all #GObject properties in the #Process interface for a concrete class.
10892 * The properties are overridden in the order they are defined.
10893 *
10894 * Returns: The last property id.
10895 */
10896guint
10897process_override_properties (GObjectClass *klass, guint property_id_begin)
10898{
10899 return property_id_begin - 1;
10900}
10901
10902
10903
10904/**
10905 * Process:
10906 *
10907 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10908 */
10909
10910/**
10911 * ProcessIface:
10912 * @parent_iface: The parent interface.
10913 * @handle_stop: Handler for the #Process::handle-stop signal.
10914 *
10915 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10916 */
10917
10918typedef ProcessIface ProcessInterface;
10919G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
10920
10921static void
10922process_default_init (ProcessIface *iface)
10923{
10924 /* GObject signals for incoming D-Bus method calls: */
10925 /**
10926 * Process::handle-stop:
10927 * @object: A #Process.
10928 * @invocation: A #GDBusMethodInvocation.
10929 *
10930 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
10931 *
10932 * 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 process_complete_stop() 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.
10933 *
10934 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10935 */
10936 g_signal_new ("handle-stop",
10937 G_TYPE_FROM_INTERFACE (iface),
10938 G_SIGNAL_RUN_LAST,
10939 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10940 g_signal_accumulator_true_handled,
10941 NULL,
10942 g_cclosure_marshal_generic,
10943 G_TYPE_BOOLEAN,
10944 1,
10945 G_TYPE_DBUS_METHOD_INVOCATION);
10946
10947}
10948
10949/**
10950 * process_call_stop:
10951 * @proxy: A #ProcessProxy.
10952 * @cancellable: (allow-none): A #GCancellable or %NULL.
10953 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10954 * @user_data: User data to pass to @callback.
10955 *
10956 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10957 * 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.
10958 * You can then call process_call_stop_finish() to get the result of the operation.
10959 *
10960 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10961 */
10962void
10963process_call_stop (
10964 Process *proxy,
10965 GCancellable *cancellable,
10966 GAsyncReadyCallback callback,
10967 gpointer user_data)
10968{
10969 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10970 "stop",
10971 g_variant_new ("()"),
10972 G_DBUS_CALL_FLAGS_NONE,
10973 -1,
10974 cancellable,
10975 callback,
10976 user_data);
10977}
10978
10979/**
10980 * process_call_stop_finish:
10981 * @proxy: A #ProcessProxy.
10982 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10983 * @error: Return location for error or %NULL.
10984 *
10985 * Finishes an operation started with process_call_stop().
10986 *
10987 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10988 */
10989gboolean
10990process_call_stop_finish (
10991 Process *proxy,
10992 GAsyncResult *res,
10993 GError **error)
10994{
10995 GVariant *_ret;
10996 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10997 if (_ret == NULL)
10998 goto _out;
10999 g_variant_get (_ret,
11000 "()");
11001 g_variant_unref (_ret);
11002_out:
11003 return _ret != NULL;
11004}
11005
11006/**
11007 * process_call_stop_sync:
11008 * @proxy: A #ProcessProxy.
11009 * @cancellable: (allow-none): A #GCancellable or %NULL.
11010 * @error: Return location for error or %NULL.
11011 *
11012 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11013 *
11014 * See process_call_stop() for the asynchronous version of this method.
11015 *
11016 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11017 */
11018gboolean
11019process_call_stop_sync (
11020 Process *proxy,
11021 GCancellable *cancellable,
11022 GError **error)
11023{
11024 GVariant *_ret;
11025 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11026 "stop",
11027 g_variant_new ("()"),
11028 G_DBUS_CALL_FLAGS_NONE,
11029 -1,
11030 cancellable,
11031 error);
11032 if (_ret == NULL)
11033 goto _out;
11034 g_variant_get (_ret,
11035 "()");
11036 g_variant_unref (_ret);
11037_out:
11038 return _ret != NULL;
11039}
11040
11041/**
11042 * process_complete_stop:
11043 * @object: A #Process.
11044 * @invocation: (transfer full): A #GDBusMethodInvocation.
11045 *
11046 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</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.
11047 *
11048 * This method will free @invocation, you cannot use it afterwards.
11049 */
11050void
11051process_complete_stop (
11052 Process *object,
11053 GDBusMethodInvocation *invocation)
11054{
11055 g_dbus_method_invocation_return_value (invocation,
11056 g_variant_new ("()"));
11057}
11058
11059/* ------------------------------------------------------------------------ */
11060
11061/**
11062 * ProcessProxy:
11063 *
11064 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
11065 */
11066
11067/**
11068 * ProcessProxyClass:
11069 * @parent_class: The parent class.
11070 *
11071 * Class structure for #ProcessProxy.
11072 */
11073
11074struct _ProcessProxyPrivate
11075{
11076 GData *qdata;
11077};
11078
11079static void process_proxy_iface_init (ProcessIface *iface);
11080
11081#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11082G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
11083 G_ADD_PRIVATE (ProcessProxy)
11084 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
11085
11086#else
11087G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
11088 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
11089
11090#endif
11091static void
11092process_proxy_finalize (GObject *object)
11093{
11094 ProcessProxy *proxy = PROCESS_PROXY (object);
11095 g_datalist_clear (&proxy->priv->qdata);
11096 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
11097}
11098
11099static void
11100process_proxy_get_property (GObject *object,
11101 guint prop_id,
11102 GValue *value,
11103 GParamSpec *pspec G_GNUC_UNUSED)
11104{
11105}
11106
11107static void
11108process_proxy_set_property (GObject *object,
11109 guint prop_id,
11110 const GValue *value,
11111 GParamSpec *pspec G_GNUC_UNUSED)
11112{
11113}
11114
11115static void
11116process_proxy_g_signal (GDBusProxy *proxy,
11117 const gchar *sender_name G_GNUC_UNUSED,
11118 const gchar *signal_name,
11119 GVariant *parameters)
11120{
11121 _ExtendedGDBusSignalInfo *info;
11122 GVariantIter iter;
11123 GVariant *child;
11124 GValue *paramv;
11125 guint num_params;
11126 guint n;
11127 guint signal_id;
11128 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
11129 if (info == NULL)
11130 return;
11131 num_params = g_variant_n_children (parameters);
11132 paramv = g_new0 (GValue, num_params + 1);
11133 g_value_init (&paramv[0], TYPE_PROCESS);
11134 g_value_set_object (&paramv[0], proxy);
11135 g_variant_iter_init (&iter, parameters);
11136 n = 1;
11137 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11138 {
11139 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11140 if (arg_info->use_gvariant)
11141 {
11142 g_value_init (&paramv[n], G_TYPE_VARIANT);
11143 g_value_set_variant (&paramv[n], child);
11144 n++;
11145 }
11146 else
11147 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11148 g_variant_unref (child);
11149 }
11150 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
11151 g_signal_emitv (paramv, signal_id, 0, NULL);
11152 for (n = 0; n < num_params + 1; n++)
11153 g_value_unset (&paramv[n]);
11154 g_free (paramv);
11155}
11156
11157static void
11158process_proxy_g_properties_changed (GDBusProxy *_proxy,
11159 GVariant *changed_properties,
11160 const gchar *const *invalidated_properties)
11161{
11162 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
11163 guint n;
11164 const gchar *key;
11165 GVariantIter *iter;
11166 _ExtendedGDBusPropertyInfo *info;
11167 g_variant_get (changed_properties, "a{sv}", &iter);
11168 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11169 {
11170 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
11171 g_datalist_remove_data (&proxy->priv->qdata, key);
11172 if (info != NULL)
11173 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11174 }
11175 g_variant_iter_free (iter);
11176 for (n = 0; invalidated_properties[n] != NULL; n++)
11177 {
11178 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
11179 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11180 if (info != NULL)
11181 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11182 }
11183}
11184
11185static void
11186process_proxy_init (ProcessProxy *proxy)
11187{
11188#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11189 proxy->priv = process_proxy_get_instance_private (proxy);
11190#else
11191 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
11192#endif
11193
11194 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
11195}
11196
11197static void
11198process_proxy_class_init (ProcessProxyClass *klass)
11199{
11200 GObjectClass *gobject_class;
11201 GDBusProxyClass *proxy_class;
11202
11203 gobject_class = G_OBJECT_CLASS (klass);
11204 gobject_class->finalize = process_proxy_finalize;
11205 gobject_class->get_property = process_proxy_get_property;
11206 gobject_class->set_property = process_proxy_set_property;
11207
11208 proxy_class = G_DBUS_PROXY_CLASS (klass);
11209 proxy_class->g_signal = process_proxy_g_signal;
11210 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
11211
11212#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11213 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
11214#endif
11215}
11216
11217static void
11218process_proxy_iface_init (ProcessIface *iface)
11219{
11220}
11221
11222/**
11223 * process_proxy_new:
11224 * @connection: A #GDBusConnection.
11225 * @flags: Flags from the #GDBusProxyFlags enumeration.
11226 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11227 * @object_path: An object path.
11228 * @cancellable: (allow-none): A #GCancellable or %NULL.
11229 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11230 * @user_data: User data to pass to @callback.
11231 *
11232 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new() for more details.
11233 *
11234 * 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.
11235 * You can then call process_proxy_new_finish() to get the result of the operation.
11236 *
11237 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
11238 */
11239void
11240process_proxy_new (
11241 GDBusConnection *connection,
11242 GDBusProxyFlags flags,
11243 const gchar *name,
11244 const gchar *object_path,
11245 GCancellable *cancellable,
11246 GAsyncReadyCallback callback,
11247 gpointer user_data)
11248{
11249 g_async_initable_new_async (TYPE_PROCESS_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.Process", NULL);
11250}
11251
11252/**
11253 * process_proxy_new_finish:
11254 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
11255 * @error: Return location for error or %NULL
11256 *
11257 * Finishes an operation started with process_proxy_new().
11258 *
11259 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
11260 */
11261Process *
11262process_proxy_new_finish (
11263 GAsyncResult *res,
11264 GError **error)
11265{
11266 GObject *ret;
11267 GObject *source_object;
11268 source_object = g_async_result_get_source_object (res);
11269 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11270 g_object_unref (source_object);
11271 if (ret != NULL)
11272 return PROCESS (ret);
11273 else
11274 return NULL;
11275}
11276
11277/**
11278 * process_proxy_new_sync:
11279 * @connection: A #GDBusConnection.
11280 * @flags: Flags from the #GDBusProxyFlags enumeration.
11281 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11282 * @object_path: An object path.
11283 * @cancellable: (allow-none): A #GCancellable or %NULL.
11284 * @error: Return location for error or %NULL
11285 *
11286 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new_sync() for more details.
11287 *
11288 * The calling thread is blocked until a reply is received.
11289 *
11290 * See process_proxy_new() for the asynchronous version of this constructor.
11291 *
11292 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
11293 */
11294Process *
11295process_proxy_new_sync (
11296 GDBusConnection *connection,
11297 GDBusProxyFlags flags,
11298 const gchar *name,
11299 const gchar *object_path,
11300 GCancellable *cancellable,
11301 GError **error)
11302{
11303 GInitable *ret;
11304 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
11305 if (ret != NULL)
11306 return PROCESS (ret);
11307 else
11308 return NULL;
11309}
11310
11311
11312/**
11313 * process_proxy_new_for_bus:
11314 * @bus_type: A #GBusType.
11315 * @flags: Flags from the #GDBusProxyFlags enumeration.
11316 * @name: A bus name (well-known or unique).
11317 * @object_path: An object path.
11318 * @cancellable: (allow-none): A #GCancellable or %NULL.
11319 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11320 * @user_data: User data to pass to @callback.
11321 *
11322 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11323 *
11324 * 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.
11325 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
11326 *
11327 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11328 */
11329void
11330process_proxy_new_for_bus (
11331 GBusType bus_type,
11332 GDBusProxyFlags flags,
11333 const gchar *name,
11334 const gchar *object_path,
11335 GCancellable *cancellable,
11336 GAsyncReadyCallback callback,
11337 gpointer user_data)
11338{
11339 g_async_initable_new_async (TYPE_PROCESS_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.Process", NULL);
11340}
11341
11342/**
11343 * process_proxy_new_for_bus_finish:
11344 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
11345 * @error: Return location for error or %NULL
11346 *
11347 * Finishes an operation started with process_proxy_new_for_bus().
11348 *
11349 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
11350 */
11351Process *
11352process_proxy_new_for_bus_finish (
11353 GAsyncResult *res,
11354 GError **error)
11355{
11356 GObject *ret;
11357 GObject *source_object;
11358 source_object = g_async_result_get_source_object (res);
11359 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11360 g_object_unref (source_object);
11361 if (ret != NULL)
11362 return PROCESS (ret);
11363 else
11364 return NULL;
11365}
11366
11367/**
11368 * process_proxy_new_for_bus_sync:
11369 * @bus_type: A #GBusType.
11370 * @flags: Flags from the #GDBusProxyFlags enumeration.
11371 * @name: A bus name (well-known or unique).
11372 * @object_path: An object path.
11373 * @cancellable: (allow-none): A #GCancellable or %NULL.
11374 * @error: Return location for error or %NULL
11375 *
11376 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11377 *
11378 * The calling thread is blocked until a reply is received.
11379 *
11380 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
11381 *
11382 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
11383 */
11384Process *
11385process_proxy_new_for_bus_sync (
11386 GBusType bus_type,
11387 GDBusProxyFlags flags,
11388 const gchar *name,
11389 const gchar *object_path,
11390 GCancellable *cancellable,
11391 GError **error)
11392{
11393 GInitable *ret;
11394 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
11395 if (ret != NULL)
11396 return PROCESS (ret);
11397 else
11398 return NULL;
11399}
11400
11401
11402/* ------------------------------------------------------------------------ */
11403
11404/**
11405 * ProcessSkeleton:
11406 *
11407 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
11408 */
11409
11410/**
11411 * ProcessSkeletonClass:
11412 * @parent_class: The parent class.
11413 *
11414 * Class structure for #ProcessSkeleton.
11415 */
11416
11417struct _ProcessSkeletonPrivate
11418{
11419 GValue *properties;
11420 GList *changed_properties;
11421 GSource *changed_properties_idle_source;
11422 GMainContext *context;
11423 GMutex lock;
11424};
11425
11426static void
11427_process_skeleton_handle_method_call (
11428 GDBusConnection *connection G_GNUC_UNUSED,
11429 const gchar *sender G_GNUC_UNUSED,
11430 const gchar *object_path G_GNUC_UNUSED,
11431 const gchar *interface_name,
11432 const gchar *method_name,
11433 GVariant *parameters,
11434 GDBusMethodInvocation *invocation,
11435 gpointer user_data)
11436{
11437 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11438 _ExtendedGDBusMethodInfo *info;
11439 GVariantIter iter;
11440 GVariant *child;
11441 GValue *paramv;
11442 guint num_params;
11443 guint num_extra;
11444 guint n;
11445 guint signal_id;
11446 GValue return_value = G_VALUE_INIT;
11447 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11448 g_assert (info != NULL);
11449 num_params = g_variant_n_children (parameters);
11450 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11451 n = 0;
11452 g_value_init (&paramv[n], TYPE_PROCESS);
11453 g_value_set_object (&paramv[n++], skeleton);
11454 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11455 g_value_set_object (&paramv[n++], invocation);
11456 if (info->pass_fdlist)
11457 {
11458#ifdef G_OS_UNIX
11459 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11460 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11461#else
11462 g_assert_not_reached ();
11463#endif
11464 }
11465 g_variant_iter_init (&iter, parameters);
11466 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11467 {
11468 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11469 if (arg_info->use_gvariant)
11470 {
11471 g_value_init (&paramv[n], G_TYPE_VARIANT);
11472 g_value_set_variant (&paramv[n], child);
11473 n++;
11474 }
11475 else
11476 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11477 g_variant_unref (child);
11478 }
11479 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
11480 g_value_init (&return_value, G_TYPE_BOOLEAN);
11481 g_signal_emitv (paramv, signal_id, 0, &return_value);
11482 if (!g_value_get_boolean (&return_value))
11483 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);
11484 g_value_unset (&return_value);
11485 for (n = 0; n < num_params + num_extra; n++)
11486 g_value_unset (&paramv[n]);
11487 g_free (paramv);
11488}
11489
11490static GVariant *
11491_process_skeleton_handle_get_property (
11492 GDBusConnection *connection G_GNUC_UNUSED,
11493 const gchar *sender G_GNUC_UNUSED,
11494 const gchar *object_path G_GNUC_UNUSED,
11495 const gchar *interface_name G_GNUC_UNUSED,
11496 const gchar *property_name,
11497 GError **error,
11498 gpointer user_data)
11499{
11500 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11501 GValue value = G_VALUE_INIT;
11502 GParamSpec *pspec;
11503 _ExtendedGDBusPropertyInfo *info;
11504 GVariant *ret;
11505 ret = NULL;
11506 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11507 g_assert (info != NULL);
11508 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11509 if (pspec == NULL)
11510 {
11511 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11512 }
11513 else
11514 {
11515 g_value_init (&value, pspec->value_type);
11516 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11517 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11518 g_value_unset (&value);
11519 }
11520 return ret;
11521}
11522
11523static gboolean
11524_process_skeleton_handle_set_property (
11525 GDBusConnection *connection G_GNUC_UNUSED,
11526 const gchar *sender G_GNUC_UNUSED,
11527 const gchar *object_path G_GNUC_UNUSED,
11528 const gchar *interface_name G_GNUC_UNUSED,
11529 const gchar *property_name,
11530 GVariant *variant,
11531 GError **error,
11532 gpointer user_data)
11533{
11534 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11535 GValue value = G_VALUE_INIT;
11536 GParamSpec *pspec;
11537 _ExtendedGDBusPropertyInfo *info;
11538 gboolean ret;
11539 ret = FALSE;
11540 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11541 g_assert (info != NULL);
11542 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11543 if (pspec == NULL)
11544 {
11545 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11546 }
11547 else
11548 {
11549 if (info->use_gvariant)
11550 g_value_set_variant (&value, variant);
11551 else
11552 g_dbus_gvariant_to_gvalue (variant, &value);
11553 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11554 g_value_unset (&value);
11555 ret = TRUE;
11556 }
11557 return ret;
11558}
11559
11560static const GDBusInterfaceVTable _process_skeleton_vtable =
11561{
11562 _process_skeleton_handle_method_call,
11563 _process_skeleton_handle_get_property,
11564 _process_skeleton_handle_set_property,
11565 {NULL}
11566};
11567
11568static GDBusInterfaceInfo *
11569process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11570{
11571 return process_interface_info ();
11572}
11573
11574static GDBusInterfaceVTable *
11575process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11576{
11577 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
11578}
11579
11580static GVariant *
11581process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11582{
11583 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
11584
11585 GVariantBuilder builder;
11586 guint n;
11587 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11588 if (_process_interface_info.parent_struct.properties == NULL)
11589 goto out;
11590 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
11591 {
11592 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
11593 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11594 {
11595 GVariant *value;
11596 value = _process_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.Process", info->name, NULL, skeleton);
11597 if (value != NULL)
11598 {
11599 g_variant_take_ref (value);
11600 g_variant_builder_add (&builder, "{sv}", info->name, value);
11601 g_variant_unref (value);
11602 }
11603 }
11604 }
11605out:
11606 return g_variant_builder_end (&builder);
11607}
11608
11609static void
11610process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11611{
11612}
11613
11614static void process_skeleton_iface_init (ProcessIface *iface);
11615#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11616G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11617 G_ADD_PRIVATE (ProcessSkeleton)
11618 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
11619
11620#else
11621G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11622 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
11623
11624#endif
11625static void
11626process_skeleton_finalize (GObject *object)
11627{
11628 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
11629 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11630 if (skeleton->priv->changed_properties_idle_source != NULL)
11631 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11632 g_main_context_unref (skeleton->priv->context);
11633 g_mutex_clear (&skeleton->priv->lock);
11634 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
11635}
11636
11637static void
11638process_skeleton_init (ProcessSkeleton *skeleton)
11639{
11640#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11641 skeleton->priv = process_skeleton_get_instance_private (skeleton);
11642#else
11643 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
11644#endif
11645
11646 g_mutex_init (&skeleton->priv->lock);
11647 skeleton->priv->context = g_main_context_ref_thread_default ();
11648}
11649
11650static void
11651process_skeleton_class_init (ProcessSkeletonClass *klass)
11652{
11653 GObjectClass *gobject_class;
11654 GDBusInterfaceSkeletonClass *skeleton_class;
11655
11656 gobject_class = G_OBJECT_CLASS (klass);
11657 gobject_class->finalize = process_skeleton_finalize;
11658
11659 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
11660 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
11661 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
11662 skeleton_class->flush = process_skeleton_dbus_interface_flush;
11663 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
11664
11665#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11666 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
11667#endif
11668}
11669
11670static void
11671process_skeleton_iface_init (ProcessIface *iface)
11672{
11673}
11674
11675/**
11676 * process_skeleton_new:
11677 *
11678 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
11679 *
11680 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
11681 */
11682Process *
11683process_skeleton_new (void)
11684{
11685 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
11686}
11687
11688/* ------------------------------------------------------------------------
11689 * Code for interface org.openbmc.Control
11690 * ------------------------------------------------------------------------
11691 */
11692
11693/**
11694 * SECTION:Control
11695 * @title: Control
11696 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
11697 *
11698 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface in C.
11699 */
11700
11701/* ---- Introspection data for org.openbmc.Control ---- */
11702
11703static const _ExtendedGDBusMethodInfo _control_method_info_init =
11704{
11705 {
11706 -1,
11707 (gchar *) "init",
11708 NULL,
11709 NULL,
11710 NULL
11711 },
11712 "handle-init",
11713 FALSE
11714};
11715
11716static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
11717{
11718 &_control_method_info_init,
11719 NULL
11720};
11721
11722static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
11723{
11724 {
11725 -1,
11726 (gchar *) "bus_name",
11727 (gchar *) "s",
11728 NULL
11729 },
11730 FALSE
11731};
11732
11733static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
11734{
11735 &_control_signal_info_heartbeat_ARG_bus_name,
11736 NULL
11737};
11738
11739static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
11740{
11741 {
11742 -1,
11743 (gchar *) "Heartbeat",
11744 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
11745 NULL
11746 },
11747 "heartbeat"
11748};
11749
11750static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
11751{
11752 {
11753 -1,
11754 (gchar *) "state_name",
11755 (gchar *) "s",
11756 NULL
11757 },
11758 FALSE
11759};
11760
11761static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
11762{
11763 &_control_signal_info_goto_system_state_ARG_state_name,
11764 NULL
11765};
11766
11767static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
11768{
11769 {
11770 -1,
11771 (gchar *) "GotoSystemState",
11772 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
11773 NULL
11774 },
11775 "goto-system-state"
11776};
11777
11778static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
11779{
11780 &_control_signal_info_heartbeat,
11781 &_control_signal_info_goto_system_state,
11782 NULL
11783};
11784
11785static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
11786{
11787 {
11788 -1,
11789 (gchar *) "poll_interval",
11790 (gchar *) "i",
11791 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
11792 NULL
11793 },
11794 "poll-interval",
11795 FALSE
11796};
11797
11798static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
11799{
11800 {
11801 -1,
11802 (gchar *) "heatbeat",
11803 (gchar *) "i",
11804 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11805 NULL
11806 },
11807 "heatbeat",
11808 FALSE
11809};
11810
11811static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
11812{
11813 &_control_property_info_poll_interval,
11814 &_control_property_info_heatbeat,
11815 NULL
11816};
11817
11818static const _ExtendedGDBusInterfaceInfo _control_interface_info =
11819{
11820 {
11821 -1,
11822 (gchar *) "org.openbmc.Control",
11823 (GDBusMethodInfo **) &_control_method_info_pointers,
11824 (GDBusSignalInfo **) &_control_signal_info_pointers,
11825 (GDBusPropertyInfo **) &_control_property_info_pointers,
11826 NULL
11827 },
11828 "control",
11829};
11830
11831
11832/**
11833 * control_interface_info:
11834 *
11835 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
11836 *
11837 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
11838 */
11839GDBusInterfaceInfo *
11840control_interface_info (void)
11841{
11842 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
11843}
11844
11845/**
11846 * control_override_properties:
11847 * @klass: The class structure for a #GObject<!-- -->-derived class.
11848 * @property_id_begin: The property id to assign to the first overridden property.
11849 *
11850 * Overrides all #GObject properties in the #Control interface for a concrete class.
11851 * The properties are overridden in the order they are defined.
11852 *
11853 * Returns: The last property id.
11854 */
11855guint
11856control_override_properties (GObjectClass *klass, guint property_id_begin)
11857{
11858 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
11859 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
11860 return property_id_begin - 1;
11861}
11862
11863
11864
11865/**
11866 * Control:
11867 *
11868 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
11869 */
11870
11871/**
11872 * ControlIface:
11873 * @parent_iface: The parent interface.
11874 * @handle_init: Handler for the #Control::handle-init signal.
11875 * @get_heatbeat: Getter for the #Control:heatbeat property.
11876 * @get_poll_interval: Getter for the #Control:poll-interval property.
11877 * @goto_system_state: Handler for the #Control::goto-system-state signal.
11878 * @heartbeat: Handler for the #Control::heartbeat signal.
11879 *
11880 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
11881 */
11882
11883typedef ControlIface ControlInterface;
11884G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
11885
11886static void
11887control_default_init (ControlIface *iface)
11888{
11889 /* GObject signals for incoming D-Bus method calls: */
11890 /**
11891 * Control::handle-init:
11892 * @object: A #Control.
11893 * @invocation: A #GDBusMethodInvocation.
11894 *
11895 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
11896 *
11897 * 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 control_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.
11898 *
11899 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11900 */
11901 g_signal_new ("handle-init",
11902 G_TYPE_FROM_INTERFACE (iface),
11903 G_SIGNAL_RUN_LAST,
11904 G_STRUCT_OFFSET (ControlIface, handle_init),
11905 g_signal_accumulator_true_handled,
11906 NULL,
11907 g_cclosure_marshal_generic,
11908 G_TYPE_BOOLEAN,
11909 1,
11910 G_TYPE_DBUS_METHOD_INVOCATION);
11911
11912 /* GObject signals for received D-Bus signals: */
11913 /**
11914 * Control::heartbeat:
11915 * @object: A #Control.
11916 * @arg_bus_name: Argument.
11917 *
11918 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> is received.
11919 *
11920 * 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.
11921 */
11922 g_signal_new ("heartbeat",
11923 G_TYPE_FROM_INTERFACE (iface),
11924 G_SIGNAL_RUN_LAST,
11925 G_STRUCT_OFFSET (ControlIface, heartbeat),
11926 NULL,
11927 NULL,
11928 g_cclosure_marshal_generic,
11929 G_TYPE_NONE,
11930 1, G_TYPE_STRING);
11931
11932 /**
11933 * Control::goto-system-state:
11934 * @object: A #Control.
11935 * @arg_state_name: Argument.
11936 *
11937 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> is received.
11938 *
11939 * 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.
11940 */
11941 g_signal_new ("goto-system-state",
11942 G_TYPE_FROM_INTERFACE (iface),
11943 G_SIGNAL_RUN_LAST,
11944 G_STRUCT_OFFSET (ControlIface, goto_system_state),
11945 NULL,
11946 NULL,
11947 g_cclosure_marshal_generic,
11948 G_TYPE_NONE,
11949 1, G_TYPE_STRING);
11950
11951 /* GObject properties for D-Bus properties: */
11952 /**
11953 * Control:poll-interval:
11954 *
11955 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
11956 *
11957 * 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.
11958 */
11959 g_object_interface_install_property (iface,
11960 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11961 /**
11962 * Control:heatbeat:
11963 *
11964 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
11965 *
11966 * 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.
11967 */
11968 g_object_interface_install_property (iface,
11969 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11970}
11971
11972/**
11973 * control_get_poll_interval: (skip)
11974 * @object: A #Control.
11975 *
11976 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
11977 *
11978 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11979 *
11980 * Returns: The property value.
11981 */
11982gint
11983control_get_poll_interval (Control *object)
11984{
11985 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
11986}
11987
11988/**
11989 * control_set_poll_interval: (skip)
11990 * @object: A #Control.
11991 * @value: The value to set.
11992 *
11993 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
11994 *
11995 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
11996 */
11997void
11998control_set_poll_interval (Control *object, gint value)
11999{
12000 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
12001}
12002
12003/**
12004 * control_get_heatbeat: (skip)
12005 * @object: A #Control.
12006 *
12007 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
12008 *
12009 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
12010 *
12011 * Returns: The property value.
12012 */
12013gint
12014control_get_heatbeat (Control *object)
12015{
12016 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
12017}
12018
12019/**
12020 * control_set_heatbeat: (skip)
12021 * @object: A #Control.
12022 * @value: The value to set.
12023 *
12024 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
12025 *
12026 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
12027 */
12028void
12029control_set_heatbeat (Control *object, gint value)
12030{
12031 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
12032}
12033
12034/**
12035 * control_emit_heartbeat:
12036 * @object: A #Control.
12037 * @arg_bus_name: Argument to pass with the signal.
12038 *
12039 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
12040 */
12041void
12042control_emit_heartbeat (
12043 Control *object,
12044 const gchar *arg_bus_name)
12045{
12046 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
12047}
12048
12049/**
12050 * control_emit_goto_system_state:
12051 * @object: A #Control.
12052 * @arg_state_name: Argument to pass with the signal.
12053 *
12054 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
12055 */
12056void
12057control_emit_goto_system_state (
12058 Control *object,
12059 const gchar *arg_state_name)
12060{
12061 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
12062}
12063
12064/**
12065 * control_call_init:
12066 * @proxy: A #ControlProxy.
12067 * @cancellable: (allow-none): A #GCancellable or %NULL.
12068 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12069 * @user_data: User data to pass to @callback.
12070 *
12071 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
12072 * 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.
12073 * You can then call control_call_init_finish() to get the result of the operation.
12074 *
12075 * See control_call_init_sync() for the synchronous, blocking version of this method.
12076 */
12077void
12078control_call_init (
12079 Control *proxy,
12080 GCancellable *cancellable,
12081 GAsyncReadyCallback callback,
12082 gpointer user_data)
12083{
12084 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12085 "init",
12086 g_variant_new ("()"),
12087 G_DBUS_CALL_FLAGS_NONE,
12088 -1,
12089 cancellable,
12090 callback,
12091 user_data);
12092}
12093
12094/**
12095 * control_call_init_finish:
12096 * @proxy: A #ControlProxy.
12097 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
12098 * @error: Return location for error or %NULL.
12099 *
12100 * Finishes an operation started with control_call_init().
12101 *
12102 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12103 */
12104gboolean
12105control_call_init_finish (
12106 Control *proxy,
12107 GAsyncResult *res,
12108 GError **error)
12109{
12110 GVariant *_ret;
12111 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12112 if (_ret == NULL)
12113 goto _out;
12114 g_variant_get (_ret,
12115 "()");
12116 g_variant_unref (_ret);
12117_out:
12118 return _ret != NULL;
12119}
12120
12121/**
12122 * control_call_init_sync:
12123 * @proxy: A #ControlProxy.
12124 * @cancellable: (allow-none): A #GCancellable or %NULL.
12125 * @error: Return location for error or %NULL.
12126 *
12127 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
12128 *
12129 * See control_call_init() for the asynchronous version of this method.
12130 *
12131 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12132 */
12133gboolean
12134control_call_init_sync (
12135 Control *proxy,
12136 GCancellable *cancellable,
12137 GError **error)
12138{
12139 GVariant *_ret;
12140 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12141 "init",
12142 g_variant_new ("()"),
12143 G_DBUS_CALL_FLAGS_NONE,
12144 -1,
12145 cancellable,
12146 error);
12147 if (_ret == NULL)
12148 goto _out;
12149 g_variant_get (_ret,
12150 "()");
12151 g_variant_unref (_ret);
12152_out:
12153 return _ret != NULL;
12154}
12155
12156/**
12157 * control_complete_init:
12158 * @object: A #Control.
12159 * @invocation: (transfer full): A #GDBusMethodInvocation.
12160 *
12161 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Control.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.
12162 *
12163 * This method will free @invocation, you cannot use it afterwards.
12164 */
12165void
12166control_complete_init (
12167 Control *object,
12168 GDBusMethodInvocation *invocation)
12169{
12170 g_dbus_method_invocation_return_value (invocation,
12171 g_variant_new ("()"));
12172}
12173
12174/* ------------------------------------------------------------------------ */
12175
12176/**
12177 * ControlProxy:
12178 *
12179 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
12180 */
12181
12182/**
12183 * ControlProxyClass:
12184 * @parent_class: The parent class.
12185 *
12186 * Class structure for #ControlProxy.
12187 */
12188
12189struct _ControlProxyPrivate
12190{
12191 GData *qdata;
12192};
12193
12194static void control_proxy_iface_init (ControlIface *iface);
12195
12196#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12197G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12198 G_ADD_PRIVATE (ControlProxy)
12199 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12200
12201#else
12202G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12203 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12204
12205#endif
12206static void
12207control_proxy_finalize (GObject *object)
12208{
12209 ControlProxy *proxy = CONTROL_PROXY (object);
12210 g_datalist_clear (&proxy->priv->qdata);
12211 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
12212}
12213
12214static void
12215control_proxy_get_property (GObject *object,
12216 guint prop_id,
12217 GValue *value,
12218 GParamSpec *pspec G_GNUC_UNUSED)
12219{
12220 const _ExtendedGDBusPropertyInfo *info;
12221 GVariant *variant;
12222 g_assert (prop_id != 0 && prop_id - 1 < 2);
12223 info = _control_property_info_pointers[prop_id - 1];
12224 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12225 if (info->use_gvariant)
12226 {
12227 g_value_set_variant (value, variant);
12228 }
12229 else
12230 {
12231 if (variant != NULL)
12232 g_dbus_gvariant_to_gvalue (variant, value);
12233 }
12234 if (variant != NULL)
12235 g_variant_unref (variant);
12236}
12237
12238static void
12239control_proxy_set_property_cb (GDBusProxy *proxy,
12240 GAsyncResult *res,
12241 gpointer user_data)
12242{
12243 const _ExtendedGDBusPropertyInfo *info = user_data;
12244 GError *error;
12245 GVariant *_ret;
12246 error = NULL;
12247 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12248 if (!_ret)
12249 {
12250 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
12251 info->parent_struct.name,
12252 error->message, g_quark_to_string (error->domain), error->code);
12253 g_error_free (error);
12254 }
12255 else
12256 {
12257 g_variant_unref (_ret);
12258 }
12259}
12260
12261static void
12262control_proxy_set_property (GObject *object,
12263 guint prop_id,
12264 const GValue *value,
12265 GParamSpec *pspec G_GNUC_UNUSED)
12266{
12267 const _ExtendedGDBusPropertyInfo *info;
12268 GVariant *variant;
12269 g_assert (prop_id != 0 && prop_id - 1 < 2);
12270 info = _control_property_info_pointers[prop_id - 1];
12271 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12272 g_dbus_proxy_call (G_DBUS_PROXY (object),
12273 "org.freedesktop.DBus.Properties.Set",
12274 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
12275 G_DBUS_CALL_FLAGS_NONE,
12276 -1,
12277 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12278 g_variant_unref (variant);
12279}
12280
12281static void
12282control_proxy_g_signal (GDBusProxy *proxy,
12283 const gchar *sender_name G_GNUC_UNUSED,
12284 const gchar *signal_name,
12285 GVariant *parameters)
12286{
12287 _ExtendedGDBusSignalInfo *info;
12288 GVariantIter iter;
12289 GVariant *child;
12290 GValue *paramv;
12291 guint num_params;
12292 guint n;
12293 guint signal_id;
12294 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
12295 if (info == NULL)
12296 return;
12297 num_params = g_variant_n_children (parameters);
12298 paramv = g_new0 (GValue, num_params + 1);
12299 g_value_init (&paramv[0], TYPE_CONTROL);
12300 g_value_set_object (&paramv[0], proxy);
12301 g_variant_iter_init (&iter, parameters);
12302 n = 1;
12303 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12304 {
12305 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12306 if (arg_info->use_gvariant)
12307 {
12308 g_value_init (&paramv[n], G_TYPE_VARIANT);
12309 g_value_set_variant (&paramv[n], child);
12310 n++;
12311 }
12312 else
12313 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12314 g_variant_unref (child);
12315 }
12316 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
12317 g_signal_emitv (paramv, signal_id, 0, NULL);
12318 for (n = 0; n < num_params + 1; n++)
12319 g_value_unset (&paramv[n]);
12320 g_free (paramv);
12321}
12322
12323static void
12324control_proxy_g_properties_changed (GDBusProxy *_proxy,
12325 GVariant *changed_properties,
12326 const gchar *const *invalidated_properties)
12327{
12328 ControlProxy *proxy = CONTROL_PROXY (_proxy);
12329 guint n;
12330 const gchar *key;
12331 GVariantIter *iter;
12332 _ExtendedGDBusPropertyInfo *info;
12333 g_variant_get (changed_properties, "a{sv}", &iter);
12334 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12335 {
12336 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
12337 g_datalist_remove_data (&proxy->priv->qdata, key);
12338 if (info != NULL)
12339 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12340 }
12341 g_variant_iter_free (iter);
12342 for (n = 0; invalidated_properties[n] != NULL; n++)
12343 {
12344 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
12345 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12346 if (info != NULL)
12347 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12348 }
12349}
12350
12351static gint
12352control_proxy_get_poll_interval (Control *object)
12353{
12354 ControlProxy *proxy = CONTROL_PROXY (object);
12355 GVariant *variant;
12356 gint value = 0;
12357 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
12358 if (variant != NULL)
12359 {
12360 value = g_variant_get_int32 (variant);
12361 g_variant_unref (variant);
12362 }
12363 return value;
12364}
12365
12366static gint
12367control_proxy_get_heatbeat (Control *object)
12368{
12369 ControlProxy *proxy = CONTROL_PROXY (object);
12370 GVariant *variant;
12371 gint value = 0;
12372 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
12373 if (variant != NULL)
12374 {
12375 value = g_variant_get_int32 (variant);
12376 g_variant_unref (variant);
12377 }
12378 return value;
12379}
12380
12381static void
12382control_proxy_init (ControlProxy *proxy)
12383{
12384#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12385 proxy->priv = control_proxy_get_instance_private (proxy);
12386#else
12387 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
12388#endif
12389
12390 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
12391}
12392
12393static void
12394control_proxy_class_init (ControlProxyClass *klass)
12395{
12396 GObjectClass *gobject_class;
12397 GDBusProxyClass *proxy_class;
12398
12399 gobject_class = G_OBJECT_CLASS (klass);
12400 gobject_class->finalize = control_proxy_finalize;
12401 gobject_class->get_property = control_proxy_get_property;
12402 gobject_class->set_property = control_proxy_set_property;
12403
12404 proxy_class = G_DBUS_PROXY_CLASS (klass);
12405 proxy_class->g_signal = control_proxy_g_signal;
12406 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
12407
12408 control_override_properties (gobject_class, 1);
12409
12410#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12411 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
12412#endif
12413}
12414
12415static void
12416control_proxy_iface_init (ControlIface *iface)
12417{
12418 iface->get_poll_interval = control_proxy_get_poll_interval;
12419 iface->get_heatbeat = control_proxy_get_heatbeat;
12420}
12421
12422/**
12423 * control_proxy_new:
12424 * @connection: A #GDBusConnection.
12425 * @flags: Flags from the #GDBusProxyFlags enumeration.
12426 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12427 * @object_path: An object path.
12428 * @cancellable: (allow-none): A #GCancellable or %NULL.
12429 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12430 * @user_data: User data to pass to @callback.
12431 *
12432 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new() for more details.
12433 *
12434 * 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.
12435 * You can then call control_proxy_new_finish() to get the result of the operation.
12436 *
12437 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
12438 */
12439void
12440control_proxy_new (
12441 GDBusConnection *connection,
12442 GDBusProxyFlags flags,
12443 const gchar *name,
12444 const gchar *object_path,
12445 GCancellable *cancellable,
12446 GAsyncReadyCallback callback,
12447 gpointer user_data)
12448{
12449 g_async_initable_new_async (TYPE_CONTROL_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.Control", NULL);
12450}
12451
12452/**
12453 * control_proxy_new_finish:
12454 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
12455 * @error: Return location for error or %NULL
12456 *
12457 * Finishes an operation started with control_proxy_new().
12458 *
12459 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12460 */
12461Control *
12462control_proxy_new_finish (
12463 GAsyncResult *res,
12464 GError **error)
12465{
12466 GObject *ret;
12467 GObject *source_object;
12468 source_object = g_async_result_get_source_object (res);
12469 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12470 g_object_unref (source_object);
12471 if (ret != NULL)
12472 return CONTROL (ret);
12473 else
12474 return NULL;
12475}
12476
12477/**
12478 * control_proxy_new_sync:
12479 * @connection: A #GDBusConnection.
12480 * @flags: Flags from the #GDBusProxyFlags enumeration.
12481 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12482 * @object_path: An object path.
12483 * @cancellable: (allow-none): A #GCancellable or %NULL.
12484 * @error: Return location for error or %NULL
12485 *
12486 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new_sync() for more details.
12487 *
12488 * The calling thread is blocked until a reply is received.
12489 *
12490 * See control_proxy_new() for the asynchronous version of this constructor.
12491 *
12492 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12493 */
12494Control *
12495control_proxy_new_sync (
12496 GDBusConnection *connection,
12497 GDBusProxyFlags flags,
12498 const gchar *name,
12499 const gchar *object_path,
12500 GCancellable *cancellable,
12501 GError **error)
12502{
12503 GInitable *ret;
12504 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
12505 if (ret != NULL)
12506 return CONTROL (ret);
12507 else
12508 return NULL;
12509}
12510
12511
12512/**
12513 * control_proxy_new_for_bus:
12514 * @bus_type: A #GBusType.
12515 * @flags: Flags from the #GDBusProxyFlags enumeration.
12516 * @name: A bus name (well-known or unique).
12517 * @object_path: An object path.
12518 * @cancellable: (allow-none): A #GCancellable or %NULL.
12519 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12520 * @user_data: User data to pass to @callback.
12521 *
12522 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12523 *
12524 * 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.
12525 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
12526 *
12527 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12528 */
12529void
12530control_proxy_new_for_bus (
12531 GBusType bus_type,
12532 GDBusProxyFlags flags,
12533 const gchar *name,
12534 const gchar *object_path,
12535 GCancellable *cancellable,
12536 GAsyncReadyCallback callback,
12537 gpointer user_data)
12538{
12539 g_async_initable_new_async (TYPE_CONTROL_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.Control", NULL);
12540}
12541
12542/**
12543 * control_proxy_new_for_bus_finish:
12544 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
12545 * @error: Return location for error or %NULL
12546 *
12547 * Finishes an operation started with control_proxy_new_for_bus().
12548 *
12549 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12550 */
12551Control *
12552control_proxy_new_for_bus_finish (
12553 GAsyncResult *res,
12554 GError **error)
12555{
12556 GObject *ret;
12557 GObject *source_object;
12558 source_object = g_async_result_get_source_object (res);
12559 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12560 g_object_unref (source_object);
12561 if (ret != NULL)
12562 return CONTROL (ret);
12563 else
12564 return NULL;
12565}
12566
12567/**
12568 * control_proxy_new_for_bus_sync:
12569 * @bus_type: A #GBusType.
12570 * @flags: Flags from the #GDBusProxyFlags enumeration.
12571 * @name: A bus name (well-known or unique).
12572 * @object_path: An object path.
12573 * @cancellable: (allow-none): A #GCancellable or %NULL.
12574 * @error: Return location for error or %NULL
12575 *
12576 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12577 *
12578 * The calling thread is blocked until a reply is received.
12579 *
12580 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
12581 *
12582 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12583 */
12584Control *
12585control_proxy_new_for_bus_sync (
12586 GBusType bus_type,
12587 GDBusProxyFlags flags,
12588 const gchar *name,
12589 const gchar *object_path,
12590 GCancellable *cancellable,
12591 GError **error)
12592{
12593 GInitable *ret;
12594 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
12595 if (ret != NULL)
12596 return CONTROL (ret);
12597 else
12598 return NULL;
12599}
12600
12601
12602/* ------------------------------------------------------------------------ */
12603
12604/**
12605 * ControlSkeleton:
12606 *
12607 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
12608 */
12609
12610/**
12611 * ControlSkeletonClass:
12612 * @parent_class: The parent class.
12613 *
12614 * Class structure for #ControlSkeleton.
12615 */
12616
12617struct _ControlSkeletonPrivate
12618{
12619 GValue *properties;
12620 GList *changed_properties;
12621 GSource *changed_properties_idle_source;
12622 GMainContext *context;
12623 GMutex lock;
12624};
12625
12626static void
12627_control_skeleton_handle_method_call (
12628 GDBusConnection *connection G_GNUC_UNUSED,
12629 const gchar *sender G_GNUC_UNUSED,
12630 const gchar *object_path G_GNUC_UNUSED,
12631 const gchar *interface_name,
12632 const gchar *method_name,
12633 GVariant *parameters,
12634 GDBusMethodInvocation *invocation,
12635 gpointer user_data)
12636{
12637 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
12638 _ExtendedGDBusMethodInfo *info;
12639 GVariantIter iter;
12640 GVariant *child;
12641 GValue *paramv;
12642 guint num_params;
12643 guint num_extra;
12644 guint n;
12645 guint signal_id;
12646 GValue return_value = G_VALUE_INIT;
12647 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12648 g_assert (info != NULL);
12649 num_params = g_variant_n_children (parameters);
12650 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12651 n = 0;
12652 g_value_init (&paramv[n], TYPE_CONTROL);
12653 g_value_set_object (&paramv[n++], skeleton);
12654 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12655 g_value_set_object (&paramv[n++], invocation);
12656 if (info->pass_fdlist)
12657 {
12658#ifdef G_OS_UNIX
12659 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
12660 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
12661#else
12662 g_assert_not_reached ();
12663#endif
12664 }
12665 g_variant_iter_init (&iter, parameters);
12666 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12667 {
12668 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
12669 if (arg_info->use_gvariant)
12670 {
12671 g_value_init (&paramv[n], G_TYPE_VARIANT);
12672 g_value_set_variant (&paramv[n], child);
12673 n++;
12674 }
12675 else
12676 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12677 g_variant_unref (child);
12678 }
12679 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
12680 g_value_init (&return_value, G_TYPE_BOOLEAN);
12681 g_signal_emitv (paramv, signal_id, 0, &return_value);
12682 if (!g_value_get_boolean (&return_value))
12683 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);
12684 g_value_unset (&return_value);
12685 for (n = 0; n < num_params + num_extra; n++)
12686 g_value_unset (&paramv[n]);
12687 g_free (paramv);
12688}
12689
12690static GVariant *
12691_control_skeleton_handle_get_property (
12692 GDBusConnection *connection G_GNUC_UNUSED,
12693 const gchar *sender G_GNUC_UNUSED,
12694 const gchar *object_path G_GNUC_UNUSED,
12695 const gchar *interface_name G_GNUC_UNUSED,
12696 const gchar *property_name,
12697 GError **error,
12698 gpointer user_data)
12699{
12700 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
12701 GValue value = G_VALUE_INIT;
12702 GParamSpec *pspec;
12703 _ExtendedGDBusPropertyInfo *info;
12704 GVariant *ret;
12705 ret = NULL;
12706 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
12707 g_assert (info != NULL);
12708 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12709 if (pspec == NULL)
12710 {
12711 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12712 }
12713 else
12714 {
12715 g_value_init (&value, pspec->value_type);
12716 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12717 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12718 g_value_unset (&value);
12719 }
12720 return ret;
12721}
12722
12723static gboolean
12724_control_skeleton_handle_set_property (
12725 GDBusConnection *connection G_GNUC_UNUSED,
12726 const gchar *sender G_GNUC_UNUSED,
12727 const gchar *object_path G_GNUC_UNUSED,
12728 const gchar *interface_name G_GNUC_UNUSED,
12729 const gchar *property_name,
12730 GVariant *variant,
12731 GError **error,
12732 gpointer user_data)
12733{
12734 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
12735 GValue value = G_VALUE_INIT;
12736 GParamSpec *pspec;
12737 _ExtendedGDBusPropertyInfo *info;
12738 gboolean ret;
12739 ret = FALSE;
12740 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
12741 g_assert (info != NULL);
12742 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12743 if (pspec == NULL)
12744 {
12745 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12746 }
12747 else
12748 {
12749 if (info->use_gvariant)
12750 g_value_set_variant (&value, variant);
12751 else
12752 g_dbus_gvariant_to_gvalue (variant, &value);
12753 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12754 g_value_unset (&value);
12755 ret = TRUE;
12756 }
12757 return ret;
12758}
12759
12760static const GDBusInterfaceVTable _control_skeleton_vtable =
12761{
12762 _control_skeleton_handle_method_call,
12763 _control_skeleton_handle_get_property,
12764 _control_skeleton_handle_set_property,
12765 {NULL}
12766};
12767
12768static GDBusInterfaceInfo *
12769control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12770{
12771 return control_interface_info ();
12772}
12773
12774static GDBusInterfaceVTable *
12775control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12776{
12777 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
12778}
12779
12780static GVariant *
12781control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12782{
12783 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
12784
12785 GVariantBuilder builder;
12786 guint n;
12787 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12788 if (_control_interface_info.parent_struct.properties == NULL)
12789 goto out;
12790 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
12791 {
12792 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
12793 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12794 {
12795 GVariant *value;
12796 value = _control_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.Control", info->name, NULL, skeleton);
12797 if (value != NULL)
12798 {
12799 g_variant_take_ref (value);
12800 g_variant_builder_add (&builder, "{sv}", info->name, value);
12801 g_variant_unref (value);
12802 }
12803 }
12804 }
12805out:
12806 return g_variant_builder_end (&builder);
12807}
12808
12809static gboolean _control_emit_changed (gpointer user_data);
12810
12811static void
12812control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12813{
12814 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
12815 gboolean emit_changed = FALSE;
12816
12817 g_mutex_lock (&skeleton->priv->lock);
12818 if (skeleton->priv->changed_properties_idle_source != NULL)
12819 {
12820 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12821 skeleton->priv->changed_properties_idle_source = NULL;
12822 emit_changed = TRUE;
12823 }
12824 g_mutex_unlock (&skeleton->priv->lock);
12825
12826 if (emit_changed)
12827 _control_emit_changed (skeleton);
12828}
12829
12830static void
12831_control_on_signal_heartbeat (
12832 Control *object,
12833 const gchar *arg_bus_name)
12834{
12835 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12836
12837 GList *connections, *l;
12838 GVariant *signal_variant;
12839 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12840
12841 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
12842 arg_bus_name));
12843 for (l = connections; l != NULL; l = l->next)
12844 {
12845 GDBusConnection *connection = l->data;
12846 g_dbus_connection_emit_signal (connection,
12847 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
12848 signal_variant, NULL);
12849 }
12850 g_variant_unref (signal_variant);
12851 g_list_free_full (connections, g_object_unref);
12852}
12853
12854static void
12855_control_on_signal_goto_system_state (
12856 Control *object,
12857 const gchar *arg_state_name)
12858{
12859 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12860
12861 GList *connections, *l;
12862 GVariant *signal_variant;
12863 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12864
12865 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
12866 arg_state_name));
12867 for (l = connections; l != NULL; l = l->next)
12868 {
12869 GDBusConnection *connection = l->data;
12870 g_dbus_connection_emit_signal (connection,
12871 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
12872 signal_variant, NULL);
12873 }
12874 g_variant_unref (signal_variant);
12875 g_list_free_full (connections, g_object_unref);
12876}
12877
12878static void control_skeleton_iface_init (ControlIface *iface);
12879#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12880G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12881 G_ADD_PRIVATE (ControlSkeleton)
12882 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
12883
12884#else
12885G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12886 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
12887
12888#endif
12889static void
12890control_skeleton_finalize (GObject *object)
12891{
12892 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12893 guint n;
12894 for (n = 0; n < 2; n++)
12895 g_value_unset (&skeleton->priv->properties[n]);
12896 g_free (skeleton->priv->properties);
12897 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12898 if (skeleton->priv->changed_properties_idle_source != NULL)
12899 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12900 g_main_context_unref (skeleton->priv->context);
12901 g_mutex_clear (&skeleton->priv->lock);
12902 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
12903}
12904
12905static void
12906control_skeleton_get_property (GObject *object,
12907 guint prop_id,
12908 GValue *value,
12909 GParamSpec *pspec G_GNUC_UNUSED)
12910{
12911 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
12912 g_assert (prop_id != 0 && prop_id - 1 < 2);
12913 g_mutex_lock (&skeleton->priv->lock);
12914 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12915 g_mutex_unlock (&skeleton->priv->lock);
12916}
12917
12918static gboolean
12919_control_emit_changed (gpointer user_data)
12920{
12921 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
12922 GList *l;
12923 GVariantBuilder builder;
12924 GVariantBuilder invalidated_builder;
12925 guint num_changes;
12926
12927 g_mutex_lock (&skeleton->priv->lock);
12928 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12929 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12930 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12931 {
12932 ChangedProperty *cp = l->data;
12933 GVariant *variant;
12934 const GValue *cur_value;
12935
12936 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12937 if (!_g_value_equal (cur_value, &cp->orig_value))
12938 {
12939 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12940 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12941 g_variant_unref (variant);
12942 num_changes++;
12943 }
12944 }
12945 if (num_changes > 0)
12946 {
12947 GList *connections, *ll;
12948 GVariant *signal_variant;
12949 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
12950 &builder, &invalidated_builder));
12951 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12952 for (ll = connections; ll != NULL; ll = ll->next)
12953 {
12954 GDBusConnection *connection = ll->data;
12955
12956 g_dbus_connection_emit_signal (connection,
12957 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12958 "org.freedesktop.DBus.Properties",
12959 "PropertiesChanged",
12960 signal_variant,
12961 NULL);
12962 }
12963 g_variant_unref (signal_variant);
12964 g_list_free_full (connections, g_object_unref);
12965 }
12966 else
12967 {
12968 g_variant_builder_clear (&builder);
12969 g_variant_builder_clear (&invalidated_builder);
12970 }
12971 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12972 skeleton->priv->changed_properties = NULL;
12973 skeleton->priv->changed_properties_idle_source = NULL;
12974 g_mutex_unlock (&skeleton->priv->lock);
12975 return FALSE;
12976}
12977
12978static void
12979_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12980{
12981 ChangedProperty *cp;
12982 GList *l;
12983 cp = NULL;
12984 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12985 {
12986 ChangedProperty *i_cp = l->data;
12987 if (i_cp->info == info)
12988 {
12989 cp = i_cp;
12990 break;
12991 }
12992 }
12993 if (cp == NULL)
12994 {
12995 cp = g_new0 (ChangedProperty, 1);
12996 cp->prop_id = prop_id;
12997 cp->info = info;
12998 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12999 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
13000 g_value_copy (orig_value, &cp->orig_value);
13001 }
13002}
13003
13004static void
13005control_skeleton_notify (GObject *object,
13006 GParamSpec *pspec G_GNUC_UNUSED)
13007{
13008 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13009 g_mutex_lock (&skeleton->priv->lock);
13010 if (skeleton->priv->changed_properties != NULL &&
13011 skeleton->priv->changed_properties_idle_source == NULL)
13012 {
13013 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
13014 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
13015 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
13016 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
13017 g_source_unref (skeleton->priv->changed_properties_idle_source);
13018 }
13019 g_mutex_unlock (&skeleton->priv->lock);
13020}
13021
13022static void
13023control_skeleton_set_property (GObject *object,
13024 guint prop_id,
13025 const GValue *value,
13026 GParamSpec *pspec)
13027{
13028 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13029 g_assert (prop_id != 0 && prop_id - 1 < 2);
13030 g_mutex_lock (&skeleton->priv->lock);
13031 g_object_freeze_notify (object);
13032 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
13033 {
13034 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
13035 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
13036 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
13037 g_object_notify_by_pspec (object, pspec);
13038 }
13039 g_mutex_unlock (&skeleton->priv->lock);
13040 g_object_thaw_notify (object);
13041}
13042
13043static void
13044control_skeleton_init (ControlSkeleton *skeleton)
13045{
13046#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13047 skeleton->priv = control_skeleton_get_instance_private (skeleton);
13048#else
13049 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
13050#endif
13051
13052 g_mutex_init (&skeleton->priv->lock);
13053 skeleton->priv->context = g_main_context_ref_thread_default ();
13054 skeleton->priv->properties = g_new0 (GValue, 2);
13055 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
13056 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
13057}
13058
13059static gint
13060control_skeleton_get_poll_interval (Control *object)
13061{
13062 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13063 gint value;
13064 g_mutex_lock (&skeleton->priv->lock);
13065 value = g_value_get_int (&(skeleton->priv->properties[0]));
13066 g_mutex_unlock (&skeleton->priv->lock);
13067 return value;
13068}
13069
13070static gint
13071control_skeleton_get_heatbeat (Control *object)
13072{
13073 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13074 gint value;
13075 g_mutex_lock (&skeleton->priv->lock);
13076 value = g_value_get_int (&(skeleton->priv->properties[1]));
13077 g_mutex_unlock (&skeleton->priv->lock);
13078 return value;
13079}
13080
13081static void
13082control_skeleton_class_init (ControlSkeletonClass *klass)
13083{
13084 GObjectClass *gobject_class;
13085 GDBusInterfaceSkeletonClass *skeleton_class;
13086
13087 gobject_class = G_OBJECT_CLASS (klass);
13088 gobject_class->finalize = control_skeleton_finalize;
13089 gobject_class->get_property = control_skeleton_get_property;
13090 gobject_class->set_property = control_skeleton_set_property;
13091 gobject_class->notify = control_skeleton_notify;
13092
13093
13094 control_override_properties (gobject_class, 1);
13095
13096 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13097 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
13098 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
13099 skeleton_class->flush = control_skeleton_dbus_interface_flush;
13100 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
13101
13102#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13103 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
13104#endif
13105}
13106
13107static void
13108control_skeleton_iface_init (ControlIface *iface)
13109{
13110 iface->heartbeat = _control_on_signal_heartbeat;
13111 iface->goto_system_state = _control_on_signal_goto_system_state;
13112 iface->get_poll_interval = control_skeleton_get_poll_interval;
13113 iface->get_heatbeat = control_skeleton_get_heatbeat;
13114}
13115
13116/**
13117 * control_skeleton_new:
13118 *
13119 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13120 *
13121 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
13122 */
13123Control *
13124control_skeleton_new (void)
13125{
13126 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
13127}
13128
13129/* ------------------------------------------------------------------------
13130 * Code for interface org.openbmc.control.Bmc
13131 * ------------------------------------------------------------------------
13132 */
13133
13134/**
13135 * SECTION:ControlBmc
13136 * @title: ControlBmc
13137 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
13138 *
13139 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface in C.
13140 */
13141
13142/* ---- Introspection data for org.openbmc.control.Bmc ---- */
13143
13144static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
13145{
13146 {
13147 -1,
13148 (gchar *) "place_holder",
13149 NULL,
13150 NULL,
13151 NULL
13152 },
13153 "handle-place-holder",
13154 FALSE
13155};
13156
13157static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
13158{
13159 &_control_bmc_method_info_place_holder,
13160 NULL
13161};
13162
13163static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
13164{
13165 {
13166 -1,
13167 (gchar *) "org.openbmc.control.Bmc",
13168 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
13169 NULL,
13170 NULL,
13171 NULL
13172 },
13173 "control-bmc",
13174};
13175
13176
13177/**
13178 * control_bmc_interface_info:
13179 *
13180 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface.
13181 *
13182 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13183 */
13184GDBusInterfaceInfo *
13185control_bmc_interface_info (void)
13186{
13187 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
13188}
13189
13190/**
13191 * control_bmc_override_properties:
13192 * @klass: The class structure for a #GObject<!-- -->-derived class.
13193 * @property_id_begin: The property id to assign to the first overridden property.
13194 *
13195 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
13196 * The properties are overridden in the order they are defined.
13197 *
13198 * Returns: The last property id.
13199 */
13200guint
13201control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
13202{
13203 return property_id_begin - 1;
13204}
13205
13206
13207
13208/**
13209 * ControlBmc:
13210 *
13211 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13212 */
13213
13214/**
13215 * ControlBmcIface:
13216 * @parent_iface: The parent interface.
13217 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
13218 *
13219 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13220 */
13221
13222typedef ControlBmcIface ControlBmcInterface;
13223G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
13224
13225static void
13226control_bmc_default_init (ControlBmcIface *iface)
13227{
13228 /* GObject signals for incoming D-Bus method calls: */
13229 /**
13230 * ControlBmc::handle-place-holder:
13231 * @object: A #ControlBmc.
13232 * @invocation: A #GDBusMethodInvocation.
13233 *
13234 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method.
13235 *
13236 * 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 control_bmc_complete_place_holder() 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.
13237 *
13238 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13239 */
13240 g_signal_new ("handle-place-holder",
13241 G_TYPE_FROM_INTERFACE (iface),
13242 G_SIGNAL_RUN_LAST,
13243 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
13244 g_signal_accumulator_true_handled,
13245 NULL,
13246 g_cclosure_marshal_generic,
13247 G_TYPE_BOOLEAN,
13248 1,
13249 G_TYPE_DBUS_METHOD_INVOCATION);
13250
13251}
13252
13253/**
13254 * control_bmc_call_place_holder:
13255 * @proxy: A #ControlBmcProxy.
13256 * @cancellable: (allow-none): A #GCancellable or %NULL.
13257 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13258 * @user_data: User data to pass to @callback.
13259 *
13260 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
13261 * 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.
13262 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
13263 *
13264 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
13265 */
13266void
13267control_bmc_call_place_holder (
13268 ControlBmc *proxy,
13269 GCancellable *cancellable,
13270 GAsyncReadyCallback callback,
13271 gpointer user_data)
13272{
13273 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13274 "place_holder",
13275 g_variant_new ("()"),
13276 G_DBUS_CALL_FLAGS_NONE,
13277 -1,
13278 cancellable,
13279 callback,
13280 user_data);
13281}
13282
13283/**
13284 * control_bmc_call_place_holder_finish:
13285 * @proxy: A #ControlBmcProxy.
13286 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
13287 * @error: Return location for error or %NULL.
13288 *
13289 * Finishes an operation started with control_bmc_call_place_holder().
13290 *
13291 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13292 */
13293gboolean
13294control_bmc_call_place_holder_finish (
13295 ControlBmc *proxy,
13296 GAsyncResult *res,
13297 GError **error)
13298{
13299 GVariant *_ret;
13300 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13301 if (_ret == NULL)
13302 goto _out;
13303 g_variant_get (_ret,
13304 "()");
13305 g_variant_unref (_ret);
13306_out:
13307 return _ret != NULL;
13308}
13309
13310/**
13311 * control_bmc_call_place_holder_sync:
13312 * @proxy: A #ControlBmcProxy.
13313 * @cancellable: (allow-none): A #GCancellable or %NULL.
13314 * @error: Return location for error or %NULL.
13315 *
13316 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
13317 *
13318 * See control_bmc_call_place_holder() for the asynchronous version of this method.
13319 *
13320 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13321 */
13322gboolean
13323control_bmc_call_place_holder_sync (
13324 ControlBmc *proxy,
13325 GCancellable *cancellable,
13326 GError **error)
13327{
13328 GVariant *_ret;
13329 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13330 "place_holder",
13331 g_variant_new ("()"),
13332 G_DBUS_CALL_FLAGS_NONE,
13333 -1,
13334 cancellable,
13335 error);
13336 if (_ret == NULL)
13337 goto _out;
13338 g_variant_get (_ret,
13339 "()");
13340 g_variant_unref (_ret);
13341_out:
13342 return _ret != NULL;
13343}
13344
13345/**
13346 * control_bmc_complete_place_holder:
13347 * @object: A #ControlBmc.
13348 * @invocation: (transfer full): A #GDBusMethodInvocation.
13349 *
13350 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</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.
13351 *
13352 * This method will free @invocation, you cannot use it afterwards.
13353 */
13354void
13355control_bmc_complete_place_holder (
13356 ControlBmc *object,
13357 GDBusMethodInvocation *invocation)
13358{
13359 g_dbus_method_invocation_return_value (invocation,
13360 g_variant_new ("()"));
13361}
13362
13363/* ------------------------------------------------------------------------ */
13364
13365/**
13366 * ControlBmcProxy:
13367 *
13368 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
13369 */
13370
13371/**
13372 * ControlBmcProxyClass:
13373 * @parent_class: The parent class.
13374 *
13375 * Class structure for #ControlBmcProxy.
13376 */
13377
13378struct _ControlBmcProxyPrivate
13379{
13380 GData *qdata;
13381};
13382
13383static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
13384
13385#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13386G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
13387 G_ADD_PRIVATE (ControlBmcProxy)
13388 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
13389
13390#else
13391G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
13392 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
13393
13394#endif
13395static void
13396control_bmc_proxy_finalize (GObject *object)
13397{
13398 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
13399 g_datalist_clear (&proxy->priv->qdata);
13400 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
13401}
13402
13403static void
13404control_bmc_proxy_get_property (GObject *object,
13405 guint prop_id,
13406 GValue *value,
13407 GParamSpec *pspec G_GNUC_UNUSED)
13408{
13409}
13410
13411static void
13412control_bmc_proxy_set_property (GObject *object,
13413 guint prop_id,
13414 const GValue *value,
13415 GParamSpec *pspec G_GNUC_UNUSED)
13416{
13417}
13418
13419static void
13420control_bmc_proxy_g_signal (GDBusProxy *proxy,
13421 const gchar *sender_name G_GNUC_UNUSED,
13422 const gchar *signal_name,
13423 GVariant *parameters)
13424{
13425 _ExtendedGDBusSignalInfo *info;
13426 GVariantIter iter;
13427 GVariant *child;
13428 GValue *paramv;
13429 guint num_params;
13430 guint n;
13431 guint signal_id;
13432 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
13433 if (info == NULL)
13434 return;
13435 num_params = g_variant_n_children (parameters);
13436 paramv = g_new0 (GValue, num_params + 1);
13437 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
13438 g_value_set_object (&paramv[0], proxy);
13439 g_variant_iter_init (&iter, parameters);
13440 n = 1;
13441 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13442 {
13443 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13444 if (arg_info->use_gvariant)
13445 {
13446 g_value_init (&paramv[n], G_TYPE_VARIANT);
13447 g_value_set_variant (&paramv[n], child);
13448 n++;
13449 }
13450 else
13451 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13452 g_variant_unref (child);
13453 }
13454 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
13455 g_signal_emitv (paramv, signal_id, 0, NULL);
13456 for (n = 0; n < num_params + 1; n++)
13457 g_value_unset (&paramv[n]);
13458 g_free (paramv);
13459}
13460
13461static void
13462control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
13463 GVariant *changed_properties,
13464 const gchar *const *invalidated_properties)
13465{
13466 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
13467 guint n;
13468 const gchar *key;
13469 GVariantIter *iter;
13470 _ExtendedGDBusPropertyInfo *info;
13471 g_variant_get (changed_properties, "a{sv}", &iter);
13472 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13473 {
13474 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
13475 g_datalist_remove_data (&proxy->priv->qdata, key);
13476 if (info != NULL)
13477 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13478 }
13479 g_variant_iter_free (iter);
13480 for (n = 0; invalidated_properties[n] != NULL; n++)
13481 {
13482 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
13483 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13484 if (info != NULL)
13485 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13486 }
13487}
13488
13489static void
13490control_bmc_proxy_init (ControlBmcProxy *proxy)
13491{
13492#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13493 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
13494#else
13495 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
13496#endif
13497
13498 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
13499}
13500
13501static void
13502control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
13503{
13504 GObjectClass *gobject_class;
13505 GDBusProxyClass *proxy_class;
13506
13507 gobject_class = G_OBJECT_CLASS (klass);
13508 gobject_class->finalize = control_bmc_proxy_finalize;
13509 gobject_class->get_property = control_bmc_proxy_get_property;
13510 gobject_class->set_property = control_bmc_proxy_set_property;
13511
13512 proxy_class = G_DBUS_PROXY_CLASS (klass);
13513 proxy_class->g_signal = control_bmc_proxy_g_signal;
13514 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
13515
13516#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13517 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
13518#endif
13519}
13520
13521static void
13522control_bmc_proxy_iface_init (ControlBmcIface *iface)
13523{
13524}
13525
13526/**
13527 * control_bmc_proxy_new:
13528 * @connection: A #GDBusConnection.
13529 * @flags: Flags from the #GDBusProxyFlags enumeration.
13530 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13531 * @object_path: An object path.
13532 * @cancellable: (allow-none): A #GCancellable or %NULL.
13533 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13534 * @user_data: User data to pass to @callback.
13535 *
13536 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new() for more details.
13537 *
13538 * 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.
13539 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
13540 *
13541 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
13542 */
13543void
13544control_bmc_proxy_new (
13545 GDBusConnection *connection,
13546 GDBusProxyFlags flags,
13547 const gchar *name,
13548 const gchar *object_path,
13549 GCancellable *cancellable,
13550 GAsyncReadyCallback callback,
13551 gpointer user_data)
13552{
13553 g_async_initable_new_async (TYPE_CONTROL_BMC_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.control.Bmc", NULL);
13554}
13555
13556/**
13557 * control_bmc_proxy_new_finish:
13558 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
13559 * @error: Return location for error or %NULL
13560 *
13561 * Finishes an operation started with control_bmc_proxy_new().
13562 *
13563 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
13564 */
13565ControlBmc *
13566control_bmc_proxy_new_finish (
13567 GAsyncResult *res,
13568 GError **error)
13569{
13570 GObject *ret;
13571 GObject *source_object;
13572 source_object = g_async_result_get_source_object (res);
13573 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13574 g_object_unref (source_object);
13575 if (ret != NULL)
13576 return CONTROL_BMC (ret);
13577 else
13578 return NULL;
13579}
13580
13581/**
13582 * control_bmc_proxy_new_sync:
13583 * @connection: A #GDBusConnection.
13584 * @flags: Flags from the #GDBusProxyFlags enumeration.
13585 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13586 * @object_path: An object path.
13587 * @cancellable: (allow-none): A #GCancellable or %NULL.
13588 * @error: Return location for error or %NULL
13589 *
13590 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new_sync() for more details.
13591 *
13592 * The calling thread is blocked until a reply is received.
13593 *
13594 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
13595 *
13596 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
13597 */
13598ControlBmc *
13599control_bmc_proxy_new_sync (
13600 GDBusConnection *connection,
13601 GDBusProxyFlags flags,
13602 const gchar *name,
13603 const gchar *object_path,
13604 GCancellable *cancellable,
13605 GError **error)
13606{
13607 GInitable *ret;
13608 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
13609 if (ret != NULL)
13610 return CONTROL_BMC (ret);
13611 else
13612 return NULL;
13613}
13614
13615
13616/**
13617 * control_bmc_proxy_new_for_bus:
13618 * @bus_type: A #GBusType.
13619 * @flags: Flags from the #GDBusProxyFlags enumeration.
13620 * @name: A bus name (well-known or unique).
13621 * @object_path: An object path.
13622 * @cancellable: (allow-none): A #GCancellable or %NULL.
13623 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13624 * @user_data: User data to pass to @callback.
13625 *
13626 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13627 *
13628 * 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.
13629 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
13630 *
13631 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13632 */
13633void
13634control_bmc_proxy_new_for_bus (
13635 GBusType bus_type,
13636 GDBusProxyFlags flags,
13637 const gchar *name,
13638 const gchar *object_path,
13639 GCancellable *cancellable,
13640 GAsyncReadyCallback callback,
13641 gpointer user_data)
13642{
13643 g_async_initable_new_async (TYPE_CONTROL_BMC_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.control.Bmc", NULL);
13644}
13645
13646/**
13647 * control_bmc_proxy_new_for_bus_finish:
13648 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
13649 * @error: Return location for error or %NULL
13650 *
13651 * Finishes an operation started with control_bmc_proxy_new_for_bus().
13652 *
13653 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
13654 */
13655ControlBmc *
13656control_bmc_proxy_new_for_bus_finish (
13657 GAsyncResult *res,
13658 GError **error)
13659{
13660 GObject *ret;
13661 GObject *source_object;
13662 source_object = g_async_result_get_source_object (res);
13663 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13664 g_object_unref (source_object);
13665 if (ret != NULL)
13666 return CONTROL_BMC (ret);
13667 else
13668 return NULL;
13669}
13670
13671/**
13672 * control_bmc_proxy_new_for_bus_sync:
13673 * @bus_type: A #GBusType.
13674 * @flags: Flags from the #GDBusProxyFlags enumeration.
13675 * @name: A bus name (well-known or unique).
13676 * @object_path: An object path.
13677 * @cancellable: (allow-none): A #GCancellable or %NULL.
13678 * @error: Return location for error or %NULL
13679 *
13680 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13681 *
13682 * The calling thread is blocked until a reply is received.
13683 *
13684 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
13685 *
13686 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
13687 */
13688ControlBmc *
13689control_bmc_proxy_new_for_bus_sync (
13690 GBusType bus_type,
13691 GDBusProxyFlags flags,
13692 const gchar *name,
13693 const gchar *object_path,
13694 GCancellable *cancellable,
13695 GError **error)
13696{
13697 GInitable *ret;
13698 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
13699 if (ret != NULL)
13700 return CONTROL_BMC (ret);
13701 else
13702 return NULL;
13703}
13704
13705
13706/* ------------------------------------------------------------------------ */
13707
13708/**
13709 * ControlBmcSkeleton:
13710 *
13711 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
13712 */
13713
13714/**
13715 * ControlBmcSkeletonClass:
13716 * @parent_class: The parent class.
13717 *
13718 * Class structure for #ControlBmcSkeleton.
13719 */
13720
13721struct _ControlBmcSkeletonPrivate
13722{
13723 GValue *properties;
13724 GList *changed_properties;
13725 GSource *changed_properties_idle_source;
13726 GMainContext *context;
13727 GMutex lock;
13728};
13729
13730static void
13731_control_bmc_skeleton_handle_method_call (
13732 GDBusConnection *connection G_GNUC_UNUSED,
13733 const gchar *sender G_GNUC_UNUSED,
13734 const gchar *object_path G_GNUC_UNUSED,
13735 const gchar *interface_name,
13736 const gchar *method_name,
13737 GVariant *parameters,
13738 GDBusMethodInvocation *invocation,
13739 gpointer user_data)
13740{
13741 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
13742 _ExtendedGDBusMethodInfo *info;
13743 GVariantIter iter;
13744 GVariant *child;
13745 GValue *paramv;
13746 guint num_params;
13747 guint num_extra;
13748 guint n;
13749 guint signal_id;
13750 GValue return_value = G_VALUE_INIT;
13751 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13752 g_assert (info != NULL);
13753 num_params = g_variant_n_children (parameters);
13754 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13755 n = 0;
13756 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
13757 g_value_set_object (&paramv[n++], skeleton);
13758 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13759 g_value_set_object (&paramv[n++], invocation);
13760 if (info->pass_fdlist)
13761 {
13762#ifdef G_OS_UNIX
13763 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13764 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13765#else
13766 g_assert_not_reached ();
13767#endif
13768 }
13769 g_variant_iter_init (&iter, parameters);
13770 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13771 {
13772 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13773 if (arg_info->use_gvariant)
13774 {
13775 g_value_init (&paramv[n], G_TYPE_VARIANT);
13776 g_value_set_variant (&paramv[n], child);
13777 n++;
13778 }
13779 else
13780 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13781 g_variant_unref (child);
13782 }
13783 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
13784 g_value_init (&return_value, G_TYPE_BOOLEAN);
13785 g_signal_emitv (paramv, signal_id, 0, &return_value);
13786 if (!g_value_get_boolean (&return_value))
13787 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);
13788 g_value_unset (&return_value);
13789 for (n = 0; n < num_params + num_extra; n++)
13790 g_value_unset (&paramv[n]);
13791 g_free (paramv);
13792}
13793
13794static GVariant *
13795_control_bmc_skeleton_handle_get_property (
13796 GDBusConnection *connection G_GNUC_UNUSED,
13797 const gchar *sender G_GNUC_UNUSED,
13798 const gchar *object_path G_GNUC_UNUSED,
13799 const gchar *interface_name G_GNUC_UNUSED,
13800 const gchar *property_name,
13801 GError **error,
13802 gpointer user_data)
13803{
13804 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
13805 GValue value = G_VALUE_INIT;
13806 GParamSpec *pspec;
13807 _ExtendedGDBusPropertyInfo *info;
13808 GVariant *ret;
13809 ret = NULL;
13810 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
13811 g_assert (info != NULL);
13812 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13813 if (pspec == NULL)
13814 {
13815 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13816 }
13817 else
13818 {
13819 g_value_init (&value, pspec->value_type);
13820 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13821 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13822 g_value_unset (&value);
13823 }
13824 return ret;
13825}
13826
13827static gboolean
13828_control_bmc_skeleton_handle_set_property (
13829 GDBusConnection *connection G_GNUC_UNUSED,
13830 const gchar *sender G_GNUC_UNUSED,
13831 const gchar *object_path G_GNUC_UNUSED,
13832 const gchar *interface_name G_GNUC_UNUSED,
13833 const gchar *property_name,
13834 GVariant *variant,
13835 GError **error,
13836 gpointer user_data)
13837{
13838 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
13839 GValue value = G_VALUE_INIT;
13840 GParamSpec *pspec;
13841 _ExtendedGDBusPropertyInfo *info;
13842 gboolean ret;
13843 ret = FALSE;
13844 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
13845 g_assert (info != NULL);
13846 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13847 if (pspec == NULL)
13848 {
13849 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13850 }
13851 else
13852 {
13853 if (info->use_gvariant)
13854 g_value_set_variant (&value, variant);
13855 else
13856 g_dbus_gvariant_to_gvalue (variant, &value);
13857 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13858 g_value_unset (&value);
13859 ret = TRUE;
13860 }
13861 return ret;
13862}
13863
13864static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
13865{
13866 _control_bmc_skeleton_handle_method_call,
13867 _control_bmc_skeleton_handle_get_property,
13868 _control_bmc_skeleton_handle_set_property,
13869 {NULL}
13870};
13871
13872static GDBusInterfaceInfo *
13873control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13874{
13875 return control_bmc_interface_info ();
13876}
13877
13878static GDBusInterfaceVTable *
13879control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13880{
13881 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
13882}
13883
13884static GVariant *
13885control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
13886{
13887 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
13888
13889 GVariantBuilder builder;
13890 guint n;
13891 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13892 if (_control_bmc_interface_info.parent_struct.properties == NULL)
13893 goto out;
13894 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
13895 {
13896 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
13897 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
13898 {
13899 GVariant *value;
13900 value = _control_bmc_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.control.Bmc", info->name, NULL, skeleton);
13901 if (value != NULL)
13902 {
13903 g_variant_take_ref (value);
13904 g_variant_builder_add (&builder, "{sv}", info->name, value);
13905 g_variant_unref (value);
13906 }
13907 }
13908 }
13909out:
13910 return g_variant_builder_end (&builder);
13911}
13912
13913static void
13914control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
13915{
13916}
13917
13918static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
13919#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13920G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13921 G_ADD_PRIVATE (ControlBmcSkeleton)
13922 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
13923
13924#else
13925G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13926 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
13927
13928#endif
13929static void
13930control_bmc_skeleton_finalize (GObject *object)
13931{
13932 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
13933 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13934 if (skeleton->priv->changed_properties_idle_source != NULL)
13935 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13936 g_main_context_unref (skeleton->priv->context);
13937 g_mutex_clear (&skeleton->priv->lock);
13938 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
13939}
13940
13941static void
13942control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
13943{
13944#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13945 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
13946#else
13947 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
13948#endif
13949
13950 g_mutex_init (&skeleton->priv->lock);
13951 skeleton->priv->context = g_main_context_ref_thread_default ();
13952}
13953
13954static void
13955control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
13956{
13957 GObjectClass *gobject_class;
13958 GDBusInterfaceSkeletonClass *skeleton_class;
13959
13960 gobject_class = G_OBJECT_CLASS (klass);
13961 gobject_class->finalize = control_bmc_skeleton_finalize;
13962
13963 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13964 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
13965 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
13966 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
13967 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
13968
13969#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13970 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
13971#endif
13972}
13973
13974static void
13975control_bmc_skeleton_iface_init (ControlBmcIface *iface)
13976{
13977}
13978
13979/**
13980 * control_bmc_skeleton_new:
13981 *
13982 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13983 *
13984 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
13985 */
13986ControlBmc *
13987control_bmc_skeleton_new (void)
13988{
13989 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
13990}
13991
13992/* ------------------------------------------------------------------------
13993 * Code for interface org.openbmc.control.Host
13994 * ------------------------------------------------------------------------
13995 */
13996
13997/**
13998 * SECTION:ControlHost
13999 * @title: ControlHost
14000 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
14001 *
14002 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface in C.
14003 */
14004
14005/* ---- Introspection data for org.openbmc.control.Host ---- */
14006
14007static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
14008{
14009 {
14010 -1,
14011 (gchar *) "boot",
14012 NULL,
14013 NULL,
14014 NULL
14015 },
14016 "handle-boot",
14017 FALSE
14018};
14019
14020static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
14021{
14022 {
14023 -1,
14024 (gchar *) "shutdown",
14025 NULL,
14026 NULL,
14027 NULL
14028 },
14029 "handle-shutdown",
14030 FALSE
14031};
14032
14033static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
14034{
14035 {
14036 -1,
14037 (gchar *) "reboot",
14038 NULL,
14039 NULL,
14040 NULL
14041 },
14042 "handle-reboot",
14043 FALSE
14044};
14045
14046static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
14047{
14048 &_control_host_method_info_boot,
14049 &_control_host_method_info_shutdown,
14050 &_control_host_method_info_reboot,
14051 NULL
14052};
14053
14054static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
14055{
14056 {
14057 -1,
14058 (gchar *) "Booted",
14059 NULL,
14060 NULL
14061 },
14062 "booted"
14063};
14064
14065static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
14066{
14067 &_control_host_signal_info_booted,
14068 NULL
14069};
14070
14071static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
14072{
14073 {
14074 -1,
14075 (gchar *) "org.openbmc.control.Host",
14076 (GDBusMethodInfo **) &_control_host_method_info_pointers,
14077 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
14078 NULL,
14079 NULL
14080 },
14081 "control-host",
14082};
14083
14084
14085/**
14086 * control_host_interface_info:
14087 *
14088 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface.
14089 *
14090 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14091 */
14092GDBusInterfaceInfo *
14093control_host_interface_info (void)
14094{
14095 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
14096}
14097
14098/**
14099 * control_host_override_properties:
14100 * @klass: The class structure for a #GObject<!-- -->-derived class.
14101 * @property_id_begin: The property id to assign to the first overridden property.
14102 *
14103 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
14104 * The properties are overridden in the order they are defined.
14105 *
14106 * Returns: The last property id.
14107 */
14108guint
14109control_host_override_properties (GObjectClass *klass, guint property_id_begin)
14110{
14111 return property_id_begin - 1;
14112}
14113
14114
14115
14116/**
14117 * ControlHost:
14118 *
14119 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14120 */
14121
14122/**
14123 * ControlHostIface:
14124 * @parent_iface: The parent interface.
14125 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
14126 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
14127 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
14128 * @booted: Handler for the #ControlHost::booted signal.
14129 *
14130 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14131 */
14132
14133typedef ControlHostIface ControlHostInterface;
14134G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
14135
14136static void
14137control_host_default_init (ControlHostIface *iface)
14138{
14139 /* GObject signals for incoming D-Bus method calls: */
14140 /**
14141 * ControlHost::handle-boot:
14142 * @object: A #ControlHost.
14143 * @invocation: A #GDBusMethodInvocation.
14144 *
14145 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
14146 *
14147 * 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 control_host_complete_boot() 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.
14148 *
14149 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14150 */
14151 g_signal_new ("handle-boot",
14152 G_TYPE_FROM_INTERFACE (iface),
14153 G_SIGNAL_RUN_LAST,
14154 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
14155 g_signal_accumulator_true_handled,
14156 NULL,
14157 g_cclosure_marshal_generic,
14158 G_TYPE_BOOLEAN,
14159 1,
14160 G_TYPE_DBUS_METHOD_INVOCATION);
14161
14162 /**
14163 * ControlHost::handle-shutdown:
14164 * @object: A #ControlHost.
14165 * @invocation: A #GDBusMethodInvocation.
14166 *
14167 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
14168 *
14169 * 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 control_host_complete_shutdown() 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.
14170 *
14171 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14172 */
14173 g_signal_new ("handle-shutdown",
14174 G_TYPE_FROM_INTERFACE (iface),
14175 G_SIGNAL_RUN_LAST,
14176 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
14177 g_signal_accumulator_true_handled,
14178 NULL,
14179 g_cclosure_marshal_generic,
14180 G_TYPE_BOOLEAN,
14181 1,
14182 G_TYPE_DBUS_METHOD_INVOCATION);
14183
14184 /**
14185 * ControlHost::handle-reboot:
14186 * @object: A #ControlHost.
14187 * @invocation: A #GDBusMethodInvocation.
14188 *
14189 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
14190 *
14191 * 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 control_host_complete_reboot() 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.
14192 *
14193 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14194 */
14195 g_signal_new ("handle-reboot",
14196 G_TYPE_FROM_INTERFACE (iface),
14197 G_SIGNAL_RUN_LAST,
14198 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
14199 g_signal_accumulator_true_handled,
14200 NULL,
14201 g_cclosure_marshal_generic,
14202 G_TYPE_BOOLEAN,
14203 1,
14204 G_TYPE_DBUS_METHOD_INVOCATION);
14205
14206 /* GObject signals for received D-Bus signals: */
14207 /**
14208 * ControlHost::booted:
14209 * @object: A #ControlHost.
14210 *
14211 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> is received.
14212 *
14213 * 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.
14214 */
14215 g_signal_new ("booted",
14216 G_TYPE_FROM_INTERFACE (iface),
14217 G_SIGNAL_RUN_LAST,
14218 G_STRUCT_OFFSET (ControlHostIface, booted),
14219 NULL,
14220 NULL,
14221 g_cclosure_marshal_generic,
14222 G_TYPE_NONE,
14223 0);
14224
14225}
14226
14227/**
14228 * control_host_emit_booted:
14229 * @object: A #ControlHost.
14230 *
14231 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
14232 */
14233void
14234control_host_emit_booted (
14235 ControlHost *object)
14236{
14237 g_signal_emit_by_name (object, "booted");
14238}
14239
14240/**
14241 * control_host_call_boot:
14242 * @proxy: A #ControlHostProxy.
14243 * @cancellable: (allow-none): A #GCancellable or %NULL.
14244 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14245 * @user_data: User data to pass to @callback.
14246 *
14247 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
14248 * 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.
14249 * You can then call control_host_call_boot_finish() to get the result of the operation.
14250 *
14251 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
14252 */
14253void
14254control_host_call_boot (
14255 ControlHost *proxy,
14256 GCancellable *cancellable,
14257 GAsyncReadyCallback callback,
14258 gpointer user_data)
14259{
14260 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14261 "boot",
14262 g_variant_new ("()"),
14263 G_DBUS_CALL_FLAGS_NONE,
14264 -1,
14265 cancellable,
14266 callback,
14267 user_data);
14268}
14269
14270/**
14271 * control_host_call_boot_finish:
14272 * @proxy: A #ControlHostProxy.
14273 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
14274 * @error: Return location for error or %NULL.
14275 *
14276 * Finishes an operation started with control_host_call_boot().
14277 *
14278 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14279 */
14280gboolean
14281control_host_call_boot_finish (
14282 ControlHost *proxy,
14283 GAsyncResult *res,
14284 GError **error)
14285{
14286 GVariant *_ret;
14287 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14288 if (_ret == NULL)
14289 goto _out;
14290 g_variant_get (_ret,
14291 "()");
14292 g_variant_unref (_ret);
14293_out:
14294 return _ret != NULL;
14295}
14296
14297/**
14298 * control_host_call_boot_sync:
14299 * @proxy: A #ControlHostProxy.
14300 * @cancellable: (allow-none): A #GCancellable or %NULL.
14301 * @error: Return location for error or %NULL.
14302 *
14303 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14304 *
14305 * See control_host_call_boot() for the asynchronous version of this method.
14306 *
14307 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14308 */
14309gboolean
14310control_host_call_boot_sync (
14311 ControlHost *proxy,
14312 GCancellable *cancellable,
14313 GError **error)
14314{
14315 GVariant *_ret;
14316 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14317 "boot",
14318 g_variant_new ("()"),
14319 G_DBUS_CALL_FLAGS_NONE,
14320 -1,
14321 cancellable,
14322 error);
14323 if (_ret == NULL)
14324 goto _out;
14325 g_variant_get (_ret,
14326 "()");
14327 g_variant_unref (_ret);
14328_out:
14329 return _ret != NULL;
14330}
14331
14332/**
14333 * control_host_call_shutdown:
14334 * @proxy: A #ControlHostProxy.
14335 * @cancellable: (allow-none): A #GCancellable or %NULL.
14336 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14337 * @user_data: User data to pass to @callback.
14338 *
14339 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
14340 * 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.
14341 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
14342 *
14343 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
14344 */
14345void
14346control_host_call_shutdown (
14347 ControlHost *proxy,
14348 GCancellable *cancellable,
14349 GAsyncReadyCallback callback,
14350 gpointer user_data)
14351{
14352 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14353 "shutdown",
14354 g_variant_new ("()"),
14355 G_DBUS_CALL_FLAGS_NONE,
14356 -1,
14357 cancellable,
14358 callback,
14359 user_data);
14360}
14361
14362/**
14363 * control_host_call_shutdown_finish:
14364 * @proxy: A #ControlHostProxy.
14365 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
14366 * @error: Return location for error or %NULL.
14367 *
14368 * Finishes an operation started with control_host_call_shutdown().
14369 *
14370 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14371 */
14372gboolean
14373control_host_call_shutdown_finish (
14374 ControlHost *proxy,
14375 GAsyncResult *res,
14376 GError **error)
14377{
14378 GVariant *_ret;
14379 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14380 if (_ret == NULL)
14381 goto _out;
14382 g_variant_get (_ret,
14383 "()");
14384 g_variant_unref (_ret);
14385_out:
14386 return _ret != NULL;
14387}
14388
14389/**
14390 * control_host_call_shutdown_sync:
14391 * @proxy: A #ControlHostProxy.
14392 * @cancellable: (allow-none): A #GCancellable or %NULL.
14393 * @error: Return location for error or %NULL.
14394 *
14395 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14396 *
14397 * See control_host_call_shutdown() for the asynchronous version of this method.
14398 *
14399 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14400 */
14401gboolean
14402control_host_call_shutdown_sync (
14403 ControlHost *proxy,
14404 GCancellable *cancellable,
14405 GError **error)
14406{
14407 GVariant *_ret;
14408 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14409 "shutdown",
14410 g_variant_new ("()"),
14411 G_DBUS_CALL_FLAGS_NONE,
14412 -1,
14413 cancellable,
14414 error);
14415 if (_ret == NULL)
14416 goto _out;
14417 g_variant_get (_ret,
14418 "()");
14419 g_variant_unref (_ret);
14420_out:
14421 return _ret != NULL;
14422}
14423
14424/**
14425 * control_host_call_reboot:
14426 * @proxy: A #ControlHostProxy.
14427 * @cancellable: (allow-none): A #GCancellable or %NULL.
14428 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14429 * @user_data: User data to pass to @callback.
14430 *
14431 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
14432 * 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.
14433 * You can then call control_host_call_reboot_finish() to get the result of the operation.
14434 *
14435 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
14436 */
14437void
14438control_host_call_reboot (
14439 ControlHost *proxy,
14440 GCancellable *cancellable,
14441 GAsyncReadyCallback callback,
14442 gpointer user_data)
14443{
14444 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14445 "reboot",
14446 g_variant_new ("()"),
14447 G_DBUS_CALL_FLAGS_NONE,
14448 -1,
14449 cancellable,
14450 callback,
14451 user_data);
14452}
14453
14454/**
14455 * control_host_call_reboot_finish:
14456 * @proxy: A #ControlHostProxy.
14457 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
14458 * @error: Return location for error or %NULL.
14459 *
14460 * Finishes an operation started with control_host_call_reboot().
14461 *
14462 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14463 */
14464gboolean
14465control_host_call_reboot_finish (
14466 ControlHost *proxy,
14467 GAsyncResult *res,
14468 GError **error)
14469{
14470 GVariant *_ret;
14471 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14472 if (_ret == NULL)
14473 goto _out;
14474 g_variant_get (_ret,
14475 "()");
14476 g_variant_unref (_ret);
14477_out:
14478 return _ret != NULL;
14479}
14480
14481/**
14482 * control_host_call_reboot_sync:
14483 * @proxy: A #ControlHostProxy.
14484 * @cancellable: (allow-none): A #GCancellable or %NULL.
14485 * @error: Return location for error or %NULL.
14486 *
14487 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14488 *
14489 * See control_host_call_reboot() for the asynchronous version of this method.
14490 *
14491 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14492 */
14493gboolean
14494control_host_call_reboot_sync (
14495 ControlHost *proxy,
14496 GCancellable *cancellable,
14497 GError **error)
14498{
14499 GVariant *_ret;
14500 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14501 "reboot",
14502 g_variant_new ("()"),
14503 G_DBUS_CALL_FLAGS_NONE,
14504 -1,
14505 cancellable,
14506 error);
14507 if (_ret == NULL)
14508 goto _out;
14509 g_variant_get (_ret,
14510 "()");
14511 g_variant_unref (_ret);
14512_out:
14513 return _ret != NULL;
14514}
14515
14516/**
14517 * control_host_complete_boot:
14518 * @object: A #ControlHost.
14519 * @invocation: (transfer full): A #GDBusMethodInvocation.
14520 *
14521 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</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.
14522 *
14523 * This method will free @invocation, you cannot use it afterwards.
14524 */
14525void
14526control_host_complete_boot (
14527 ControlHost *object,
14528 GDBusMethodInvocation *invocation)
14529{
14530 g_dbus_method_invocation_return_value (invocation,
14531 g_variant_new ("()"));
14532}
14533
14534/**
14535 * control_host_complete_shutdown:
14536 * @object: A #ControlHost.
14537 * @invocation: (transfer full): A #GDBusMethodInvocation.
14538 *
14539 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</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.
14540 *
14541 * This method will free @invocation, you cannot use it afterwards.
14542 */
14543void
14544control_host_complete_shutdown (
14545 ControlHost *object,
14546 GDBusMethodInvocation *invocation)
14547{
14548 g_dbus_method_invocation_return_value (invocation,
14549 g_variant_new ("()"));
14550}
14551
14552/**
14553 * control_host_complete_reboot:
14554 * @object: A #ControlHost.
14555 * @invocation: (transfer full): A #GDBusMethodInvocation.
14556 *
14557 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</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.
14558 *
14559 * This method will free @invocation, you cannot use it afterwards.
14560 */
14561void
14562control_host_complete_reboot (
14563 ControlHost *object,
14564 GDBusMethodInvocation *invocation)
14565{
14566 g_dbus_method_invocation_return_value (invocation,
14567 g_variant_new ("()"));
14568}
14569
14570/* ------------------------------------------------------------------------ */
14571
14572/**
14573 * ControlHostProxy:
14574 *
14575 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
14576 */
14577
14578/**
14579 * ControlHostProxyClass:
14580 * @parent_class: The parent class.
14581 *
14582 * Class structure for #ControlHostProxy.
14583 */
14584
14585struct _ControlHostProxyPrivate
14586{
14587 GData *qdata;
14588};
14589
14590static void control_host_proxy_iface_init (ControlHostIface *iface);
14591
14592#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14593G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
14594 G_ADD_PRIVATE (ControlHostProxy)
14595 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
14596
14597#else
14598G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
14599 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
14600
14601#endif
14602static void
14603control_host_proxy_finalize (GObject *object)
14604{
14605 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
14606 g_datalist_clear (&proxy->priv->qdata);
14607 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
14608}
14609
14610static void
14611control_host_proxy_get_property (GObject *object,
14612 guint prop_id,
14613 GValue *value,
14614 GParamSpec *pspec G_GNUC_UNUSED)
14615{
14616}
14617
14618static void
14619control_host_proxy_set_property (GObject *object,
14620 guint prop_id,
14621 const GValue *value,
14622 GParamSpec *pspec G_GNUC_UNUSED)
14623{
14624}
14625
14626static void
14627control_host_proxy_g_signal (GDBusProxy *proxy,
14628 const gchar *sender_name G_GNUC_UNUSED,
14629 const gchar *signal_name,
14630 GVariant *parameters)
14631{
14632 _ExtendedGDBusSignalInfo *info;
14633 GVariantIter iter;
14634 GVariant *child;
14635 GValue *paramv;
14636 guint num_params;
14637 guint n;
14638 guint signal_id;
14639 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
14640 if (info == NULL)
14641 return;
14642 num_params = g_variant_n_children (parameters);
14643 paramv = g_new0 (GValue, num_params + 1);
14644 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
14645 g_value_set_object (&paramv[0], proxy);
14646 g_variant_iter_init (&iter, parameters);
14647 n = 1;
14648 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14649 {
14650 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14651 if (arg_info->use_gvariant)
14652 {
14653 g_value_init (&paramv[n], G_TYPE_VARIANT);
14654 g_value_set_variant (&paramv[n], child);
14655 n++;
14656 }
14657 else
14658 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14659 g_variant_unref (child);
14660 }
14661 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
14662 g_signal_emitv (paramv, signal_id, 0, NULL);
14663 for (n = 0; n < num_params + 1; n++)
14664 g_value_unset (&paramv[n]);
14665 g_free (paramv);
14666}
14667
14668static void
14669control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
14670 GVariant *changed_properties,
14671 const gchar *const *invalidated_properties)
14672{
14673 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
14674 guint n;
14675 const gchar *key;
14676 GVariantIter *iter;
14677 _ExtendedGDBusPropertyInfo *info;
14678 g_variant_get (changed_properties, "a{sv}", &iter);
14679 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14680 {
14681 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
14682 g_datalist_remove_data (&proxy->priv->qdata, key);
14683 if (info != NULL)
14684 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14685 }
14686 g_variant_iter_free (iter);
14687 for (n = 0; invalidated_properties[n] != NULL; n++)
14688 {
14689 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
14690 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
14691 if (info != NULL)
14692 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14693 }
14694}
14695
14696static void
14697control_host_proxy_init (ControlHostProxy *proxy)
14698{
14699#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14700 proxy->priv = control_host_proxy_get_instance_private (proxy);
14701#else
14702 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
14703#endif
14704
14705 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
14706}
14707
14708static void
14709control_host_proxy_class_init (ControlHostProxyClass *klass)
14710{
14711 GObjectClass *gobject_class;
14712 GDBusProxyClass *proxy_class;
14713
14714 gobject_class = G_OBJECT_CLASS (klass);
14715 gobject_class->finalize = control_host_proxy_finalize;
14716 gobject_class->get_property = control_host_proxy_get_property;
14717 gobject_class->set_property = control_host_proxy_set_property;
14718
14719 proxy_class = G_DBUS_PROXY_CLASS (klass);
14720 proxy_class->g_signal = control_host_proxy_g_signal;
14721 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
14722
14723#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14724 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
14725#endif
14726}
14727
14728static void
14729control_host_proxy_iface_init (ControlHostIface *iface)
14730{
14731}
14732
14733/**
14734 * control_host_proxy_new:
14735 * @connection: A #GDBusConnection.
14736 * @flags: Flags from the #GDBusProxyFlags enumeration.
14737 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14738 * @object_path: An object path.
14739 * @cancellable: (allow-none): A #GCancellable or %NULL.
14740 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14741 * @user_data: User data to pass to @callback.
14742 *
14743 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new() for more details.
14744 *
14745 * 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.
14746 * You can then call control_host_proxy_new_finish() to get the result of the operation.
14747 *
14748 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
14749 */
14750void
14751control_host_proxy_new (
14752 GDBusConnection *connection,
14753 GDBusProxyFlags flags,
14754 const gchar *name,
14755 const gchar *object_path,
14756 GCancellable *cancellable,
14757 GAsyncReadyCallback callback,
14758 gpointer user_data)
14759{
14760 g_async_initable_new_async (TYPE_CONTROL_HOST_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.control.Host", NULL);
14761}
14762
14763/**
14764 * control_host_proxy_new_finish:
14765 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
14766 * @error: Return location for error or %NULL
14767 *
14768 * Finishes an operation started with control_host_proxy_new().
14769 *
14770 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14771 */
14772ControlHost *
14773control_host_proxy_new_finish (
14774 GAsyncResult *res,
14775 GError **error)
14776{
14777 GObject *ret;
14778 GObject *source_object;
14779 source_object = g_async_result_get_source_object (res);
14780 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14781 g_object_unref (source_object);
14782 if (ret != NULL)
14783 return CONTROL_HOST (ret);
14784 else
14785 return NULL;
14786}
14787
14788/**
14789 * control_host_proxy_new_sync:
14790 * @connection: A #GDBusConnection.
14791 * @flags: Flags from the #GDBusProxyFlags enumeration.
14792 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14793 * @object_path: An object path.
14794 * @cancellable: (allow-none): A #GCancellable or %NULL.
14795 * @error: Return location for error or %NULL
14796 *
14797 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new_sync() for more details.
14798 *
14799 * The calling thread is blocked until a reply is received.
14800 *
14801 * See control_host_proxy_new() for the asynchronous version of this constructor.
14802 *
14803 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14804 */
14805ControlHost *
14806control_host_proxy_new_sync (
14807 GDBusConnection *connection,
14808 GDBusProxyFlags flags,
14809 const gchar *name,
14810 const gchar *object_path,
14811 GCancellable *cancellable,
14812 GError **error)
14813{
14814 GInitable *ret;
14815 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
14816 if (ret != NULL)
14817 return CONTROL_HOST (ret);
14818 else
14819 return NULL;
14820}
14821
14822
14823/**
14824 * control_host_proxy_new_for_bus:
14825 * @bus_type: A #GBusType.
14826 * @flags: Flags from the #GDBusProxyFlags enumeration.
14827 * @name: A bus name (well-known or unique).
14828 * @object_path: An object path.
14829 * @cancellable: (allow-none): A #GCancellable or %NULL.
14830 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14831 * @user_data: User data to pass to @callback.
14832 *
14833 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14834 *
14835 * 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.
14836 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
14837 *
14838 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14839 */
14840void
14841control_host_proxy_new_for_bus (
14842 GBusType bus_type,
14843 GDBusProxyFlags flags,
14844 const gchar *name,
14845 const gchar *object_path,
14846 GCancellable *cancellable,
14847 GAsyncReadyCallback callback,
14848 gpointer user_data)
14849{
14850 g_async_initable_new_async (TYPE_CONTROL_HOST_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.control.Host", NULL);
14851}
14852
14853/**
14854 * control_host_proxy_new_for_bus_finish:
14855 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
14856 * @error: Return location for error or %NULL
14857 *
14858 * Finishes an operation started with control_host_proxy_new_for_bus().
14859 *
14860 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14861 */
14862ControlHost *
14863control_host_proxy_new_for_bus_finish (
14864 GAsyncResult *res,
14865 GError **error)
14866{
14867 GObject *ret;
14868 GObject *source_object;
14869 source_object = g_async_result_get_source_object (res);
14870 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14871 g_object_unref (source_object);
14872 if (ret != NULL)
14873 return CONTROL_HOST (ret);
14874 else
14875 return NULL;
14876}
14877
14878/**
14879 * control_host_proxy_new_for_bus_sync:
14880 * @bus_type: A #GBusType.
14881 * @flags: Flags from the #GDBusProxyFlags enumeration.
14882 * @name: A bus name (well-known or unique).
14883 * @object_path: An object path.
14884 * @cancellable: (allow-none): A #GCancellable or %NULL.
14885 * @error: Return location for error or %NULL
14886 *
14887 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14888 *
14889 * The calling thread is blocked until a reply is received.
14890 *
14891 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
14892 *
14893 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
14894 */
14895ControlHost *
14896control_host_proxy_new_for_bus_sync (
14897 GBusType bus_type,
14898 GDBusProxyFlags flags,
14899 const gchar *name,
14900 const gchar *object_path,
14901 GCancellable *cancellable,
14902 GError **error)
14903{
14904 GInitable *ret;
14905 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
14906 if (ret != NULL)
14907 return CONTROL_HOST (ret);
14908 else
14909 return NULL;
14910}
14911
14912
14913/* ------------------------------------------------------------------------ */
14914
14915/**
14916 * ControlHostSkeleton:
14917 *
14918 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
14919 */
14920
14921/**
14922 * ControlHostSkeletonClass:
14923 * @parent_class: The parent class.
14924 *
14925 * Class structure for #ControlHostSkeleton.
14926 */
14927
14928struct _ControlHostSkeletonPrivate
14929{
14930 GValue *properties;
14931 GList *changed_properties;
14932 GSource *changed_properties_idle_source;
14933 GMainContext *context;
14934 GMutex lock;
14935};
14936
14937static void
14938_control_host_skeleton_handle_method_call (
14939 GDBusConnection *connection G_GNUC_UNUSED,
14940 const gchar *sender G_GNUC_UNUSED,
14941 const gchar *object_path G_GNUC_UNUSED,
14942 const gchar *interface_name,
14943 const gchar *method_name,
14944 GVariant *parameters,
14945 GDBusMethodInvocation *invocation,
14946 gpointer user_data)
14947{
14948 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
14949 _ExtendedGDBusMethodInfo *info;
14950 GVariantIter iter;
14951 GVariant *child;
14952 GValue *paramv;
14953 guint num_params;
14954 guint num_extra;
14955 guint n;
14956 guint signal_id;
14957 GValue return_value = G_VALUE_INIT;
14958 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14959 g_assert (info != NULL);
14960 num_params = g_variant_n_children (parameters);
14961 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14962 n = 0;
14963 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
14964 g_value_set_object (&paramv[n++], skeleton);
14965 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14966 g_value_set_object (&paramv[n++], invocation);
14967 if (info->pass_fdlist)
14968 {
14969#ifdef G_OS_UNIX
14970 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14971 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14972#else
14973 g_assert_not_reached ();
14974#endif
14975 }
14976 g_variant_iter_init (&iter, parameters);
14977 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14978 {
14979 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14980 if (arg_info->use_gvariant)
14981 {
14982 g_value_init (&paramv[n], G_TYPE_VARIANT);
14983 g_value_set_variant (&paramv[n], child);
14984 n++;
14985 }
14986 else
14987 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14988 g_variant_unref (child);
14989 }
14990 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
14991 g_value_init (&return_value, G_TYPE_BOOLEAN);
14992 g_signal_emitv (paramv, signal_id, 0, &return_value);
14993 if (!g_value_get_boolean (&return_value))
14994 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);
14995 g_value_unset (&return_value);
14996 for (n = 0; n < num_params + num_extra; n++)
14997 g_value_unset (&paramv[n]);
14998 g_free (paramv);
14999}
15000
15001static GVariant *
15002_control_host_skeleton_handle_get_property (
15003 GDBusConnection *connection G_GNUC_UNUSED,
15004 const gchar *sender G_GNUC_UNUSED,
15005 const gchar *object_path G_GNUC_UNUSED,
15006 const gchar *interface_name G_GNUC_UNUSED,
15007 const gchar *property_name,
15008 GError **error,
15009 gpointer user_data)
15010{
15011 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15012 GValue value = G_VALUE_INIT;
15013 GParamSpec *pspec;
15014 _ExtendedGDBusPropertyInfo *info;
15015 GVariant *ret;
15016 ret = NULL;
15017 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15018 g_assert (info != NULL);
15019 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15020 if (pspec == NULL)
15021 {
15022 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15023 }
15024 else
15025 {
15026 g_value_init (&value, pspec->value_type);
15027 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15028 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15029 g_value_unset (&value);
15030 }
15031 return ret;
15032}
15033
15034static gboolean
15035_control_host_skeleton_handle_set_property (
15036 GDBusConnection *connection G_GNUC_UNUSED,
15037 const gchar *sender G_GNUC_UNUSED,
15038 const gchar *object_path G_GNUC_UNUSED,
15039 const gchar *interface_name G_GNUC_UNUSED,
15040 const gchar *property_name,
15041 GVariant *variant,
15042 GError **error,
15043 gpointer user_data)
15044{
15045 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15046 GValue value = G_VALUE_INIT;
15047 GParamSpec *pspec;
15048 _ExtendedGDBusPropertyInfo *info;
15049 gboolean ret;
15050 ret = FALSE;
15051 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15052 g_assert (info != NULL);
15053 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15054 if (pspec == NULL)
15055 {
15056 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15057 }
15058 else
15059 {
15060 if (info->use_gvariant)
15061 g_value_set_variant (&value, variant);
15062 else
15063 g_dbus_gvariant_to_gvalue (variant, &value);
15064 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15065 g_value_unset (&value);
15066 ret = TRUE;
15067 }
15068 return ret;
15069}
15070
15071static const GDBusInterfaceVTable _control_host_skeleton_vtable =
15072{
15073 _control_host_skeleton_handle_method_call,
15074 _control_host_skeleton_handle_get_property,
15075 _control_host_skeleton_handle_set_property,
15076 {NULL}
15077};
15078
15079static GDBusInterfaceInfo *
15080control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15081{
15082 return control_host_interface_info ();
15083}
15084
15085static GDBusInterfaceVTable *
15086control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15087{
15088 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
15089}
15090
15091static GVariant *
15092control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15093{
15094 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
15095
15096 GVariantBuilder builder;
15097 guint n;
15098 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15099 if (_control_host_interface_info.parent_struct.properties == NULL)
15100 goto out;
15101 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
15102 {
15103 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
15104 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15105 {
15106 GVariant *value;
15107 value = _control_host_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.control.Host", info->name, NULL, skeleton);
15108 if (value != NULL)
15109 {
15110 g_variant_take_ref (value);
15111 g_variant_builder_add (&builder, "{sv}", info->name, value);
15112 g_variant_unref (value);
15113 }
15114 }
15115 }
15116out:
15117 return g_variant_builder_end (&builder);
15118}
15119
15120static void
15121control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15122{
15123}
15124
15125static void
15126_control_host_on_signal_booted (
15127 ControlHost *object)
15128{
15129 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15130
15131 GList *connections, *l;
15132 GVariant *signal_variant;
15133 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15134
15135 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15136 for (l = connections; l != NULL; l = l->next)
15137 {
15138 GDBusConnection *connection = l->data;
15139 g_dbus_connection_emit_signal (connection,
15140 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
15141 signal_variant, NULL);
15142 }
15143 g_variant_unref (signal_variant);
15144 g_list_free_full (connections, g_object_unref);
15145}
15146
15147static void control_host_skeleton_iface_init (ControlHostIface *iface);
15148#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15149G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15150 G_ADD_PRIVATE (ControlHostSkeleton)
15151 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15152
15153#else
15154G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15155 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15156
15157#endif
15158static void
15159control_host_skeleton_finalize (GObject *object)
15160{
15161 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15162 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15163 if (skeleton->priv->changed_properties_idle_source != NULL)
15164 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15165 g_main_context_unref (skeleton->priv->context);
15166 g_mutex_clear (&skeleton->priv->lock);
15167 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
15168}
15169
15170static void
15171control_host_skeleton_init (ControlHostSkeleton *skeleton)
15172{
15173#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15174 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
15175#else
15176 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
15177#endif
15178
15179 g_mutex_init (&skeleton->priv->lock);
15180 skeleton->priv->context = g_main_context_ref_thread_default ();
15181}
15182
15183static void
15184control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
15185{
15186 GObjectClass *gobject_class;
15187 GDBusInterfaceSkeletonClass *skeleton_class;
15188
15189 gobject_class = G_OBJECT_CLASS (klass);
15190 gobject_class->finalize = control_host_skeleton_finalize;
15191
15192 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15193 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
15194 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
15195 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
15196 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
15197
15198#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15199 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
15200#endif
15201}
15202
15203static void
15204control_host_skeleton_iface_init (ControlHostIface *iface)
15205{
15206 iface->booted = _control_host_on_signal_booted;
15207}
15208
15209/**
15210 * control_host_skeleton_new:
15211 *
15212 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15213 *
15214 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
15215 */
15216ControlHost *
15217control_host_skeleton_new (void)
15218{
15219 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
15220}
15221
15222/* ------------------------------------------------------------------------
15223 * Code for interface org.openbmc.control.Power
15224 * ------------------------------------------------------------------------
15225 */
15226
15227/**
15228 * SECTION:ControlPower
15229 * @title: ControlPower
15230 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
15231 *
15232 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface in C.
15233 */
15234
15235/* ---- Introspection data for org.openbmc.control.Power ---- */
15236
15237static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
15238{
15239 {
15240 -1,
15241 (gchar *) "state",
15242 (gchar *) "i",
15243 NULL
15244 },
15245 FALSE
15246};
15247
15248static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
15249{
15250 &_control_power_method_info_set_power_state_IN_ARG_state,
15251 NULL
15252};
15253
15254static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
15255{
15256 {
15257 -1,
15258 (gchar *) "setPowerState",
15259 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
15260 NULL,
15261 NULL
15262 },
15263 "handle-set-power-state",
15264 FALSE
15265};
15266
15267static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
15268{
15269 {
15270 -1,
15271 (gchar *) "state",
15272 (gchar *) "i",
15273 NULL
15274 },
15275 FALSE
15276};
15277
15278static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
15279{
15280 &_control_power_method_info_get_power_state_OUT_ARG_state,
15281 NULL
15282};
15283
15284static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
15285{
15286 {
15287 -1,
15288 (gchar *) "getPowerState",
15289 NULL,
15290 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
15291 NULL
15292 },
15293 "handle-get-power-state",
15294 FALSE
15295};
15296
15297static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
15298{
15299 &_control_power_method_info_set_power_state,
15300 &_control_power_method_info_get_power_state,
15301 NULL
15302};
15303
15304static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
15305{
15306 {
15307 -1,
15308 (gchar *) "PowerGood",
15309 NULL,
15310 NULL
15311 },
15312 "power-good"
15313};
15314
15315static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
15316{
15317 {
15318 -1,
15319 (gchar *) "PowerLost",
15320 NULL,
15321 NULL
15322 },
15323 "power-lost"
15324};
15325
15326static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
15327{
15328 &_control_power_signal_info_power_good,
15329 &_control_power_signal_info_power_lost,
15330 NULL
15331};
15332
15333static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
15334{
15335 {
15336 -1,
15337 (gchar *) "pgood",
15338 (gchar *) "i",
15339 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
15340 NULL
15341 },
15342 "pgood",
15343 FALSE
15344};
15345
15346static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
15347{
15348 {
15349 -1,
15350 (gchar *) "state",
15351 (gchar *) "i",
15352 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
15353 NULL
15354 },
15355 "state",
15356 FALSE
15357};
15358
Norman James32e74e22015-09-15 21:28:06 -050015359static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
15360{
15361 {
15362 -1,
15363 (gchar *) "pgood_timeout",
15364 (gchar *) "i",
15365 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15366 NULL
15367 },
15368 "pgood-timeout",
15369 FALSE
15370};
15371
Norman James362a80f2015-09-14 14:04:39 -050015372static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
15373{
15374 &_control_power_property_info_pgood,
15375 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050015376 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050015377 NULL
15378};
15379
15380static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
15381{
15382 {
15383 -1,
15384 (gchar *) "org.openbmc.control.Power",
15385 (GDBusMethodInfo **) &_control_power_method_info_pointers,
15386 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
15387 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
15388 NULL
15389 },
15390 "control-power",
15391};
15392
15393
15394/**
15395 * control_power_interface_info:
15396 *
15397 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface.
15398 *
15399 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
15400 */
15401GDBusInterfaceInfo *
15402control_power_interface_info (void)
15403{
15404 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
15405}
15406
15407/**
15408 * control_power_override_properties:
15409 * @klass: The class structure for a #GObject<!-- -->-derived class.
15410 * @property_id_begin: The property id to assign to the first overridden property.
15411 *
15412 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
15413 * The properties are overridden in the order they are defined.
15414 *
15415 * Returns: The last property id.
15416 */
15417guint
15418control_power_override_properties (GObjectClass *klass, guint property_id_begin)
15419{
15420 g_object_class_override_property (klass, property_id_begin++, "pgood");
15421 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050015422 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050015423 return property_id_begin - 1;
15424}
15425
15426
15427
15428/**
15429 * ControlPower:
15430 *
15431 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
15432 */
15433
15434/**
15435 * ControlPowerIface:
15436 * @parent_iface: The parent interface.
15437 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
15438 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
15439 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050015440 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050015441 * @get_state: Getter for the #ControlPower:state property.
15442 * @power_good: Handler for the #ControlPower::power-good signal.
15443 * @power_lost: Handler for the #ControlPower::power-lost signal.
15444 *
15445 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
15446 */
15447
15448typedef ControlPowerIface ControlPowerInterface;
15449G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
15450
15451static void
15452control_power_default_init (ControlPowerIface *iface)
15453{
15454 /* GObject signals for incoming D-Bus method calls: */
15455 /**
15456 * ControlPower::handle-set-power-state:
15457 * @object: A #ControlPower.
15458 * @invocation: A #GDBusMethodInvocation.
15459 * @arg_state: Argument passed by remote caller.
15460 *
15461 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
15462 *
15463 * 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 control_power_complete_set_power_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.
15464 *
15465 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15466 */
15467 g_signal_new ("handle-set-power-state",
15468 G_TYPE_FROM_INTERFACE (iface),
15469 G_SIGNAL_RUN_LAST,
15470 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
15471 g_signal_accumulator_true_handled,
15472 NULL,
15473 g_cclosure_marshal_generic,
15474 G_TYPE_BOOLEAN,
15475 2,
15476 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
15477
15478 /**
15479 * ControlPower::handle-get-power-state:
15480 * @object: A #ControlPower.
15481 * @invocation: A #GDBusMethodInvocation.
15482 *
15483 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
15484 *
15485 * 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 control_power_complete_get_power_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.
15486 *
15487 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15488 */
15489 g_signal_new ("handle-get-power-state",
15490 G_TYPE_FROM_INTERFACE (iface),
15491 G_SIGNAL_RUN_LAST,
15492 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
15493 g_signal_accumulator_true_handled,
15494 NULL,
15495 g_cclosure_marshal_generic,
15496 G_TYPE_BOOLEAN,
15497 1,
15498 G_TYPE_DBUS_METHOD_INVOCATION);
15499
15500 /* GObject signals for received D-Bus signals: */
15501 /**
15502 * ControlPower::power-good:
15503 * @object: A #ControlPower.
15504 *
15505 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> is received.
15506 *
15507 * 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.
15508 */
15509 g_signal_new ("power-good",
15510 G_TYPE_FROM_INTERFACE (iface),
15511 G_SIGNAL_RUN_LAST,
15512 G_STRUCT_OFFSET (ControlPowerIface, power_good),
15513 NULL,
15514 NULL,
15515 g_cclosure_marshal_generic,
15516 G_TYPE_NONE,
15517 0);
15518
15519 /**
15520 * ControlPower::power-lost:
15521 * @object: A #ControlPower.
15522 *
15523 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> is received.
15524 *
15525 * 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.
15526 */
15527 g_signal_new ("power-lost",
15528 G_TYPE_FROM_INTERFACE (iface),
15529 G_SIGNAL_RUN_LAST,
15530 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
15531 NULL,
15532 NULL,
15533 g_cclosure_marshal_generic,
15534 G_TYPE_NONE,
15535 0);
15536
15537 /* GObject properties for D-Bus properties: */
15538 /**
15539 * ControlPower:pgood:
15540 *
15541 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
15542 *
15543 * 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.
15544 */
15545 g_object_interface_install_property (iface,
15546 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15547 /**
15548 * ControlPower:state:
15549 *
15550 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
15551 *
15552 * 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.
15553 */
15554 g_object_interface_install_property (iface,
15555 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James32e74e22015-09-15 21:28:06 -050015556 /**
15557 * ControlPower:pgood-timeout:
15558 *
15559 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
15560 *
15561 * 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.
15562 */
15563 g_object_interface_install_property (iface,
15564 g_param_spec_int ("pgood-timeout", "pgood_timeout", "pgood_timeout", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050015565}
15566
15567/**
15568 * control_power_get_pgood: (skip)
15569 * @object: A #ControlPower.
15570 *
15571 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
15572 *
15573 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
15574 *
15575 * Returns: The property value.
15576 */
15577gint
15578control_power_get_pgood (ControlPower *object)
15579{
15580 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
15581}
15582
15583/**
15584 * control_power_set_pgood: (skip)
15585 * @object: A #ControlPower.
15586 * @value: The value to set.
15587 *
15588 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
15589 *
15590 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
15591 */
15592void
15593control_power_set_pgood (ControlPower *object, gint value)
15594{
15595 g_object_set (G_OBJECT (object), "pgood", value, NULL);
15596}
15597
15598/**
15599 * control_power_get_state: (skip)
15600 * @object: A #ControlPower.
15601 *
15602 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
15603 *
15604 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
15605 *
15606 * Returns: The property value.
15607 */
15608gint
15609control_power_get_state (ControlPower *object)
15610{
15611 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
15612}
15613
15614/**
15615 * control_power_set_state: (skip)
15616 * @object: A #ControlPower.
15617 * @value: The value to set.
15618 *
15619 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
15620 *
15621 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
15622 */
15623void
15624control_power_set_state (ControlPower *object, gint value)
15625{
15626 g_object_set (G_OBJECT (object), "state", value, NULL);
15627}
15628
15629/**
Norman James32e74e22015-09-15 21:28:06 -050015630 * control_power_get_pgood_timeout: (skip)
15631 * @object: A #ControlPower.
15632 *
15633 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
15634 *
15635 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15636 *
15637 * Returns: The property value.
15638 */
15639gint
15640control_power_get_pgood_timeout (ControlPower *object)
15641{
15642 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
15643}
15644
15645/**
15646 * control_power_set_pgood_timeout: (skip)
15647 * @object: A #ControlPower.
15648 * @value: The value to set.
15649 *
15650 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
15651 *
15652 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15653 */
15654void
15655control_power_set_pgood_timeout (ControlPower *object, gint value)
15656{
15657 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
15658}
15659
15660/**
Norman James362a80f2015-09-14 14:04:39 -050015661 * control_power_emit_power_good:
15662 * @object: A #ControlPower.
15663 *
15664 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
15665 */
15666void
15667control_power_emit_power_good (
15668 ControlPower *object)
15669{
15670 g_signal_emit_by_name (object, "power-good");
15671}
15672
15673/**
15674 * control_power_emit_power_lost:
15675 * @object: A #ControlPower.
15676 *
15677 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
15678 */
15679void
15680control_power_emit_power_lost (
15681 ControlPower *object)
15682{
15683 g_signal_emit_by_name (object, "power-lost");
15684}
15685
15686/**
15687 * control_power_call_set_power_state:
15688 * @proxy: A #ControlPowerProxy.
15689 * @arg_state: Argument to pass with the method invocation.
15690 * @cancellable: (allow-none): A #GCancellable or %NULL.
15691 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15692 * @user_data: User data to pass to @callback.
15693 *
15694 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
15695 * 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.
15696 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
15697 *
15698 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
15699 */
15700void
15701control_power_call_set_power_state (
15702 ControlPower *proxy,
15703 gint arg_state,
15704 GCancellable *cancellable,
15705 GAsyncReadyCallback callback,
15706 gpointer user_data)
15707{
15708 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15709 "setPowerState",
15710 g_variant_new ("(i)",
15711 arg_state),
15712 G_DBUS_CALL_FLAGS_NONE,
15713 -1,
15714 cancellable,
15715 callback,
15716 user_data);
15717}
15718
15719/**
15720 * control_power_call_set_power_state_finish:
15721 * @proxy: A #ControlPowerProxy.
15722 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
15723 * @error: Return location for error or %NULL.
15724 *
15725 * Finishes an operation started with control_power_call_set_power_state().
15726 *
15727 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15728 */
15729gboolean
15730control_power_call_set_power_state_finish (
15731 ControlPower *proxy,
15732 GAsyncResult *res,
15733 GError **error)
15734{
15735 GVariant *_ret;
15736 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15737 if (_ret == NULL)
15738 goto _out;
15739 g_variant_get (_ret,
15740 "()");
15741 g_variant_unref (_ret);
15742_out:
15743 return _ret != NULL;
15744}
15745
15746/**
15747 * control_power_call_set_power_state_sync:
15748 * @proxy: A #ControlPowerProxy.
15749 * @arg_state: Argument to pass with the method invocation.
15750 * @cancellable: (allow-none): A #GCancellable or %NULL.
15751 * @error: Return location for error or %NULL.
15752 *
15753 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
15754 *
15755 * See control_power_call_set_power_state() for the asynchronous version of this method.
15756 *
15757 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15758 */
15759gboolean
15760control_power_call_set_power_state_sync (
15761 ControlPower *proxy,
15762 gint arg_state,
15763 GCancellable *cancellable,
15764 GError **error)
15765{
15766 GVariant *_ret;
15767 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15768 "setPowerState",
15769 g_variant_new ("(i)",
15770 arg_state),
15771 G_DBUS_CALL_FLAGS_NONE,
15772 -1,
15773 cancellable,
15774 error);
15775 if (_ret == NULL)
15776 goto _out;
15777 g_variant_get (_ret,
15778 "()");
15779 g_variant_unref (_ret);
15780_out:
15781 return _ret != NULL;
15782}
15783
15784/**
15785 * control_power_call_get_power_state:
15786 * @proxy: A #ControlPowerProxy.
15787 * @cancellable: (allow-none): A #GCancellable or %NULL.
15788 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15789 * @user_data: User data to pass to @callback.
15790 *
15791 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
15792 * 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.
15793 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
15794 *
15795 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
15796 */
15797void
15798control_power_call_get_power_state (
15799 ControlPower *proxy,
15800 GCancellable *cancellable,
15801 GAsyncReadyCallback callback,
15802 gpointer user_data)
15803{
15804 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15805 "getPowerState",
15806 g_variant_new ("()"),
15807 G_DBUS_CALL_FLAGS_NONE,
15808 -1,
15809 cancellable,
15810 callback,
15811 user_data);
15812}
15813
15814/**
15815 * control_power_call_get_power_state_finish:
15816 * @proxy: A #ControlPowerProxy.
15817 * @out_state: (out): Return location for return parameter or %NULL to ignore.
15818 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
15819 * @error: Return location for error or %NULL.
15820 *
15821 * Finishes an operation started with control_power_call_get_power_state().
15822 *
15823 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15824 */
15825gboolean
15826control_power_call_get_power_state_finish (
15827 ControlPower *proxy,
15828 gint *out_state,
15829 GAsyncResult *res,
15830 GError **error)
15831{
15832 GVariant *_ret;
15833 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15834 if (_ret == NULL)
15835 goto _out;
15836 g_variant_get (_ret,
15837 "(i)",
15838 out_state);
15839 g_variant_unref (_ret);
15840_out:
15841 return _ret != NULL;
15842}
15843
15844/**
15845 * control_power_call_get_power_state_sync:
15846 * @proxy: A #ControlPowerProxy.
15847 * @out_state: (out): Return location for return parameter or %NULL to ignore.
15848 * @cancellable: (allow-none): A #GCancellable or %NULL.
15849 * @error: Return location for error or %NULL.
15850 *
15851 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
15852 *
15853 * See control_power_call_get_power_state() for the asynchronous version of this method.
15854 *
15855 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15856 */
15857gboolean
15858control_power_call_get_power_state_sync (
15859 ControlPower *proxy,
15860 gint *out_state,
15861 GCancellable *cancellable,
15862 GError **error)
15863{
15864 GVariant *_ret;
15865 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15866 "getPowerState",
15867 g_variant_new ("()"),
15868 G_DBUS_CALL_FLAGS_NONE,
15869 -1,
15870 cancellable,
15871 error);
15872 if (_ret == NULL)
15873 goto _out;
15874 g_variant_get (_ret,
15875 "(i)",
15876 out_state);
15877 g_variant_unref (_ret);
15878_out:
15879 return _ret != NULL;
15880}
15881
15882/**
15883 * control_power_complete_set_power_state:
15884 * @object: A #ControlPower.
15885 * @invocation: (transfer full): A #GDBusMethodInvocation.
15886 *
15887 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</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.
15888 *
15889 * This method will free @invocation, you cannot use it afterwards.
15890 */
15891void
15892control_power_complete_set_power_state (
15893 ControlPower *object,
15894 GDBusMethodInvocation *invocation)
15895{
15896 g_dbus_method_invocation_return_value (invocation,
15897 g_variant_new ("()"));
15898}
15899
15900/**
15901 * control_power_complete_get_power_state:
15902 * @object: A #ControlPower.
15903 * @invocation: (transfer full): A #GDBusMethodInvocation.
15904 * @state: Parameter to return.
15905 *
15906 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</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.
15907 *
15908 * This method will free @invocation, you cannot use it afterwards.
15909 */
15910void
15911control_power_complete_get_power_state (
15912 ControlPower *object,
15913 GDBusMethodInvocation *invocation,
15914 gint state)
15915{
15916 g_dbus_method_invocation_return_value (invocation,
15917 g_variant_new ("(i)",
15918 state));
15919}
15920
15921/* ------------------------------------------------------------------------ */
15922
15923/**
15924 * ControlPowerProxy:
15925 *
15926 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
15927 */
15928
15929/**
15930 * ControlPowerProxyClass:
15931 * @parent_class: The parent class.
15932 *
15933 * Class structure for #ControlPowerProxy.
15934 */
15935
15936struct _ControlPowerProxyPrivate
15937{
15938 GData *qdata;
15939};
15940
15941static void control_power_proxy_iface_init (ControlPowerIface *iface);
15942
15943#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15944G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15945 G_ADD_PRIVATE (ControlPowerProxy)
15946 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15947
15948#else
15949G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
15950 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
15951
15952#endif
15953static void
15954control_power_proxy_finalize (GObject *object)
15955{
15956 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
15957 g_datalist_clear (&proxy->priv->qdata);
15958 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
15959}
15960
15961static void
15962control_power_proxy_get_property (GObject *object,
15963 guint prop_id,
15964 GValue *value,
15965 GParamSpec *pspec G_GNUC_UNUSED)
15966{
15967 const _ExtendedGDBusPropertyInfo *info;
15968 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050015969 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050015970 info = _control_power_property_info_pointers[prop_id - 1];
15971 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
15972 if (info->use_gvariant)
15973 {
15974 g_value_set_variant (value, variant);
15975 }
15976 else
15977 {
15978 if (variant != NULL)
15979 g_dbus_gvariant_to_gvalue (variant, value);
15980 }
15981 if (variant != NULL)
15982 g_variant_unref (variant);
15983}
15984
15985static void
15986control_power_proxy_set_property_cb (GDBusProxy *proxy,
15987 GAsyncResult *res,
15988 gpointer user_data)
15989{
15990 const _ExtendedGDBusPropertyInfo *info = user_data;
15991 GError *error;
15992 GVariant *_ret;
15993 error = NULL;
15994 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
15995 if (!_ret)
15996 {
15997 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
15998 info->parent_struct.name,
15999 error->message, g_quark_to_string (error->domain), error->code);
16000 g_error_free (error);
16001 }
16002 else
16003 {
16004 g_variant_unref (_ret);
16005 }
16006}
16007
16008static void
16009control_power_proxy_set_property (GObject *object,
16010 guint prop_id,
16011 const GValue *value,
16012 GParamSpec *pspec G_GNUC_UNUSED)
16013{
16014 const _ExtendedGDBusPropertyInfo *info;
16015 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016016 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016017 info = _control_power_property_info_pointers[prop_id - 1];
16018 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16019 g_dbus_proxy_call (G_DBUS_PROXY (object),
16020 "org.freedesktop.DBus.Properties.Set",
16021 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
16022 G_DBUS_CALL_FLAGS_NONE,
16023 -1,
16024 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16025 g_variant_unref (variant);
16026}
16027
16028static void
16029control_power_proxy_g_signal (GDBusProxy *proxy,
16030 const gchar *sender_name G_GNUC_UNUSED,
16031 const gchar *signal_name,
16032 GVariant *parameters)
16033{
16034 _ExtendedGDBusSignalInfo *info;
16035 GVariantIter iter;
16036 GVariant *child;
16037 GValue *paramv;
16038 guint num_params;
16039 guint n;
16040 guint signal_id;
16041 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
16042 if (info == NULL)
16043 return;
16044 num_params = g_variant_n_children (parameters);
16045 paramv = g_new0 (GValue, num_params + 1);
16046 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
16047 g_value_set_object (&paramv[0], proxy);
16048 g_variant_iter_init (&iter, parameters);
16049 n = 1;
16050 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16051 {
16052 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16053 if (arg_info->use_gvariant)
16054 {
16055 g_value_init (&paramv[n], G_TYPE_VARIANT);
16056 g_value_set_variant (&paramv[n], child);
16057 n++;
16058 }
16059 else
16060 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16061 g_variant_unref (child);
16062 }
16063 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
16064 g_signal_emitv (paramv, signal_id, 0, NULL);
16065 for (n = 0; n < num_params + 1; n++)
16066 g_value_unset (&paramv[n]);
16067 g_free (paramv);
16068}
16069
16070static void
16071control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
16072 GVariant *changed_properties,
16073 const gchar *const *invalidated_properties)
16074{
16075 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
16076 guint n;
16077 const gchar *key;
16078 GVariantIter *iter;
16079 _ExtendedGDBusPropertyInfo *info;
16080 g_variant_get (changed_properties, "a{sv}", &iter);
16081 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16082 {
16083 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
16084 g_datalist_remove_data (&proxy->priv->qdata, key);
16085 if (info != NULL)
16086 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16087 }
16088 g_variant_iter_free (iter);
16089 for (n = 0; invalidated_properties[n] != NULL; n++)
16090 {
16091 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
16092 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16093 if (info != NULL)
16094 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16095 }
16096}
16097
16098static gint
16099control_power_proxy_get_pgood (ControlPower *object)
16100{
16101 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16102 GVariant *variant;
16103 gint value = 0;
16104 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
16105 if (variant != NULL)
16106 {
16107 value = g_variant_get_int32 (variant);
16108 g_variant_unref (variant);
16109 }
16110 return value;
16111}
16112
16113static gint
16114control_power_proxy_get_state (ControlPower *object)
16115{
16116 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16117 GVariant *variant;
16118 gint value = 0;
16119 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
16120 if (variant != NULL)
16121 {
16122 value = g_variant_get_int32 (variant);
16123 g_variant_unref (variant);
16124 }
16125 return value;
16126}
16127
Norman James32e74e22015-09-15 21:28:06 -050016128static gint
16129control_power_proxy_get_pgood_timeout (ControlPower *object)
16130{
16131 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16132 GVariant *variant;
16133 gint value = 0;
16134 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
16135 if (variant != NULL)
16136 {
16137 value = g_variant_get_int32 (variant);
16138 g_variant_unref (variant);
16139 }
16140 return value;
16141}
16142
Norman James362a80f2015-09-14 14:04:39 -050016143static void
16144control_power_proxy_init (ControlPowerProxy *proxy)
16145{
16146#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16147 proxy->priv = control_power_proxy_get_instance_private (proxy);
16148#else
16149 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
16150#endif
16151
16152 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
16153}
16154
16155static void
16156control_power_proxy_class_init (ControlPowerProxyClass *klass)
16157{
16158 GObjectClass *gobject_class;
16159 GDBusProxyClass *proxy_class;
16160
16161 gobject_class = G_OBJECT_CLASS (klass);
16162 gobject_class->finalize = control_power_proxy_finalize;
16163 gobject_class->get_property = control_power_proxy_get_property;
16164 gobject_class->set_property = control_power_proxy_set_property;
16165
16166 proxy_class = G_DBUS_PROXY_CLASS (klass);
16167 proxy_class->g_signal = control_power_proxy_g_signal;
16168 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
16169
16170 control_power_override_properties (gobject_class, 1);
16171
16172#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16173 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
16174#endif
16175}
16176
16177static void
16178control_power_proxy_iface_init (ControlPowerIface *iface)
16179{
16180 iface->get_pgood = control_power_proxy_get_pgood;
16181 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050016182 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050016183}
16184
16185/**
16186 * control_power_proxy_new:
16187 * @connection: A #GDBusConnection.
16188 * @flags: Flags from the #GDBusProxyFlags enumeration.
16189 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16190 * @object_path: An object path.
16191 * @cancellable: (allow-none): A #GCancellable or %NULL.
16192 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16193 * @user_data: User data to pass to @callback.
16194 *
16195 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new() for more details.
16196 *
16197 * 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.
16198 * You can then call control_power_proxy_new_finish() to get the result of the operation.
16199 *
16200 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
16201 */
16202void
16203control_power_proxy_new (
16204 GDBusConnection *connection,
16205 GDBusProxyFlags flags,
16206 const gchar *name,
16207 const gchar *object_path,
16208 GCancellable *cancellable,
16209 GAsyncReadyCallback callback,
16210 gpointer user_data)
16211{
16212 g_async_initable_new_async (TYPE_CONTROL_POWER_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.control.Power", NULL);
16213}
16214
16215/**
16216 * control_power_proxy_new_finish:
16217 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
16218 * @error: Return location for error or %NULL
16219 *
16220 * Finishes an operation started with control_power_proxy_new().
16221 *
16222 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
16223 */
16224ControlPower *
16225control_power_proxy_new_finish (
16226 GAsyncResult *res,
16227 GError **error)
16228{
16229 GObject *ret;
16230 GObject *source_object;
16231 source_object = g_async_result_get_source_object (res);
16232 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16233 g_object_unref (source_object);
16234 if (ret != NULL)
16235 return CONTROL_POWER (ret);
16236 else
16237 return NULL;
16238}
16239
16240/**
16241 * control_power_proxy_new_sync:
16242 * @connection: A #GDBusConnection.
16243 * @flags: Flags from the #GDBusProxyFlags enumeration.
16244 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16245 * @object_path: An object path.
16246 * @cancellable: (allow-none): A #GCancellable or %NULL.
16247 * @error: Return location for error or %NULL
16248 *
16249 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new_sync() for more details.
16250 *
16251 * The calling thread is blocked until a reply is received.
16252 *
16253 * See control_power_proxy_new() for the asynchronous version of this constructor.
16254 *
16255 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
16256 */
16257ControlPower *
16258control_power_proxy_new_sync (
16259 GDBusConnection *connection,
16260 GDBusProxyFlags flags,
16261 const gchar *name,
16262 const gchar *object_path,
16263 GCancellable *cancellable,
16264 GError **error)
16265{
16266 GInitable *ret;
16267 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
16268 if (ret != NULL)
16269 return CONTROL_POWER (ret);
16270 else
16271 return NULL;
16272}
16273
16274
16275/**
16276 * control_power_proxy_new_for_bus:
16277 * @bus_type: A #GBusType.
16278 * @flags: Flags from the #GDBusProxyFlags enumeration.
16279 * @name: A bus name (well-known or unique).
16280 * @object_path: An object path.
16281 * @cancellable: (allow-none): A #GCancellable or %NULL.
16282 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16283 * @user_data: User data to pass to @callback.
16284 *
16285 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
16286 *
16287 * 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.
16288 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
16289 *
16290 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
16291 */
16292void
16293control_power_proxy_new_for_bus (
16294 GBusType bus_type,
16295 GDBusProxyFlags flags,
16296 const gchar *name,
16297 const gchar *object_path,
16298 GCancellable *cancellable,
16299 GAsyncReadyCallback callback,
16300 gpointer user_data)
16301{
16302 g_async_initable_new_async (TYPE_CONTROL_POWER_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.control.Power", NULL);
16303}
16304
16305/**
16306 * control_power_proxy_new_for_bus_finish:
16307 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
16308 * @error: Return location for error or %NULL
16309 *
16310 * Finishes an operation started with control_power_proxy_new_for_bus().
16311 *
16312 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
16313 */
16314ControlPower *
16315control_power_proxy_new_for_bus_finish (
16316 GAsyncResult *res,
16317 GError **error)
16318{
16319 GObject *ret;
16320 GObject *source_object;
16321 source_object = g_async_result_get_source_object (res);
16322 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16323 g_object_unref (source_object);
16324 if (ret != NULL)
16325 return CONTROL_POWER (ret);
16326 else
16327 return NULL;
16328}
16329
16330/**
16331 * control_power_proxy_new_for_bus_sync:
16332 * @bus_type: A #GBusType.
16333 * @flags: Flags from the #GDBusProxyFlags enumeration.
16334 * @name: A bus name (well-known or unique).
16335 * @object_path: An object path.
16336 * @cancellable: (allow-none): A #GCancellable or %NULL.
16337 * @error: Return location for error or %NULL
16338 *
16339 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
16340 *
16341 * The calling thread is blocked until a reply is received.
16342 *
16343 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
16344 *
16345 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
16346 */
16347ControlPower *
16348control_power_proxy_new_for_bus_sync (
16349 GBusType bus_type,
16350 GDBusProxyFlags flags,
16351 const gchar *name,
16352 const gchar *object_path,
16353 GCancellable *cancellable,
16354 GError **error)
16355{
16356 GInitable *ret;
16357 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
16358 if (ret != NULL)
16359 return CONTROL_POWER (ret);
16360 else
16361 return NULL;
16362}
16363
16364
16365/* ------------------------------------------------------------------------ */
16366
16367/**
16368 * ControlPowerSkeleton:
16369 *
16370 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
16371 */
16372
16373/**
16374 * ControlPowerSkeletonClass:
16375 * @parent_class: The parent class.
16376 *
16377 * Class structure for #ControlPowerSkeleton.
16378 */
16379
16380struct _ControlPowerSkeletonPrivate
16381{
16382 GValue *properties;
16383 GList *changed_properties;
16384 GSource *changed_properties_idle_source;
16385 GMainContext *context;
16386 GMutex lock;
16387};
16388
16389static void
16390_control_power_skeleton_handle_method_call (
16391 GDBusConnection *connection G_GNUC_UNUSED,
16392 const gchar *sender G_GNUC_UNUSED,
16393 const gchar *object_path G_GNUC_UNUSED,
16394 const gchar *interface_name,
16395 const gchar *method_name,
16396 GVariant *parameters,
16397 GDBusMethodInvocation *invocation,
16398 gpointer user_data)
16399{
16400 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
16401 _ExtendedGDBusMethodInfo *info;
16402 GVariantIter iter;
16403 GVariant *child;
16404 GValue *paramv;
16405 guint num_params;
16406 guint num_extra;
16407 guint n;
16408 guint signal_id;
16409 GValue return_value = G_VALUE_INIT;
16410 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
16411 g_assert (info != NULL);
16412 num_params = g_variant_n_children (parameters);
16413 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
16414 n = 0;
16415 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
16416 g_value_set_object (&paramv[n++], skeleton);
16417 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
16418 g_value_set_object (&paramv[n++], invocation);
16419 if (info->pass_fdlist)
16420 {
16421#ifdef G_OS_UNIX
16422 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
16423 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
16424#else
16425 g_assert_not_reached ();
16426#endif
16427 }
16428 g_variant_iter_init (&iter, parameters);
16429 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16430 {
16431 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
16432 if (arg_info->use_gvariant)
16433 {
16434 g_value_init (&paramv[n], G_TYPE_VARIANT);
16435 g_value_set_variant (&paramv[n], child);
16436 n++;
16437 }
16438 else
16439 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16440 g_variant_unref (child);
16441 }
16442 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
16443 g_value_init (&return_value, G_TYPE_BOOLEAN);
16444 g_signal_emitv (paramv, signal_id, 0, &return_value);
16445 if (!g_value_get_boolean (&return_value))
16446 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);
16447 g_value_unset (&return_value);
16448 for (n = 0; n < num_params + num_extra; n++)
16449 g_value_unset (&paramv[n]);
16450 g_free (paramv);
16451}
16452
16453static GVariant *
16454_control_power_skeleton_handle_get_property (
16455 GDBusConnection *connection G_GNUC_UNUSED,
16456 const gchar *sender G_GNUC_UNUSED,
16457 const gchar *object_path G_GNUC_UNUSED,
16458 const gchar *interface_name G_GNUC_UNUSED,
16459 const gchar *property_name,
16460 GError **error,
16461 gpointer user_data)
16462{
16463 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
16464 GValue value = G_VALUE_INIT;
16465 GParamSpec *pspec;
16466 _ExtendedGDBusPropertyInfo *info;
16467 GVariant *ret;
16468 ret = NULL;
16469 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
16470 g_assert (info != NULL);
16471 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16472 if (pspec == NULL)
16473 {
16474 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16475 }
16476 else
16477 {
16478 g_value_init (&value, pspec->value_type);
16479 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16480 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
16481 g_value_unset (&value);
16482 }
16483 return ret;
16484}
16485
16486static gboolean
16487_control_power_skeleton_handle_set_property (
16488 GDBusConnection *connection G_GNUC_UNUSED,
16489 const gchar *sender G_GNUC_UNUSED,
16490 const gchar *object_path G_GNUC_UNUSED,
16491 const gchar *interface_name G_GNUC_UNUSED,
16492 const gchar *property_name,
16493 GVariant *variant,
16494 GError **error,
16495 gpointer user_data)
16496{
16497 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
16498 GValue value = G_VALUE_INIT;
16499 GParamSpec *pspec;
16500 _ExtendedGDBusPropertyInfo *info;
16501 gboolean ret;
16502 ret = FALSE;
16503 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
16504 g_assert (info != NULL);
16505 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16506 if (pspec == NULL)
16507 {
16508 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16509 }
16510 else
16511 {
16512 if (info->use_gvariant)
16513 g_value_set_variant (&value, variant);
16514 else
16515 g_dbus_gvariant_to_gvalue (variant, &value);
16516 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16517 g_value_unset (&value);
16518 ret = TRUE;
16519 }
16520 return ret;
16521}
16522
16523static const GDBusInterfaceVTable _control_power_skeleton_vtable =
16524{
16525 _control_power_skeleton_handle_method_call,
16526 _control_power_skeleton_handle_get_property,
16527 _control_power_skeleton_handle_set_property,
16528 {NULL}
16529};
16530
16531static GDBusInterfaceInfo *
16532control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16533{
16534 return control_power_interface_info ();
16535}
16536
16537static GDBusInterfaceVTable *
16538control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16539{
16540 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
16541}
16542
16543static GVariant *
16544control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
16545{
16546 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
16547
16548 GVariantBuilder builder;
16549 guint n;
16550 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16551 if (_control_power_interface_info.parent_struct.properties == NULL)
16552 goto out;
16553 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
16554 {
16555 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
16556 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
16557 {
16558 GVariant *value;
16559 value = _control_power_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.control.Power", info->name, NULL, skeleton);
16560 if (value != NULL)
16561 {
16562 g_variant_take_ref (value);
16563 g_variant_builder_add (&builder, "{sv}", info->name, value);
16564 g_variant_unref (value);
16565 }
16566 }
16567 }
16568out:
16569 return g_variant_builder_end (&builder);
16570}
16571
16572static gboolean _control_power_emit_changed (gpointer user_data);
16573
16574static void
16575control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
16576{
16577 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
16578 gboolean emit_changed = FALSE;
16579
16580 g_mutex_lock (&skeleton->priv->lock);
16581 if (skeleton->priv->changed_properties_idle_source != NULL)
16582 {
16583 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16584 skeleton->priv->changed_properties_idle_source = NULL;
16585 emit_changed = TRUE;
16586 }
16587 g_mutex_unlock (&skeleton->priv->lock);
16588
16589 if (emit_changed)
16590 _control_power_emit_changed (skeleton);
16591}
16592
16593static void
16594_control_power_on_signal_power_good (
16595 ControlPower *object)
16596{
16597 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16598
16599 GList *connections, *l;
16600 GVariant *signal_variant;
16601 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16602
16603 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
16604 for (l = connections; l != NULL; l = l->next)
16605 {
16606 GDBusConnection *connection = l->data;
16607 g_dbus_connection_emit_signal (connection,
16608 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
16609 signal_variant, NULL);
16610 }
16611 g_variant_unref (signal_variant);
16612 g_list_free_full (connections, g_object_unref);
16613}
16614
16615static void
16616_control_power_on_signal_power_lost (
16617 ControlPower *object)
16618{
16619 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16620
16621 GList *connections, *l;
16622 GVariant *signal_variant;
16623 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16624
16625 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
16626 for (l = connections; l != NULL; l = l->next)
16627 {
16628 GDBusConnection *connection = l->data;
16629 g_dbus_connection_emit_signal (connection,
16630 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
16631 signal_variant, NULL);
16632 }
16633 g_variant_unref (signal_variant);
16634 g_list_free_full (connections, g_object_unref);
16635}
16636
16637static void control_power_skeleton_iface_init (ControlPowerIface *iface);
16638#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16639G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16640 G_ADD_PRIVATE (ControlPowerSkeleton)
16641 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
16642
16643#else
16644G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16645 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
16646
16647#endif
16648static void
16649control_power_skeleton_finalize (GObject *object)
16650{
16651 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16652 guint n;
Norman James32e74e22015-09-15 21:28:06 -050016653 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050016654 g_value_unset (&skeleton->priv->properties[n]);
16655 g_free (skeleton->priv->properties);
16656 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16657 if (skeleton->priv->changed_properties_idle_source != NULL)
16658 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16659 g_main_context_unref (skeleton->priv->context);
16660 g_mutex_clear (&skeleton->priv->lock);
16661 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
16662}
16663
16664static void
16665control_power_skeleton_get_property (GObject *object,
16666 guint prop_id,
16667 GValue *value,
16668 GParamSpec *pspec G_GNUC_UNUSED)
16669{
16670 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050016671 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016672 g_mutex_lock (&skeleton->priv->lock);
16673 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
16674 g_mutex_unlock (&skeleton->priv->lock);
16675}
16676
16677static gboolean
16678_control_power_emit_changed (gpointer user_data)
16679{
16680 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
16681 GList *l;
16682 GVariantBuilder builder;
16683 GVariantBuilder invalidated_builder;
16684 guint num_changes;
16685
16686 g_mutex_lock (&skeleton->priv->lock);
16687 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16688 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
16689 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
16690 {
16691 ChangedProperty *cp = l->data;
16692 GVariant *variant;
16693 const GValue *cur_value;
16694
16695 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
16696 if (!_g_value_equal (cur_value, &cp->orig_value))
16697 {
16698 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
16699 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
16700 g_variant_unref (variant);
16701 num_changes++;
16702 }
16703 }
16704 if (num_changes > 0)
16705 {
16706 GList *connections, *ll;
16707 GVariant *signal_variant;
16708 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
16709 &builder, &invalidated_builder));
16710 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16711 for (ll = connections; ll != NULL; ll = ll->next)
16712 {
16713 GDBusConnection *connection = ll->data;
16714
16715 g_dbus_connection_emit_signal (connection,
16716 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
16717 "org.freedesktop.DBus.Properties",
16718 "PropertiesChanged",
16719 signal_variant,
16720 NULL);
16721 }
16722 g_variant_unref (signal_variant);
16723 g_list_free_full (connections, g_object_unref);
16724 }
16725 else
16726 {
16727 g_variant_builder_clear (&builder);
16728 g_variant_builder_clear (&invalidated_builder);
16729 }
16730 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16731 skeleton->priv->changed_properties = NULL;
16732 skeleton->priv->changed_properties_idle_source = NULL;
16733 g_mutex_unlock (&skeleton->priv->lock);
16734 return FALSE;
16735}
16736
16737static void
16738_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
16739{
16740 ChangedProperty *cp;
16741 GList *l;
16742 cp = NULL;
16743 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
16744 {
16745 ChangedProperty *i_cp = l->data;
16746 if (i_cp->info == info)
16747 {
16748 cp = i_cp;
16749 break;
16750 }
16751 }
16752 if (cp == NULL)
16753 {
16754 cp = g_new0 (ChangedProperty, 1);
16755 cp->prop_id = prop_id;
16756 cp->info = info;
16757 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
16758 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
16759 g_value_copy (orig_value, &cp->orig_value);
16760 }
16761}
16762
16763static void
16764control_power_skeleton_notify (GObject *object,
16765 GParamSpec *pspec G_GNUC_UNUSED)
16766{
16767 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16768 g_mutex_lock (&skeleton->priv->lock);
16769 if (skeleton->priv->changed_properties != NULL &&
16770 skeleton->priv->changed_properties_idle_source == NULL)
16771 {
16772 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
16773 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
16774 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
16775 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
16776 g_source_unref (skeleton->priv->changed_properties_idle_source);
16777 }
16778 g_mutex_unlock (&skeleton->priv->lock);
16779}
16780
16781static void
16782control_power_skeleton_set_property (GObject *object,
16783 guint prop_id,
16784 const GValue *value,
16785 GParamSpec *pspec)
16786{
16787 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050016788 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016789 g_mutex_lock (&skeleton->priv->lock);
16790 g_object_freeze_notify (object);
16791 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
16792 {
16793 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
16794 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
16795 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
16796 g_object_notify_by_pspec (object, pspec);
16797 }
16798 g_mutex_unlock (&skeleton->priv->lock);
16799 g_object_thaw_notify (object);
16800}
16801
16802static void
16803control_power_skeleton_init (ControlPowerSkeleton *skeleton)
16804{
16805#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16806 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
16807#else
16808 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
16809#endif
16810
16811 g_mutex_init (&skeleton->priv->lock);
16812 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050016813 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050016814 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
16815 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050016816 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050016817}
16818
16819static gint
16820control_power_skeleton_get_pgood (ControlPower *object)
16821{
16822 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16823 gint value;
16824 g_mutex_lock (&skeleton->priv->lock);
16825 value = g_value_get_int (&(skeleton->priv->properties[0]));
16826 g_mutex_unlock (&skeleton->priv->lock);
16827 return value;
16828}
16829
16830static gint
16831control_power_skeleton_get_state (ControlPower *object)
16832{
16833 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16834 gint value;
16835 g_mutex_lock (&skeleton->priv->lock);
16836 value = g_value_get_int (&(skeleton->priv->properties[1]));
16837 g_mutex_unlock (&skeleton->priv->lock);
16838 return value;
16839}
16840
Norman James32e74e22015-09-15 21:28:06 -050016841static gint
16842control_power_skeleton_get_pgood_timeout (ControlPower *object)
16843{
16844 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
16845 gint value;
16846 g_mutex_lock (&skeleton->priv->lock);
16847 value = g_value_get_int (&(skeleton->priv->properties[2]));
16848 g_mutex_unlock (&skeleton->priv->lock);
16849 return value;
16850}
16851
Norman James362a80f2015-09-14 14:04:39 -050016852static void
16853control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
16854{
16855 GObjectClass *gobject_class;
16856 GDBusInterfaceSkeletonClass *skeleton_class;
16857
16858 gobject_class = G_OBJECT_CLASS (klass);
16859 gobject_class->finalize = control_power_skeleton_finalize;
16860 gobject_class->get_property = control_power_skeleton_get_property;
16861 gobject_class->set_property = control_power_skeleton_set_property;
16862 gobject_class->notify = control_power_skeleton_notify;
16863
16864
16865 control_power_override_properties (gobject_class, 1);
16866
16867 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
16868 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
16869 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
16870 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
16871 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
16872
16873#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16874 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
16875#endif
16876}
16877
16878static void
16879control_power_skeleton_iface_init (ControlPowerIface *iface)
16880{
16881 iface->power_good = _control_power_on_signal_power_good;
16882 iface->power_lost = _control_power_on_signal_power_lost;
16883 iface->get_pgood = control_power_skeleton_get_pgood;
16884 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050016885 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050016886}
16887
16888/**
16889 * control_power_skeleton_new:
16890 *
16891 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16892 *
16893 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
16894 */
16895ControlPower *
16896control_power_skeleton_new (void)
16897{
16898 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
16899}
16900
16901/* ------------------------------------------------------------------------
16902 * Code for interface org.openbmc.Watchdog
16903 * ------------------------------------------------------------------------
16904 */
16905
16906/**
16907 * SECTION:Watchdog
16908 * @title: Watchdog
16909 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
16910 *
16911 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface in C.
16912 */
16913
16914/* ---- Introspection data for org.openbmc.Watchdog ---- */
16915
16916static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
16917{
16918 {
16919 -1,
16920 (gchar *) "start",
16921 NULL,
16922 NULL,
16923 NULL
16924 },
16925 "handle-start",
16926 FALSE
16927};
16928
16929static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
16930{
16931 {
16932 -1,
16933 (gchar *) "poke",
16934 NULL,
16935 NULL,
16936 NULL
16937 },
16938 "handle-poke",
16939 FALSE
16940};
16941
16942static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
16943{
16944 {
16945 -1,
16946 (gchar *) "stop",
16947 NULL,
16948 NULL,
16949 NULL
16950 },
16951 "handle-stop",
16952 FALSE
16953};
16954
16955static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
16956{
16957 &_watchdog_method_info_start,
16958 &_watchdog_method_info_poke,
16959 &_watchdog_method_info_stop,
16960 NULL
16961};
16962
16963static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
16964{
16965 {
16966 -1,
16967 (gchar *) "WatchdogError",
16968 NULL,
16969 NULL
16970 },
16971 "watchdog-error"
16972};
16973
16974static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
16975{
16976 &_watchdog_signal_info_watchdog_error,
16977 NULL
16978};
16979
16980static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
16981{
16982 {
16983 -1,
16984 (gchar *) "watchdog",
16985 (gchar *) "i",
16986 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16987 NULL
16988 },
16989 "watchdog",
16990 FALSE
16991};
16992
16993static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
16994{
16995 {
16996 -1,
16997 (gchar *) "poll_interval",
16998 (gchar *) "i",
16999 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17000 NULL
17001 },
17002 "poll-interval",
17003 FALSE
17004};
17005
17006static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
17007{
17008 &_watchdog_property_info_watchdog,
17009 &_watchdog_property_info_poll_interval,
17010 NULL
17011};
17012
17013static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
17014{
17015 {
17016 -1,
17017 (gchar *) "org.openbmc.Watchdog",
17018 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
17019 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
17020 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
17021 NULL
17022 },
17023 "watchdog",
17024};
17025
17026
17027/**
17028 * watchdog_interface_info:
17029 *
17030 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
17031 *
17032 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17033 */
17034GDBusInterfaceInfo *
17035watchdog_interface_info (void)
17036{
17037 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
17038}
17039
17040/**
17041 * watchdog_override_properties:
17042 * @klass: The class structure for a #GObject<!-- -->-derived class.
17043 * @property_id_begin: The property id to assign to the first overridden property.
17044 *
17045 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
17046 * The properties are overridden in the order they are defined.
17047 *
17048 * Returns: The last property id.
17049 */
17050guint
17051watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
17052{
17053 g_object_class_override_property (klass, property_id_begin++, "watchdog");
17054 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
17055 return property_id_begin - 1;
17056}
17057
17058
17059
17060/**
17061 * Watchdog:
17062 *
17063 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17064 */
17065
17066/**
17067 * WatchdogIface:
17068 * @parent_iface: The parent interface.
17069 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
17070 * @handle_start: Handler for the #Watchdog::handle-start signal.
17071 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
17072 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
17073 * @get_watchdog: Getter for the #Watchdog:watchdog property.
17074 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
17075 *
17076 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17077 */
17078
17079typedef WatchdogIface WatchdogInterface;
17080G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
17081
17082static void
17083watchdog_default_init (WatchdogIface *iface)
17084{
17085 /* GObject signals for incoming D-Bus method calls: */
17086 /**
17087 * Watchdog::handle-start:
17088 * @object: A #Watchdog.
17089 * @invocation: A #GDBusMethodInvocation.
17090 *
17091 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
17092 *
17093 * 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 watchdog_complete_start() 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.
17094 *
17095 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17096 */
17097 g_signal_new ("handle-start",
17098 G_TYPE_FROM_INTERFACE (iface),
17099 G_SIGNAL_RUN_LAST,
17100 G_STRUCT_OFFSET (WatchdogIface, handle_start),
17101 g_signal_accumulator_true_handled,
17102 NULL,
17103 g_cclosure_marshal_generic,
17104 G_TYPE_BOOLEAN,
17105 1,
17106 G_TYPE_DBUS_METHOD_INVOCATION);
17107
17108 /**
17109 * Watchdog::handle-poke:
17110 * @object: A #Watchdog.
17111 * @invocation: A #GDBusMethodInvocation.
17112 *
17113 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
17114 *
17115 * 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 watchdog_complete_poke() 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.
17116 *
17117 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17118 */
17119 g_signal_new ("handle-poke",
17120 G_TYPE_FROM_INTERFACE (iface),
17121 G_SIGNAL_RUN_LAST,
17122 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
17123 g_signal_accumulator_true_handled,
17124 NULL,
17125 g_cclosure_marshal_generic,
17126 G_TYPE_BOOLEAN,
17127 1,
17128 G_TYPE_DBUS_METHOD_INVOCATION);
17129
17130 /**
17131 * Watchdog::handle-stop:
17132 * @object: A #Watchdog.
17133 * @invocation: A #GDBusMethodInvocation.
17134 *
17135 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
17136 *
17137 * 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 watchdog_complete_stop() 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.
17138 *
17139 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17140 */
17141 g_signal_new ("handle-stop",
17142 G_TYPE_FROM_INTERFACE (iface),
17143 G_SIGNAL_RUN_LAST,
17144 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
17145 g_signal_accumulator_true_handled,
17146 NULL,
17147 g_cclosure_marshal_generic,
17148 G_TYPE_BOOLEAN,
17149 1,
17150 G_TYPE_DBUS_METHOD_INVOCATION);
17151
17152 /* GObject signals for received D-Bus signals: */
17153 /**
17154 * Watchdog::watchdog-error:
17155 * @object: A #Watchdog.
17156 *
17157 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> is received.
17158 *
17159 * 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.
17160 */
17161 g_signal_new ("watchdog-error",
17162 G_TYPE_FROM_INTERFACE (iface),
17163 G_SIGNAL_RUN_LAST,
17164 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
17165 NULL,
17166 NULL,
17167 g_cclosure_marshal_generic,
17168 G_TYPE_NONE,
17169 0);
17170
17171 /* GObject properties for D-Bus properties: */
17172 /**
17173 * Watchdog:watchdog:
17174 *
17175 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
17176 *
17177 * 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.
17178 */
17179 g_object_interface_install_property (iface,
17180 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17181 /**
17182 * Watchdog:poll-interval:
17183 *
17184 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
17185 *
17186 * 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.
17187 */
17188 g_object_interface_install_property (iface,
17189 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17190}
17191
17192/**
17193 * watchdog_get_watchdog: (skip)
17194 * @object: A #Watchdog.
17195 *
17196 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
17197 *
17198 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17199 *
17200 * Returns: The property value.
17201 */
17202gint
17203watchdog_get_watchdog (Watchdog *object)
17204{
17205 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
17206}
17207
17208/**
17209 * watchdog_set_watchdog: (skip)
17210 * @object: A #Watchdog.
17211 * @value: The value to set.
17212 *
17213 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
17214 *
17215 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17216 */
17217void
17218watchdog_set_watchdog (Watchdog *object, gint value)
17219{
17220 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
17221}
17222
17223/**
17224 * watchdog_get_poll_interval: (skip)
17225 * @object: A #Watchdog.
17226 *
17227 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
17228 *
17229 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17230 *
17231 * Returns: The property value.
17232 */
17233gint
17234watchdog_get_poll_interval (Watchdog *object)
17235{
17236 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
17237}
17238
17239/**
17240 * watchdog_set_poll_interval: (skip)
17241 * @object: A #Watchdog.
17242 * @value: The value to set.
17243 *
17244 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
17245 *
17246 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17247 */
17248void
17249watchdog_set_poll_interval (Watchdog *object, gint value)
17250{
17251 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
17252}
17253
17254/**
17255 * watchdog_emit_watchdog_error:
17256 * @object: A #Watchdog.
17257 *
17258 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
17259 */
17260void
17261watchdog_emit_watchdog_error (
17262 Watchdog *object)
17263{
17264 g_signal_emit_by_name (object, "watchdog-error");
17265}
17266
17267/**
17268 * watchdog_call_start:
17269 * @proxy: A #WatchdogProxy.
17270 * @cancellable: (allow-none): A #GCancellable or %NULL.
17271 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17272 * @user_data: User data to pass to @callback.
17273 *
17274 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
17275 * 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.
17276 * You can then call watchdog_call_start_finish() to get the result of the operation.
17277 *
17278 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
17279 */
17280void
17281watchdog_call_start (
17282 Watchdog *proxy,
17283 GCancellable *cancellable,
17284 GAsyncReadyCallback callback,
17285 gpointer user_data)
17286{
17287 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17288 "start",
17289 g_variant_new ("()"),
17290 G_DBUS_CALL_FLAGS_NONE,
17291 -1,
17292 cancellable,
17293 callback,
17294 user_data);
17295}
17296
17297/**
17298 * watchdog_call_start_finish:
17299 * @proxy: A #WatchdogProxy.
17300 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
17301 * @error: Return location for error or %NULL.
17302 *
17303 * Finishes an operation started with watchdog_call_start().
17304 *
17305 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17306 */
17307gboolean
17308watchdog_call_start_finish (
17309 Watchdog *proxy,
17310 GAsyncResult *res,
17311 GError **error)
17312{
17313 GVariant *_ret;
17314 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17315 if (_ret == NULL)
17316 goto _out;
17317 g_variant_get (_ret,
17318 "()");
17319 g_variant_unref (_ret);
17320_out:
17321 return _ret != NULL;
17322}
17323
17324/**
17325 * watchdog_call_start_sync:
17326 * @proxy: A #WatchdogProxy.
17327 * @cancellable: (allow-none): A #GCancellable or %NULL.
17328 * @error: Return location for error or %NULL.
17329 *
17330 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
17331 *
17332 * See watchdog_call_start() for the asynchronous version of this method.
17333 *
17334 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17335 */
17336gboolean
17337watchdog_call_start_sync (
17338 Watchdog *proxy,
17339 GCancellable *cancellable,
17340 GError **error)
17341{
17342 GVariant *_ret;
17343 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17344 "start",
17345 g_variant_new ("()"),
17346 G_DBUS_CALL_FLAGS_NONE,
17347 -1,
17348 cancellable,
17349 error);
17350 if (_ret == NULL)
17351 goto _out;
17352 g_variant_get (_ret,
17353 "()");
17354 g_variant_unref (_ret);
17355_out:
17356 return _ret != NULL;
17357}
17358
17359/**
17360 * watchdog_call_poke:
17361 * @proxy: A #WatchdogProxy.
17362 * @cancellable: (allow-none): A #GCancellable or %NULL.
17363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17364 * @user_data: User data to pass to @callback.
17365 *
17366 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
17367 * 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.
17368 * You can then call watchdog_call_poke_finish() to get the result of the operation.
17369 *
17370 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
17371 */
17372void
17373watchdog_call_poke (
17374 Watchdog *proxy,
17375 GCancellable *cancellable,
17376 GAsyncReadyCallback callback,
17377 gpointer user_data)
17378{
17379 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17380 "poke",
17381 g_variant_new ("()"),
17382 G_DBUS_CALL_FLAGS_NONE,
17383 -1,
17384 cancellable,
17385 callback,
17386 user_data);
17387}
17388
17389/**
17390 * watchdog_call_poke_finish:
17391 * @proxy: A #WatchdogProxy.
17392 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
17393 * @error: Return location for error or %NULL.
17394 *
17395 * Finishes an operation started with watchdog_call_poke().
17396 *
17397 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17398 */
17399gboolean
17400watchdog_call_poke_finish (
17401 Watchdog *proxy,
17402 GAsyncResult *res,
17403 GError **error)
17404{
17405 GVariant *_ret;
17406 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17407 if (_ret == NULL)
17408 goto _out;
17409 g_variant_get (_ret,
17410 "()");
17411 g_variant_unref (_ret);
17412_out:
17413 return _ret != NULL;
17414}
17415
17416/**
17417 * watchdog_call_poke_sync:
17418 * @proxy: A #WatchdogProxy.
17419 * @cancellable: (allow-none): A #GCancellable or %NULL.
17420 * @error: Return location for error or %NULL.
17421 *
17422 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
17423 *
17424 * See watchdog_call_poke() for the asynchronous version of this method.
17425 *
17426 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17427 */
17428gboolean
17429watchdog_call_poke_sync (
17430 Watchdog *proxy,
17431 GCancellable *cancellable,
17432 GError **error)
17433{
17434 GVariant *_ret;
17435 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17436 "poke",
17437 g_variant_new ("()"),
17438 G_DBUS_CALL_FLAGS_NONE,
17439 -1,
17440 cancellable,
17441 error);
17442 if (_ret == NULL)
17443 goto _out;
17444 g_variant_get (_ret,
17445 "()");
17446 g_variant_unref (_ret);
17447_out:
17448 return _ret != NULL;
17449}
17450
17451/**
17452 * watchdog_call_stop:
17453 * @proxy: A #WatchdogProxy.
17454 * @cancellable: (allow-none): A #GCancellable or %NULL.
17455 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17456 * @user_data: User data to pass to @callback.
17457 *
17458 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
17459 * 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.
17460 * You can then call watchdog_call_stop_finish() to get the result of the operation.
17461 *
17462 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
17463 */
17464void
17465watchdog_call_stop (
17466 Watchdog *proxy,
17467 GCancellable *cancellable,
17468 GAsyncReadyCallback callback,
17469 gpointer user_data)
17470{
17471 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17472 "stop",
17473 g_variant_new ("()"),
17474 G_DBUS_CALL_FLAGS_NONE,
17475 -1,
17476 cancellable,
17477 callback,
17478 user_data);
17479}
17480
17481/**
17482 * watchdog_call_stop_finish:
17483 * @proxy: A #WatchdogProxy.
17484 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
17485 * @error: Return location for error or %NULL.
17486 *
17487 * Finishes an operation started with watchdog_call_stop().
17488 *
17489 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17490 */
17491gboolean
17492watchdog_call_stop_finish (
17493 Watchdog *proxy,
17494 GAsyncResult *res,
17495 GError **error)
17496{
17497 GVariant *_ret;
17498 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17499 if (_ret == NULL)
17500 goto _out;
17501 g_variant_get (_ret,
17502 "()");
17503 g_variant_unref (_ret);
17504_out:
17505 return _ret != NULL;
17506}
17507
17508/**
17509 * watchdog_call_stop_sync:
17510 * @proxy: A #WatchdogProxy.
17511 * @cancellable: (allow-none): A #GCancellable or %NULL.
17512 * @error: Return location for error or %NULL.
17513 *
17514 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
17515 *
17516 * See watchdog_call_stop() for the asynchronous version of this method.
17517 *
17518 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17519 */
17520gboolean
17521watchdog_call_stop_sync (
17522 Watchdog *proxy,
17523 GCancellable *cancellable,
17524 GError **error)
17525{
17526 GVariant *_ret;
17527 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17528 "stop",
17529 g_variant_new ("()"),
17530 G_DBUS_CALL_FLAGS_NONE,
17531 -1,
17532 cancellable,
17533 error);
17534 if (_ret == NULL)
17535 goto _out;
17536 g_variant_get (_ret,
17537 "()");
17538 g_variant_unref (_ret);
17539_out:
17540 return _ret != NULL;
17541}
17542
17543/**
17544 * watchdog_complete_start:
17545 * @object: A #Watchdog.
17546 * @invocation: (transfer full): A #GDBusMethodInvocation.
17547 *
17548 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</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.
17549 *
17550 * This method will free @invocation, you cannot use it afterwards.
17551 */
17552void
17553watchdog_complete_start (
17554 Watchdog *object,
17555 GDBusMethodInvocation *invocation)
17556{
17557 g_dbus_method_invocation_return_value (invocation,
17558 g_variant_new ("()"));
17559}
17560
17561/**
17562 * watchdog_complete_poke:
17563 * @object: A #Watchdog.
17564 * @invocation: (transfer full): A #GDBusMethodInvocation.
17565 *
17566 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</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.
17567 *
17568 * This method will free @invocation, you cannot use it afterwards.
17569 */
17570void
17571watchdog_complete_poke (
17572 Watchdog *object,
17573 GDBusMethodInvocation *invocation)
17574{
17575 g_dbus_method_invocation_return_value (invocation,
17576 g_variant_new ("()"));
17577}
17578
17579/**
17580 * watchdog_complete_stop:
17581 * @object: A #Watchdog.
17582 * @invocation: (transfer full): A #GDBusMethodInvocation.
17583 *
17584 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</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.
17585 *
17586 * This method will free @invocation, you cannot use it afterwards.
17587 */
17588void
17589watchdog_complete_stop (
17590 Watchdog *object,
17591 GDBusMethodInvocation *invocation)
17592{
17593 g_dbus_method_invocation_return_value (invocation,
17594 g_variant_new ("()"));
17595}
17596
17597/* ------------------------------------------------------------------------ */
17598
17599/**
17600 * WatchdogProxy:
17601 *
17602 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
17603 */
17604
17605/**
17606 * WatchdogProxyClass:
17607 * @parent_class: The parent class.
17608 *
17609 * Class structure for #WatchdogProxy.
17610 */
17611
17612struct _WatchdogProxyPrivate
17613{
17614 GData *qdata;
17615};
17616
17617static void watchdog_proxy_iface_init (WatchdogIface *iface);
17618
17619#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17620G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
17621 G_ADD_PRIVATE (WatchdogProxy)
17622 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
17623
17624#else
17625G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
17626 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
17627
17628#endif
17629static void
17630watchdog_proxy_finalize (GObject *object)
17631{
17632 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
17633 g_datalist_clear (&proxy->priv->qdata);
17634 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
17635}
17636
17637static void
17638watchdog_proxy_get_property (GObject *object,
17639 guint prop_id,
17640 GValue *value,
17641 GParamSpec *pspec G_GNUC_UNUSED)
17642{
17643 const _ExtendedGDBusPropertyInfo *info;
17644 GVariant *variant;
17645 g_assert (prop_id != 0 && prop_id - 1 < 2);
17646 info = _watchdog_property_info_pointers[prop_id - 1];
17647 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
17648 if (info->use_gvariant)
17649 {
17650 g_value_set_variant (value, variant);
17651 }
17652 else
17653 {
17654 if (variant != NULL)
17655 g_dbus_gvariant_to_gvalue (variant, value);
17656 }
17657 if (variant != NULL)
17658 g_variant_unref (variant);
17659}
17660
17661static void
17662watchdog_proxy_set_property_cb (GDBusProxy *proxy,
17663 GAsyncResult *res,
17664 gpointer user_data)
17665{
17666 const _ExtendedGDBusPropertyInfo *info = user_data;
17667 GError *error;
17668 GVariant *_ret;
17669 error = NULL;
17670 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
17671 if (!_ret)
17672 {
17673 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
17674 info->parent_struct.name,
17675 error->message, g_quark_to_string (error->domain), error->code);
17676 g_error_free (error);
17677 }
17678 else
17679 {
17680 g_variant_unref (_ret);
17681 }
17682}
17683
17684static void
17685watchdog_proxy_set_property (GObject *object,
17686 guint prop_id,
17687 const GValue *value,
17688 GParamSpec *pspec G_GNUC_UNUSED)
17689{
17690 const _ExtendedGDBusPropertyInfo *info;
17691 GVariant *variant;
17692 g_assert (prop_id != 0 && prop_id - 1 < 2);
17693 info = _watchdog_property_info_pointers[prop_id - 1];
17694 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
17695 g_dbus_proxy_call (G_DBUS_PROXY (object),
17696 "org.freedesktop.DBus.Properties.Set",
17697 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
17698 G_DBUS_CALL_FLAGS_NONE,
17699 -1,
17700 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
17701 g_variant_unref (variant);
17702}
17703
17704static void
17705watchdog_proxy_g_signal (GDBusProxy *proxy,
17706 const gchar *sender_name G_GNUC_UNUSED,
17707 const gchar *signal_name,
17708 GVariant *parameters)
17709{
17710 _ExtendedGDBusSignalInfo *info;
17711 GVariantIter iter;
17712 GVariant *child;
17713 GValue *paramv;
17714 guint num_params;
17715 guint n;
17716 guint signal_id;
17717 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
17718 if (info == NULL)
17719 return;
17720 num_params = g_variant_n_children (parameters);
17721 paramv = g_new0 (GValue, num_params + 1);
17722 g_value_init (&paramv[0], TYPE_WATCHDOG);
17723 g_value_set_object (&paramv[0], proxy);
17724 g_variant_iter_init (&iter, parameters);
17725 n = 1;
17726 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17727 {
17728 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
17729 if (arg_info->use_gvariant)
17730 {
17731 g_value_init (&paramv[n], G_TYPE_VARIANT);
17732 g_value_set_variant (&paramv[n], child);
17733 n++;
17734 }
17735 else
17736 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17737 g_variant_unref (child);
17738 }
17739 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
17740 g_signal_emitv (paramv, signal_id, 0, NULL);
17741 for (n = 0; n < num_params + 1; n++)
17742 g_value_unset (&paramv[n]);
17743 g_free (paramv);
17744}
17745
17746static void
17747watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
17748 GVariant *changed_properties,
17749 const gchar *const *invalidated_properties)
17750{
17751 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
17752 guint n;
17753 const gchar *key;
17754 GVariantIter *iter;
17755 _ExtendedGDBusPropertyInfo *info;
17756 g_variant_get (changed_properties, "a{sv}", &iter);
17757 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
17758 {
17759 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
17760 g_datalist_remove_data (&proxy->priv->qdata, key);
17761 if (info != NULL)
17762 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17763 }
17764 g_variant_iter_free (iter);
17765 for (n = 0; invalidated_properties[n] != NULL; n++)
17766 {
17767 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
17768 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
17769 if (info != NULL)
17770 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17771 }
17772}
17773
17774static gint
17775watchdog_proxy_get_watchdog (Watchdog *object)
17776{
17777 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
17778 GVariant *variant;
17779 gint value = 0;
17780 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
17781 if (variant != NULL)
17782 {
17783 value = g_variant_get_int32 (variant);
17784 g_variant_unref (variant);
17785 }
17786 return value;
17787}
17788
17789static gint
17790watchdog_proxy_get_poll_interval (Watchdog *object)
17791{
17792 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
17793 GVariant *variant;
17794 gint value = 0;
17795 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
17796 if (variant != NULL)
17797 {
17798 value = g_variant_get_int32 (variant);
17799 g_variant_unref (variant);
17800 }
17801 return value;
17802}
17803
17804static void
17805watchdog_proxy_init (WatchdogProxy *proxy)
17806{
17807#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17808 proxy->priv = watchdog_proxy_get_instance_private (proxy);
17809#else
17810 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
17811#endif
17812
17813 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
17814}
17815
17816static void
17817watchdog_proxy_class_init (WatchdogProxyClass *klass)
17818{
17819 GObjectClass *gobject_class;
17820 GDBusProxyClass *proxy_class;
17821
17822 gobject_class = G_OBJECT_CLASS (klass);
17823 gobject_class->finalize = watchdog_proxy_finalize;
17824 gobject_class->get_property = watchdog_proxy_get_property;
17825 gobject_class->set_property = watchdog_proxy_set_property;
17826
17827 proxy_class = G_DBUS_PROXY_CLASS (klass);
17828 proxy_class->g_signal = watchdog_proxy_g_signal;
17829 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
17830
17831 watchdog_override_properties (gobject_class, 1);
17832
17833#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17834 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
17835#endif
17836}
17837
17838static void
17839watchdog_proxy_iface_init (WatchdogIface *iface)
17840{
17841 iface->get_watchdog = watchdog_proxy_get_watchdog;
17842 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
17843}
17844
17845/**
17846 * watchdog_proxy_new:
17847 * @connection: A #GDBusConnection.
17848 * @flags: Flags from the #GDBusProxyFlags enumeration.
17849 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17850 * @object_path: An object path.
17851 * @cancellable: (allow-none): A #GCancellable or %NULL.
17852 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17853 * @user_data: User data to pass to @callback.
17854 *
17855 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new() for more details.
17856 *
17857 * 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.
17858 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
17859 *
17860 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
17861 */
17862void
17863watchdog_proxy_new (
17864 GDBusConnection *connection,
17865 GDBusProxyFlags flags,
17866 const gchar *name,
17867 const gchar *object_path,
17868 GCancellable *cancellable,
17869 GAsyncReadyCallback callback,
17870 gpointer user_data)
17871{
17872 g_async_initable_new_async (TYPE_WATCHDOG_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.Watchdog", NULL);
17873}
17874
17875/**
17876 * watchdog_proxy_new_finish:
17877 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
17878 * @error: Return location for error or %NULL
17879 *
17880 * Finishes an operation started with watchdog_proxy_new().
17881 *
17882 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17883 */
17884Watchdog *
17885watchdog_proxy_new_finish (
17886 GAsyncResult *res,
17887 GError **error)
17888{
17889 GObject *ret;
17890 GObject *source_object;
17891 source_object = g_async_result_get_source_object (res);
17892 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17893 g_object_unref (source_object);
17894 if (ret != NULL)
17895 return WATCHDOG (ret);
17896 else
17897 return NULL;
17898}
17899
17900/**
17901 * watchdog_proxy_new_sync:
17902 * @connection: A #GDBusConnection.
17903 * @flags: Flags from the #GDBusProxyFlags enumeration.
17904 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17905 * @object_path: An object path.
17906 * @cancellable: (allow-none): A #GCancellable or %NULL.
17907 * @error: Return location for error or %NULL
17908 *
17909 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new_sync() for more details.
17910 *
17911 * The calling thread is blocked until a reply is received.
17912 *
17913 * See watchdog_proxy_new() for the asynchronous version of this constructor.
17914 *
17915 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17916 */
17917Watchdog *
17918watchdog_proxy_new_sync (
17919 GDBusConnection *connection,
17920 GDBusProxyFlags flags,
17921 const gchar *name,
17922 const gchar *object_path,
17923 GCancellable *cancellable,
17924 GError **error)
17925{
17926 GInitable *ret;
17927 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
17928 if (ret != NULL)
17929 return WATCHDOG (ret);
17930 else
17931 return NULL;
17932}
17933
17934
17935/**
17936 * watchdog_proxy_new_for_bus:
17937 * @bus_type: A #GBusType.
17938 * @flags: Flags from the #GDBusProxyFlags enumeration.
17939 * @name: A bus name (well-known or unique).
17940 * @object_path: An object path.
17941 * @cancellable: (allow-none): A #GCancellable or %NULL.
17942 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17943 * @user_data: User data to pass to @callback.
17944 *
17945 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17946 *
17947 * 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.
17948 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
17949 *
17950 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17951 */
17952void
17953watchdog_proxy_new_for_bus (
17954 GBusType bus_type,
17955 GDBusProxyFlags flags,
17956 const gchar *name,
17957 const gchar *object_path,
17958 GCancellable *cancellable,
17959 GAsyncReadyCallback callback,
17960 gpointer user_data)
17961{
17962 g_async_initable_new_async (TYPE_WATCHDOG_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.Watchdog", NULL);
17963}
17964
17965/**
17966 * watchdog_proxy_new_for_bus_finish:
17967 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
17968 * @error: Return location for error or %NULL
17969 *
17970 * Finishes an operation started with watchdog_proxy_new_for_bus().
17971 *
17972 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
17973 */
17974Watchdog *
17975watchdog_proxy_new_for_bus_finish (
17976 GAsyncResult *res,
17977 GError **error)
17978{
17979 GObject *ret;
17980 GObject *source_object;
17981 source_object = g_async_result_get_source_object (res);
17982 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17983 g_object_unref (source_object);
17984 if (ret != NULL)
17985 return WATCHDOG (ret);
17986 else
17987 return NULL;
17988}
17989
17990/**
17991 * watchdog_proxy_new_for_bus_sync:
17992 * @bus_type: A #GBusType.
17993 * @flags: Flags from the #GDBusProxyFlags enumeration.
17994 * @name: A bus name (well-known or unique).
17995 * @object_path: An object path.
17996 * @cancellable: (allow-none): A #GCancellable or %NULL.
17997 * @error: Return location for error or %NULL
17998 *
17999 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18000 *
18001 * The calling thread is blocked until a reply is received.
18002 *
18003 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
18004 *
18005 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18006 */
18007Watchdog *
18008watchdog_proxy_new_for_bus_sync (
18009 GBusType bus_type,
18010 GDBusProxyFlags flags,
18011 const gchar *name,
18012 const gchar *object_path,
18013 GCancellable *cancellable,
18014 GError **error)
18015{
18016 GInitable *ret;
18017 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
18018 if (ret != NULL)
18019 return WATCHDOG (ret);
18020 else
18021 return NULL;
18022}
18023
18024
18025/* ------------------------------------------------------------------------ */
18026
18027/**
18028 * WatchdogSkeleton:
18029 *
18030 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
18031 */
18032
18033/**
18034 * WatchdogSkeletonClass:
18035 * @parent_class: The parent class.
18036 *
18037 * Class structure for #WatchdogSkeleton.
18038 */
18039
18040struct _WatchdogSkeletonPrivate
18041{
18042 GValue *properties;
18043 GList *changed_properties;
18044 GSource *changed_properties_idle_source;
18045 GMainContext *context;
18046 GMutex lock;
18047};
18048
18049static void
18050_watchdog_skeleton_handle_method_call (
18051 GDBusConnection *connection G_GNUC_UNUSED,
18052 const gchar *sender G_GNUC_UNUSED,
18053 const gchar *object_path G_GNUC_UNUSED,
18054 const gchar *interface_name,
18055 const gchar *method_name,
18056 GVariant *parameters,
18057 GDBusMethodInvocation *invocation,
18058 gpointer user_data)
18059{
18060 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
18061 _ExtendedGDBusMethodInfo *info;
18062 GVariantIter iter;
18063 GVariant *child;
18064 GValue *paramv;
18065 guint num_params;
18066 guint num_extra;
18067 guint n;
18068 guint signal_id;
18069 GValue return_value = G_VALUE_INIT;
18070 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18071 g_assert (info != NULL);
18072 num_params = g_variant_n_children (parameters);
18073 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18074 n = 0;
18075 g_value_init (&paramv[n], TYPE_WATCHDOG);
18076 g_value_set_object (&paramv[n++], skeleton);
18077 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18078 g_value_set_object (&paramv[n++], invocation);
18079 if (info->pass_fdlist)
18080 {
18081#ifdef G_OS_UNIX
18082 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18083 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18084#else
18085 g_assert_not_reached ();
18086#endif
18087 }
18088 g_variant_iter_init (&iter, parameters);
18089 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18090 {
18091 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18092 if (arg_info->use_gvariant)
18093 {
18094 g_value_init (&paramv[n], G_TYPE_VARIANT);
18095 g_value_set_variant (&paramv[n], child);
18096 n++;
18097 }
18098 else
18099 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18100 g_variant_unref (child);
18101 }
18102 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
18103 g_value_init (&return_value, G_TYPE_BOOLEAN);
18104 g_signal_emitv (paramv, signal_id, 0, &return_value);
18105 if (!g_value_get_boolean (&return_value))
18106 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);
18107 g_value_unset (&return_value);
18108 for (n = 0; n < num_params + num_extra; n++)
18109 g_value_unset (&paramv[n]);
18110 g_free (paramv);
18111}
18112
18113static GVariant *
18114_watchdog_skeleton_handle_get_property (
18115 GDBusConnection *connection G_GNUC_UNUSED,
18116 const gchar *sender G_GNUC_UNUSED,
18117 const gchar *object_path G_GNUC_UNUSED,
18118 const gchar *interface_name G_GNUC_UNUSED,
18119 const gchar *property_name,
18120 GError **error,
18121 gpointer user_data)
18122{
18123 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
18124 GValue value = G_VALUE_INIT;
18125 GParamSpec *pspec;
18126 _ExtendedGDBusPropertyInfo *info;
18127 GVariant *ret;
18128 ret = NULL;
18129 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
18130 g_assert (info != NULL);
18131 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18132 if (pspec == NULL)
18133 {
18134 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18135 }
18136 else
18137 {
18138 g_value_init (&value, pspec->value_type);
18139 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18140 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18141 g_value_unset (&value);
18142 }
18143 return ret;
18144}
18145
18146static gboolean
18147_watchdog_skeleton_handle_set_property (
18148 GDBusConnection *connection G_GNUC_UNUSED,
18149 const gchar *sender G_GNUC_UNUSED,
18150 const gchar *object_path G_GNUC_UNUSED,
18151 const gchar *interface_name G_GNUC_UNUSED,
18152 const gchar *property_name,
18153 GVariant *variant,
18154 GError **error,
18155 gpointer user_data)
18156{
18157 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
18158 GValue value = G_VALUE_INIT;
18159 GParamSpec *pspec;
18160 _ExtendedGDBusPropertyInfo *info;
18161 gboolean ret;
18162 ret = FALSE;
18163 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
18164 g_assert (info != NULL);
18165 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18166 if (pspec == NULL)
18167 {
18168 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18169 }
18170 else
18171 {
18172 if (info->use_gvariant)
18173 g_value_set_variant (&value, variant);
18174 else
18175 g_dbus_gvariant_to_gvalue (variant, &value);
18176 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18177 g_value_unset (&value);
18178 ret = TRUE;
18179 }
18180 return ret;
18181}
18182
18183static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
18184{
18185 _watchdog_skeleton_handle_method_call,
18186 _watchdog_skeleton_handle_get_property,
18187 _watchdog_skeleton_handle_set_property,
18188 {NULL}
18189};
18190
18191static GDBusInterfaceInfo *
18192watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18193{
18194 return watchdog_interface_info ();
18195}
18196
18197static GDBusInterfaceVTable *
18198watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18199{
18200 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
18201}
18202
18203static GVariant *
18204watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18205{
18206 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
18207
18208 GVariantBuilder builder;
18209 guint n;
18210 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18211 if (_watchdog_interface_info.parent_struct.properties == NULL)
18212 goto out;
18213 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
18214 {
18215 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
18216 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18217 {
18218 GVariant *value;
18219 value = _watchdog_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.Watchdog", info->name, NULL, skeleton);
18220 if (value != NULL)
18221 {
18222 g_variant_take_ref (value);
18223 g_variant_builder_add (&builder, "{sv}", info->name, value);
18224 g_variant_unref (value);
18225 }
18226 }
18227 }
18228out:
18229 return g_variant_builder_end (&builder);
18230}
18231
18232static gboolean _watchdog_emit_changed (gpointer user_data);
18233
18234static void
18235watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18236{
18237 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
18238 gboolean emit_changed = FALSE;
18239
18240 g_mutex_lock (&skeleton->priv->lock);
18241 if (skeleton->priv->changed_properties_idle_source != NULL)
18242 {
18243 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18244 skeleton->priv->changed_properties_idle_source = NULL;
18245 emit_changed = TRUE;
18246 }
18247 g_mutex_unlock (&skeleton->priv->lock);
18248
18249 if (emit_changed)
18250 _watchdog_emit_changed (skeleton);
18251}
18252
18253static void
18254_watchdog_on_signal_watchdog_error (
18255 Watchdog *object)
18256{
18257 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18258
18259 GList *connections, *l;
18260 GVariant *signal_variant;
18261 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18262
18263 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18264 for (l = connections; l != NULL; l = l->next)
18265 {
18266 GDBusConnection *connection = l->data;
18267 g_dbus_connection_emit_signal (connection,
18268 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
18269 signal_variant, NULL);
18270 }
18271 g_variant_unref (signal_variant);
18272 g_list_free_full (connections, g_object_unref);
18273}
18274
18275static void watchdog_skeleton_iface_init (WatchdogIface *iface);
18276#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18277G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18278 G_ADD_PRIVATE (WatchdogSkeleton)
18279 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
18280
18281#else
18282G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18283 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
18284
18285#endif
18286static void
18287watchdog_skeleton_finalize (GObject *object)
18288{
18289 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18290 guint n;
18291 for (n = 0; n < 2; n++)
18292 g_value_unset (&skeleton->priv->properties[n]);
18293 g_free (skeleton->priv->properties);
18294 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18295 if (skeleton->priv->changed_properties_idle_source != NULL)
18296 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18297 g_main_context_unref (skeleton->priv->context);
18298 g_mutex_clear (&skeleton->priv->lock);
18299 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
18300}
18301
18302static void
18303watchdog_skeleton_get_property (GObject *object,
18304 guint prop_id,
18305 GValue *value,
18306 GParamSpec *pspec G_GNUC_UNUSED)
18307{
18308 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18309 g_assert (prop_id != 0 && prop_id - 1 < 2);
18310 g_mutex_lock (&skeleton->priv->lock);
18311 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
18312 g_mutex_unlock (&skeleton->priv->lock);
18313}
18314
18315static gboolean
18316_watchdog_emit_changed (gpointer user_data)
18317{
18318 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
18319 GList *l;
18320 GVariantBuilder builder;
18321 GVariantBuilder invalidated_builder;
18322 guint num_changes;
18323
18324 g_mutex_lock (&skeleton->priv->lock);
18325 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18326 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
18327 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
18328 {
18329 ChangedProperty *cp = l->data;
18330 GVariant *variant;
18331 const GValue *cur_value;
18332
18333 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
18334 if (!_g_value_equal (cur_value, &cp->orig_value))
18335 {
18336 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
18337 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
18338 g_variant_unref (variant);
18339 num_changes++;
18340 }
18341 }
18342 if (num_changes > 0)
18343 {
18344 GList *connections, *ll;
18345 GVariant *signal_variant;
18346 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
18347 &builder, &invalidated_builder));
18348 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18349 for (ll = connections; ll != NULL; ll = ll->next)
18350 {
18351 GDBusConnection *connection = ll->data;
18352
18353 g_dbus_connection_emit_signal (connection,
18354 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
18355 "org.freedesktop.DBus.Properties",
18356 "PropertiesChanged",
18357 signal_variant,
18358 NULL);
18359 }
18360 g_variant_unref (signal_variant);
18361 g_list_free_full (connections, g_object_unref);
18362 }
18363 else
18364 {
18365 g_variant_builder_clear (&builder);
18366 g_variant_builder_clear (&invalidated_builder);
18367 }
18368 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18369 skeleton->priv->changed_properties = NULL;
18370 skeleton->priv->changed_properties_idle_source = NULL;
18371 g_mutex_unlock (&skeleton->priv->lock);
18372 return FALSE;
18373}
18374
18375static void
18376_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
18377{
18378 ChangedProperty *cp;
18379 GList *l;
18380 cp = NULL;
18381 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
18382 {
18383 ChangedProperty *i_cp = l->data;
18384 if (i_cp->info == info)
18385 {
18386 cp = i_cp;
18387 break;
18388 }
18389 }
18390 if (cp == NULL)
18391 {
18392 cp = g_new0 (ChangedProperty, 1);
18393 cp->prop_id = prop_id;
18394 cp->info = info;
18395 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
18396 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
18397 g_value_copy (orig_value, &cp->orig_value);
18398 }
18399}
18400
18401static void
18402watchdog_skeleton_notify (GObject *object,
18403 GParamSpec *pspec G_GNUC_UNUSED)
18404{
18405 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18406 g_mutex_lock (&skeleton->priv->lock);
18407 if (skeleton->priv->changed_properties != NULL &&
18408 skeleton->priv->changed_properties_idle_source == NULL)
18409 {
18410 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
18411 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
18412 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
18413 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
18414 g_source_unref (skeleton->priv->changed_properties_idle_source);
18415 }
18416 g_mutex_unlock (&skeleton->priv->lock);
18417}
18418
18419static void
18420watchdog_skeleton_set_property (GObject *object,
18421 guint prop_id,
18422 const GValue *value,
18423 GParamSpec *pspec)
18424{
18425 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18426 g_assert (prop_id != 0 && prop_id - 1 < 2);
18427 g_mutex_lock (&skeleton->priv->lock);
18428 g_object_freeze_notify (object);
18429 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
18430 {
18431 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
18432 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
18433 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
18434 g_object_notify_by_pspec (object, pspec);
18435 }
18436 g_mutex_unlock (&skeleton->priv->lock);
18437 g_object_thaw_notify (object);
18438}
18439
18440static void
18441watchdog_skeleton_init (WatchdogSkeleton *skeleton)
18442{
18443#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18444 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
18445#else
18446 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
18447#endif
18448
18449 g_mutex_init (&skeleton->priv->lock);
18450 skeleton->priv->context = g_main_context_ref_thread_default ();
18451 skeleton->priv->properties = g_new0 (GValue, 2);
18452 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
18453 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
18454}
18455
18456static gint
18457watchdog_skeleton_get_watchdog (Watchdog *object)
18458{
18459 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18460 gint value;
18461 g_mutex_lock (&skeleton->priv->lock);
18462 value = g_value_get_int (&(skeleton->priv->properties[0]));
18463 g_mutex_unlock (&skeleton->priv->lock);
18464 return value;
18465}
18466
18467static gint
18468watchdog_skeleton_get_poll_interval (Watchdog *object)
18469{
18470 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18471 gint value;
18472 g_mutex_lock (&skeleton->priv->lock);
18473 value = g_value_get_int (&(skeleton->priv->properties[1]));
18474 g_mutex_unlock (&skeleton->priv->lock);
18475 return value;
18476}
18477
18478static void
18479watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
18480{
18481 GObjectClass *gobject_class;
18482 GDBusInterfaceSkeletonClass *skeleton_class;
18483
18484 gobject_class = G_OBJECT_CLASS (klass);
18485 gobject_class->finalize = watchdog_skeleton_finalize;
18486 gobject_class->get_property = watchdog_skeleton_get_property;
18487 gobject_class->set_property = watchdog_skeleton_set_property;
18488 gobject_class->notify = watchdog_skeleton_notify;
18489
18490
18491 watchdog_override_properties (gobject_class, 1);
18492
18493 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18494 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
18495 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
18496 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
18497 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
18498
18499#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18500 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
18501#endif
18502}
18503
18504static void
18505watchdog_skeleton_iface_init (WatchdogIface *iface)
18506{
18507 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
18508 iface->get_watchdog = watchdog_skeleton_get_watchdog;
18509 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
18510}
18511
18512/**
18513 * watchdog_skeleton_new:
18514 *
18515 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18516 *
18517 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
18518 */
18519Watchdog *
18520watchdog_skeleton_new (void)
18521{
18522 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
18523}
18524
18525/* ------------------------------------------------------------------------
18526 * Code for interface org.openbmc.EventLog
18527 * ------------------------------------------------------------------------
18528 */
18529
18530/**
18531 * SECTION:EventLog
18532 * @title: EventLog
18533 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
18534 *
18535 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface in C.
18536 */
18537
18538/* ---- Introspection data for org.openbmc.EventLog ---- */
18539
Norman James2d1ee892015-09-16 23:13:45 -050018540static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
18541{
18542 {
18543 -1,
18544 (gchar *) "log",
18545 (gchar *) "a(s)",
18546 NULL
18547 },
18548 FALSE
18549};
18550
18551static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
18552{
18553 &_event_log_method_info_get_event_log_OUT_ARG_log,
18554 NULL
18555};
18556
18557static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
18558{
18559 {
18560 -1,
18561 (gchar *) "getEventLog",
18562 NULL,
18563 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
18564 NULL
18565 },
18566 "handle-get-event-log",
18567 FALSE
18568};
18569
18570static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
18571{
18572 &_event_log_method_info_get_event_log,
18573 NULL
18574};
18575
Norman James8abb50c2015-09-16 10:58:16 -050018576static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050018577{
18578 {
18579 -1,
Norman James8abb50c2015-09-16 10:58:16 -050018580 (gchar *) "priority",
18581 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050018582 NULL
18583 },
18584 FALSE
18585};
18586
Norman James362a80f2015-09-14 14:04:39 -050018587static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
18588{
18589 {
18590 -1,
18591 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050018592 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050018593 NULL
18594 },
18595 FALSE
18596};
18597
Norman James88872672015-09-21 16:51:35 -050018598static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
18599{
18600 {
18601 -1,
18602 (gchar *) "rc",
18603 (gchar *) "i",
18604 NULL
18605 },
18606 FALSE
18607};
18608
Norman James362a80f2015-09-14 14:04:39 -050018609static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
18610{
Norman James8abb50c2015-09-16 10:58:16 -050018611 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050018612 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050018613 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050018614 NULL
18615};
18616
18617static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
18618{
18619 {
18620 -1,
18621 (gchar *) "EventLog",
18622 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
18623 NULL
18624 },
18625 "event-log"
18626};
18627
18628static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
18629{
18630 &_event_log_signal_info_event_log,
18631 NULL
18632};
18633
Norman James362a80f2015-09-14 14:04:39 -050018634static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
18635{
18636 {
18637 -1,
18638 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050018639 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050018640 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050018641 NULL,
Norman James362a80f2015-09-14 14:04:39 -050018642 NULL
18643 },
18644 "event-log",
18645};
18646
18647
18648/**
18649 * event_log_interface_info:
18650 *
18651 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
18652 *
18653 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18654 */
18655GDBusInterfaceInfo *
18656event_log_interface_info (void)
18657{
18658 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
18659}
18660
18661/**
18662 * event_log_override_properties:
18663 * @klass: The class structure for a #GObject<!-- -->-derived class.
18664 * @property_id_begin: The property id to assign to the first overridden property.
18665 *
18666 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
18667 * The properties are overridden in the order they are defined.
18668 *
18669 * Returns: The last property id.
18670 */
18671guint
18672event_log_override_properties (GObjectClass *klass, guint property_id_begin)
18673{
Norman James362a80f2015-09-14 14:04:39 -050018674 return property_id_begin - 1;
18675}
18676
18677
18678
18679/**
18680 * EventLog:
18681 *
18682 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18683 */
18684
18685/**
18686 * EventLogIface:
18687 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050018688 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050018689 * @event_log: Handler for the #EventLog::event-log signal.
18690 *
18691 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
18692 */
18693
18694typedef EventLogIface EventLogInterface;
18695G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
18696
18697static void
18698event_log_default_init (EventLogIface *iface)
18699{
Norman James2d1ee892015-09-16 23:13:45 -050018700 /* GObject signals for incoming D-Bus method calls: */
18701 /**
18702 * EventLog::handle-get-event-log:
18703 * @object: A #EventLog.
18704 * @invocation: A #GDBusMethodInvocation.
18705 *
18706 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
18707 *
18708 * 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 event_log_complete_get_event_log() 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.
18709 *
18710 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18711 */
18712 g_signal_new ("handle-get-event-log",
18713 G_TYPE_FROM_INTERFACE (iface),
18714 G_SIGNAL_RUN_LAST,
18715 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
18716 g_signal_accumulator_true_handled,
18717 NULL,
18718 g_cclosure_marshal_generic,
18719 G_TYPE_BOOLEAN,
18720 1,
18721 G_TYPE_DBUS_METHOD_INVOCATION);
18722
Norman James362a80f2015-09-14 14:04:39 -050018723 /* GObject signals for received D-Bus signals: */
18724 /**
18725 * EventLog::event-log:
18726 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050018727 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050018728 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050018729 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050018730 *
18731 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> is received.
18732 *
18733 * 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.
18734 */
18735 g_signal_new ("event-log",
18736 G_TYPE_FROM_INTERFACE (iface),
18737 G_SIGNAL_RUN_LAST,
18738 G_STRUCT_OFFSET (EventLogIface, event_log),
18739 NULL,
18740 NULL,
18741 g_cclosure_marshal_generic,
18742 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050018743 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050018744
Norman James362a80f2015-09-14 14:04:39 -050018745}
18746
18747/**
18748 * event_log_emit_event_log:
18749 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050018750 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050018751 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050018752 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050018753 *
18754 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
18755 */
18756void
18757event_log_emit_event_log (
18758 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050018759 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050018760 const gchar *arg_message,
18761 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050018762{
Norman James88872672015-09-21 16:51:35 -050018763 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050018764}
18765
Norman James2d1ee892015-09-16 23:13:45 -050018766/**
18767 * event_log_call_get_event_log:
18768 * @proxy: A #EventLogProxy.
18769 * @cancellable: (allow-none): A #GCancellable or %NULL.
18770 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18771 * @user_data: User data to pass to @callback.
18772 *
18773 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
18774 * 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.
18775 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
18776 *
18777 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
18778 */
18779void
18780event_log_call_get_event_log (
18781 EventLog *proxy,
18782 GCancellable *cancellable,
18783 GAsyncReadyCallback callback,
18784 gpointer user_data)
18785{
18786 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18787 "getEventLog",
18788 g_variant_new ("()"),
18789 G_DBUS_CALL_FLAGS_NONE,
18790 -1,
18791 cancellable,
18792 callback,
18793 user_data);
18794}
18795
18796/**
18797 * event_log_call_get_event_log_finish:
18798 * @proxy: A #EventLogProxy.
18799 * @out_log: (out): Return location for return parameter or %NULL to ignore.
18800 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
18801 * @error: Return location for error or %NULL.
18802 *
18803 * Finishes an operation started with event_log_call_get_event_log().
18804 *
18805 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18806 */
18807gboolean
18808event_log_call_get_event_log_finish (
18809 EventLog *proxy,
18810 GVariant **out_log,
18811 GAsyncResult *res,
18812 GError **error)
18813{
18814 GVariant *_ret;
18815 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18816 if (_ret == NULL)
18817 goto _out;
18818 g_variant_get (_ret,
18819 "(@a(s))",
18820 out_log);
18821 g_variant_unref (_ret);
18822_out:
18823 return _ret != NULL;
18824}
18825
18826/**
18827 * event_log_call_get_event_log_sync:
18828 * @proxy: A #EventLogProxy.
18829 * @out_log: (out): Return location for return parameter or %NULL to ignore.
18830 * @cancellable: (allow-none): A #GCancellable or %NULL.
18831 * @error: Return location for error or %NULL.
18832 *
18833 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
18834 *
18835 * See event_log_call_get_event_log() for the asynchronous version of this method.
18836 *
18837 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18838 */
18839gboolean
18840event_log_call_get_event_log_sync (
18841 EventLog *proxy,
18842 GVariant **out_log,
18843 GCancellable *cancellable,
18844 GError **error)
18845{
18846 GVariant *_ret;
18847 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18848 "getEventLog",
18849 g_variant_new ("()"),
18850 G_DBUS_CALL_FLAGS_NONE,
18851 -1,
18852 cancellable,
18853 error);
18854 if (_ret == NULL)
18855 goto _out;
18856 g_variant_get (_ret,
18857 "(@a(s))",
18858 out_log);
18859 g_variant_unref (_ret);
18860_out:
18861 return _ret != NULL;
18862}
18863
18864/**
18865 * event_log_complete_get_event_log:
18866 * @object: A #EventLog.
18867 * @invocation: (transfer full): A #GDBusMethodInvocation.
18868 * @log: Parameter to return.
18869 *
18870 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</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.
18871 *
18872 * This method will free @invocation, you cannot use it afterwards.
18873 */
18874void
18875event_log_complete_get_event_log (
18876 EventLog *object,
18877 GDBusMethodInvocation *invocation,
18878 GVariant *log)
18879{
18880 g_dbus_method_invocation_return_value (invocation,
18881 g_variant_new ("(@a(s))",
18882 log));
18883}
18884
Norman James362a80f2015-09-14 14:04:39 -050018885/* ------------------------------------------------------------------------ */
18886
18887/**
18888 * EventLogProxy:
18889 *
18890 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
18891 */
18892
18893/**
18894 * EventLogProxyClass:
18895 * @parent_class: The parent class.
18896 *
18897 * Class structure for #EventLogProxy.
18898 */
18899
18900struct _EventLogProxyPrivate
18901{
18902 GData *qdata;
18903};
18904
18905static void event_log_proxy_iface_init (EventLogIface *iface);
18906
18907#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18908G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
18909 G_ADD_PRIVATE (EventLogProxy)
18910 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
18911
18912#else
18913G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
18914 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
18915
18916#endif
18917static void
18918event_log_proxy_finalize (GObject *object)
18919{
18920 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
18921 g_datalist_clear (&proxy->priv->qdata);
18922 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
18923}
18924
18925static void
18926event_log_proxy_get_property (GObject *object,
18927 guint prop_id,
18928 GValue *value,
18929 GParamSpec *pspec G_GNUC_UNUSED)
18930{
Norman James362a80f2015-09-14 14:04:39 -050018931}
18932
18933static void
18934event_log_proxy_set_property (GObject *object,
18935 guint prop_id,
18936 const GValue *value,
18937 GParamSpec *pspec G_GNUC_UNUSED)
18938{
Norman James362a80f2015-09-14 14:04:39 -050018939}
18940
18941static void
18942event_log_proxy_g_signal (GDBusProxy *proxy,
18943 const gchar *sender_name G_GNUC_UNUSED,
18944 const gchar *signal_name,
18945 GVariant *parameters)
18946{
18947 _ExtendedGDBusSignalInfo *info;
18948 GVariantIter iter;
18949 GVariant *child;
18950 GValue *paramv;
18951 guint num_params;
18952 guint n;
18953 guint signal_id;
18954 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
18955 if (info == NULL)
18956 return;
18957 num_params = g_variant_n_children (parameters);
18958 paramv = g_new0 (GValue, num_params + 1);
18959 g_value_init (&paramv[0], TYPE_EVENT_LOG);
18960 g_value_set_object (&paramv[0], proxy);
18961 g_variant_iter_init (&iter, parameters);
18962 n = 1;
18963 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18964 {
18965 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18966 if (arg_info->use_gvariant)
18967 {
18968 g_value_init (&paramv[n], G_TYPE_VARIANT);
18969 g_value_set_variant (&paramv[n], child);
18970 n++;
18971 }
18972 else
18973 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18974 g_variant_unref (child);
18975 }
18976 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
18977 g_signal_emitv (paramv, signal_id, 0, NULL);
18978 for (n = 0; n < num_params + 1; n++)
18979 g_value_unset (&paramv[n]);
18980 g_free (paramv);
18981}
18982
18983static void
18984event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
18985 GVariant *changed_properties,
18986 const gchar *const *invalidated_properties)
18987{
18988 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
18989 guint n;
18990 const gchar *key;
18991 GVariantIter *iter;
18992 _ExtendedGDBusPropertyInfo *info;
18993 g_variant_get (changed_properties, "a{sv}", &iter);
18994 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18995 {
18996 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
18997 g_datalist_remove_data (&proxy->priv->qdata, key);
18998 if (info != NULL)
18999 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19000 }
19001 g_variant_iter_free (iter);
19002 for (n = 0; invalidated_properties[n] != NULL; n++)
19003 {
19004 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
19005 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19006 if (info != NULL)
19007 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19008 }
19009}
19010
Norman James362a80f2015-09-14 14:04:39 -050019011static void
19012event_log_proxy_init (EventLogProxy *proxy)
19013{
19014#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19015 proxy->priv = event_log_proxy_get_instance_private (proxy);
19016#else
19017 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
19018#endif
19019
19020 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
19021}
19022
19023static void
19024event_log_proxy_class_init (EventLogProxyClass *klass)
19025{
19026 GObjectClass *gobject_class;
19027 GDBusProxyClass *proxy_class;
19028
19029 gobject_class = G_OBJECT_CLASS (klass);
19030 gobject_class->finalize = event_log_proxy_finalize;
19031 gobject_class->get_property = event_log_proxy_get_property;
19032 gobject_class->set_property = event_log_proxy_set_property;
19033
19034 proxy_class = G_DBUS_PROXY_CLASS (klass);
19035 proxy_class->g_signal = event_log_proxy_g_signal;
19036 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
19037
Norman James362a80f2015-09-14 14:04:39 -050019038#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19039 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
19040#endif
19041}
19042
19043static void
19044event_log_proxy_iface_init (EventLogIface *iface)
19045{
Norman James362a80f2015-09-14 14:04:39 -050019046}
19047
19048/**
19049 * event_log_proxy_new:
19050 * @connection: A #GDBusConnection.
19051 * @flags: Flags from the #GDBusProxyFlags enumeration.
19052 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19053 * @object_path: An object path.
19054 * @cancellable: (allow-none): A #GCancellable or %NULL.
19055 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19056 * @user_data: User data to pass to @callback.
19057 *
19058 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new() for more details.
19059 *
19060 * 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.
19061 * You can then call event_log_proxy_new_finish() to get the result of the operation.
19062 *
19063 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
19064 */
19065void
19066event_log_proxy_new (
19067 GDBusConnection *connection,
19068 GDBusProxyFlags flags,
19069 const gchar *name,
19070 const gchar *object_path,
19071 GCancellable *cancellable,
19072 GAsyncReadyCallback callback,
19073 gpointer user_data)
19074{
19075 g_async_initable_new_async (TYPE_EVENT_LOG_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.EventLog", NULL);
19076}
19077
19078/**
19079 * event_log_proxy_new_finish:
19080 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
19081 * @error: Return location for error or %NULL
19082 *
19083 * Finishes an operation started with event_log_proxy_new().
19084 *
19085 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19086 */
19087EventLog *
19088event_log_proxy_new_finish (
19089 GAsyncResult *res,
19090 GError **error)
19091{
19092 GObject *ret;
19093 GObject *source_object;
19094 source_object = g_async_result_get_source_object (res);
19095 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19096 g_object_unref (source_object);
19097 if (ret != NULL)
19098 return EVENT_LOG (ret);
19099 else
19100 return NULL;
19101}
19102
19103/**
19104 * event_log_proxy_new_sync:
19105 * @connection: A #GDBusConnection.
19106 * @flags: Flags from the #GDBusProxyFlags enumeration.
19107 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19108 * @object_path: An object path.
19109 * @cancellable: (allow-none): A #GCancellable or %NULL.
19110 * @error: Return location for error or %NULL
19111 *
19112 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new_sync() for more details.
19113 *
19114 * The calling thread is blocked until a reply is received.
19115 *
19116 * See event_log_proxy_new() for the asynchronous version of this constructor.
19117 *
19118 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19119 */
19120EventLog *
19121event_log_proxy_new_sync (
19122 GDBusConnection *connection,
19123 GDBusProxyFlags flags,
19124 const gchar *name,
19125 const gchar *object_path,
19126 GCancellable *cancellable,
19127 GError **error)
19128{
19129 GInitable *ret;
19130 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
19131 if (ret != NULL)
19132 return EVENT_LOG (ret);
19133 else
19134 return NULL;
19135}
19136
19137
19138/**
19139 * event_log_proxy_new_for_bus:
19140 * @bus_type: A #GBusType.
19141 * @flags: Flags from the #GDBusProxyFlags enumeration.
19142 * @name: A bus name (well-known or unique).
19143 * @object_path: An object path.
19144 * @cancellable: (allow-none): A #GCancellable or %NULL.
19145 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19146 * @user_data: User data to pass to @callback.
19147 *
19148 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19149 *
19150 * 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.
19151 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
19152 *
19153 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19154 */
19155void
19156event_log_proxy_new_for_bus (
19157 GBusType bus_type,
19158 GDBusProxyFlags flags,
19159 const gchar *name,
19160 const gchar *object_path,
19161 GCancellable *cancellable,
19162 GAsyncReadyCallback callback,
19163 gpointer user_data)
19164{
19165 g_async_initable_new_async (TYPE_EVENT_LOG_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.EventLog", NULL);
19166}
19167
19168/**
19169 * event_log_proxy_new_for_bus_finish:
19170 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
19171 * @error: Return location for error or %NULL
19172 *
19173 * Finishes an operation started with event_log_proxy_new_for_bus().
19174 *
19175 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19176 */
19177EventLog *
19178event_log_proxy_new_for_bus_finish (
19179 GAsyncResult *res,
19180 GError **error)
19181{
19182 GObject *ret;
19183 GObject *source_object;
19184 source_object = g_async_result_get_source_object (res);
19185 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19186 g_object_unref (source_object);
19187 if (ret != NULL)
19188 return EVENT_LOG (ret);
19189 else
19190 return NULL;
19191}
19192
19193/**
19194 * event_log_proxy_new_for_bus_sync:
19195 * @bus_type: A #GBusType.
19196 * @flags: Flags from the #GDBusProxyFlags enumeration.
19197 * @name: A bus name (well-known or unique).
19198 * @object_path: An object path.
19199 * @cancellable: (allow-none): A #GCancellable or %NULL.
19200 * @error: Return location for error or %NULL
19201 *
19202 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19203 *
19204 * The calling thread is blocked until a reply is received.
19205 *
19206 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
19207 *
19208 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19209 */
19210EventLog *
19211event_log_proxy_new_for_bus_sync (
19212 GBusType bus_type,
19213 GDBusProxyFlags flags,
19214 const gchar *name,
19215 const gchar *object_path,
19216 GCancellable *cancellable,
19217 GError **error)
19218{
19219 GInitable *ret;
19220 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
19221 if (ret != NULL)
19222 return EVENT_LOG (ret);
19223 else
19224 return NULL;
19225}
19226
19227
19228/* ------------------------------------------------------------------------ */
19229
19230/**
19231 * EventLogSkeleton:
19232 *
19233 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
19234 */
19235
19236/**
19237 * EventLogSkeletonClass:
19238 * @parent_class: The parent class.
19239 *
19240 * Class structure for #EventLogSkeleton.
19241 */
19242
19243struct _EventLogSkeletonPrivate
19244{
19245 GValue *properties;
19246 GList *changed_properties;
19247 GSource *changed_properties_idle_source;
19248 GMainContext *context;
19249 GMutex lock;
19250};
19251
19252static void
19253_event_log_skeleton_handle_method_call (
19254 GDBusConnection *connection G_GNUC_UNUSED,
19255 const gchar *sender G_GNUC_UNUSED,
19256 const gchar *object_path G_GNUC_UNUSED,
19257 const gchar *interface_name,
19258 const gchar *method_name,
19259 GVariant *parameters,
19260 GDBusMethodInvocation *invocation,
19261 gpointer user_data)
19262{
19263 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
19264 _ExtendedGDBusMethodInfo *info;
19265 GVariantIter iter;
19266 GVariant *child;
19267 GValue *paramv;
19268 guint num_params;
19269 guint num_extra;
19270 guint n;
19271 guint signal_id;
19272 GValue return_value = G_VALUE_INIT;
19273 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19274 g_assert (info != NULL);
19275 num_params = g_variant_n_children (parameters);
19276 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19277 n = 0;
19278 g_value_init (&paramv[n], TYPE_EVENT_LOG);
19279 g_value_set_object (&paramv[n++], skeleton);
19280 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19281 g_value_set_object (&paramv[n++], invocation);
19282 if (info->pass_fdlist)
19283 {
19284#ifdef G_OS_UNIX
19285 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19286 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19287#else
19288 g_assert_not_reached ();
19289#endif
19290 }
19291 g_variant_iter_init (&iter, parameters);
19292 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19293 {
19294 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19295 if (arg_info->use_gvariant)
19296 {
19297 g_value_init (&paramv[n], G_TYPE_VARIANT);
19298 g_value_set_variant (&paramv[n], child);
19299 n++;
19300 }
19301 else
19302 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19303 g_variant_unref (child);
19304 }
19305 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
19306 g_value_init (&return_value, G_TYPE_BOOLEAN);
19307 g_signal_emitv (paramv, signal_id, 0, &return_value);
19308 if (!g_value_get_boolean (&return_value))
19309 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);
19310 g_value_unset (&return_value);
19311 for (n = 0; n < num_params + num_extra; n++)
19312 g_value_unset (&paramv[n]);
19313 g_free (paramv);
19314}
19315
19316static GVariant *
19317_event_log_skeleton_handle_get_property (
19318 GDBusConnection *connection G_GNUC_UNUSED,
19319 const gchar *sender G_GNUC_UNUSED,
19320 const gchar *object_path G_GNUC_UNUSED,
19321 const gchar *interface_name G_GNUC_UNUSED,
19322 const gchar *property_name,
19323 GError **error,
19324 gpointer user_data)
19325{
19326 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
19327 GValue value = G_VALUE_INIT;
19328 GParamSpec *pspec;
19329 _ExtendedGDBusPropertyInfo *info;
19330 GVariant *ret;
19331 ret = NULL;
19332 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
19333 g_assert (info != NULL);
19334 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19335 if (pspec == NULL)
19336 {
19337 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19338 }
19339 else
19340 {
19341 g_value_init (&value, pspec->value_type);
19342 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19343 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19344 g_value_unset (&value);
19345 }
19346 return ret;
19347}
19348
19349static gboolean
19350_event_log_skeleton_handle_set_property (
19351 GDBusConnection *connection G_GNUC_UNUSED,
19352 const gchar *sender G_GNUC_UNUSED,
19353 const gchar *object_path G_GNUC_UNUSED,
19354 const gchar *interface_name G_GNUC_UNUSED,
19355 const gchar *property_name,
19356 GVariant *variant,
19357 GError **error,
19358 gpointer user_data)
19359{
19360 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
19361 GValue value = G_VALUE_INIT;
19362 GParamSpec *pspec;
19363 _ExtendedGDBusPropertyInfo *info;
19364 gboolean ret;
19365 ret = FALSE;
19366 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
19367 g_assert (info != NULL);
19368 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19369 if (pspec == NULL)
19370 {
19371 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19372 }
19373 else
19374 {
19375 if (info->use_gvariant)
19376 g_value_set_variant (&value, variant);
19377 else
19378 g_dbus_gvariant_to_gvalue (variant, &value);
19379 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19380 g_value_unset (&value);
19381 ret = TRUE;
19382 }
19383 return ret;
19384}
19385
19386static const GDBusInterfaceVTable _event_log_skeleton_vtable =
19387{
19388 _event_log_skeleton_handle_method_call,
19389 _event_log_skeleton_handle_get_property,
19390 _event_log_skeleton_handle_set_property,
19391 {NULL}
19392};
19393
19394static GDBusInterfaceInfo *
19395event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19396{
19397 return event_log_interface_info ();
19398}
19399
19400static GDBusInterfaceVTable *
19401event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19402{
19403 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
19404}
19405
19406static GVariant *
19407event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19408{
19409 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
19410
19411 GVariantBuilder builder;
19412 guint n;
19413 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19414 if (_event_log_interface_info.parent_struct.properties == NULL)
19415 goto out;
19416 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
19417 {
19418 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
19419 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19420 {
19421 GVariant *value;
19422 value = _event_log_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.EventLog", info->name, NULL, skeleton);
19423 if (value != NULL)
19424 {
19425 g_variant_take_ref (value);
19426 g_variant_builder_add (&builder, "{sv}", info->name, value);
19427 g_variant_unref (value);
19428 }
19429 }
19430 }
19431out:
19432 return g_variant_builder_end (&builder);
19433}
19434
Norman James362a80f2015-09-14 14:04:39 -050019435static void
19436event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
19437{
Norman James362a80f2015-09-14 14:04:39 -050019438}
19439
19440static void
19441_event_log_on_signal_event_log (
19442 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050019443 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050019444 const gchar *arg_message,
19445 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050019446{
19447 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
19448
19449 GList *connections, *l;
19450 GVariant *signal_variant;
19451 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19452
Norman James88872672015-09-21 16:51:35 -050019453 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050019454 arg_priority,
Norman James88872672015-09-21 16:51:35 -050019455 arg_message,
19456 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050019457 for (l = connections; l != NULL; l = l->next)
19458 {
19459 GDBusConnection *connection = l->data;
19460 g_dbus_connection_emit_signal (connection,
19461 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
19462 signal_variant, NULL);
19463 }
19464 g_variant_unref (signal_variant);
19465 g_list_free_full (connections, g_object_unref);
19466}
19467
19468static void event_log_skeleton_iface_init (EventLogIface *iface);
19469#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19470G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19471 G_ADD_PRIVATE (EventLogSkeleton)
19472 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
19473
19474#else
19475G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19476 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
19477
19478#endif
19479static void
19480event_log_skeleton_finalize (GObject *object)
19481{
19482 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050019483 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19484 if (skeleton->priv->changed_properties_idle_source != NULL)
19485 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19486 g_main_context_unref (skeleton->priv->context);
19487 g_mutex_clear (&skeleton->priv->lock);
19488 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
19489}
19490
19491static void
Norman James362a80f2015-09-14 14:04:39 -050019492event_log_skeleton_init (EventLogSkeleton *skeleton)
19493{
19494#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19495 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
19496#else
19497 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
19498#endif
19499
19500 g_mutex_init (&skeleton->priv->lock);
19501 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050019502}
19503
19504static void
19505event_log_skeleton_class_init (EventLogSkeletonClass *klass)
19506{
19507 GObjectClass *gobject_class;
19508 GDBusInterfaceSkeletonClass *skeleton_class;
19509
19510 gobject_class = G_OBJECT_CLASS (klass);
19511 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050019512
19513 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
19514 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
19515 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
19516 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
19517 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
19518
19519#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19520 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
19521#endif
19522}
19523
19524static void
19525event_log_skeleton_iface_init (EventLogIface *iface)
19526{
19527 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050019528}
19529
19530/**
19531 * event_log_skeleton_new:
19532 *
19533 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
19534 *
19535 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
19536 */
19537EventLog *
19538event_log_skeleton_new (void)
19539{
19540 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
19541}
19542
19543/* ------------------------------------------------------------------------
19544 * Code for interface org.openbmc.Flash
19545 * ------------------------------------------------------------------------
19546 */
19547
19548/**
19549 * SECTION:Flash
19550 * @title: Flash
19551 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
19552 *
19553 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface in C.
19554 */
19555
19556/* ---- Introspection data for org.openbmc.Flash ---- */
19557
19558static const _ExtendedGDBusArgInfo _flash_method_info_update_via_file_IN_ARG_file =
19559{
19560 {
19561 -1,
19562 (gchar *) "file",
19563 (gchar *) "s",
19564 NULL
19565 },
19566 FALSE
19567};
19568
19569static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_file_IN_ARG_pointers[] =
19570{
19571 &_flash_method_info_update_via_file_IN_ARG_file,
19572 NULL
19573};
19574
19575static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_file =
19576{
19577 {
19578 -1,
19579 (gchar *) "updateViaFile",
19580 (GDBusArgInfo **) &_flash_method_info_update_via_file_IN_ARG_pointers,
19581 NULL,
19582 NULL
19583 },
19584 "handle-update-via-file",
19585 FALSE
19586};
19587
19588static const _ExtendedGDBusArgInfo _flash_method_info_update_via_http_IN_ARG_url =
19589{
19590 {
19591 -1,
19592 (gchar *) "url",
19593 (gchar *) "s",
19594 NULL
19595 },
19596 FALSE
19597};
19598
19599static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_http_IN_ARG_pointers[] =
19600{
19601 &_flash_method_info_update_via_http_IN_ARG_url,
19602 NULL
19603};
19604
19605static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_http =
19606{
19607 {
19608 -1,
19609 (gchar *) "updateViaHttp",
19610 (GDBusArgInfo **) &_flash_method_info_update_via_http_IN_ARG_pointers,
19611 NULL,
19612 NULL
19613 },
19614 "handle-update-via-http",
19615 FALSE
19616};
19617
19618static const _ExtendedGDBusMethodInfo _flash_method_info_erase =
19619{
19620 {
19621 -1,
19622 (gchar *) "erase",
19623 NULL,
19624 NULL,
19625 NULL
19626 },
19627 "handle-erase",
19628 FALSE
19629};
19630
19631static const _ExtendedGDBusMethodInfo _flash_method_info_init =
19632{
19633 {
19634 -1,
19635 (gchar *) "init",
19636 NULL,
19637 NULL,
19638 NULL
19639 },
19640 "handle-init",
19641 FALSE
19642};
19643
19644static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
19645{
19646 &_flash_method_info_update_via_file,
19647 &_flash_method_info_update_via_http,
19648 &_flash_method_info_erase,
19649 &_flash_method_info_init,
19650 NULL
19651};
19652
19653static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
19654{
19655 {
19656 -1,
19657 (gchar *) "Updated",
19658 NULL,
19659 NULL
19660 },
19661 "updated"
19662};
19663
19664static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
19665{
19666 &_flash_signal_info_updated,
19667 NULL
19668};
19669
19670static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
19671{
19672 {
19673 -1,
19674 (gchar *) "org.openbmc.Flash",
19675 (GDBusMethodInfo **) &_flash_method_info_pointers,
19676 (GDBusSignalInfo **) &_flash_signal_info_pointers,
19677 NULL,
19678 NULL
19679 },
19680 "flash",
19681};
19682
19683
19684/**
19685 * flash_interface_info:
19686 *
19687 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
19688 *
19689 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19690 */
19691GDBusInterfaceInfo *
19692flash_interface_info (void)
19693{
19694 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
19695}
19696
19697/**
19698 * flash_override_properties:
19699 * @klass: The class structure for a #GObject<!-- -->-derived class.
19700 * @property_id_begin: The property id to assign to the first overridden property.
19701 *
19702 * Overrides all #GObject properties in the #Flash interface for a concrete class.
19703 * The properties are overridden in the order they are defined.
19704 *
19705 * Returns: The last property id.
19706 */
19707guint
19708flash_override_properties (GObjectClass *klass, guint property_id_begin)
19709{
19710 return property_id_begin - 1;
19711}
19712
19713
19714
19715/**
19716 * Flash:
19717 *
19718 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
19719 */
19720
19721/**
19722 * FlashIface:
19723 * @parent_iface: The parent interface.
19724 * @handle_erase: Handler for the #Flash::handle-erase signal.
19725 * @handle_init: Handler for the #Flash::handle-init signal.
19726 * @handle_update_via_file: Handler for the #Flash::handle-update-via-file signal.
19727 * @handle_update_via_http: Handler for the #Flash::handle-update-via-http signal.
19728 * @updated: Handler for the #Flash::updated signal.
19729 *
19730 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
19731 */
19732
19733typedef FlashIface FlashInterface;
19734G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
19735
19736static void
19737flash_default_init (FlashIface *iface)
19738{
19739 /* GObject signals for incoming D-Bus method calls: */
19740 /**
19741 * Flash::handle-update-via-file:
19742 * @object: A #Flash.
19743 * @invocation: A #GDBusMethodInvocation.
19744 * @arg_file: Argument passed by remote caller.
19745 *
19746 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method.
19747 *
19748 * 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 flash_complete_update_via_file() 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.
19749 *
19750 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19751 */
19752 g_signal_new ("handle-update-via-file",
19753 G_TYPE_FROM_INTERFACE (iface),
19754 G_SIGNAL_RUN_LAST,
19755 G_STRUCT_OFFSET (FlashIface, handle_update_via_file),
19756 g_signal_accumulator_true_handled,
19757 NULL,
19758 g_cclosure_marshal_generic,
19759 G_TYPE_BOOLEAN,
19760 2,
19761 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
19762
19763 /**
19764 * Flash::handle-update-via-http:
19765 * @object: A #Flash.
19766 * @invocation: A #GDBusMethodInvocation.
19767 * @arg_url: Argument passed by remote caller.
19768 *
19769 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method.
19770 *
19771 * 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 flash_complete_update_via_http() 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.
19772 *
19773 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19774 */
19775 g_signal_new ("handle-update-via-http",
19776 G_TYPE_FROM_INTERFACE (iface),
19777 G_SIGNAL_RUN_LAST,
19778 G_STRUCT_OFFSET (FlashIface, handle_update_via_http),
19779 g_signal_accumulator_true_handled,
19780 NULL,
19781 g_cclosure_marshal_generic,
19782 G_TYPE_BOOLEAN,
19783 2,
19784 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
19785
19786 /**
19787 * Flash::handle-erase:
19788 * @object: A #Flash.
19789 * @invocation: A #GDBusMethodInvocation.
19790 *
19791 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method.
19792 *
19793 * 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 flash_complete_erase() 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.
19794 *
19795 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19796 */
19797 g_signal_new ("handle-erase",
19798 G_TYPE_FROM_INTERFACE (iface),
19799 G_SIGNAL_RUN_LAST,
19800 G_STRUCT_OFFSET (FlashIface, handle_erase),
19801 g_signal_accumulator_true_handled,
19802 NULL,
19803 g_cclosure_marshal_generic,
19804 G_TYPE_BOOLEAN,
19805 1,
19806 G_TYPE_DBUS_METHOD_INVOCATION);
19807
19808 /**
19809 * Flash::handle-init:
19810 * @object: A #Flash.
19811 * @invocation: A #GDBusMethodInvocation.
19812 *
19813 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
19814 *
19815 * 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 flash_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.
19816 *
19817 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19818 */
19819 g_signal_new ("handle-init",
19820 G_TYPE_FROM_INTERFACE (iface),
19821 G_SIGNAL_RUN_LAST,
19822 G_STRUCT_OFFSET (FlashIface, handle_init),
19823 g_signal_accumulator_true_handled,
19824 NULL,
19825 g_cclosure_marshal_generic,
19826 G_TYPE_BOOLEAN,
19827 1,
19828 G_TYPE_DBUS_METHOD_INVOCATION);
19829
19830 /* GObject signals for received D-Bus signals: */
19831 /**
19832 * Flash::updated:
19833 * @object: A #Flash.
19834 *
19835 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> is received.
19836 *
19837 * 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.
19838 */
19839 g_signal_new ("updated",
19840 G_TYPE_FROM_INTERFACE (iface),
19841 G_SIGNAL_RUN_LAST,
19842 G_STRUCT_OFFSET (FlashIface, updated),
19843 NULL,
19844 NULL,
19845 g_cclosure_marshal_generic,
19846 G_TYPE_NONE,
19847 0);
19848
19849}
19850
19851/**
19852 * flash_emit_updated:
19853 * @object: A #Flash.
19854 *
19855 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
19856 */
19857void
19858flash_emit_updated (
19859 Flash *object)
19860{
19861 g_signal_emit_by_name (object, "updated");
19862}
19863
19864/**
19865 * flash_call_update_via_file:
19866 * @proxy: A #FlashProxy.
19867 * @arg_file: Argument to pass with the method invocation.
19868 * @cancellable: (allow-none): A #GCancellable or %NULL.
19869 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19870 * @user_data: User data to pass to @callback.
19871 *
19872 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy.
19873 * 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.
19874 * You can then call flash_call_update_via_file_finish() to get the result of the operation.
19875 *
19876 * See flash_call_update_via_file_sync() for the synchronous, blocking version of this method.
19877 */
19878void
19879flash_call_update_via_file (
19880 Flash *proxy,
19881 const gchar *arg_file,
19882 GCancellable *cancellable,
19883 GAsyncReadyCallback callback,
19884 gpointer user_data)
19885{
19886 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19887 "updateViaFile",
19888 g_variant_new ("(s)",
19889 arg_file),
19890 G_DBUS_CALL_FLAGS_NONE,
19891 -1,
19892 cancellable,
19893 callback,
19894 user_data);
19895}
19896
19897/**
19898 * flash_call_update_via_file_finish:
19899 * @proxy: A #FlashProxy.
19900 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_file().
19901 * @error: Return location for error or %NULL.
19902 *
19903 * Finishes an operation started with flash_call_update_via_file().
19904 *
19905 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19906 */
19907gboolean
19908flash_call_update_via_file_finish (
19909 Flash *proxy,
19910 GAsyncResult *res,
19911 GError **error)
19912{
19913 GVariant *_ret;
19914 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19915 if (_ret == NULL)
19916 goto _out;
19917 g_variant_get (_ret,
19918 "()");
19919 g_variant_unref (_ret);
19920_out:
19921 return _ret != NULL;
19922}
19923
19924/**
19925 * flash_call_update_via_file_sync:
19926 * @proxy: A #FlashProxy.
19927 * @arg_file: Argument to pass with the method invocation.
19928 * @cancellable: (allow-none): A #GCancellable or %NULL.
19929 * @error: Return location for error or %NULL.
19930 *
19931 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
19932 *
19933 * See flash_call_update_via_file() for the asynchronous version of this method.
19934 *
19935 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19936 */
19937gboolean
19938flash_call_update_via_file_sync (
19939 Flash *proxy,
19940 const gchar *arg_file,
19941 GCancellable *cancellable,
19942 GError **error)
19943{
19944 GVariant *_ret;
19945 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19946 "updateViaFile",
19947 g_variant_new ("(s)",
19948 arg_file),
19949 G_DBUS_CALL_FLAGS_NONE,
19950 -1,
19951 cancellable,
19952 error);
19953 if (_ret == NULL)
19954 goto _out;
19955 g_variant_get (_ret,
19956 "()");
19957 g_variant_unref (_ret);
19958_out:
19959 return _ret != NULL;
19960}
19961
19962/**
19963 * flash_call_update_via_http:
19964 * @proxy: A #FlashProxy.
19965 * @arg_url: Argument to pass with the method invocation.
19966 * @cancellable: (allow-none): A #GCancellable or %NULL.
19967 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19968 * @user_data: User data to pass to @callback.
19969 *
19970 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy.
19971 * 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.
19972 * You can then call flash_call_update_via_http_finish() to get the result of the operation.
19973 *
19974 * See flash_call_update_via_http_sync() for the synchronous, blocking version of this method.
19975 */
19976void
19977flash_call_update_via_http (
19978 Flash *proxy,
19979 const gchar *arg_url,
19980 GCancellable *cancellable,
19981 GAsyncReadyCallback callback,
19982 gpointer user_data)
19983{
19984 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19985 "updateViaHttp",
19986 g_variant_new ("(s)",
19987 arg_url),
19988 G_DBUS_CALL_FLAGS_NONE,
19989 -1,
19990 cancellable,
19991 callback,
19992 user_data);
19993}
19994
19995/**
19996 * flash_call_update_via_http_finish:
19997 * @proxy: A #FlashProxy.
19998 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_http().
19999 * @error: Return location for error or %NULL.
20000 *
20001 * Finishes an operation started with flash_call_update_via_http().
20002 *
20003 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20004 */
20005gboolean
20006flash_call_update_via_http_finish (
20007 Flash *proxy,
20008 GAsyncResult *res,
20009 GError **error)
20010{
20011 GVariant *_ret;
20012 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20013 if (_ret == NULL)
20014 goto _out;
20015 g_variant_get (_ret,
20016 "()");
20017 g_variant_unref (_ret);
20018_out:
20019 return _ret != NULL;
20020}
20021
20022/**
20023 * flash_call_update_via_http_sync:
20024 * @proxy: A #FlashProxy.
20025 * @arg_url: Argument to pass with the method invocation.
20026 * @cancellable: (allow-none): A #GCancellable or %NULL.
20027 * @error: Return location for error or %NULL.
20028 *
20029 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20030 *
20031 * See flash_call_update_via_http() for the asynchronous version of this method.
20032 *
20033 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20034 */
20035gboolean
20036flash_call_update_via_http_sync (
20037 Flash *proxy,
20038 const gchar *arg_url,
20039 GCancellable *cancellable,
20040 GError **error)
20041{
20042 GVariant *_ret;
20043 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20044 "updateViaHttp",
20045 g_variant_new ("(s)",
20046 arg_url),
20047 G_DBUS_CALL_FLAGS_NONE,
20048 -1,
20049 cancellable,
20050 error);
20051 if (_ret == NULL)
20052 goto _out;
20053 g_variant_get (_ret,
20054 "()");
20055 g_variant_unref (_ret);
20056_out:
20057 return _ret != NULL;
20058}
20059
20060/**
20061 * flash_call_erase:
20062 * @proxy: A #FlashProxy.
20063 * @cancellable: (allow-none): A #GCancellable or %NULL.
20064 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20065 * @user_data: User data to pass to @callback.
20066 *
20067 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy.
20068 * 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.
20069 * You can then call flash_call_erase_finish() to get the result of the operation.
20070 *
20071 * See flash_call_erase_sync() for the synchronous, blocking version of this method.
20072 */
20073void
20074flash_call_erase (
20075 Flash *proxy,
20076 GCancellable *cancellable,
20077 GAsyncReadyCallback callback,
20078 gpointer user_data)
20079{
20080 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20081 "erase",
20082 g_variant_new ("()"),
20083 G_DBUS_CALL_FLAGS_NONE,
20084 -1,
20085 cancellable,
20086 callback,
20087 user_data);
20088}
20089
20090/**
20091 * flash_call_erase_finish:
20092 * @proxy: A #FlashProxy.
20093 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_erase().
20094 * @error: Return location for error or %NULL.
20095 *
20096 * Finishes an operation started with flash_call_erase().
20097 *
20098 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20099 */
20100gboolean
20101flash_call_erase_finish (
20102 Flash *proxy,
20103 GAsyncResult *res,
20104 GError **error)
20105{
20106 GVariant *_ret;
20107 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20108 if (_ret == NULL)
20109 goto _out;
20110 g_variant_get (_ret,
20111 "()");
20112 g_variant_unref (_ret);
20113_out:
20114 return _ret != NULL;
20115}
20116
20117/**
20118 * flash_call_erase_sync:
20119 * @proxy: A #FlashProxy.
20120 * @cancellable: (allow-none): A #GCancellable or %NULL.
20121 * @error: Return location for error or %NULL.
20122 *
20123 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20124 *
20125 * See flash_call_erase() for the asynchronous version of this method.
20126 *
20127 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20128 */
20129gboolean
20130flash_call_erase_sync (
20131 Flash *proxy,
20132 GCancellable *cancellable,
20133 GError **error)
20134{
20135 GVariant *_ret;
20136 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20137 "erase",
20138 g_variant_new ("()"),
20139 G_DBUS_CALL_FLAGS_NONE,
20140 -1,
20141 cancellable,
20142 error);
20143 if (_ret == NULL)
20144 goto _out;
20145 g_variant_get (_ret,
20146 "()");
20147 g_variant_unref (_ret);
20148_out:
20149 return _ret != NULL;
20150}
20151
20152/**
20153 * flash_call_init:
20154 * @proxy: A #FlashProxy.
20155 * @cancellable: (allow-none): A #GCancellable or %NULL.
20156 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20157 * @user_data: User data to pass to @callback.
20158 *
20159 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
20160 * 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.
20161 * You can then call flash_call_init_finish() to get the result of the operation.
20162 *
20163 * See flash_call_init_sync() for the synchronous, blocking version of this method.
20164 */
20165void
20166flash_call_init (
20167 Flash *proxy,
20168 GCancellable *cancellable,
20169 GAsyncReadyCallback callback,
20170 gpointer user_data)
20171{
20172 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20173 "init",
20174 g_variant_new ("()"),
20175 G_DBUS_CALL_FLAGS_NONE,
20176 -1,
20177 cancellable,
20178 callback,
20179 user_data);
20180}
20181
20182/**
20183 * flash_call_init_finish:
20184 * @proxy: A #FlashProxy.
20185 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
20186 * @error: Return location for error or %NULL.
20187 *
20188 * Finishes an operation started with flash_call_init().
20189 *
20190 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20191 */
20192gboolean
20193flash_call_init_finish (
20194 Flash *proxy,
20195 GAsyncResult *res,
20196 GError **error)
20197{
20198 GVariant *_ret;
20199 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20200 if (_ret == NULL)
20201 goto _out;
20202 g_variant_get (_ret,
20203 "()");
20204 g_variant_unref (_ret);
20205_out:
20206 return _ret != NULL;
20207}
20208
20209/**
20210 * flash_call_init_sync:
20211 * @proxy: A #FlashProxy.
20212 * @cancellable: (allow-none): A #GCancellable or %NULL.
20213 * @error: Return location for error or %NULL.
20214 *
20215 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20216 *
20217 * See flash_call_init() for the asynchronous version of this method.
20218 *
20219 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20220 */
20221gboolean
20222flash_call_init_sync (
20223 Flash *proxy,
20224 GCancellable *cancellable,
20225 GError **error)
20226{
20227 GVariant *_ret;
20228 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20229 "init",
20230 g_variant_new ("()"),
20231 G_DBUS_CALL_FLAGS_NONE,
20232 -1,
20233 cancellable,
20234 error);
20235 if (_ret == NULL)
20236 goto _out;
20237 g_variant_get (_ret,
20238 "()");
20239 g_variant_unref (_ret);
20240_out:
20241 return _ret != NULL;
20242}
20243
20244/**
20245 * flash_complete_update_via_file:
20246 * @object: A #Flash.
20247 * @invocation: (transfer full): A #GDBusMethodInvocation.
20248 *
20249 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaFile">updateViaFile()</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.
20250 *
20251 * This method will free @invocation, you cannot use it afterwards.
20252 */
20253void
20254flash_complete_update_via_file (
20255 Flash *object,
20256 GDBusMethodInvocation *invocation)
20257{
20258 g_dbus_method_invocation_return_value (invocation,
20259 g_variant_new ("()"));
20260}
20261
20262/**
20263 * flash_complete_update_via_http:
20264 * @object: A #Flash.
20265 * @invocation: (transfer full): A #GDBusMethodInvocation.
20266 *
20267 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaHttp">updateViaHttp()</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.
20268 *
20269 * This method will free @invocation, you cannot use it afterwards.
20270 */
20271void
20272flash_complete_update_via_http (
20273 Flash *object,
20274 GDBusMethodInvocation *invocation)
20275{
20276 g_dbus_method_invocation_return_value (invocation,
20277 g_variant_new ("()"));
20278}
20279
20280/**
20281 * flash_complete_erase:
20282 * @object: A #Flash.
20283 * @invocation: (transfer full): A #GDBusMethodInvocation.
20284 *
20285 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.erase">erase()</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.
20286 *
20287 * This method will free @invocation, you cannot use it afterwards.
20288 */
20289void
20290flash_complete_erase (
20291 Flash *object,
20292 GDBusMethodInvocation *invocation)
20293{
20294 g_dbus_method_invocation_return_value (invocation,
20295 g_variant_new ("()"));
20296}
20297
20298/**
20299 * flash_complete_init:
20300 * @object: A #Flash.
20301 * @invocation: (transfer full): A #GDBusMethodInvocation.
20302 *
20303 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.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.
20304 *
20305 * This method will free @invocation, you cannot use it afterwards.
20306 */
20307void
20308flash_complete_init (
20309 Flash *object,
20310 GDBusMethodInvocation *invocation)
20311{
20312 g_dbus_method_invocation_return_value (invocation,
20313 g_variant_new ("()"));
20314}
20315
20316/* ------------------------------------------------------------------------ */
20317
20318/**
20319 * FlashProxy:
20320 *
20321 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
20322 */
20323
20324/**
20325 * FlashProxyClass:
20326 * @parent_class: The parent class.
20327 *
20328 * Class structure for #FlashProxy.
20329 */
20330
20331struct _FlashProxyPrivate
20332{
20333 GData *qdata;
20334};
20335
20336static void flash_proxy_iface_init (FlashIface *iface);
20337
20338#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20339G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
20340 G_ADD_PRIVATE (FlashProxy)
20341 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
20342
20343#else
20344G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
20345 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
20346
20347#endif
20348static void
20349flash_proxy_finalize (GObject *object)
20350{
20351 FlashProxy *proxy = FLASH_PROXY (object);
20352 g_datalist_clear (&proxy->priv->qdata);
20353 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
20354}
20355
20356static void
20357flash_proxy_get_property (GObject *object,
20358 guint prop_id,
20359 GValue *value,
20360 GParamSpec *pspec G_GNUC_UNUSED)
20361{
20362}
20363
20364static void
20365flash_proxy_set_property (GObject *object,
20366 guint prop_id,
20367 const GValue *value,
20368 GParamSpec *pspec G_GNUC_UNUSED)
20369{
20370}
20371
20372static void
20373flash_proxy_g_signal (GDBusProxy *proxy,
20374 const gchar *sender_name G_GNUC_UNUSED,
20375 const gchar *signal_name,
20376 GVariant *parameters)
20377{
20378 _ExtendedGDBusSignalInfo *info;
20379 GVariantIter iter;
20380 GVariant *child;
20381 GValue *paramv;
20382 guint num_params;
20383 guint n;
20384 guint signal_id;
20385 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
20386 if (info == NULL)
20387 return;
20388 num_params = g_variant_n_children (parameters);
20389 paramv = g_new0 (GValue, num_params + 1);
20390 g_value_init (&paramv[0], TYPE_FLASH);
20391 g_value_set_object (&paramv[0], proxy);
20392 g_variant_iter_init (&iter, parameters);
20393 n = 1;
20394 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20395 {
20396 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20397 if (arg_info->use_gvariant)
20398 {
20399 g_value_init (&paramv[n], G_TYPE_VARIANT);
20400 g_value_set_variant (&paramv[n], child);
20401 n++;
20402 }
20403 else
20404 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20405 g_variant_unref (child);
20406 }
20407 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
20408 g_signal_emitv (paramv, signal_id, 0, NULL);
20409 for (n = 0; n < num_params + 1; n++)
20410 g_value_unset (&paramv[n]);
20411 g_free (paramv);
20412}
20413
20414static void
20415flash_proxy_g_properties_changed (GDBusProxy *_proxy,
20416 GVariant *changed_properties,
20417 const gchar *const *invalidated_properties)
20418{
20419 FlashProxy *proxy = FLASH_PROXY (_proxy);
20420 guint n;
20421 const gchar *key;
20422 GVariantIter *iter;
20423 _ExtendedGDBusPropertyInfo *info;
20424 g_variant_get (changed_properties, "a{sv}", &iter);
20425 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20426 {
20427 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
20428 g_datalist_remove_data (&proxy->priv->qdata, key);
20429 if (info != NULL)
20430 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20431 }
20432 g_variant_iter_free (iter);
20433 for (n = 0; invalidated_properties[n] != NULL; n++)
20434 {
20435 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
20436 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20437 if (info != NULL)
20438 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20439 }
20440}
20441
20442static void
20443flash_proxy_init (FlashProxy *proxy)
20444{
20445#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20446 proxy->priv = flash_proxy_get_instance_private (proxy);
20447#else
20448 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
20449#endif
20450
20451 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
20452}
20453
20454static void
20455flash_proxy_class_init (FlashProxyClass *klass)
20456{
20457 GObjectClass *gobject_class;
20458 GDBusProxyClass *proxy_class;
20459
20460 gobject_class = G_OBJECT_CLASS (klass);
20461 gobject_class->finalize = flash_proxy_finalize;
20462 gobject_class->get_property = flash_proxy_get_property;
20463 gobject_class->set_property = flash_proxy_set_property;
20464
20465 proxy_class = G_DBUS_PROXY_CLASS (klass);
20466 proxy_class->g_signal = flash_proxy_g_signal;
20467 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
20468
20469#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20470 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
20471#endif
20472}
20473
20474static void
20475flash_proxy_iface_init (FlashIface *iface)
20476{
20477}
20478
20479/**
20480 * flash_proxy_new:
20481 * @connection: A #GDBusConnection.
20482 * @flags: Flags from the #GDBusProxyFlags enumeration.
20483 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20484 * @object_path: An object path.
20485 * @cancellable: (allow-none): A #GCancellable or %NULL.
20486 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20487 * @user_data: User data to pass to @callback.
20488 *
20489 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new() for more details.
20490 *
20491 * 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.
20492 * You can then call flash_proxy_new_finish() to get the result of the operation.
20493 *
20494 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
20495 */
20496void
20497flash_proxy_new (
20498 GDBusConnection *connection,
20499 GDBusProxyFlags flags,
20500 const gchar *name,
20501 const gchar *object_path,
20502 GCancellable *cancellable,
20503 GAsyncReadyCallback callback,
20504 gpointer user_data)
20505{
20506 g_async_initable_new_async (TYPE_FLASH_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.Flash", NULL);
20507}
20508
20509/**
20510 * flash_proxy_new_finish:
20511 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
20512 * @error: Return location for error or %NULL
20513 *
20514 * Finishes an operation started with flash_proxy_new().
20515 *
20516 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20517 */
20518Flash *
20519flash_proxy_new_finish (
20520 GAsyncResult *res,
20521 GError **error)
20522{
20523 GObject *ret;
20524 GObject *source_object;
20525 source_object = g_async_result_get_source_object (res);
20526 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20527 g_object_unref (source_object);
20528 if (ret != NULL)
20529 return FLASH (ret);
20530 else
20531 return NULL;
20532}
20533
20534/**
20535 * flash_proxy_new_sync:
20536 * @connection: A #GDBusConnection.
20537 * @flags: Flags from the #GDBusProxyFlags enumeration.
20538 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20539 * @object_path: An object path.
20540 * @cancellable: (allow-none): A #GCancellable or %NULL.
20541 * @error: Return location for error or %NULL
20542 *
20543 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new_sync() for more details.
20544 *
20545 * The calling thread is blocked until a reply is received.
20546 *
20547 * See flash_proxy_new() for the asynchronous version of this constructor.
20548 *
20549 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20550 */
20551Flash *
20552flash_proxy_new_sync (
20553 GDBusConnection *connection,
20554 GDBusProxyFlags flags,
20555 const gchar *name,
20556 const gchar *object_path,
20557 GCancellable *cancellable,
20558 GError **error)
20559{
20560 GInitable *ret;
20561 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
20562 if (ret != NULL)
20563 return FLASH (ret);
20564 else
20565 return NULL;
20566}
20567
20568
20569/**
20570 * flash_proxy_new_for_bus:
20571 * @bus_type: A #GBusType.
20572 * @flags: Flags from the #GDBusProxyFlags enumeration.
20573 * @name: A bus name (well-known or unique).
20574 * @object_path: An object path.
20575 * @cancellable: (allow-none): A #GCancellable or %NULL.
20576 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20577 * @user_data: User data to pass to @callback.
20578 *
20579 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20580 *
20581 * 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.
20582 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
20583 *
20584 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20585 */
20586void
20587flash_proxy_new_for_bus (
20588 GBusType bus_type,
20589 GDBusProxyFlags flags,
20590 const gchar *name,
20591 const gchar *object_path,
20592 GCancellable *cancellable,
20593 GAsyncReadyCallback callback,
20594 gpointer user_data)
20595{
20596 g_async_initable_new_async (TYPE_FLASH_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.Flash", NULL);
20597}
20598
20599/**
20600 * flash_proxy_new_for_bus_finish:
20601 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
20602 * @error: Return location for error or %NULL
20603 *
20604 * Finishes an operation started with flash_proxy_new_for_bus().
20605 *
20606 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20607 */
20608Flash *
20609flash_proxy_new_for_bus_finish (
20610 GAsyncResult *res,
20611 GError **error)
20612{
20613 GObject *ret;
20614 GObject *source_object;
20615 source_object = g_async_result_get_source_object (res);
20616 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20617 g_object_unref (source_object);
20618 if (ret != NULL)
20619 return FLASH (ret);
20620 else
20621 return NULL;
20622}
20623
20624/**
20625 * flash_proxy_new_for_bus_sync:
20626 * @bus_type: A #GBusType.
20627 * @flags: Flags from the #GDBusProxyFlags enumeration.
20628 * @name: A bus name (well-known or unique).
20629 * @object_path: An object path.
20630 * @cancellable: (allow-none): A #GCancellable or %NULL.
20631 * @error: Return location for error or %NULL
20632 *
20633 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
20634 *
20635 * The calling thread is blocked until a reply is received.
20636 *
20637 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
20638 *
20639 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
20640 */
20641Flash *
20642flash_proxy_new_for_bus_sync (
20643 GBusType bus_type,
20644 GDBusProxyFlags flags,
20645 const gchar *name,
20646 const gchar *object_path,
20647 GCancellable *cancellable,
20648 GError **error)
20649{
20650 GInitable *ret;
20651 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
20652 if (ret != NULL)
20653 return FLASH (ret);
20654 else
20655 return NULL;
20656}
20657
20658
20659/* ------------------------------------------------------------------------ */
20660
20661/**
20662 * FlashSkeleton:
20663 *
20664 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
20665 */
20666
20667/**
20668 * FlashSkeletonClass:
20669 * @parent_class: The parent class.
20670 *
20671 * Class structure for #FlashSkeleton.
20672 */
20673
20674struct _FlashSkeletonPrivate
20675{
20676 GValue *properties;
20677 GList *changed_properties;
20678 GSource *changed_properties_idle_source;
20679 GMainContext *context;
20680 GMutex lock;
20681};
20682
20683static void
20684_flash_skeleton_handle_method_call (
20685 GDBusConnection *connection G_GNUC_UNUSED,
20686 const gchar *sender G_GNUC_UNUSED,
20687 const gchar *object_path G_GNUC_UNUSED,
20688 const gchar *interface_name,
20689 const gchar *method_name,
20690 GVariant *parameters,
20691 GDBusMethodInvocation *invocation,
20692 gpointer user_data)
20693{
20694 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20695 _ExtendedGDBusMethodInfo *info;
20696 GVariantIter iter;
20697 GVariant *child;
20698 GValue *paramv;
20699 guint num_params;
20700 guint num_extra;
20701 guint n;
20702 guint signal_id;
20703 GValue return_value = G_VALUE_INIT;
20704 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
20705 g_assert (info != NULL);
20706 num_params = g_variant_n_children (parameters);
20707 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
20708 n = 0;
20709 g_value_init (&paramv[n], TYPE_FLASH);
20710 g_value_set_object (&paramv[n++], skeleton);
20711 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
20712 g_value_set_object (&paramv[n++], invocation);
20713 if (info->pass_fdlist)
20714 {
20715#ifdef G_OS_UNIX
20716 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
20717 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
20718#else
20719 g_assert_not_reached ();
20720#endif
20721 }
20722 g_variant_iter_init (&iter, parameters);
20723 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20724 {
20725 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
20726 if (arg_info->use_gvariant)
20727 {
20728 g_value_init (&paramv[n], G_TYPE_VARIANT);
20729 g_value_set_variant (&paramv[n], child);
20730 n++;
20731 }
20732 else
20733 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20734 g_variant_unref (child);
20735 }
20736 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
20737 g_value_init (&return_value, G_TYPE_BOOLEAN);
20738 g_signal_emitv (paramv, signal_id, 0, &return_value);
20739 if (!g_value_get_boolean (&return_value))
20740 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);
20741 g_value_unset (&return_value);
20742 for (n = 0; n < num_params + num_extra; n++)
20743 g_value_unset (&paramv[n]);
20744 g_free (paramv);
20745}
20746
20747static GVariant *
20748_flash_skeleton_handle_get_property (
20749 GDBusConnection *connection G_GNUC_UNUSED,
20750 const gchar *sender G_GNUC_UNUSED,
20751 const gchar *object_path G_GNUC_UNUSED,
20752 const gchar *interface_name G_GNUC_UNUSED,
20753 const gchar *property_name,
20754 GError **error,
20755 gpointer user_data)
20756{
20757 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20758 GValue value = G_VALUE_INIT;
20759 GParamSpec *pspec;
20760 _ExtendedGDBusPropertyInfo *info;
20761 GVariant *ret;
20762 ret = NULL;
20763 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20764 g_assert (info != NULL);
20765 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20766 if (pspec == NULL)
20767 {
20768 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20769 }
20770 else
20771 {
20772 g_value_init (&value, pspec->value_type);
20773 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20774 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20775 g_value_unset (&value);
20776 }
20777 return ret;
20778}
20779
20780static gboolean
20781_flash_skeleton_handle_set_property (
20782 GDBusConnection *connection G_GNUC_UNUSED,
20783 const gchar *sender G_GNUC_UNUSED,
20784 const gchar *object_path G_GNUC_UNUSED,
20785 const gchar *interface_name G_GNUC_UNUSED,
20786 const gchar *property_name,
20787 GVariant *variant,
20788 GError **error,
20789 gpointer user_data)
20790{
20791 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
20792 GValue value = G_VALUE_INIT;
20793 GParamSpec *pspec;
20794 _ExtendedGDBusPropertyInfo *info;
20795 gboolean ret;
20796 ret = FALSE;
20797 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
20798 g_assert (info != NULL);
20799 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20800 if (pspec == NULL)
20801 {
20802 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20803 }
20804 else
20805 {
20806 if (info->use_gvariant)
20807 g_value_set_variant (&value, variant);
20808 else
20809 g_dbus_gvariant_to_gvalue (variant, &value);
20810 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20811 g_value_unset (&value);
20812 ret = TRUE;
20813 }
20814 return ret;
20815}
20816
20817static const GDBusInterfaceVTable _flash_skeleton_vtable =
20818{
20819 _flash_skeleton_handle_method_call,
20820 _flash_skeleton_handle_get_property,
20821 _flash_skeleton_handle_set_property,
20822 {NULL}
20823};
20824
20825static GDBusInterfaceInfo *
20826flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20827{
20828 return flash_interface_info ();
20829}
20830
20831static GDBusInterfaceVTable *
20832flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20833{
20834 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
20835}
20836
20837static GVariant *
20838flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20839{
20840 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
20841
20842 GVariantBuilder builder;
20843 guint n;
20844 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20845 if (_flash_interface_info.parent_struct.properties == NULL)
20846 goto out;
20847 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
20848 {
20849 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
20850 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20851 {
20852 GVariant *value;
20853 value = _flash_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.Flash", info->name, NULL, skeleton);
20854 if (value != NULL)
20855 {
20856 g_variant_take_ref (value);
20857 g_variant_builder_add (&builder, "{sv}", info->name, value);
20858 g_variant_unref (value);
20859 }
20860 }
20861 }
20862out:
20863 return g_variant_builder_end (&builder);
20864}
20865
20866static void
20867flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20868{
20869}
20870
20871static void
20872_flash_on_signal_updated (
20873 Flash *object)
20874{
20875 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20876
20877 GList *connections, *l;
20878 GVariant *signal_variant;
20879 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20880
20881 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20882 for (l = connections; l != NULL; l = l->next)
20883 {
20884 GDBusConnection *connection = l->data;
20885 g_dbus_connection_emit_signal (connection,
20886 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
20887 signal_variant, NULL);
20888 }
20889 g_variant_unref (signal_variant);
20890 g_list_free_full (connections, g_object_unref);
20891}
20892
20893static void flash_skeleton_iface_init (FlashIface *iface);
20894#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20895G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20896 G_ADD_PRIVATE (FlashSkeleton)
20897 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
20898
20899#else
20900G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20901 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
20902
20903#endif
20904static void
20905flash_skeleton_finalize (GObject *object)
20906{
20907 FlashSkeleton *skeleton = FLASH_SKELETON (object);
20908 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20909 if (skeleton->priv->changed_properties_idle_source != NULL)
20910 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20911 g_main_context_unref (skeleton->priv->context);
20912 g_mutex_clear (&skeleton->priv->lock);
20913 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
20914}
20915
20916static void
20917flash_skeleton_init (FlashSkeleton *skeleton)
20918{
20919#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20920 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
20921#else
20922 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
20923#endif
20924
20925 g_mutex_init (&skeleton->priv->lock);
20926 skeleton->priv->context = g_main_context_ref_thread_default ();
20927}
20928
20929static void
20930flash_skeleton_class_init (FlashSkeletonClass *klass)
20931{
20932 GObjectClass *gobject_class;
20933 GDBusInterfaceSkeletonClass *skeleton_class;
20934
20935 gobject_class = G_OBJECT_CLASS (klass);
20936 gobject_class->finalize = flash_skeleton_finalize;
20937
20938 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20939 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
20940 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
20941 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
20942 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
20943
20944#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20945 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
20946#endif
20947}
20948
20949static void
20950flash_skeleton_iface_init (FlashIface *iface)
20951{
20952 iface->updated = _flash_on_signal_updated;
20953}
20954
20955/**
20956 * flash_skeleton_new:
20957 *
20958 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20959 *
20960 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
20961 */
20962Flash *
20963flash_skeleton_new (void)
20964{
20965 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
20966}
20967
20968/* ------------------------------------------------------------------------
20969 * Code for interface org.openbmc.Button
20970 * ------------------------------------------------------------------------
20971 */
20972
20973/**
20974 * SECTION:Button
20975 * @title: Button
20976 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
20977 *
20978 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface in C.
20979 */
20980
20981/* ---- Introspection data for org.openbmc.Button ---- */
20982
20983static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
20984{
20985 {
20986 -1,
20987 (gchar *) "state",
20988 (gchar *) "b",
20989 NULL
20990 },
20991 FALSE
20992};
20993
20994static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
20995{
20996 &_button_method_info_is_on_OUT_ARG_state,
20997 NULL
20998};
20999
21000static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
21001{
21002 {
21003 -1,
21004 (gchar *) "isOn",
21005 NULL,
21006 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
21007 NULL
21008 },
21009 "handle-is-on",
21010 FALSE
21011};
21012
21013static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
21014{
21015 {
21016 -1,
21017 (gchar *) "simButtonPress",
21018 NULL,
21019 NULL,
21020 NULL
21021 },
21022 "handle-sim-button-press",
21023 FALSE
21024};
21025
21026static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
21027{
21028 {
21029 -1,
21030 (gchar *) "simButtonLongPress",
21031 NULL,
21032 NULL,
21033 NULL
21034 },
21035 "handle-sim-button-long-press",
21036 FALSE
21037};
21038
21039static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
21040{
21041 &_button_method_info_is_on,
21042 &_button_method_info_sim_button_press,
21043 &_button_method_info_sim_button_long_press,
21044 NULL
21045};
21046
21047static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
21048{
21049 {
21050 -1,
21051 (gchar *) "ButtonRelease",
21052 NULL,
21053 NULL
21054 },
21055 "button-release"
21056};
21057
21058static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
21059{
21060 {
21061 -1,
21062 (gchar *) "ButtonPressed",
21063 NULL,
21064 NULL
21065 },
21066 "button-pressed"
21067};
21068
21069static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
21070{
21071 {
21072 -1,
21073 (gchar *) "ButtonPressedLong",
21074 NULL,
21075 NULL
21076 },
21077 "button-pressed-long"
21078};
21079
21080static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
21081{
21082 &_button_signal_info_button_release,
21083 &_button_signal_info_button_pressed,
21084 &_button_signal_info_button_pressed_long,
21085 NULL
21086};
21087
21088static const _ExtendedGDBusPropertyInfo _button_property_info_state =
21089{
21090 {
21091 -1,
21092 (gchar *) "state",
21093 (gchar *) "b",
21094 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21095 NULL
21096 },
21097 "state",
21098 FALSE
21099};
21100
21101static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
21102{
21103 &_button_property_info_state,
21104 NULL
21105};
21106
21107static const _ExtendedGDBusInterfaceInfo _button_interface_info =
21108{
21109 {
21110 -1,
21111 (gchar *) "org.openbmc.Button",
21112 (GDBusMethodInfo **) &_button_method_info_pointers,
21113 (GDBusSignalInfo **) &_button_signal_info_pointers,
21114 (GDBusPropertyInfo **) &_button_property_info_pointers,
21115 NULL
21116 },
21117 "button",
21118};
21119
21120
21121/**
21122 * button_interface_info:
21123 *
21124 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
21125 *
21126 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21127 */
21128GDBusInterfaceInfo *
21129button_interface_info (void)
21130{
21131 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
21132}
21133
21134/**
21135 * button_override_properties:
21136 * @klass: The class structure for a #GObject<!-- -->-derived class.
21137 * @property_id_begin: The property id to assign to the first overridden property.
21138 *
21139 * Overrides all #GObject properties in the #Button interface for a concrete class.
21140 * The properties are overridden in the order they are defined.
21141 *
21142 * Returns: The last property id.
21143 */
21144guint
21145button_override_properties (GObjectClass *klass, guint property_id_begin)
21146{
21147 g_object_class_override_property (klass, property_id_begin++, "state");
21148 return property_id_begin - 1;
21149}
21150
21151
21152
21153/**
21154 * Button:
21155 *
21156 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
21157 */
21158
21159/**
21160 * ButtonIface:
21161 * @parent_iface: The parent interface.
21162 * @handle_is_on: Handler for the #Button::handle-is-on signal.
21163 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
21164 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
21165 * @get_state: Getter for the #Button:state property.
21166 * @button_pressed: Handler for the #Button::button-pressed signal.
21167 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
21168 * @button_release: Handler for the #Button::button-release signal.
21169 *
21170 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
21171 */
21172
21173typedef ButtonIface ButtonInterface;
21174G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
21175
21176static void
21177button_default_init (ButtonIface *iface)
21178{
21179 /* GObject signals for incoming D-Bus method calls: */
21180 /**
21181 * Button::handle-is-on:
21182 * @object: A #Button.
21183 * @invocation: A #GDBusMethodInvocation.
21184 *
21185 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
21186 *
21187 * 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 button_complete_is_on() 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.
21188 *
21189 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21190 */
21191 g_signal_new ("handle-is-on",
21192 G_TYPE_FROM_INTERFACE (iface),
21193 G_SIGNAL_RUN_LAST,
21194 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
21195 g_signal_accumulator_true_handled,
21196 NULL,
21197 g_cclosure_marshal_generic,
21198 G_TYPE_BOOLEAN,
21199 1,
21200 G_TYPE_DBUS_METHOD_INVOCATION);
21201
21202 /**
21203 * Button::handle-sim-button-press:
21204 * @object: A #Button.
21205 * @invocation: A #GDBusMethodInvocation.
21206 *
21207 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
21208 *
21209 * 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 button_complete_sim_button_press() 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.
21210 *
21211 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21212 */
21213 g_signal_new ("handle-sim-button-press",
21214 G_TYPE_FROM_INTERFACE (iface),
21215 G_SIGNAL_RUN_LAST,
21216 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
21217 g_signal_accumulator_true_handled,
21218 NULL,
21219 g_cclosure_marshal_generic,
21220 G_TYPE_BOOLEAN,
21221 1,
21222 G_TYPE_DBUS_METHOD_INVOCATION);
21223
21224 /**
21225 * Button::handle-sim-button-long-press:
21226 * @object: A #Button.
21227 * @invocation: A #GDBusMethodInvocation.
21228 *
21229 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
21230 *
21231 * 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 button_complete_sim_button_long_press() 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.
21232 *
21233 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21234 */
21235 g_signal_new ("handle-sim-button-long-press",
21236 G_TYPE_FROM_INTERFACE (iface),
21237 G_SIGNAL_RUN_LAST,
21238 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
21239 g_signal_accumulator_true_handled,
21240 NULL,
21241 g_cclosure_marshal_generic,
21242 G_TYPE_BOOLEAN,
21243 1,
21244 G_TYPE_DBUS_METHOD_INVOCATION);
21245
21246 /* GObject signals for received D-Bus signals: */
21247 /**
21248 * Button::button-release:
21249 * @object: A #Button.
21250 *
21251 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> is received.
21252 *
21253 * 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.
21254 */
21255 g_signal_new ("button-release",
21256 G_TYPE_FROM_INTERFACE (iface),
21257 G_SIGNAL_RUN_LAST,
21258 G_STRUCT_OFFSET (ButtonIface, button_release),
21259 NULL,
21260 NULL,
21261 g_cclosure_marshal_generic,
21262 G_TYPE_NONE,
21263 0);
21264
21265 /**
21266 * Button::button-pressed:
21267 * @object: A #Button.
21268 *
21269 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> is received.
21270 *
21271 * 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.
21272 */
21273 g_signal_new ("button-pressed",
21274 G_TYPE_FROM_INTERFACE (iface),
21275 G_SIGNAL_RUN_LAST,
21276 G_STRUCT_OFFSET (ButtonIface, button_pressed),
21277 NULL,
21278 NULL,
21279 g_cclosure_marshal_generic,
21280 G_TYPE_NONE,
21281 0);
21282
21283 /**
21284 * Button::button-pressed-long:
21285 * @object: A #Button.
21286 *
21287 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> is received.
21288 *
21289 * 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.
21290 */
21291 g_signal_new ("button-pressed-long",
21292 G_TYPE_FROM_INTERFACE (iface),
21293 G_SIGNAL_RUN_LAST,
21294 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
21295 NULL,
21296 NULL,
21297 g_cclosure_marshal_generic,
21298 G_TYPE_NONE,
21299 0);
21300
21301 /* GObject properties for D-Bus properties: */
21302 /**
21303 * Button:state:
21304 *
21305 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
21306 *
21307 * 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.
21308 */
21309 g_object_interface_install_property (iface,
21310 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21311}
21312
21313/**
21314 * button_get_state: (skip)
21315 * @object: A #Button.
21316 *
21317 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
21318 *
21319 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21320 *
21321 * Returns: The property value.
21322 */
21323gboolean
21324button_get_state (Button *object)
21325{
21326 return BUTTON_GET_IFACE (object)->get_state (object);
21327}
21328
21329/**
21330 * button_set_state: (skip)
21331 * @object: A #Button.
21332 * @value: The value to set.
21333 *
21334 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
21335 *
21336 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21337 */
21338void
21339button_set_state (Button *object, gboolean value)
21340{
21341 g_object_set (G_OBJECT (object), "state", value, NULL);
21342}
21343
21344/**
21345 * button_emit_button_release:
21346 * @object: A #Button.
21347 *
21348 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
21349 */
21350void
21351button_emit_button_release (
21352 Button *object)
21353{
21354 g_signal_emit_by_name (object, "button-release");
21355}
21356
21357/**
21358 * button_emit_button_pressed:
21359 * @object: A #Button.
21360 *
21361 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
21362 */
21363void
21364button_emit_button_pressed (
21365 Button *object)
21366{
21367 g_signal_emit_by_name (object, "button-pressed");
21368}
21369
21370/**
21371 * button_emit_button_pressed_long:
21372 * @object: A #Button.
21373 *
21374 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
21375 */
21376void
21377button_emit_button_pressed_long (
21378 Button *object)
21379{
21380 g_signal_emit_by_name (object, "button-pressed-long");
21381}
21382
21383/**
21384 * button_call_is_on:
21385 * @proxy: A #ButtonProxy.
21386 * @cancellable: (allow-none): A #GCancellable or %NULL.
21387 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21388 * @user_data: User data to pass to @callback.
21389 *
21390 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
21391 * 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.
21392 * You can then call button_call_is_on_finish() to get the result of the operation.
21393 *
21394 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
21395 */
21396void
21397button_call_is_on (
21398 Button *proxy,
21399 GCancellable *cancellable,
21400 GAsyncReadyCallback callback,
21401 gpointer user_data)
21402{
21403 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21404 "isOn",
21405 g_variant_new ("()"),
21406 G_DBUS_CALL_FLAGS_NONE,
21407 -1,
21408 cancellable,
21409 callback,
21410 user_data);
21411}
21412
21413/**
21414 * button_call_is_on_finish:
21415 * @proxy: A #ButtonProxy.
21416 * @out_state: (out): Return location for return parameter or %NULL to ignore.
21417 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
21418 * @error: Return location for error or %NULL.
21419 *
21420 * Finishes an operation started with button_call_is_on().
21421 *
21422 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21423 */
21424gboolean
21425button_call_is_on_finish (
21426 Button *proxy,
21427 gboolean *out_state,
21428 GAsyncResult *res,
21429 GError **error)
21430{
21431 GVariant *_ret;
21432 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21433 if (_ret == NULL)
21434 goto _out;
21435 g_variant_get (_ret,
21436 "(b)",
21437 out_state);
21438 g_variant_unref (_ret);
21439_out:
21440 return _ret != NULL;
21441}
21442
21443/**
21444 * button_call_is_on_sync:
21445 * @proxy: A #ButtonProxy.
21446 * @out_state: (out): Return location for return parameter or %NULL to ignore.
21447 * @cancellable: (allow-none): A #GCancellable or %NULL.
21448 * @error: Return location for error or %NULL.
21449 *
21450 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
21451 *
21452 * See button_call_is_on() for the asynchronous version of this method.
21453 *
21454 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21455 */
21456gboolean
21457button_call_is_on_sync (
21458 Button *proxy,
21459 gboolean *out_state,
21460 GCancellable *cancellable,
21461 GError **error)
21462{
21463 GVariant *_ret;
21464 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21465 "isOn",
21466 g_variant_new ("()"),
21467 G_DBUS_CALL_FLAGS_NONE,
21468 -1,
21469 cancellable,
21470 error);
21471 if (_ret == NULL)
21472 goto _out;
21473 g_variant_get (_ret,
21474 "(b)",
21475 out_state);
21476 g_variant_unref (_ret);
21477_out:
21478 return _ret != NULL;
21479}
21480
21481/**
21482 * button_call_sim_button_press:
21483 * @proxy: A #ButtonProxy.
21484 * @cancellable: (allow-none): A #GCancellable or %NULL.
21485 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21486 * @user_data: User data to pass to @callback.
21487 *
21488 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
21489 * 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.
21490 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
21491 *
21492 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
21493 */
21494void
21495button_call_sim_button_press (
21496 Button *proxy,
21497 GCancellable *cancellable,
21498 GAsyncReadyCallback callback,
21499 gpointer user_data)
21500{
21501 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21502 "simButtonPress",
21503 g_variant_new ("()"),
21504 G_DBUS_CALL_FLAGS_NONE,
21505 -1,
21506 cancellable,
21507 callback,
21508 user_data);
21509}
21510
21511/**
21512 * button_call_sim_button_press_finish:
21513 * @proxy: A #ButtonProxy.
21514 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
21515 * @error: Return location for error or %NULL.
21516 *
21517 * Finishes an operation started with button_call_sim_button_press().
21518 *
21519 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21520 */
21521gboolean
21522button_call_sim_button_press_finish (
21523 Button *proxy,
21524 GAsyncResult *res,
21525 GError **error)
21526{
21527 GVariant *_ret;
21528 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21529 if (_ret == NULL)
21530 goto _out;
21531 g_variant_get (_ret,
21532 "()");
21533 g_variant_unref (_ret);
21534_out:
21535 return _ret != NULL;
21536}
21537
21538/**
21539 * button_call_sim_button_press_sync:
21540 * @proxy: A #ButtonProxy.
21541 * @cancellable: (allow-none): A #GCancellable or %NULL.
21542 * @error: Return location for error or %NULL.
21543 *
21544 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
21545 *
21546 * See button_call_sim_button_press() for the asynchronous version of this method.
21547 *
21548 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21549 */
21550gboolean
21551button_call_sim_button_press_sync (
21552 Button *proxy,
21553 GCancellable *cancellable,
21554 GError **error)
21555{
21556 GVariant *_ret;
21557 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21558 "simButtonPress",
21559 g_variant_new ("()"),
21560 G_DBUS_CALL_FLAGS_NONE,
21561 -1,
21562 cancellable,
21563 error);
21564 if (_ret == NULL)
21565 goto _out;
21566 g_variant_get (_ret,
21567 "()");
21568 g_variant_unref (_ret);
21569_out:
21570 return _ret != NULL;
21571}
21572
21573/**
21574 * button_call_sim_button_long_press:
21575 * @proxy: A #ButtonProxy.
21576 * @cancellable: (allow-none): A #GCancellable or %NULL.
21577 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21578 * @user_data: User data to pass to @callback.
21579 *
21580 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
21581 * 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.
21582 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
21583 *
21584 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
21585 */
21586void
21587button_call_sim_button_long_press (
21588 Button *proxy,
21589 GCancellable *cancellable,
21590 GAsyncReadyCallback callback,
21591 gpointer user_data)
21592{
21593 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21594 "simButtonLongPress",
21595 g_variant_new ("()"),
21596 G_DBUS_CALL_FLAGS_NONE,
21597 -1,
21598 cancellable,
21599 callback,
21600 user_data);
21601}
21602
21603/**
21604 * button_call_sim_button_long_press_finish:
21605 * @proxy: A #ButtonProxy.
21606 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
21607 * @error: Return location for error or %NULL.
21608 *
21609 * Finishes an operation started with button_call_sim_button_long_press().
21610 *
21611 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21612 */
21613gboolean
21614button_call_sim_button_long_press_finish (
21615 Button *proxy,
21616 GAsyncResult *res,
21617 GError **error)
21618{
21619 GVariant *_ret;
21620 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21621 if (_ret == NULL)
21622 goto _out;
21623 g_variant_get (_ret,
21624 "()");
21625 g_variant_unref (_ret);
21626_out:
21627 return _ret != NULL;
21628}
21629
21630/**
21631 * button_call_sim_button_long_press_sync:
21632 * @proxy: A #ButtonProxy.
21633 * @cancellable: (allow-none): A #GCancellable or %NULL.
21634 * @error: Return location for error or %NULL.
21635 *
21636 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
21637 *
21638 * See button_call_sim_button_long_press() for the asynchronous version of this method.
21639 *
21640 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21641 */
21642gboolean
21643button_call_sim_button_long_press_sync (
21644 Button *proxy,
21645 GCancellable *cancellable,
21646 GError **error)
21647{
21648 GVariant *_ret;
21649 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21650 "simButtonLongPress",
21651 g_variant_new ("()"),
21652 G_DBUS_CALL_FLAGS_NONE,
21653 -1,
21654 cancellable,
21655 error);
21656 if (_ret == NULL)
21657 goto _out;
21658 g_variant_get (_ret,
21659 "()");
21660 g_variant_unref (_ret);
21661_out:
21662 return _ret != NULL;
21663}
21664
21665/**
21666 * button_complete_is_on:
21667 * @object: A #Button.
21668 * @invocation: (transfer full): A #GDBusMethodInvocation.
21669 * @state: Parameter to return.
21670 *
21671 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</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.
21672 *
21673 * This method will free @invocation, you cannot use it afterwards.
21674 */
21675void
21676button_complete_is_on (
21677 Button *object,
21678 GDBusMethodInvocation *invocation,
21679 gboolean state)
21680{
21681 g_dbus_method_invocation_return_value (invocation,
21682 g_variant_new ("(b)",
21683 state));
21684}
21685
21686/**
21687 * button_complete_sim_button_press:
21688 * @object: A #Button.
21689 * @invocation: (transfer full): A #GDBusMethodInvocation.
21690 *
21691 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</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.
21692 *
21693 * This method will free @invocation, you cannot use it afterwards.
21694 */
21695void
21696button_complete_sim_button_press (
21697 Button *object,
21698 GDBusMethodInvocation *invocation)
21699{
21700 g_dbus_method_invocation_return_value (invocation,
21701 g_variant_new ("()"));
21702}
21703
21704/**
21705 * button_complete_sim_button_long_press:
21706 * @object: A #Button.
21707 * @invocation: (transfer full): A #GDBusMethodInvocation.
21708 *
21709 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</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.
21710 *
21711 * This method will free @invocation, you cannot use it afterwards.
21712 */
21713void
21714button_complete_sim_button_long_press (
21715 Button *object,
21716 GDBusMethodInvocation *invocation)
21717{
21718 g_dbus_method_invocation_return_value (invocation,
21719 g_variant_new ("()"));
21720}
21721
21722/* ------------------------------------------------------------------------ */
21723
21724/**
21725 * ButtonProxy:
21726 *
21727 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
21728 */
21729
21730/**
21731 * ButtonProxyClass:
21732 * @parent_class: The parent class.
21733 *
21734 * Class structure for #ButtonProxy.
21735 */
21736
21737struct _ButtonProxyPrivate
21738{
21739 GData *qdata;
21740};
21741
21742static void button_proxy_iface_init (ButtonIface *iface);
21743
21744#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21745G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
21746 G_ADD_PRIVATE (ButtonProxy)
21747 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
21748
21749#else
21750G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
21751 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
21752
21753#endif
21754static void
21755button_proxy_finalize (GObject *object)
21756{
21757 ButtonProxy *proxy = BUTTON_PROXY (object);
21758 g_datalist_clear (&proxy->priv->qdata);
21759 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
21760}
21761
21762static void
21763button_proxy_get_property (GObject *object,
21764 guint prop_id,
21765 GValue *value,
21766 GParamSpec *pspec G_GNUC_UNUSED)
21767{
21768 const _ExtendedGDBusPropertyInfo *info;
21769 GVariant *variant;
21770 g_assert (prop_id != 0 && prop_id - 1 < 1);
21771 info = _button_property_info_pointers[prop_id - 1];
21772 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
21773 if (info->use_gvariant)
21774 {
21775 g_value_set_variant (value, variant);
21776 }
21777 else
21778 {
21779 if (variant != NULL)
21780 g_dbus_gvariant_to_gvalue (variant, value);
21781 }
21782 if (variant != NULL)
21783 g_variant_unref (variant);
21784}
21785
21786static void
21787button_proxy_set_property_cb (GDBusProxy *proxy,
21788 GAsyncResult *res,
21789 gpointer user_data)
21790{
21791 const _ExtendedGDBusPropertyInfo *info = user_data;
21792 GError *error;
21793 GVariant *_ret;
21794 error = NULL;
21795 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
21796 if (!_ret)
21797 {
21798 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
21799 info->parent_struct.name,
21800 error->message, g_quark_to_string (error->domain), error->code);
21801 g_error_free (error);
21802 }
21803 else
21804 {
21805 g_variant_unref (_ret);
21806 }
21807}
21808
21809static void
21810button_proxy_set_property (GObject *object,
21811 guint prop_id,
21812 const GValue *value,
21813 GParamSpec *pspec G_GNUC_UNUSED)
21814{
21815 const _ExtendedGDBusPropertyInfo *info;
21816 GVariant *variant;
21817 g_assert (prop_id != 0 && prop_id - 1 < 1);
21818 info = _button_property_info_pointers[prop_id - 1];
21819 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
21820 g_dbus_proxy_call (G_DBUS_PROXY (object),
21821 "org.freedesktop.DBus.Properties.Set",
21822 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
21823 G_DBUS_CALL_FLAGS_NONE,
21824 -1,
21825 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
21826 g_variant_unref (variant);
21827}
21828
21829static void
21830button_proxy_g_signal (GDBusProxy *proxy,
21831 const gchar *sender_name G_GNUC_UNUSED,
21832 const gchar *signal_name,
21833 GVariant *parameters)
21834{
21835 _ExtendedGDBusSignalInfo *info;
21836 GVariantIter iter;
21837 GVariant *child;
21838 GValue *paramv;
21839 guint num_params;
21840 guint n;
21841 guint signal_id;
21842 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
21843 if (info == NULL)
21844 return;
21845 num_params = g_variant_n_children (parameters);
21846 paramv = g_new0 (GValue, num_params + 1);
21847 g_value_init (&paramv[0], TYPE_BUTTON);
21848 g_value_set_object (&paramv[0], proxy);
21849 g_variant_iter_init (&iter, parameters);
21850 n = 1;
21851 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21852 {
21853 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
21854 if (arg_info->use_gvariant)
21855 {
21856 g_value_init (&paramv[n], G_TYPE_VARIANT);
21857 g_value_set_variant (&paramv[n], child);
21858 n++;
21859 }
21860 else
21861 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21862 g_variant_unref (child);
21863 }
21864 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
21865 g_signal_emitv (paramv, signal_id, 0, NULL);
21866 for (n = 0; n < num_params + 1; n++)
21867 g_value_unset (&paramv[n]);
21868 g_free (paramv);
21869}
21870
21871static void
21872button_proxy_g_properties_changed (GDBusProxy *_proxy,
21873 GVariant *changed_properties,
21874 const gchar *const *invalidated_properties)
21875{
21876 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
21877 guint n;
21878 const gchar *key;
21879 GVariantIter *iter;
21880 _ExtendedGDBusPropertyInfo *info;
21881 g_variant_get (changed_properties, "a{sv}", &iter);
21882 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
21883 {
21884 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
21885 g_datalist_remove_data (&proxy->priv->qdata, key);
21886 if (info != NULL)
21887 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21888 }
21889 g_variant_iter_free (iter);
21890 for (n = 0; invalidated_properties[n] != NULL; n++)
21891 {
21892 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
21893 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
21894 if (info != NULL)
21895 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21896 }
21897}
21898
21899static gboolean
21900button_proxy_get_state (Button *object)
21901{
21902 ButtonProxy *proxy = BUTTON_PROXY (object);
21903 GVariant *variant;
21904 gboolean value = 0;
21905 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
21906 if (variant != NULL)
21907 {
21908 value = g_variant_get_boolean (variant);
21909 g_variant_unref (variant);
21910 }
21911 return value;
21912}
21913
21914static void
21915button_proxy_init (ButtonProxy *proxy)
21916{
21917#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21918 proxy->priv = button_proxy_get_instance_private (proxy);
21919#else
21920 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
21921#endif
21922
21923 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
21924}
21925
21926static void
21927button_proxy_class_init (ButtonProxyClass *klass)
21928{
21929 GObjectClass *gobject_class;
21930 GDBusProxyClass *proxy_class;
21931
21932 gobject_class = G_OBJECT_CLASS (klass);
21933 gobject_class->finalize = button_proxy_finalize;
21934 gobject_class->get_property = button_proxy_get_property;
21935 gobject_class->set_property = button_proxy_set_property;
21936
21937 proxy_class = G_DBUS_PROXY_CLASS (klass);
21938 proxy_class->g_signal = button_proxy_g_signal;
21939 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
21940
21941 button_override_properties (gobject_class, 1);
21942
21943#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21944 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
21945#endif
21946}
21947
21948static void
21949button_proxy_iface_init (ButtonIface *iface)
21950{
21951 iface->get_state = button_proxy_get_state;
21952}
21953
21954/**
21955 * button_proxy_new:
21956 * @connection: A #GDBusConnection.
21957 * @flags: Flags from the #GDBusProxyFlags enumeration.
21958 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21959 * @object_path: An object path.
21960 * @cancellable: (allow-none): A #GCancellable or %NULL.
21961 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21962 * @user_data: User data to pass to @callback.
21963 *
21964 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new() for more details.
21965 *
21966 * 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.
21967 * You can then call button_proxy_new_finish() to get the result of the operation.
21968 *
21969 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
21970 */
21971void
21972button_proxy_new (
21973 GDBusConnection *connection,
21974 GDBusProxyFlags flags,
21975 const gchar *name,
21976 const gchar *object_path,
21977 GCancellable *cancellable,
21978 GAsyncReadyCallback callback,
21979 gpointer user_data)
21980{
21981 g_async_initable_new_async (TYPE_BUTTON_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.Button", NULL);
21982}
21983
21984/**
21985 * button_proxy_new_finish:
21986 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
21987 * @error: Return location for error or %NULL
21988 *
21989 * Finishes an operation started with button_proxy_new().
21990 *
21991 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
21992 */
21993Button *
21994button_proxy_new_finish (
21995 GAsyncResult *res,
21996 GError **error)
21997{
21998 GObject *ret;
21999 GObject *source_object;
22000 source_object = g_async_result_get_source_object (res);
22001 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22002 g_object_unref (source_object);
22003 if (ret != NULL)
22004 return BUTTON (ret);
22005 else
22006 return NULL;
22007}
22008
22009/**
22010 * button_proxy_new_sync:
22011 * @connection: A #GDBusConnection.
22012 * @flags: Flags from the #GDBusProxyFlags enumeration.
22013 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
22014 * @object_path: An object path.
22015 * @cancellable: (allow-none): A #GCancellable or %NULL.
22016 * @error: Return location for error or %NULL
22017 *
22018 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new_sync() for more details.
22019 *
22020 * The calling thread is blocked until a reply is received.
22021 *
22022 * See button_proxy_new() for the asynchronous version of this constructor.
22023 *
22024 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
22025 */
22026Button *
22027button_proxy_new_sync (
22028 GDBusConnection *connection,
22029 GDBusProxyFlags flags,
22030 const gchar *name,
22031 const gchar *object_path,
22032 GCancellable *cancellable,
22033 GError **error)
22034{
22035 GInitable *ret;
22036 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
22037 if (ret != NULL)
22038 return BUTTON (ret);
22039 else
22040 return NULL;
22041}
22042
22043
22044/**
22045 * button_proxy_new_for_bus:
22046 * @bus_type: A #GBusType.
22047 * @flags: Flags from the #GDBusProxyFlags enumeration.
22048 * @name: A bus name (well-known or unique).
22049 * @object_path: An object path.
22050 * @cancellable: (allow-none): A #GCancellable or %NULL.
22051 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
22052 * @user_data: User data to pass to @callback.
22053 *
22054 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
22055 *
22056 * 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.
22057 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
22058 *
22059 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
22060 */
22061void
22062button_proxy_new_for_bus (
22063 GBusType bus_type,
22064 GDBusProxyFlags flags,
22065 const gchar *name,
22066 const gchar *object_path,
22067 GCancellable *cancellable,
22068 GAsyncReadyCallback callback,
22069 gpointer user_data)
22070{
22071 g_async_initable_new_async (TYPE_BUTTON_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.Button", NULL);
22072}
22073
22074/**
22075 * button_proxy_new_for_bus_finish:
22076 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
22077 * @error: Return location for error or %NULL
22078 *
22079 * Finishes an operation started with button_proxy_new_for_bus().
22080 *
22081 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
22082 */
22083Button *
22084button_proxy_new_for_bus_finish (
22085 GAsyncResult *res,
22086 GError **error)
22087{
22088 GObject *ret;
22089 GObject *source_object;
22090 source_object = g_async_result_get_source_object (res);
22091 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
22092 g_object_unref (source_object);
22093 if (ret != NULL)
22094 return BUTTON (ret);
22095 else
22096 return NULL;
22097}
22098
22099/**
22100 * button_proxy_new_for_bus_sync:
22101 * @bus_type: A #GBusType.
22102 * @flags: Flags from the #GDBusProxyFlags enumeration.
22103 * @name: A bus name (well-known or unique).
22104 * @object_path: An object path.
22105 * @cancellable: (allow-none): A #GCancellable or %NULL.
22106 * @error: Return location for error or %NULL
22107 *
22108 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
22109 *
22110 * The calling thread is blocked until a reply is received.
22111 *
22112 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
22113 *
22114 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
22115 */
22116Button *
22117button_proxy_new_for_bus_sync (
22118 GBusType bus_type,
22119 GDBusProxyFlags flags,
22120 const gchar *name,
22121 const gchar *object_path,
22122 GCancellable *cancellable,
22123 GError **error)
22124{
22125 GInitable *ret;
22126 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
22127 if (ret != NULL)
22128 return BUTTON (ret);
22129 else
22130 return NULL;
22131}
22132
22133
22134/* ------------------------------------------------------------------------ */
22135
22136/**
22137 * ButtonSkeleton:
22138 *
22139 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
22140 */
22141
22142/**
22143 * ButtonSkeletonClass:
22144 * @parent_class: The parent class.
22145 *
22146 * Class structure for #ButtonSkeleton.
22147 */
22148
22149struct _ButtonSkeletonPrivate
22150{
22151 GValue *properties;
22152 GList *changed_properties;
22153 GSource *changed_properties_idle_source;
22154 GMainContext *context;
22155 GMutex lock;
22156};
22157
22158static void
22159_button_skeleton_handle_method_call (
22160 GDBusConnection *connection G_GNUC_UNUSED,
22161 const gchar *sender G_GNUC_UNUSED,
22162 const gchar *object_path G_GNUC_UNUSED,
22163 const gchar *interface_name,
22164 const gchar *method_name,
22165 GVariant *parameters,
22166 GDBusMethodInvocation *invocation,
22167 gpointer user_data)
22168{
22169 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
22170 _ExtendedGDBusMethodInfo *info;
22171 GVariantIter iter;
22172 GVariant *child;
22173 GValue *paramv;
22174 guint num_params;
22175 guint num_extra;
22176 guint n;
22177 guint signal_id;
22178 GValue return_value = G_VALUE_INIT;
22179 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
22180 g_assert (info != NULL);
22181 num_params = g_variant_n_children (parameters);
22182 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
22183 n = 0;
22184 g_value_init (&paramv[n], TYPE_BUTTON);
22185 g_value_set_object (&paramv[n++], skeleton);
22186 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
22187 g_value_set_object (&paramv[n++], invocation);
22188 if (info->pass_fdlist)
22189 {
22190#ifdef G_OS_UNIX
22191 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
22192 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
22193#else
22194 g_assert_not_reached ();
22195#endif
22196 }
22197 g_variant_iter_init (&iter, parameters);
22198 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22199 {
22200 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
22201 if (arg_info->use_gvariant)
22202 {
22203 g_value_init (&paramv[n], G_TYPE_VARIANT);
22204 g_value_set_variant (&paramv[n], child);
22205 n++;
22206 }
22207 else
22208 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22209 g_variant_unref (child);
22210 }
22211 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
22212 g_value_init (&return_value, G_TYPE_BOOLEAN);
22213 g_signal_emitv (paramv, signal_id, 0, &return_value);
22214 if (!g_value_get_boolean (&return_value))
22215 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);
22216 g_value_unset (&return_value);
22217 for (n = 0; n < num_params + num_extra; n++)
22218 g_value_unset (&paramv[n]);
22219 g_free (paramv);
22220}
22221
22222static GVariant *
22223_button_skeleton_handle_get_property (
22224 GDBusConnection *connection G_GNUC_UNUSED,
22225 const gchar *sender G_GNUC_UNUSED,
22226 const gchar *object_path G_GNUC_UNUSED,
22227 const gchar *interface_name G_GNUC_UNUSED,
22228 const gchar *property_name,
22229 GError **error,
22230 gpointer user_data)
22231{
22232 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
22233 GValue value = G_VALUE_INIT;
22234 GParamSpec *pspec;
22235 _ExtendedGDBusPropertyInfo *info;
22236 GVariant *ret;
22237 ret = NULL;
22238 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
22239 g_assert (info != NULL);
22240 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22241 if (pspec == NULL)
22242 {
22243 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22244 }
22245 else
22246 {
22247 g_value_init (&value, pspec->value_type);
22248 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22249 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
22250 g_value_unset (&value);
22251 }
22252 return ret;
22253}
22254
22255static gboolean
22256_button_skeleton_handle_set_property (
22257 GDBusConnection *connection G_GNUC_UNUSED,
22258 const gchar *sender G_GNUC_UNUSED,
22259 const gchar *object_path G_GNUC_UNUSED,
22260 const gchar *interface_name G_GNUC_UNUSED,
22261 const gchar *property_name,
22262 GVariant *variant,
22263 GError **error,
22264 gpointer user_data)
22265{
22266 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
22267 GValue value = G_VALUE_INIT;
22268 GParamSpec *pspec;
22269 _ExtendedGDBusPropertyInfo *info;
22270 gboolean ret;
22271 ret = FALSE;
22272 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
22273 g_assert (info != NULL);
22274 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22275 if (pspec == NULL)
22276 {
22277 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22278 }
22279 else
22280 {
22281 if (info->use_gvariant)
22282 g_value_set_variant (&value, variant);
22283 else
22284 g_dbus_gvariant_to_gvalue (variant, &value);
22285 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22286 g_value_unset (&value);
22287 ret = TRUE;
22288 }
22289 return ret;
22290}
22291
22292static const GDBusInterfaceVTable _button_skeleton_vtable =
22293{
22294 _button_skeleton_handle_method_call,
22295 _button_skeleton_handle_get_property,
22296 _button_skeleton_handle_set_property,
22297 {NULL}
22298};
22299
22300static GDBusInterfaceInfo *
22301button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22302{
22303 return button_interface_info ();
22304}
22305
22306static GDBusInterfaceVTable *
22307button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22308{
22309 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
22310}
22311
22312static GVariant *
22313button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
22314{
22315 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
22316
22317 GVariantBuilder builder;
22318 guint n;
22319 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22320 if (_button_interface_info.parent_struct.properties == NULL)
22321 goto out;
22322 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
22323 {
22324 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
22325 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
22326 {
22327 GVariant *value;
22328 value = _button_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.Button", info->name, NULL, skeleton);
22329 if (value != NULL)
22330 {
22331 g_variant_take_ref (value);
22332 g_variant_builder_add (&builder, "{sv}", info->name, value);
22333 g_variant_unref (value);
22334 }
22335 }
22336 }
22337out:
22338 return g_variant_builder_end (&builder);
22339}
22340
22341static gboolean _button_emit_changed (gpointer user_data);
22342
22343static void
22344button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
22345{
22346 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
22347 gboolean emit_changed = FALSE;
22348
22349 g_mutex_lock (&skeleton->priv->lock);
22350 if (skeleton->priv->changed_properties_idle_source != NULL)
22351 {
22352 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22353 skeleton->priv->changed_properties_idle_source = NULL;
22354 emit_changed = TRUE;
22355 }
22356 g_mutex_unlock (&skeleton->priv->lock);
22357
22358 if (emit_changed)
22359 _button_emit_changed (skeleton);
22360}
22361
22362static void
22363_button_on_signal_button_release (
22364 Button *object)
22365{
22366 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
22367
22368 GList *connections, *l;
22369 GVariant *signal_variant;
22370 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22371
22372 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
22373 for (l = connections; l != NULL; l = l->next)
22374 {
22375 GDBusConnection *connection = l->data;
22376 g_dbus_connection_emit_signal (connection,
22377 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
22378 signal_variant, NULL);
22379 }
22380 g_variant_unref (signal_variant);
22381 g_list_free_full (connections, g_object_unref);
22382}
22383
22384static void
22385_button_on_signal_button_pressed (
22386 Button *object)
22387{
22388 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
22389
22390 GList *connections, *l;
22391 GVariant *signal_variant;
22392 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22393
22394 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
22395 for (l = connections; l != NULL; l = l->next)
22396 {
22397 GDBusConnection *connection = l->data;
22398 g_dbus_connection_emit_signal (connection,
22399 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
22400 signal_variant, NULL);
22401 }
22402 g_variant_unref (signal_variant);
22403 g_list_free_full (connections, g_object_unref);
22404}
22405
22406static void
22407_button_on_signal_button_pressed_long (
22408 Button *object)
22409{
22410 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
22411
22412 GList *connections, *l;
22413 GVariant *signal_variant;
22414 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22415
22416 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
22417 for (l = connections; l != NULL; l = l->next)
22418 {
22419 GDBusConnection *connection = l->data;
22420 g_dbus_connection_emit_signal (connection,
22421 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
22422 signal_variant, NULL);
22423 }
22424 g_variant_unref (signal_variant);
22425 g_list_free_full (connections, g_object_unref);
22426}
22427
22428static void button_skeleton_iface_init (ButtonIface *iface);
22429#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22430G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22431 G_ADD_PRIVATE (ButtonSkeleton)
22432 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
22433
22434#else
22435G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22436 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
22437
22438#endif
22439static void
22440button_skeleton_finalize (GObject *object)
22441{
22442 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
22443 guint n;
22444 for (n = 0; n < 1; n++)
22445 g_value_unset (&skeleton->priv->properties[n]);
22446 g_free (skeleton->priv->properties);
22447 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22448 if (skeleton->priv->changed_properties_idle_source != NULL)
22449 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22450 g_main_context_unref (skeleton->priv->context);
22451 g_mutex_clear (&skeleton->priv->lock);
22452 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
22453}
22454
22455static void
22456button_skeleton_get_property (GObject *object,
22457 guint prop_id,
22458 GValue *value,
22459 GParamSpec *pspec G_GNUC_UNUSED)
22460{
22461 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
22462 g_assert (prop_id != 0 && prop_id - 1 < 1);
22463 g_mutex_lock (&skeleton->priv->lock);
22464 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
22465 g_mutex_unlock (&skeleton->priv->lock);
22466}
22467
22468static gboolean
22469_button_emit_changed (gpointer user_data)
22470{
22471 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
22472 GList *l;
22473 GVariantBuilder builder;
22474 GVariantBuilder invalidated_builder;
22475 guint num_changes;
22476
22477 g_mutex_lock (&skeleton->priv->lock);
22478 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22479 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
22480 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
22481 {
22482 ChangedProperty *cp = l->data;
22483 GVariant *variant;
22484 const GValue *cur_value;
22485
22486 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
22487 if (!_g_value_equal (cur_value, &cp->orig_value))
22488 {
22489 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
22490 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
22491 g_variant_unref (variant);
22492 num_changes++;
22493 }
22494 }
22495 if (num_changes > 0)
22496 {
22497 GList *connections, *ll;
22498 GVariant *signal_variant;
22499 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
22500 &builder, &invalidated_builder));
22501 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22502 for (ll = connections; ll != NULL; ll = ll->next)
22503 {
22504 GDBusConnection *connection = ll->data;
22505
22506 g_dbus_connection_emit_signal (connection,
22507 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
22508 "org.freedesktop.DBus.Properties",
22509 "PropertiesChanged",
22510 signal_variant,
22511 NULL);
22512 }
22513 g_variant_unref (signal_variant);
22514 g_list_free_full (connections, g_object_unref);
22515 }
22516 else
22517 {
22518 g_variant_builder_clear (&builder);
22519 g_variant_builder_clear (&invalidated_builder);
22520 }
22521 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22522 skeleton->priv->changed_properties = NULL;
22523 skeleton->priv->changed_properties_idle_source = NULL;
22524 g_mutex_unlock (&skeleton->priv->lock);
22525 return FALSE;
22526}
22527
22528static void
22529_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
22530{
22531 ChangedProperty *cp;
22532 GList *l;
22533 cp = NULL;
22534 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
22535 {
22536 ChangedProperty *i_cp = l->data;
22537 if (i_cp->info == info)
22538 {
22539 cp = i_cp;
22540 break;
22541 }
22542 }
22543 if (cp == NULL)
22544 {
22545 cp = g_new0 (ChangedProperty, 1);
22546 cp->prop_id = prop_id;
22547 cp->info = info;
22548 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
22549 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
22550 g_value_copy (orig_value, &cp->orig_value);
22551 }
22552}
22553
22554static void
22555button_skeleton_notify (GObject *object,
22556 GParamSpec *pspec G_GNUC_UNUSED)
22557{
22558 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
22559 g_mutex_lock (&skeleton->priv->lock);
22560 if (skeleton->priv->changed_properties != NULL &&
22561 skeleton->priv->changed_properties_idle_source == NULL)
22562 {
22563 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
22564 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
22565 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
22566 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
22567 g_source_unref (skeleton->priv->changed_properties_idle_source);
22568 }
22569 g_mutex_unlock (&skeleton->priv->lock);
22570}
22571
22572static void
22573button_skeleton_set_property (GObject *object,
22574 guint prop_id,
22575 const GValue *value,
22576 GParamSpec *pspec)
22577{
22578 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
22579 g_assert (prop_id != 0 && prop_id - 1 < 1);
22580 g_mutex_lock (&skeleton->priv->lock);
22581 g_object_freeze_notify (object);
22582 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
22583 {
22584 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
22585 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
22586 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
22587 g_object_notify_by_pspec (object, pspec);
22588 }
22589 g_mutex_unlock (&skeleton->priv->lock);
22590 g_object_thaw_notify (object);
22591}
22592
22593static void
22594button_skeleton_init (ButtonSkeleton *skeleton)
22595{
22596#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22597 skeleton->priv = button_skeleton_get_instance_private (skeleton);
22598#else
22599 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
22600#endif
22601
22602 g_mutex_init (&skeleton->priv->lock);
22603 skeleton->priv->context = g_main_context_ref_thread_default ();
22604 skeleton->priv->properties = g_new0 (GValue, 1);
22605 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
22606}
22607
22608static gboolean
22609button_skeleton_get_state (Button *object)
22610{
22611 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
22612 gboolean value;
22613 g_mutex_lock (&skeleton->priv->lock);
22614 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
22615 g_mutex_unlock (&skeleton->priv->lock);
22616 return value;
22617}
22618
22619static void
22620button_skeleton_class_init (ButtonSkeletonClass *klass)
22621{
22622 GObjectClass *gobject_class;
22623 GDBusInterfaceSkeletonClass *skeleton_class;
22624
22625 gobject_class = G_OBJECT_CLASS (klass);
22626 gobject_class->finalize = button_skeleton_finalize;
22627 gobject_class->get_property = button_skeleton_get_property;
22628 gobject_class->set_property = button_skeleton_set_property;
22629 gobject_class->notify = button_skeleton_notify;
22630
22631
22632 button_override_properties (gobject_class, 1);
22633
22634 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
22635 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
22636 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
22637 skeleton_class->flush = button_skeleton_dbus_interface_flush;
22638 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
22639
22640#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22641 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
22642#endif
22643}
22644
22645static void
22646button_skeleton_iface_init (ButtonIface *iface)
22647{
22648 iface->button_release = _button_on_signal_button_release;
22649 iface->button_pressed = _button_on_signal_button_pressed;
22650 iface->button_pressed_long = _button_on_signal_button_pressed_long;
22651 iface->get_state = button_skeleton_get_state;
22652}
22653
22654/**
22655 * button_skeleton_new:
22656 *
22657 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
22658 *
22659 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
22660 */
22661Button *
22662button_skeleton_new (void)
22663{
22664 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
22665}
22666
22667/* ------------------------------------------------------------------------
22668 * Code for interface org.openbmc.Led
22669 * ------------------------------------------------------------------------
22670 */
22671
22672/**
22673 * SECTION:Led
22674 * @title: Led
22675 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
22676 *
22677 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface in C.
22678 */
22679
22680/* ---- Introspection data for org.openbmc.Led ---- */
22681
22682static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
22683{
22684 {
22685 -1,
22686 (gchar *) "setOn",
22687 NULL,
22688 NULL,
22689 NULL
22690 },
22691 "handle-set-on",
22692 FALSE
22693};
22694
22695static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
22696{
22697 {
22698 -1,
22699 (gchar *) "setOff",
22700 NULL,
22701 NULL,
22702 NULL
22703 },
22704 "handle-set-off",
22705 FALSE
22706};
22707
22708static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
22709{
22710 {
22711 -1,
22712 (gchar *) "setBlinkSlow",
22713 NULL,
22714 NULL,
22715 NULL
22716 },
22717 "handle-set-blink-slow",
22718 FALSE
22719};
22720
22721static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
22722{
22723 {
22724 -1,
22725 (gchar *) "setBlinkFast",
22726 NULL,
22727 NULL,
22728 NULL
22729 },
22730 "handle-set-blink-fast",
22731 FALSE
22732};
22733
22734static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
22735{
22736 &_led_method_info_set_on,
22737 &_led_method_info_set_off,
22738 &_led_method_info_set_blink_slow,
22739 &_led_method_info_set_blink_fast,
22740 NULL
22741};
22742
22743static const _ExtendedGDBusPropertyInfo _led_property_info_color =
22744{
22745 {
22746 -1,
22747 (gchar *) "color",
22748 (gchar *) "i",
22749 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22750 NULL
22751 },
22752 "color",
22753 FALSE
22754};
22755
22756static const _ExtendedGDBusPropertyInfo _led_property_info_function =
22757{
22758 {
22759 -1,
22760 (gchar *) "function",
22761 (gchar *) "s",
22762 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22763 NULL
22764 },
22765 "function",
22766 FALSE
22767};
22768
22769static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
22770{
22771 &_led_property_info_color,
22772 &_led_property_info_function,
22773 NULL
22774};
22775
22776static const _ExtendedGDBusInterfaceInfo _led_interface_info =
22777{
22778 {
22779 -1,
22780 (gchar *) "org.openbmc.Led",
22781 (GDBusMethodInfo **) &_led_method_info_pointers,
22782 NULL,
22783 (GDBusPropertyInfo **) &_led_property_info_pointers,
22784 NULL
22785 },
22786 "led",
22787};
22788
22789
22790/**
22791 * led_interface_info:
22792 *
22793 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
22794 *
22795 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22796 */
22797GDBusInterfaceInfo *
22798led_interface_info (void)
22799{
22800 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
22801}
22802
22803/**
22804 * led_override_properties:
22805 * @klass: The class structure for a #GObject<!-- -->-derived class.
22806 * @property_id_begin: The property id to assign to the first overridden property.
22807 *
22808 * Overrides all #GObject properties in the #Led interface for a concrete class.
22809 * The properties are overridden in the order they are defined.
22810 *
22811 * Returns: The last property id.
22812 */
22813guint
22814led_override_properties (GObjectClass *klass, guint property_id_begin)
22815{
22816 g_object_class_override_property (klass, property_id_begin++, "color");
22817 g_object_class_override_property (klass, property_id_begin++, "function");
22818 return property_id_begin - 1;
22819}
22820
22821
22822
22823/**
22824 * Led:
22825 *
22826 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
22827 */
22828
22829/**
22830 * LedIface:
22831 * @parent_iface: The parent interface.
22832 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
22833 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
22834 * @handle_set_off: Handler for the #Led::handle-set-off signal.
22835 * @handle_set_on: Handler for the #Led::handle-set-on signal.
22836 * @get_color: Getter for the #Led:color property.
22837 * @get_function: Getter for the #Led:function property.
22838 *
22839 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
22840 */
22841
22842typedef LedIface LedInterface;
22843G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
22844
22845static void
22846led_default_init (LedIface *iface)
22847{
22848 /* GObject signals for incoming D-Bus method calls: */
22849 /**
22850 * Led::handle-set-on:
22851 * @object: A #Led.
22852 * @invocation: A #GDBusMethodInvocation.
22853 *
22854 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
22855 *
22856 * 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 led_complete_set_on() 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.
22857 *
22858 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22859 */
22860 g_signal_new ("handle-set-on",
22861 G_TYPE_FROM_INTERFACE (iface),
22862 G_SIGNAL_RUN_LAST,
22863 G_STRUCT_OFFSET (LedIface, handle_set_on),
22864 g_signal_accumulator_true_handled,
22865 NULL,
22866 g_cclosure_marshal_generic,
22867 G_TYPE_BOOLEAN,
22868 1,
22869 G_TYPE_DBUS_METHOD_INVOCATION);
22870
22871 /**
22872 * Led::handle-set-off:
22873 * @object: A #Led.
22874 * @invocation: A #GDBusMethodInvocation.
22875 *
22876 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
22877 *
22878 * 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 led_complete_set_off() 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.
22879 *
22880 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22881 */
22882 g_signal_new ("handle-set-off",
22883 G_TYPE_FROM_INTERFACE (iface),
22884 G_SIGNAL_RUN_LAST,
22885 G_STRUCT_OFFSET (LedIface, handle_set_off),
22886 g_signal_accumulator_true_handled,
22887 NULL,
22888 g_cclosure_marshal_generic,
22889 G_TYPE_BOOLEAN,
22890 1,
22891 G_TYPE_DBUS_METHOD_INVOCATION);
22892
22893 /**
22894 * Led::handle-set-blink-slow:
22895 * @object: A #Led.
22896 * @invocation: A #GDBusMethodInvocation.
22897 *
22898 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
22899 *
22900 * 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 led_complete_set_blink_slow() 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.
22901 *
22902 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22903 */
22904 g_signal_new ("handle-set-blink-slow",
22905 G_TYPE_FROM_INTERFACE (iface),
22906 G_SIGNAL_RUN_LAST,
22907 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
22908 g_signal_accumulator_true_handled,
22909 NULL,
22910 g_cclosure_marshal_generic,
22911 G_TYPE_BOOLEAN,
22912 1,
22913 G_TYPE_DBUS_METHOD_INVOCATION);
22914
22915 /**
22916 * Led::handle-set-blink-fast:
22917 * @object: A #Led.
22918 * @invocation: A #GDBusMethodInvocation.
22919 *
22920 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
22921 *
22922 * 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 led_complete_set_blink_fast() 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.
22923 *
22924 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22925 */
22926 g_signal_new ("handle-set-blink-fast",
22927 G_TYPE_FROM_INTERFACE (iface),
22928 G_SIGNAL_RUN_LAST,
22929 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
22930 g_signal_accumulator_true_handled,
22931 NULL,
22932 g_cclosure_marshal_generic,
22933 G_TYPE_BOOLEAN,
22934 1,
22935 G_TYPE_DBUS_METHOD_INVOCATION);
22936
22937 /* GObject properties for D-Bus properties: */
22938 /**
22939 * Led:color:
22940 *
22941 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
22942 *
22943 * 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.
22944 */
22945 g_object_interface_install_property (iface,
22946 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22947 /**
22948 * Led:function:
22949 *
22950 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
22951 *
22952 * 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.
22953 */
22954 g_object_interface_install_property (iface,
22955 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22956}
22957
22958/**
22959 * led_get_color: (skip)
22960 * @object: A #Led.
22961 *
22962 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
22963 *
22964 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22965 *
22966 * Returns: The property value.
22967 */
22968gint
22969led_get_color (Led *object)
22970{
22971 return LED_GET_IFACE (object)->get_color (object);
22972}
22973
22974/**
22975 * led_set_color: (skip)
22976 * @object: A #Led.
22977 * @value: The value to set.
22978 *
22979 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
22980 *
22981 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22982 */
22983void
22984led_set_color (Led *object, gint value)
22985{
22986 g_object_set (G_OBJECT (object), "color", value, NULL);
22987}
22988
22989/**
22990 * led_get_function: (skip)
22991 * @object: A #Led.
22992 *
22993 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
22994 *
22995 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22996 *
22997 * <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 led_dup_function() if on another thread.</warning>
22998 *
22999 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
23000 */
23001const gchar *
23002led_get_function (Led *object)
23003{
23004 return LED_GET_IFACE (object)->get_function (object);
23005}
23006
23007/**
23008 * led_dup_function: (skip)
23009 * @object: A #Led.
23010 *
23011 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
23012 *
23013 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
23014 *
23015 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
23016 */
23017gchar *
23018led_dup_function (Led *object)
23019{
23020 gchar *value;
23021 g_object_get (G_OBJECT (object), "function", &value, NULL);
23022 return value;
23023}
23024
23025/**
23026 * led_set_function: (skip)
23027 * @object: A #Led.
23028 * @value: The value to set.
23029 *
23030 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
23031 *
23032 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
23033 */
23034void
23035led_set_function (Led *object, const gchar *value)
23036{
23037 g_object_set (G_OBJECT (object), "function", value, NULL);
23038}
23039
23040/**
23041 * led_call_set_on:
23042 * @proxy: A #LedProxy.
23043 * @cancellable: (allow-none): A #GCancellable or %NULL.
23044 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23045 * @user_data: User data to pass to @callback.
23046 *
23047 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
23048 * 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.
23049 * You can then call led_call_set_on_finish() to get the result of the operation.
23050 *
23051 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
23052 */
23053void
23054led_call_set_on (
23055 Led *proxy,
23056 GCancellable *cancellable,
23057 GAsyncReadyCallback callback,
23058 gpointer user_data)
23059{
23060 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23061 "setOn",
23062 g_variant_new ("()"),
23063 G_DBUS_CALL_FLAGS_NONE,
23064 -1,
23065 cancellable,
23066 callback,
23067 user_data);
23068}
23069
23070/**
23071 * led_call_set_on_finish:
23072 * @proxy: A #LedProxy.
23073 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
23074 * @error: Return location for error or %NULL.
23075 *
23076 * Finishes an operation started with led_call_set_on().
23077 *
23078 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23079 */
23080gboolean
23081led_call_set_on_finish (
23082 Led *proxy,
23083 GAsyncResult *res,
23084 GError **error)
23085{
23086 GVariant *_ret;
23087 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23088 if (_ret == NULL)
23089 goto _out;
23090 g_variant_get (_ret,
23091 "()");
23092 g_variant_unref (_ret);
23093_out:
23094 return _ret != NULL;
23095}
23096
23097/**
23098 * led_call_set_on_sync:
23099 * @proxy: A #LedProxy.
23100 * @cancellable: (allow-none): A #GCancellable or %NULL.
23101 * @error: Return location for error or %NULL.
23102 *
23103 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23104 *
23105 * See led_call_set_on() for the asynchronous version of this method.
23106 *
23107 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23108 */
23109gboolean
23110led_call_set_on_sync (
23111 Led *proxy,
23112 GCancellable *cancellable,
23113 GError **error)
23114{
23115 GVariant *_ret;
23116 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23117 "setOn",
23118 g_variant_new ("()"),
23119 G_DBUS_CALL_FLAGS_NONE,
23120 -1,
23121 cancellable,
23122 error);
23123 if (_ret == NULL)
23124 goto _out;
23125 g_variant_get (_ret,
23126 "()");
23127 g_variant_unref (_ret);
23128_out:
23129 return _ret != NULL;
23130}
23131
23132/**
23133 * led_call_set_off:
23134 * @proxy: A #LedProxy.
23135 * @cancellable: (allow-none): A #GCancellable or %NULL.
23136 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23137 * @user_data: User data to pass to @callback.
23138 *
23139 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
23140 * 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.
23141 * You can then call led_call_set_off_finish() to get the result of the operation.
23142 *
23143 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
23144 */
23145void
23146led_call_set_off (
23147 Led *proxy,
23148 GCancellable *cancellable,
23149 GAsyncReadyCallback callback,
23150 gpointer user_data)
23151{
23152 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23153 "setOff",
23154 g_variant_new ("()"),
23155 G_DBUS_CALL_FLAGS_NONE,
23156 -1,
23157 cancellable,
23158 callback,
23159 user_data);
23160}
23161
23162/**
23163 * led_call_set_off_finish:
23164 * @proxy: A #LedProxy.
23165 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
23166 * @error: Return location for error or %NULL.
23167 *
23168 * Finishes an operation started with led_call_set_off().
23169 *
23170 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23171 */
23172gboolean
23173led_call_set_off_finish (
23174 Led *proxy,
23175 GAsyncResult *res,
23176 GError **error)
23177{
23178 GVariant *_ret;
23179 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23180 if (_ret == NULL)
23181 goto _out;
23182 g_variant_get (_ret,
23183 "()");
23184 g_variant_unref (_ret);
23185_out:
23186 return _ret != NULL;
23187}
23188
23189/**
23190 * led_call_set_off_sync:
23191 * @proxy: A #LedProxy.
23192 * @cancellable: (allow-none): A #GCancellable or %NULL.
23193 * @error: Return location for error or %NULL.
23194 *
23195 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23196 *
23197 * See led_call_set_off() for the asynchronous version of this method.
23198 *
23199 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23200 */
23201gboolean
23202led_call_set_off_sync (
23203 Led *proxy,
23204 GCancellable *cancellable,
23205 GError **error)
23206{
23207 GVariant *_ret;
23208 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23209 "setOff",
23210 g_variant_new ("()"),
23211 G_DBUS_CALL_FLAGS_NONE,
23212 -1,
23213 cancellable,
23214 error);
23215 if (_ret == NULL)
23216 goto _out;
23217 g_variant_get (_ret,
23218 "()");
23219 g_variant_unref (_ret);
23220_out:
23221 return _ret != NULL;
23222}
23223
23224/**
23225 * led_call_set_blink_slow:
23226 * @proxy: A #LedProxy.
23227 * @cancellable: (allow-none): A #GCancellable or %NULL.
23228 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23229 * @user_data: User data to pass to @callback.
23230 *
23231 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
23232 * 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.
23233 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
23234 *
23235 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
23236 */
23237void
23238led_call_set_blink_slow (
23239 Led *proxy,
23240 GCancellable *cancellable,
23241 GAsyncReadyCallback callback,
23242 gpointer user_data)
23243{
23244 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23245 "setBlinkSlow",
23246 g_variant_new ("()"),
23247 G_DBUS_CALL_FLAGS_NONE,
23248 -1,
23249 cancellable,
23250 callback,
23251 user_data);
23252}
23253
23254/**
23255 * led_call_set_blink_slow_finish:
23256 * @proxy: A #LedProxy.
23257 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
23258 * @error: Return location for error or %NULL.
23259 *
23260 * Finishes an operation started with led_call_set_blink_slow().
23261 *
23262 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23263 */
23264gboolean
23265led_call_set_blink_slow_finish (
23266 Led *proxy,
23267 GAsyncResult *res,
23268 GError **error)
23269{
23270 GVariant *_ret;
23271 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23272 if (_ret == NULL)
23273 goto _out;
23274 g_variant_get (_ret,
23275 "()");
23276 g_variant_unref (_ret);
23277_out:
23278 return _ret != NULL;
23279}
23280
23281/**
23282 * led_call_set_blink_slow_sync:
23283 * @proxy: A #LedProxy.
23284 * @cancellable: (allow-none): A #GCancellable or %NULL.
23285 * @error: Return location for error or %NULL.
23286 *
23287 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23288 *
23289 * See led_call_set_blink_slow() for the asynchronous version of this method.
23290 *
23291 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23292 */
23293gboolean
23294led_call_set_blink_slow_sync (
23295 Led *proxy,
23296 GCancellable *cancellable,
23297 GError **error)
23298{
23299 GVariant *_ret;
23300 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23301 "setBlinkSlow",
23302 g_variant_new ("()"),
23303 G_DBUS_CALL_FLAGS_NONE,
23304 -1,
23305 cancellable,
23306 error);
23307 if (_ret == NULL)
23308 goto _out;
23309 g_variant_get (_ret,
23310 "()");
23311 g_variant_unref (_ret);
23312_out:
23313 return _ret != NULL;
23314}
23315
23316/**
23317 * led_call_set_blink_fast:
23318 * @proxy: A #LedProxy.
23319 * @cancellable: (allow-none): A #GCancellable or %NULL.
23320 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23321 * @user_data: User data to pass to @callback.
23322 *
23323 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
23324 * 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.
23325 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
23326 *
23327 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
23328 */
23329void
23330led_call_set_blink_fast (
23331 Led *proxy,
23332 GCancellable *cancellable,
23333 GAsyncReadyCallback callback,
23334 gpointer user_data)
23335{
23336 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23337 "setBlinkFast",
23338 g_variant_new ("()"),
23339 G_DBUS_CALL_FLAGS_NONE,
23340 -1,
23341 cancellable,
23342 callback,
23343 user_data);
23344}
23345
23346/**
23347 * led_call_set_blink_fast_finish:
23348 * @proxy: A #LedProxy.
23349 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
23350 * @error: Return location for error or %NULL.
23351 *
23352 * Finishes an operation started with led_call_set_blink_fast().
23353 *
23354 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23355 */
23356gboolean
23357led_call_set_blink_fast_finish (
23358 Led *proxy,
23359 GAsyncResult *res,
23360 GError **error)
23361{
23362 GVariant *_ret;
23363 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23364 if (_ret == NULL)
23365 goto _out;
23366 g_variant_get (_ret,
23367 "()");
23368 g_variant_unref (_ret);
23369_out:
23370 return _ret != NULL;
23371}
23372
23373/**
23374 * led_call_set_blink_fast_sync:
23375 * @proxy: A #LedProxy.
23376 * @cancellable: (allow-none): A #GCancellable or %NULL.
23377 * @error: Return location for error or %NULL.
23378 *
23379 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
23380 *
23381 * See led_call_set_blink_fast() for the asynchronous version of this method.
23382 *
23383 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23384 */
23385gboolean
23386led_call_set_blink_fast_sync (
23387 Led *proxy,
23388 GCancellable *cancellable,
23389 GError **error)
23390{
23391 GVariant *_ret;
23392 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23393 "setBlinkFast",
23394 g_variant_new ("()"),
23395 G_DBUS_CALL_FLAGS_NONE,
23396 -1,
23397 cancellable,
23398 error);
23399 if (_ret == NULL)
23400 goto _out;
23401 g_variant_get (_ret,
23402 "()");
23403 g_variant_unref (_ret);
23404_out:
23405 return _ret != NULL;
23406}
23407
23408/**
23409 * led_complete_set_on:
23410 * @object: A #Led.
23411 * @invocation: (transfer full): A #GDBusMethodInvocation.
23412 *
23413 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</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.
23414 *
23415 * This method will free @invocation, you cannot use it afterwards.
23416 */
23417void
23418led_complete_set_on (
23419 Led *object,
23420 GDBusMethodInvocation *invocation)
23421{
23422 g_dbus_method_invocation_return_value (invocation,
23423 g_variant_new ("()"));
23424}
23425
23426/**
23427 * led_complete_set_off:
23428 * @object: A #Led.
23429 * @invocation: (transfer full): A #GDBusMethodInvocation.
23430 *
23431 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</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.
23432 *
23433 * This method will free @invocation, you cannot use it afterwards.
23434 */
23435void
23436led_complete_set_off (
23437 Led *object,
23438 GDBusMethodInvocation *invocation)
23439{
23440 g_dbus_method_invocation_return_value (invocation,
23441 g_variant_new ("()"));
23442}
23443
23444/**
23445 * led_complete_set_blink_slow:
23446 * @object: A #Led.
23447 * @invocation: (transfer full): A #GDBusMethodInvocation.
23448 *
23449 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</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.
23450 *
23451 * This method will free @invocation, you cannot use it afterwards.
23452 */
23453void
23454led_complete_set_blink_slow (
23455 Led *object,
23456 GDBusMethodInvocation *invocation)
23457{
23458 g_dbus_method_invocation_return_value (invocation,
23459 g_variant_new ("()"));
23460}
23461
23462/**
23463 * led_complete_set_blink_fast:
23464 * @object: A #Led.
23465 * @invocation: (transfer full): A #GDBusMethodInvocation.
23466 *
23467 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</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.
23468 *
23469 * This method will free @invocation, you cannot use it afterwards.
23470 */
23471void
23472led_complete_set_blink_fast (
23473 Led *object,
23474 GDBusMethodInvocation *invocation)
23475{
23476 g_dbus_method_invocation_return_value (invocation,
23477 g_variant_new ("()"));
23478}
23479
23480/* ------------------------------------------------------------------------ */
23481
23482/**
23483 * LedProxy:
23484 *
23485 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
23486 */
23487
23488/**
23489 * LedProxyClass:
23490 * @parent_class: The parent class.
23491 *
23492 * Class structure for #LedProxy.
23493 */
23494
23495struct _LedProxyPrivate
23496{
23497 GData *qdata;
23498};
23499
23500static void led_proxy_iface_init (LedIface *iface);
23501
23502#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23503G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
23504 G_ADD_PRIVATE (LedProxy)
23505 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
23506
23507#else
23508G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
23509 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
23510
23511#endif
23512static void
23513led_proxy_finalize (GObject *object)
23514{
23515 LedProxy *proxy = LED_PROXY (object);
23516 g_datalist_clear (&proxy->priv->qdata);
23517 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
23518}
23519
23520static void
23521led_proxy_get_property (GObject *object,
23522 guint prop_id,
23523 GValue *value,
23524 GParamSpec *pspec G_GNUC_UNUSED)
23525{
23526 const _ExtendedGDBusPropertyInfo *info;
23527 GVariant *variant;
23528 g_assert (prop_id != 0 && prop_id - 1 < 2);
23529 info = _led_property_info_pointers[prop_id - 1];
23530 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
23531 if (info->use_gvariant)
23532 {
23533 g_value_set_variant (value, variant);
23534 }
23535 else
23536 {
23537 if (variant != NULL)
23538 g_dbus_gvariant_to_gvalue (variant, value);
23539 }
23540 if (variant != NULL)
23541 g_variant_unref (variant);
23542}
23543
23544static void
23545led_proxy_set_property_cb (GDBusProxy *proxy,
23546 GAsyncResult *res,
23547 gpointer user_data)
23548{
23549 const _ExtendedGDBusPropertyInfo *info = user_data;
23550 GError *error;
23551 GVariant *_ret;
23552 error = NULL;
23553 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
23554 if (!_ret)
23555 {
23556 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
23557 info->parent_struct.name,
23558 error->message, g_quark_to_string (error->domain), error->code);
23559 g_error_free (error);
23560 }
23561 else
23562 {
23563 g_variant_unref (_ret);
23564 }
23565}
23566
23567static void
23568led_proxy_set_property (GObject *object,
23569 guint prop_id,
23570 const GValue *value,
23571 GParamSpec *pspec G_GNUC_UNUSED)
23572{
23573 const _ExtendedGDBusPropertyInfo *info;
23574 GVariant *variant;
23575 g_assert (prop_id != 0 && prop_id - 1 < 2);
23576 info = _led_property_info_pointers[prop_id - 1];
23577 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
23578 g_dbus_proxy_call (G_DBUS_PROXY (object),
23579 "org.freedesktop.DBus.Properties.Set",
23580 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
23581 G_DBUS_CALL_FLAGS_NONE,
23582 -1,
23583 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
23584 g_variant_unref (variant);
23585}
23586
23587static void
23588led_proxy_g_signal (GDBusProxy *proxy,
23589 const gchar *sender_name G_GNUC_UNUSED,
23590 const gchar *signal_name,
23591 GVariant *parameters)
23592{
23593 _ExtendedGDBusSignalInfo *info;
23594 GVariantIter iter;
23595 GVariant *child;
23596 GValue *paramv;
23597 guint num_params;
23598 guint n;
23599 guint signal_id;
23600 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
23601 if (info == NULL)
23602 return;
23603 num_params = g_variant_n_children (parameters);
23604 paramv = g_new0 (GValue, num_params + 1);
23605 g_value_init (&paramv[0], TYPE_LED);
23606 g_value_set_object (&paramv[0], proxy);
23607 g_variant_iter_init (&iter, parameters);
23608 n = 1;
23609 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23610 {
23611 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23612 if (arg_info->use_gvariant)
23613 {
23614 g_value_init (&paramv[n], G_TYPE_VARIANT);
23615 g_value_set_variant (&paramv[n], child);
23616 n++;
23617 }
23618 else
23619 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23620 g_variant_unref (child);
23621 }
23622 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
23623 g_signal_emitv (paramv, signal_id, 0, NULL);
23624 for (n = 0; n < num_params + 1; n++)
23625 g_value_unset (&paramv[n]);
23626 g_free (paramv);
23627}
23628
23629static void
23630led_proxy_g_properties_changed (GDBusProxy *_proxy,
23631 GVariant *changed_properties,
23632 const gchar *const *invalidated_properties)
23633{
23634 LedProxy *proxy = LED_PROXY (_proxy);
23635 guint n;
23636 const gchar *key;
23637 GVariantIter *iter;
23638 _ExtendedGDBusPropertyInfo *info;
23639 g_variant_get (changed_properties, "a{sv}", &iter);
23640 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23641 {
23642 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
23643 g_datalist_remove_data (&proxy->priv->qdata, key);
23644 if (info != NULL)
23645 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23646 }
23647 g_variant_iter_free (iter);
23648 for (n = 0; invalidated_properties[n] != NULL; n++)
23649 {
23650 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
23651 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23652 if (info != NULL)
23653 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23654 }
23655}
23656
23657static gint
23658led_proxy_get_color (Led *object)
23659{
23660 LedProxy *proxy = LED_PROXY (object);
23661 GVariant *variant;
23662 gint value = 0;
23663 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
23664 if (variant != NULL)
23665 {
23666 value = g_variant_get_int32 (variant);
23667 g_variant_unref (variant);
23668 }
23669 return value;
23670}
23671
23672static const gchar *
23673led_proxy_get_function (Led *object)
23674{
23675 LedProxy *proxy = LED_PROXY (object);
23676 GVariant *variant;
23677 const gchar *value = NULL;
23678 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
23679 if (variant != NULL)
23680 {
23681 value = g_variant_get_string (variant, NULL);
23682 g_variant_unref (variant);
23683 }
23684 return value;
23685}
23686
23687static void
23688led_proxy_init (LedProxy *proxy)
23689{
23690#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23691 proxy->priv = led_proxy_get_instance_private (proxy);
23692#else
23693 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
23694#endif
23695
23696 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
23697}
23698
23699static void
23700led_proxy_class_init (LedProxyClass *klass)
23701{
23702 GObjectClass *gobject_class;
23703 GDBusProxyClass *proxy_class;
23704
23705 gobject_class = G_OBJECT_CLASS (klass);
23706 gobject_class->finalize = led_proxy_finalize;
23707 gobject_class->get_property = led_proxy_get_property;
23708 gobject_class->set_property = led_proxy_set_property;
23709
23710 proxy_class = G_DBUS_PROXY_CLASS (klass);
23711 proxy_class->g_signal = led_proxy_g_signal;
23712 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
23713
23714 led_override_properties (gobject_class, 1);
23715
23716#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23717 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
23718#endif
23719}
23720
23721static void
23722led_proxy_iface_init (LedIface *iface)
23723{
23724 iface->get_color = led_proxy_get_color;
23725 iface->get_function = led_proxy_get_function;
23726}
23727
23728/**
23729 * led_proxy_new:
23730 * @connection: A #GDBusConnection.
23731 * @flags: Flags from the #GDBusProxyFlags enumeration.
23732 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23733 * @object_path: An object path.
23734 * @cancellable: (allow-none): A #GCancellable or %NULL.
23735 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23736 * @user_data: User data to pass to @callback.
23737 *
23738 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new() for more details.
23739 *
23740 * 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.
23741 * You can then call led_proxy_new_finish() to get the result of the operation.
23742 *
23743 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
23744 */
23745void
23746led_proxy_new (
23747 GDBusConnection *connection,
23748 GDBusProxyFlags flags,
23749 const gchar *name,
23750 const gchar *object_path,
23751 GCancellable *cancellable,
23752 GAsyncReadyCallback callback,
23753 gpointer user_data)
23754{
23755 g_async_initable_new_async (TYPE_LED_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.Led", NULL);
23756}
23757
23758/**
23759 * led_proxy_new_finish:
23760 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
23761 * @error: Return location for error or %NULL
23762 *
23763 * Finishes an operation started with led_proxy_new().
23764 *
23765 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23766 */
23767Led *
23768led_proxy_new_finish (
23769 GAsyncResult *res,
23770 GError **error)
23771{
23772 GObject *ret;
23773 GObject *source_object;
23774 source_object = g_async_result_get_source_object (res);
23775 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23776 g_object_unref (source_object);
23777 if (ret != NULL)
23778 return LED (ret);
23779 else
23780 return NULL;
23781}
23782
23783/**
23784 * led_proxy_new_sync:
23785 * @connection: A #GDBusConnection.
23786 * @flags: Flags from the #GDBusProxyFlags enumeration.
23787 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23788 * @object_path: An object path.
23789 * @cancellable: (allow-none): A #GCancellable or %NULL.
23790 * @error: Return location for error or %NULL
23791 *
23792 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new_sync() for more details.
23793 *
23794 * The calling thread is blocked until a reply is received.
23795 *
23796 * See led_proxy_new() for the asynchronous version of this constructor.
23797 *
23798 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23799 */
23800Led *
23801led_proxy_new_sync (
23802 GDBusConnection *connection,
23803 GDBusProxyFlags flags,
23804 const gchar *name,
23805 const gchar *object_path,
23806 GCancellable *cancellable,
23807 GError **error)
23808{
23809 GInitable *ret;
23810 ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
23811 if (ret != NULL)
23812 return LED (ret);
23813 else
23814 return NULL;
23815}
23816
23817
23818/**
23819 * led_proxy_new_for_bus:
23820 * @bus_type: A #GBusType.
23821 * @flags: Flags from the #GDBusProxyFlags enumeration.
23822 * @name: A bus name (well-known or unique).
23823 * @object_path: An object path.
23824 * @cancellable: (allow-none): A #GCancellable or %NULL.
23825 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23826 * @user_data: User data to pass to @callback.
23827 *
23828 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23829 *
23830 * 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.
23831 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
23832 *
23833 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23834 */
23835void
23836led_proxy_new_for_bus (
23837 GBusType bus_type,
23838 GDBusProxyFlags flags,
23839 const gchar *name,
23840 const gchar *object_path,
23841 GCancellable *cancellable,
23842 GAsyncReadyCallback callback,
23843 gpointer user_data)
23844{
23845 g_async_initable_new_async (TYPE_LED_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.Led", NULL);
23846}
23847
23848/**
23849 * led_proxy_new_for_bus_finish:
23850 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
23851 * @error: Return location for error or %NULL
23852 *
23853 * Finishes an operation started with led_proxy_new_for_bus().
23854 *
23855 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23856 */
23857Led *
23858led_proxy_new_for_bus_finish (
23859 GAsyncResult *res,
23860 GError **error)
23861{
23862 GObject *ret;
23863 GObject *source_object;
23864 source_object = g_async_result_get_source_object (res);
23865 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23866 g_object_unref (source_object);
23867 if (ret != NULL)
23868 return LED (ret);
23869 else
23870 return NULL;
23871}
23872
23873/**
23874 * led_proxy_new_for_bus_sync:
23875 * @bus_type: A #GBusType.
23876 * @flags: Flags from the #GDBusProxyFlags enumeration.
23877 * @name: A bus name (well-known or unique).
23878 * @object_path: An object path.
23879 * @cancellable: (allow-none): A #GCancellable or %NULL.
23880 * @error: Return location for error or %NULL
23881 *
23882 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23883 *
23884 * The calling thread is blocked until a reply is received.
23885 *
23886 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
23887 *
23888 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
23889 */
23890Led *
23891led_proxy_new_for_bus_sync (
23892 GBusType bus_type,
23893 GDBusProxyFlags flags,
23894 const gchar *name,
23895 const gchar *object_path,
23896 GCancellable *cancellable,
23897 GError **error)
23898{
23899 GInitable *ret;
23900 ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
23901 if (ret != NULL)
23902 return LED (ret);
23903 else
23904 return NULL;
23905}
23906
23907
23908/* ------------------------------------------------------------------------ */
23909
23910/**
23911 * LedSkeleton:
23912 *
23913 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
23914 */
23915
23916/**
23917 * LedSkeletonClass:
23918 * @parent_class: The parent class.
23919 *
23920 * Class structure for #LedSkeleton.
23921 */
23922
23923struct _LedSkeletonPrivate
23924{
23925 GValue *properties;
23926 GList *changed_properties;
23927 GSource *changed_properties_idle_source;
23928 GMainContext *context;
23929 GMutex lock;
23930};
23931
23932static void
23933_led_skeleton_handle_method_call (
23934 GDBusConnection *connection G_GNUC_UNUSED,
23935 const gchar *sender G_GNUC_UNUSED,
23936 const gchar *object_path G_GNUC_UNUSED,
23937 const gchar *interface_name,
23938 const gchar *method_name,
23939 GVariant *parameters,
23940 GDBusMethodInvocation *invocation,
23941 gpointer user_data)
23942{
23943 LedSkeleton *skeleton = LED_SKELETON (user_data);
23944 _ExtendedGDBusMethodInfo *info;
23945 GVariantIter iter;
23946 GVariant *child;
23947 GValue *paramv;
23948 guint num_params;
23949 guint num_extra;
23950 guint n;
23951 guint signal_id;
23952 GValue return_value = G_VALUE_INIT;
23953 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23954 g_assert (info != NULL);
23955 num_params = g_variant_n_children (parameters);
23956 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23957 n = 0;
23958 g_value_init (&paramv[n], TYPE_LED);
23959 g_value_set_object (&paramv[n++], skeleton);
23960 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23961 g_value_set_object (&paramv[n++], invocation);
23962 if (info->pass_fdlist)
23963 {
23964#ifdef G_OS_UNIX
23965 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23966 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23967#else
23968 g_assert_not_reached ();
23969#endif
23970 }
23971 g_variant_iter_init (&iter, parameters);
23972 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23973 {
23974 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23975 if (arg_info->use_gvariant)
23976 {
23977 g_value_init (&paramv[n], G_TYPE_VARIANT);
23978 g_value_set_variant (&paramv[n], child);
23979 n++;
23980 }
23981 else
23982 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23983 g_variant_unref (child);
23984 }
23985 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
23986 g_value_init (&return_value, G_TYPE_BOOLEAN);
23987 g_signal_emitv (paramv, signal_id, 0, &return_value);
23988 if (!g_value_get_boolean (&return_value))
23989 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);
23990 g_value_unset (&return_value);
23991 for (n = 0; n < num_params + num_extra; n++)
23992 g_value_unset (&paramv[n]);
23993 g_free (paramv);
23994}
23995
23996static GVariant *
23997_led_skeleton_handle_get_property (
23998 GDBusConnection *connection G_GNUC_UNUSED,
23999 const gchar *sender G_GNUC_UNUSED,
24000 const gchar *object_path G_GNUC_UNUSED,
24001 const gchar *interface_name G_GNUC_UNUSED,
24002 const gchar *property_name,
24003 GError **error,
24004 gpointer user_data)
24005{
24006 LedSkeleton *skeleton = LED_SKELETON (user_data);
24007 GValue value = G_VALUE_INIT;
24008 GParamSpec *pspec;
24009 _ExtendedGDBusPropertyInfo *info;
24010 GVariant *ret;
24011 ret = NULL;
24012 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
24013 g_assert (info != NULL);
24014 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24015 if (pspec == NULL)
24016 {
24017 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24018 }
24019 else
24020 {
24021 g_value_init (&value, pspec->value_type);
24022 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24023 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
24024 g_value_unset (&value);
24025 }
24026 return ret;
24027}
24028
24029static gboolean
24030_led_skeleton_handle_set_property (
24031 GDBusConnection *connection G_GNUC_UNUSED,
24032 const gchar *sender G_GNUC_UNUSED,
24033 const gchar *object_path G_GNUC_UNUSED,
24034 const gchar *interface_name G_GNUC_UNUSED,
24035 const gchar *property_name,
24036 GVariant *variant,
24037 GError **error,
24038 gpointer user_data)
24039{
24040 LedSkeleton *skeleton = LED_SKELETON (user_data);
24041 GValue value = G_VALUE_INIT;
24042 GParamSpec *pspec;
24043 _ExtendedGDBusPropertyInfo *info;
24044 gboolean ret;
24045 ret = FALSE;
24046 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
24047 g_assert (info != NULL);
24048 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24049 if (pspec == NULL)
24050 {
24051 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24052 }
24053 else
24054 {
24055 if (info->use_gvariant)
24056 g_value_set_variant (&value, variant);
24057 else
24058 g_dbus_gvariant_to_gvalue (variant, &value);
24059 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24060 g_value_unset (&value);
24061 ret = TRUE;
24062 }
24063 return ret;
24064}
24065
24066static const GDBusInterfaceVTable _led_skeleton_vtable =
24067{
24068 _led_skeleton_handle_method_call,
24069 _led_skeleton_handle_get_property,
24070 _led_skeleton_handle_set_property,
24071 {NULL}
24072};
24073
24074static GDBusInterfaceInfo *
24075led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24076{
24077 return led_interface_info ();
24078}
24079
24080static GDBusInterfaceVTable *
24081led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24082{
24083 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
24084}
24085
24086static GVariant *
24087led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
24088{
24089 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
24090
24091 GVariantBuilder builder;
24092 guint n;
24093 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24094 if (_led_interface_info.parent_struct.properties == NULL)
24095 goto out;
24096 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
24097 {
24098 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
24099 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
24100 {
24101 GVariant *value;
24102 value = _led_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.Led", info->name, NULL, skeleton);
24103 if (value != NULL)
24104 {
24105 g_variant_take_ref (value);
24106 g_variant_builder_add (&builder, "{sv}", info->name, value);
24107 g_variant_unref (value);
24108 }
24109 }
24110 }
24111out:
24112 return g_variant_builder_end (&builder);
24113}
24114
24115static gboolean _led_emit_changed (gpointer user_data);
24116
24117static void
24118led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
24119{
24120 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
24121 gboolean emit_changed = FALSE;
24122
24123 g_mutex_lock (&skeleton->priv->lock);
24124 if (skeleton->priv->changed_properties_idle_source != NULL)
24125 {
24126 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24127 skeleton->priv->changed_properties_idle_source = NULL;
24128 emit_changed = TRUE;
24129 }
24130 g_mutex_unlock (&skeleton->priv->lock);
24131
24132 if (emit_changed)
24133 _led_emit_changed (skeleton);
24134}
24135
24136static void led_skeleton_iface_init (LedIface *iface);
24137#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24138G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24139 G_ADD_PRIVATE (LedSkeleton)
24140 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
24141
24142#else
24143G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24144 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
24145
24146#endif
24147static void
24148led_skeleton_finalize (GObject *object)
24149{
24150 LedSkeleton *skeleton = LED_SKELETON (object);
24151 guint n;
24152 for (n = 0; n < 2; n++)
24153 g_value_unset (&skeleton->priv->properties[n]);
24154 g_free (skeleton->priv->properties);
24155 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24156 if (skeleton->priv->changed_properties_idle_source != NULL)
24157 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24158 g_main_context_unref (skeleton->priv->context);
24159 g_mutex_clear (&skeleton->priv->lock);
24160 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
24161}
24162
24163static void
24164led_skeleton_get_property (GObject *object,
24165 guint prop_id,
24166 GValue *value,
24167 GParamSpec *pspec G_GNUC_UNUSED)
24168{
24169 LedSkeleton *skeleton = LED_SKELETON (object);
24170 g_assert (prop_id != 0 && prop_id - 1 < 2);
24171 g_mutex_lock (&skeleton->priv->lock);
24172 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
24173 g_mutex_unlock (&skeleton->priv->lock);
24174}
24175
24176static gboolean
24177_led_emit_changed (gpointer user_data)
24178{
24179 LedSkeleton *skeleton = LED_SKELETON (user_data);
24180 GList *l;
24181 GVariantBuilder builder;
24182 GVariantBuilder invalidated_builder;
24183 guint num_changes;
24184
24185 g_mutex_lock (&skeleton->priv->lock);
24186 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24187 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
24188 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
24189 {
24190 ChangedProperty *cp = l->data;
24191 GVariant *variant;
24192 const GValue *cur_value;
24193
24194 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
24195 if (!_g_value_equal (cur_value, &cp->orig_value))
24196 {
24197 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
24198 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
24199 g_variant_unref (variant);
24200 num_changes++;
24201 }
24202 }
24203 if (num_changes > 0)
24204 {
24205 GList *connections, *ll;
24206 GVariant *signal_variant;
24207 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
24208 &builder, &invalidated_builder));
24209 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24210 for (ll = connections; ll != NULL; ll = ll->next)
24211 {
24212 GDBusConnection *connection = ll->data;
24213
24214 g_dbus_connection_emit_signal (connection,
24215 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
24216 "org.freedesktop.DBus.Properties",
24217 "PropertiesChanged",
24218 signal_variant,
24219 NULL);
24220 }
24221 g_variant_unref (signal_variant);
24222 g_list_free_full (connections, g_object_unref);
24223 }
24224 else
24225 {
24226 g_variant_builder_clear (&builder);
24227 g_variant_builder_clear (&invalidated_builder);
24228 }
24229 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24230 skeleton->priv->changed_properties = NULL;
24231 skeleton->priv->changed_properties_idle_source = NULL;
24232 g_mutex_unlock (&skeleton->priv->lock);
24233 return FALSE;
24234}
24235
24236static void
24237_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
24238{
24239 ChangedProperty *cp;
24240 GList *l;
24241 cp = NULL;
24242 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
24243 {
24244 ChangedProperty *i_cp = l->data;
24245 if (i_cp->info == info)
24246 {
24247 cp = i_cp;
24248 break;
24249 }
24250 }
24251 if (cp == NULL)
24252 {
24253 cp = g_new0 (ChangedProperty, 1);
24254 cp->prop_id = prop_id;
24255 cp->info = info;
24256 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
24257 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
24258 g_value_copy (orig_value, &cp->orig_value);
24259 }
24260}
24261
24262static void
24263led_skeleton_notify (GObject *object,
24264 GParamSpec *pspec G_GNUC_UNUSED)
24265{
24266 LedSkeleton *skeleton = LED_SKELETON (object);
24267 g_mutex_lock (&skeleton->priv->lock);
24268 if (skeleton->priv->changed_properties != NULL &&
24269 skeleton->priv->changed_properties_idle_source == NULL)
24270 {
24271 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
24272 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
24273 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
24274 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
24275 g_source_unref (skeleton->priv->changed_properties_idle_source);
24276 }
24277 g_mutex_unlock (&skeleton->priv->lock);
24278}
24279
24280static void
24281led_skeleton_set_property (GObject *object,
24282 guint prop_id,
24283 const GValue *value,
24284 GParamSpec *pspec)
24285{
24286 LedSkeleton *skeleton = LED_SKELETON (object);
24287 g_assert (prop_id != 0 && prop_id - 1 < 2);
24288 g_mutex_lock (&skeleton->priv->lock);
24289 g_object_freeze_notify (object);
24290 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
24291 {
24292 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
24293 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
24294 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
24295 g_object_notify_by_pspec (object, pspec);
24296 }
24297 g_mutex_unlock (&skeleton->priv->lock);
24298 g_object_thaw_notify (object);
24299}
24300
24301static void
24302led_skeleton_init (LedSkeleton *skeleton)
24303{
24304#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24305 skeleton->priv = led_skeleton_get_instance_private (skeleton);
24306#else
24307 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
24308#endif
24309
24310 g_mutex_init (&skeleton->priv->lock);
24311 skeleton->priv->context = g_main_context_ref_thread_default ();
24312 skeleton->priv->properties = g_new0 (GValue, 2);
24313 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
24314 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
24315}
24316
24317static gint
24318led_skeleton_get_color (Led *object)
24319{
24320 LedSkeleton *skeleton = LED_SKELETON (object);
24321 gint value;
24322 g_mutex_lock (&skeleton->priv->lock);
24323 value = g_value_get_int (&(skeleton->priv->properties[0]));
24324 g_mutex_unlock (&skeleton->priv->lock);
24325 return value;
24326}
24327
24328static const gchar *
24329led_skeleton_get_function (Led *object)
24330{
24331 LedSkeleton *skeleton = LED_SKELETON (object);
24332 const gchar *value;
24333 g_mutex_lock (&skeleton->priv->lock);
24334 value = g_value_get_string (&(skeleton->priv->properties[1]));
24335 g_mutex_unlock (&skeleton->priv->lock);
24336 return value;
24337}
24338
24339static void
24340led_skeleton_class_init (LedSkeletonClass *klass)
24341{
24342 GObjectClass *gobject_class;
24343 GDBusInterfaceSkeletonClass *skeleton_class;
24344
24345 gobject_class = G_OBJECT_CLASS (klass);
24346 gobject_class->finalize = led_skeleton_finalize;
24347 gobject_class->get_property = led_skeleton_get_property;
24348 gobject_class->set_property = led_skeleton_set_property;
24349 gobject_class->notify = led_skeleton_notify;
24350
24351
24352 led_override_properties (gobject_class, 1);
24353
24354 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
24355 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
24356 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
24357 skeleton_class->flush = led_skeleton_dbus_interface_flush;
24358 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
24359
24360#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24361 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
24362#endif
24363}
24364
24365static void
24366led_skeleton_iface_init (LedIface *iface)
24367{
24368 iface->get_color = led_skeleton_get_color;
24369 iface->get_function = led_skeleton_get_function;
24370}
24371
24372/**
24373 * led_skeleton_new:
24374 *
24375 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
24376 *
24377 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
24378 */
24379Led *
24380led_skeleton_new (void)
24381{
24382 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
24383}
24384
24385/* ------------------------------------------------------------------------
24386 * Code for Object, ObjectProxy and ObjectSkeleton
24387 * ------------------------------------------------------------------------
24388 */
24389
24390/**
24391 * SECTION:Object
24392 * @title: Object
24393 * @short_description: Specialized GDBusObject types
24394 *
24395 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
24396 */
24397
24398/**
24399 * Object:
24400 *
24401 * The #Object type is a specialized container of interfaces.
24402 */
24403
24404/**
24405 * ObjectIface:
24406 * @parent_iface: The parent interface.
24407 *
24408 * Virtual table for the #Object interface.
24409 */
24410
24411typedef ObjectIface ObjectInterface;
24412G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
24413
24414static void
24415object_default_init (ObjectIface *iface)
24416{
24417 /**
24418 * Object:occ:
24419 *
24420 * The #Occ instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>, if any.
24421 *
24422 * Connect to the #GObject::notify signal to get informed of property changes.
24423 */
24424 g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24425
24426 /**
24427 * Object:fan:
24428 *
24429 * The #Fan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>, if any.
24430 *
24431 * Connect to the #GObject::notify signal to get informed of property changes.
24432 */
24433 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24434
24435 /**
24436 * Object:sensor-value:
24437 *
24438 * The #SensorValue instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>, if any.
24439 *
24440 * Connect to the #GObject::notify signal to get informed of property changes.
24441 */
24442 g_object_interface_install_property (iface, g_param_spec_object ("sensor-value", "sensor-value", "sensor-value", TYPE_SENSOR_VALUE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24443
24444 /**
Norman Jamesdfdaca92015-09-27 22:11:15 -050024445 * Object:sensor-ipmi:
24446 *
24447 * The #SensorIpmi instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link>, if any.
24448 *
24449 * Connect to the #GObject::notify signal to get informed of property changes.
24450 */
24451 g_object_interface_install_property (iface, g_param_spec_object ("sensor-ipmi", "sensor-ipmi", "sensor-ipmi", TYPE_SENSOR_IPMI, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24452
24453 /**
Norman James362a80f2015-09-14 14:04:39 -050024454 * Object:sensor-threshold:
24455 *
24456 * The #SensorThreshold instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>, if any.
24457 *
24458 * Connect to the #GObject::notify signal to get informed of property changes.
24459 */
24460 g_object_interface_install_property (iface, g_param_spec_object ("sensor-threshold", "sensor-threshold", "sensor-threshold", TYPE_SENSOR_THRESHOLD, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24461
24462 /**
24463 * Object:sensor-i2c:
24464 *
24465 * 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.
24466 *
24467 * Connect to the #GObject::notify signal to get informed of property changes.
24468 */
24469 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));
24470
24471 /**
24472 * Object:sensor-match:
24473 *
24474 * The #SensorMatch instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>, if any.
24475 *
24476 * Connect to the #GObject::notify signal to get informed of property changes.
24477 */
24478 g_object_interface_install_property (iface, g_param_spec_object ("sensor-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24479
24480 /**
24481 * Object:process:
24482 *
24483 * The #Process instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>, if any.
24484 *
24485 * Connect to the #GObject::notify signal to get informed of property changes.
24486 */
24487 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24488
24489 /**
24490 * Object:control:
24491 *
24492 * The #Control instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>, if any.
24493 *
24494 * Connect to the #GObject::notify signal to get informed of property changes.
24495 */
24496 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24497
24498 /**
24499 * Object:control-bmc:
24500 *
24501 * The #ControlBmc instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>, if any.
24502 *
24503 * Connect to the #GObject::notify signal to get informed of property changes.
24504 */
24505 g_object_interface_install_property (iface, g_param_spec_object ("control-bmc", "control-bmc", "control-bmc", TYPE_CONTROL_BMC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24506
24507 /**
24508 * Object:control-host:
24509 *
24510 * The #ControlHost instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>, if any.
24511 *
24512 * Connect to the #GObject::notify signal to get informed of property changes.
24513 */
24514 g_object_interface_install_property (iface, g_param_spec_object ("control-host", "control-host", "control-host", TYPE_CONTROL_HOST, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24515
24516 /**
24517 * Object:control-power:
24518 *
24519 * The #ControlPower instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>, if any.
24520 *
24521 * Connect to the #GObject::notify signal to get informed of property changes.
24522 */
24523 g_object_interface_install_property (iface, g_param_spec_object ("control-power", "control-power", "control-power", TYPE_CONTROL_POWER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24524
24525 /**
24526 * Object:watchdog:
24527 *
24528 * The #Watchdog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>, if any.
24529 *
24530 * Connect to the #GObject::notify signal to get informed of property changes.
24531 */
24532 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24533
24534 /**
24535 * Object:event-log:
24536 *
24537 * The #EventLog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>, if any.
24538 *
24539 * Connect to the #GObject::notify signal to get informed of property changes.
24540 */
24541 g_object_interface_install_property (iface, g_param_spec_object ("event-log", "event-log", "event-log", TYPE_EVENT_LOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24542
24543 /**
24544 * Object:flash:
24545 *
24546 * The #Flash instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>, if any.
24547 *
24548 * Connect to the #GObject::notify signal to get informed of property changes.
24549 */
24550 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24551
24552 /**
24553 * Object:button:
24554 *
24555 * The #Button instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>, if any.
24556 *
24557 * Connect to the #GObject::notify signal to get informed of property changes.
24558 */
24559 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24560
24561 /**
24562 * Object:led:
24563 *
24564 * The #Led instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>, if any.
24565 *
24566 * Connect to the #GObject::notify signal to get informed of property changes.
24567 */
24568 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
24569
24570}
24571
24572/**
24573 * object_get_occ:
24574 * @object: A #Object.
24575 *
24576 * Gets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object, if any.
24577 *
24578 * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24579 */
24580Occ *object_get_occ (Object *object)
24581{
24582 GDBusInterface *ret;
24583 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24584 if (ret == NULL)
24585 return NULL;
24586 return OCC (ret);
24587}
24588
24589/**
24590 * object_get_fan:
24591 * @object: A #Object.
24592 *
24593 * Gets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object, if any.
24594 *
24595 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24596 */
24597Fan *object_get_fan (Object *object)
24598{
24599 GDBusInterface *ret;
24600 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24601 if (ret == NULL)
24602 return NULL;
24603 return FAN (ret);
24604}
24605
24606/**
24607 * object_get_sensor_value:
24608 * @object: A #Object.
24609 *
24610 * Gets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object, if any.
24611 *
24612 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24613 */
24614SensorValue *object_get_sensor_value (Object *object)
24615{
24616 GDBusInterface *ret;
24617 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24618 if (ret == NULL)
24619 return NULL;
24620 return SENSOR_VALUE (ret);
24621}
24622
24623/**
Norman Jamesdfdaca92015-09-27 22:11:15 -050024624 * object_get_sensor_ipmi:
24625 * @object: A #Object.
24626 *
24627 * Gets the #SensorIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link> on @object, if any.
24628 *
24629 * Returns: (transfer full): A #SensorIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24630 */
24631SensorIpmi *object_get_sensor_ipmi (Object *object)
24632{
24633 GDBusInterface *ret;
24634 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIpmi");
24635 if (ret == NULL)
24636 return NULL;
24637 return SENSOR_IPMI (ret);
24638}
24639
24640/**
Norman James362a80f2015-09-14 14:04:39 -050024641 * object_get_sensor_threshold:
24642 * @object: A #Object.
24643 *
24644 * Gets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object, if any.
24645 *
24646 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24647 */
24648SensorThreshold *object_get_sensor_threshold (Object *object)
24649{
24650 GDBusInterface *ret;
24651 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24652 if (ret == NULL)
24653 return NULL;
24654 return SENSOR_THRESHOLD (ret);
24655}
24656
24657/**
24658 * object_get_sensor_i2c:
24659 * @object: A #Object.
24660 *
24661 * 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.
24662 *
24663 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24664 */
24665SensorI2c *object_get_sensor_i2c (Object *object)
24666{
24667 GDBusInterface *ret;
24668 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24669 if (ret == NULL)
24670 return NULL;
24671 return SENSOR_I2C (ret);
24672}
24673
24674/**
24675 * object_get_sensor_match:
24676 * @object: A #Object.
24677 *
24678 * Gets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object, if any.
24679 *
24680 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24681 */
24682SensorMatch *object_get_sensor_match (Object *object)
24683{
24684 GDBusInterface *ret;
24685 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24686 if (ret == NULL)
24687 return NULL;
24688 return SENSOR_MATCH (ret);
24689}
24690
24691/**
24692 * object_get_process:
24693 * @object: A #Object.
24694 *
24695 * Gets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object, if any.
24696 *
24697 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24698 */
24699Process *object_get_process (Object *object)
24700{
24701 GDBusInterface *ret;
24702 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
24703 if (ret == NULL)
24704 return NULL;
24705 return PROCESS (ret);
24706}
24707
24708/**
24709 * object_get_control:
24710 * @object: A #Object.
24711 *
24712 * Gets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object, if any.
24713 *
24714 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24715 */
24716Control *object_get_control (Object *object)
24717{
24718 GDBusInterface *ret;
24719 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
24720 if (ret == NULL)
24721 return NULL;
24722 return CONTROL (ret);
24723}
24724
24725/**
24726 * object_get_control_bmc:
24727 * @object: A #Object.
24728 *
24729 * Gets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object, if any.
24730 *
24731 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24732 */
24733ControlBmc *object_get_control_bmc (Object *object)
24734{
24735 GDBusInterface *ret;
24736 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
24737 if (ret == NULL)
24738 return NULL;
24739 return CONTROL_BMC (ret);
24740}
24741
24742/**
24743 * object_get_control_host:
24744 * @object: A #Object.
24745 *
24746 * Gets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object, if any.
24747 *
24748 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24749 */
24750ControlHost *object_get_control_host (Object *object)
24751{
24752 GDBusInterface *ret;
24753 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
24754 if (ret == NULL)
24755 return NULL;
24756 return CONTROL_HOST (ret);
24757}
24758
24759/**
24760 * object_get_control_power:
24761 * @object: A #Object.
24762 *
24763 * Gets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object, if any.
24764 *
24765 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24766 */
24767ControlPower *object_get_control_power (Object *object)
24768{
24769 GDBusInterface *ret;
24770 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
24771 if (ret == NULL)
24772 return NULL;
24773 return CONTROL_POWER (ret);
24774}
24775
24776/**
24777 * object_get_watchdog:
24778 * @object: A #Object.
24779 *
24780 * Gets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object, if any.
24781 *
24782 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24783 */
24784Watchdog *object_get_watchdog (Object *object)
24785{
24786 GDBusInterface *ret;
24787 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
24788 if (ret == NULL)
24789 return NULL;
24790 return WATCHDOG (ret);
24791}
24792
24793/**
24794 * object_get_event_log:
24795 * @object: A #Object.
24796 *
24797 * Gets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object, if any.
24798 *
24799 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24800 */
24801EventLog *object_get_event_log (Object *object)
24802{
24803 GDBusInterface *ret;
24804 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
24805 if (ret == NULL)
24806 return NULL;
24807 return EVENT_LOG (ret);
24808}
24809
24810/**
24811 * object_get_flash:
24812 * @object: A #Object.
24813 *
24814 * Gets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object, if any.
24815 *
24816 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24817 */
24818Flash *object_get_flash (Object *object)
24819{
24820 GDBusInterface *ret;
24821 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
24822 if (ret == NULL)
24823 return NULL;
24824 return FLASH (ret);
24825}
24826
24827/**
24828 * object_get_button:
24829 * @object: A #Object.
24830 *
24831 * Gets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object, if any.
24832 *
24833 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24834 */
24835Button *object_get_button (Object *object)
24836{
24837 GDBusInterface *ret;
24838 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
24839 if (ret == NULL)
24840 return NULL;
24841 return BUTTON (ret);
24842}
24843
24844/**
24845 * object_get_led:
24846 * @object: A #Object.
24847 *
24848 * Gets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object, if any.
24849 *
24850 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
24851 */
24852Led *object_get_led (Object *object)
24853{
24854 GDBusInterface *ret;
24855 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
24856 if (ret == NULL)
24857 return NULL;
24858 return LED (ret);
24859}
24860
24861
24862/**
24863 * object_peek_occ: (skip)
24864 * @object: A #Object.
24865 *
24866 * Like object_get_occ() but doesn't increase the reference count on the returned object.
24867 *
24868 * <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>
24869 *
24870 * Returns: (transfer none): A #Occ or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24871 */
24872Occ *object_peek_occ (Object *object)
24873{
24874 GDBusInterface *ret;
24875 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
24876 if (ret == NULL)
24877 return NULL;
24878 g_object_unref (ret);
24879 return OCC (ret);
24880}
24881
24882/**
24883 * object_peek_fan: (skip)
24884 * @object: A #Object.
24885 *
24886 * Like object_get_fan() but doesn't increase the reference count on the returned object.
24887 *
24888 * <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>
24889 *
24890 * Returns: (transfer none): A #Fan or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24891 */
24892Fan *object_peek_fan (Object *object)
24893{
24894 GDBusInterface *ret;
24895 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
24896 if (ret == NULL)
24897 return NULL;
24898 g_object_unref (ret);
24899 return FAN (ret);
24900}
24901
24902/**
24903 * object_peek_sensor_value: (skip)
24904 * @object: A #Object.
24905 *
24906 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
24907 *
24908 * <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>
24909 *
24910 * Returns: (transfer none): A #SensorValue or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24911 */
24912SensorValue *object_peek_sensor_value (Object *object)
24913{
24914 GDBusInterface *ret;
24915 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
24916 if (ret == NULL)
24917 return NULL;
24918 g_object_unref (ret);
24919 return SENSOR_VALUE (ret);
24920}
24921
24922/**
Norman Jamesdfdaca92015-09-27 22:11:15 -050024923 * object_peek_sensor_ipmi: (skip)
24924 * @object: A #Object.
24925 *
24926 * Like object_get_sensor_ipmi() but doesn't increase the reference count on the returned object.
24927 *
24928 * <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>
24929 *
24930 * Returns: (transfer none): A #SensorIpmi or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24931 */
24932SensorIpmi *object_peek_sensor_ipmi (Object *object)
24933{
24934 GDBusInterface *ret;
24935 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIpmi");
24936 if (ret == NULL)
24937 return NULL;
24938 g_object_unref (ret);
24939 return SENSOR_IPMI (ret);
24940}
24941
24942/**
Norman James362a80f2015-09-14 14:04:39 -050024943 * object_peek_sensor_threshold: (skip)
24944 * @object: A #Object.
24945 *
24946 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
24947 *
24948 * <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>
24949 *
24950 * Returns: (transfer none): A #SensorThreshold or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24951 */
24952SensorThreshold *object_peek_sensor_threshold (Object *object)
24953{
24954 GDBusInterface *ret;
24955 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
24956 if (ret == NULL)
24957 return NULL;
24958 g_object_unref (ret);
24959 return SENSOR_THRESHOLD (ret);
24960}
24961
24962/**
24963 * object_peek_sensor_i2c: (skip)
24964 * @object: A #Object.
24965 *
24966 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
24967 *
24968 * <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>
24969 *
24970 * 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.
24971 */
24972SensorI2c *object_peek_sensor_i2c (Object *object)
24973{
24974 GDBusInterface *ret;
24975 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
24976 if (ret == NULL)
24977 return NULL;
24978 g_object_unref (ret);
24979 return SENSOR_I2C (ret);
24980}
24981
24982/**
24983 * object_peek_sensor_match: (skip)
24984 * @object: A #Object.
24985 *
24986 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
24987 *
24988 * <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>
24989 *
24990 * Returns: (transfer none): A #SensorMatch or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
24991 */
24992SensorMatch *object_peek_sensor_match (Object *object)
24993{
24994 GDBusInterface *ret;
24995 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
24996 if (ret == NULL)
24997 return NULL;
24998 g_object_unref (ret);
24999 return SENSOR_MATCH (ret);
25000}
25001
25002/**
25003 * object_peek_process: (skip)
25004 * @object: A #Object.
25005 *
25006 * Like object_get_process() but doesn't increase the reference count on the returned object.
25007 *
25008 * <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>
25009 *
25010 * Returns: (transfer none): A #Process or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25011 */
25012Process *object_peek_process (Object *object)
25013{
25014 GDBusInterface *ret;
25015 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
25016 if (ret == NULL)
25017 return NULL;
25018 g_object_unref (ret);
25019 return PROCESS (ret);
25020}
25021
25022/**
25023 * object_peek_control: (skip)
25024 * @object: A #Object.
25025 *
25026 * Like object_get_control() but doesn't increase the reference count on the returned object.
25027 *
25028 * <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>
25029 *
25030 * Returns: (transfer none): A #Control or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25031 */
25032Control *object_peek_control (Object *object)
25033{
25034 GDBusInterface *ret;
25035 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
25036 if (ret == NULL)
25037 return NULL;
25038 g_object_unref (ret);
25039 return CONTROL (ret);
25040}
25041
25042/**
25043 * object_peek_control_bmc: (skip)
25044 * @object: A #Object.
25045 *
25046 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
25047 *
25048 * <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>
25049 *
25050 * Returns: (transfer none): A #ControlBmc or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25051 */
25052ControlBmc *object_peek_control_bmc (Object *object)
25053{
25054 GDBusInterface *ret;
25055 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
25056 if (ret == NULL)
25057 return NULL;
25058 g_object_unref (ret);
25059 return CONTROL_BMC (ret);
25060}
25061
25062/**
25063 * object_peek_control_host: (skip)
25064 * @object: A #Object.
25065 *
25066 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
25067 *
25068 * <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>
25069 *
25070 * Returns: (transfer none): A #ControlHost or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25071 */
25072ControlHost *object_peek_control_host (Object *object)
25073{
25074 GDBusInterface *ret;
25075 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
25076 if (ret == NULL)
25077 return NULL;
25078 g_object_unref (ret);
25079 return CONTROL_HOST (ret);
25080}
25081
25082/**
25083 * object_peek_control_power: (skip)
25084 * @object: A #Object.
25085 *
25086 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
25087 *
25088 * <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>
25089 *
25090 * Returns: (transfer none): A #ControlPower or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25091 */
25092ControlPower *object_peek_control_power (Object *object)
25093{
25094 GDBusInterface *ret;
25095 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
25096 if (ret == NULL)
25097 return NULL;
25098 g_object_unref (ret);
25099 return CONTROL_POWER (ret);
25100}
25101
25102/**
25103 * object_peek_watchdog: (skip)
25104 * @object: A #Object.
25105 *
25106 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
25107 *
25108 * <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>
25109 *
25110 * Returns: (transfer none): A #Watchdog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25111 */
25112Watchdog *object_peek_watchdog (Object *object)
25113{
25114 GDBusInterface *ret;
25115 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
25116 if (ret == NULL)
25117 return NULL;
25118 g_object_unref (ret);
25119 return WATCHDOG (ret);
25120}
25121
25122/**
25123 * object_peek_event_log: (skip)
25124 * @object: A #Object.
25125 *
25126 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
25127 *
25128 * <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>
25129 *
25130 * Returns: (transfer none): A #EventLog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25131 */
25132EventLog *object_peek_event_log (Object *object)
25133{
25134 GDBusInterface *ret;
25135 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
25136 if (ret == NULL)
25137 return NULL;
25138 g_object_unref (ret);
25139 return EVENT_LOG (ret);
25140}
25141
25142/**
25143 * object_peek_flash: (skip)
25144 * @object: A #Object.
25145 *
25146 * Like object_get_flash() but doesn't increase the reference count on the returned object.
25147 *
25148 * <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>
25149 *
25150 * Returns: (transfer none): A #Flash or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25151 */
25152Flash *object_peek_flash (Object *object)
25153{
25154 GDBusInterface *ret;
25155 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
25156 if (ret == NULL)
25157 return NULL;
25158 g_object_unref (ret);
25159 return FLASH (ret);
25160}
25161
25162/**
25163 * object_peek_button: (skip)
25164 * @object: A #Object.
25165 *
25166 * Like object_get_button() but doesn't increase the reference count on the returned object.
25167 *
25168 * <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>
25169 *
25170 * Returns: (transfer none): A #Button or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25171 */
25172Button *object_peek_button (Object *object)
25173{
25174 GDBusInterface *ret;
25175 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25176 if (ret == NULL)
25177 return NULL;
25178 g_object_unref (ret);
25179 return BUTTON (ret);
25180}
25181
25182/**
25183 * object_peek_led: (skip)
25184 * @object: A #Object.
25185 *
25186 * Like object_get_led() but doesn't increase the reference count on the returned object.
25187 *
25188 * <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>
25189 *
25190 * Returns: (transfer none): A #Led or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
25191 */
25192Led *object_peek_led (Object *object)
25193{
25194 GDBusInterface *ret;
25195 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25196 if (ret == NULL)
25197 return NULL;
25198 g_object_unref (ret);
25199 return LED (ret);
25200}
25201
25202
25203static void
25204object_notify (GDBusObject *object, GDBusInterface *interface)
25205{
25206 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
25207 /* info can be NULL if the other end is using a D-Bus interface we don't know
25208 * anything about, for example old generated code in this process talking to
25209 * newer generated code in the other process. */
25210 if (info != NULL)
25211 g_object_notify (G_OBJECT (object), info->hyphen_name);
25212}
25213
25214/**
25215 * ObjectProxy:
25216 *
25217 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
25218 */
25219
25220/**
25221 * ObjectProxyClass:
25222 * @parent_class: The parent class.
25223 *
25224 * Class structure for #ObjectProxy.
25225 */
25226
25227static void
25228object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
25229{
25230}
25231
25232static void
25233object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
25234{
25235 iface->interface_added = object_notify;
25236 iface->interface_removed = object_notify;
25237}
25238
25239
25240G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
25241 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
25242 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
25243
25244static void
25245object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
25246{
25247}
25248
25249static void
25250object_proxy_set_property (GObject *gobject,
25251 guint prop_id,
25252 const GValue *value G_GNUC_UNUSED,
25253 GParamSpec *pspec)
25254{
25255 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25256}
25257
25258static void
25259object_proxy_get_property (GObject *gobject,
25260 guint prop_id,
25261 GValue *value,
25262 GParamSpec *pspec)
25263{
25264 ObjectProxy *object = OBJECT_PROXY (gobject);
25265 GDBusInterface *interface;
25266
25267 switch (prop_id)
25268 {
25269 case 1:
25270 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
25271 g_value_take_object (value, interface);
25272 break;
25273
25274 case 2:
25275 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
25276 g_value_take_object (value, interface);
25277 break;
25278
25279 case 3:
25280 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
25281 g_value_take_object (value, interface);
25282 break;
25283
25284 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025285 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIpmi");
Norman James362a80f2015-09-14 14:04:39 -050025286 g_value_take_object (value, interface);
25287 break;
25288
25289 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025290 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050025291 g_value_take_object (value, interface);
25292 break;
25293
25294 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025295 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050025296 g_value_take_object (value, interface);
25297 break;
25298
25299 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025300 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050025301 g_value_take_object (value, interface);
25302 break;
25303
25304 case 8:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025305 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050025306 g_value_take_object (value, interface);
25307 break;
25308
25309 case 9:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025310 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050025311 g_value_take_object (value, interface);
25312 break;
25313
25314 case 10:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025315 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050025316 g_value_take_object (value, interface);
25317 break;
25318
25319 case 11:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025320 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050025321 g_value_take_object (value, interface);
25322 break;
25323
25324 case 12:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025325 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050025326 g_value_take_object (value, interface);
25327 break;
25328
25329 case 13:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025330 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050025331 g_value_take_object (value, interface);
25332 break;
25333
25334 case 14:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025335 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050025336 g_value_take_object (value, interface);
25337 break;
25338
25339 case 15:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025340 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James362a80f2015-09-14 14:04:39 -050025341 g_value_take_object (value, interface);
25342 break;
25343
25344 case 16:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025345 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25346 g_value_take_object (value, interface);
25347 break;
25348
25349 case 17:
Norman James362a80f2015-09-14 14:04:39 -050025350 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25351 g_value_take_object (value, interface);
25352 break;
25353
25354 default:
25355 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25356 break;
25357 }
25358}
25359
25360static void
25361object_proxy_class_init (ObjectProxyClass *klass)
25362{
25363 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
25364
25365 gobject_class->set_property = object_proxy_set_property;
25366 gobject_class->get_property = object_proxy_get_property;
25367
25368 g_object_class_override_property (gobject_class, 1, "occ");
25369 g_object_class_override_property (gobject_class, 2, "fan");
25370 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman Jamesdfdaca92015-09-27 22:11:15 -050025371 g_object_class_override_property (gobject_class, 4, "sensor-ipmi");
25372 g_object_class_override_property (gobject_class, 5, "sensor-threshold");
25373 g_object_class_override_property (gobject_class, 6, "sensor-i2c");
25374 g_object_class_override_property (gobject_class, 7, "sensor-match");
25375 g_object_class_override_property (gobject_class, 8, "process");
25376 g_object_class_override_property (gobject_class, 9, "control");
25377 g_object_class_override_property (gobject_class, 10, "control-bmc");
25378 g_object_class_override_property (gobject_class, 11, "control-host");
25379 g_object_class_override_property (gobject_class, 12, "control-power");
25380 g_object_class_override_property (gobject_class, 13, "watchdog");
25381 g_object_class_override_property (gobject_class, 14, "event-log");
25382 g_object_class_override_property (gobject_class, 15, "flash");
25383 g_object_class_override_property (gobject_class, 16, "button");
25384 g_object_class_override_property (gobject_class, 17, "led");
Norman James362a80f2015-09-14 14:04:39 -050025385}
25386
25387/**
25388 * object_proxy_new:
25389 * @connection: A #GDBusConnection.
25390 * @object_path: An object path.
25391 *
25392 * Creates a new proxy object.
25393 *
25394 * Returns: (transfer full): The proxy object.
25395 */
25396ObjectProxy *
25397object_proxy_new (GDBusConnection *connection,
25398 const gchar *object_path)
25399{
25400 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
25401 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
25402 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
25403}
25404
25405/**
25406 * ObjectSkeleton:
25407 *
25408 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
25409 */
25410
25411/**
25412 * ObjectSkeletonClass:
25413 * @parent_class: The parent class.
25414 *
25415 * Class structure for #ObjectSkeleton.
25416 */
25417
25418static void
25419object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
25420{
25421}
25422
25423
25424static void
25425object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
25426{
25427 iface->interface_added = object_notify;
25428 iface->interface_removed = object_notify;
25429}
25430
25431G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
25432 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
25433 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
25434
25435static void
25436object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
25437{
25438}
25439
25440static void
25441object_skeleton_set_property (GObject *gobject,
25442 guint prop_id,
25443 const GValue *value,
25444 GParamSpec *pspec)
25445{
25446 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
25447 GDBusInterfaceSkeleton *interface;
25448
25449 switch (prop_id)
25450 {
25451 case 1:
25452 interface = g_value_get_object (value);
25453 if (interface != NULL)
25454 {
25455 g_warn_if_fail (IS_OCC (interface));
25456 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25457 }
25458 else
25459 {
25460 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
25461 }
25462 break;
25463
25464 case 2:
25465 interface = g_value_get_object (value);
25466 if (interface != NULL)
25467 {
25468 g_warn_if_fail (IS_FAN (interface));
25469 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25470 }
25471 else
25472 {
25473 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
25474 }
25475 break;
25476
25477 case 3:
25478 interface = g_value_get_object (value);
25479 if (interface != NULL)
25480 {
25481 g_warn_if_fail (IS_SENSOR_VALUE (interface));
25482 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25483 }
25484 else
25485 {
25486 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
25487 }
25488 break;
25489
25490 case 4:
25491 interface = g_value_get_object (value);
25492 if (interface != NULL)
25493 {
Norman Jamesdfdaca92015-09-27 22:11:15 -050025494 g_warn_if_fail (IS_SENSOR_IPMI (interface));
25495 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25496 }
25497 else
25498 {
25499 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorIpmi");
25500 }
25501 break;
25502
25503 case 5:
25504 interface = g_value_get_object (value);
25505 if (interface != NULL)
25506 {
Norman James362a80f2015-09-14 14:04:39 -050025507 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
25508 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25509 }
25510 else
25511 {
25512 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
25513 }
25514 break;
25515
Norman Jamesdfdaca92015-09-27 22:11:15 -050025516 case 6:
Norman James362a80f2015-09-14 14:04:39 -050025517 interface = g_value_get_object (value);
25518 if (interface != NULL)
25519 {
25520 g_warn_if_fail (IS_SENSOR_I2C (interface));
25521 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25522 }
25523 else
25524 {
25525 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
25526 }
25527 break;
25528
Norman Jamesdfdaca92015-09-27 22:11:15 -050025529 case 7:
Norman James362a80f2015-09-14 14:04:39 -050025530 interface = g_value_get_object (value);
25531 if (interface != NULL)
25532 {
25533 g_warn_if_fail (IS_SENSOR_MATCH (interface));
25534 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25535 }
25536 else
25537 {
25538 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
25539 }
25540 break;
25541
Norman Jamesdfdaca92015-09-27 22:11:15 -050025542 case 8:
Norman James362a80f2015-09-14 14:04:39 -050025543 interface = g_value_get_object (value);
25544 if (interface != NULL)
25545 {
25546 g_warn_if_fail (IS_PROCESS (interface));
25547 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25548 }
25549 else
25550 {
25551 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
25552 }
25553 break;
25554
Norman Jamesdfdaca92015-09-27 22:11:15 -050025555 case 9:
Norman James362a80f2015-09-14 14:04:39 -050025556 interface = g_value_get_object (value);
25557 if (interface != NULL)
25558 {
25559 g_warn_if_fail (IS_CONTROL (interface));
25560 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25561 }
25562 else
25563 {
25564 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
25565 }
25566 break;
25567
Norman Jamesdfdaca92015-09-27 22:11:15 -050025568 case 10:
Norman James362a80f2015-09-14 14:04:39 -050025569 interface = g_value_get_object (value);
25570 if (interface != NULL)
25571 {
25572 g_warn_if_fail (IS_CONTROL_BMC (interface));
25573 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25574 }
25575 else
25576 {
25577 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
25578 }
25579 break;
25580
Norman Jamesdfdaca92015-09-27 22:11:15 -050025581 case 11:
Norman James362a80f2015-09-14 14:04:39 -050025582 interface = g_value_get_object (value);
25583 if (interface != NULL)
25584 {
25585 g_warn_if_fail (IS_CONTROL_HOST (interface));
25586 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25587 }
25588 else
25589 {
25590 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
25591 }
25592 break;
25593
Norman Jamesdfdaca92015-09-27 22:11:15 -050025594 case 12:
Norman James362a80f2015-09-14 14:04:39 -050025595 interface = g_value_get_object (value);
25596 if (interface != NULL)
25597 {
25598 g_warn_if_fail (IS_CONTROL_POWER (interface));
25599 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25600 }
25601 else
25602 {
25603 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
25604 }
25605 break;
25606
Norman Jamesdfdaca92015-09-27 22:11:15 -050025607 case 13:
Norman James362a80f2015-09-14 14:04:39 -050025608 interface = g_value_get_object (value);
25609 if (interface != NULL)
25610 {
25611 g_warn_if_fail (IS_WATCHDOG (interface));
25612 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25613 }
25614 else
25615 {
25616 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
25617 }
25618 break;
25619
Norman Jamesdfdaca92015-09-27 22:11:15 -050025620 case 14:
Norman James362a80f2015-09-14 14:04:39 -050025621 interface = g_value_get_object (value);
25622 if (interface != NULL)
25623 {
25624 g_warn_if_fail (IS_EVENT_LOG (interface));
25625 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25626 }
25627 else
25628 {
25629 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
25630 }
25631 break;
25632
Norman Jamesdfdaca92015-09-27 22:11:15 -050025633 case 15:
Norman James362a80f2015-09-14 14:04:39 -050025634 interface = g_value_get_object (value);
25635 if (interface != NULL)
25636 {
25637 g_warn_if_fail (IS_FLASH (interface));
25638 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25639 }
25640 else
25641 {
25642 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
25643 }
25644 break;
25645
Norman Jamesdfdaca92015-09-27 22:11:15 -050025646 case 16:
Norman James362a80f2015-09-14 14:04:39 -050025647 interface = g_value_get_object (value);
25648 if (interface != NULL)
25649 {
25650 g_warn_if_fail (IS_BUTTON (interface));
25651 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25652 }
25653 else
25654 {
25655 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
25656 }
25657 break;
25658
Norman Jamesdfdaca92015-09-27 22:11:15 -050025659 case 17:
Norman James362a80f2015-09-14 14:04:39 -050025660 interface = g_value_get_object (value);
25661 if (interface != NULL)
25662 {
25663 g_warn_if_fail (IS_LED (interface));
25664 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
25665 }
25666 else
25667 {
25668 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
25669 }
25670 break;
25671
25672 default:
25673 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25674 break;
25675 }
25676}
25677
25678static void
25679object_skeleton_get_property (GObject *gobject,
25680 guint prop_id,
25681 GValue *value,
25682 GParamSpec *pspec)
25683{
25684 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
25685 GDBusInterface *interface;
25686
25687 switch (prop_id)
25688 {
25689 case 1:
25690 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
25691 g_value_take_object (value, interface);
25692 break;
25693
25694 case 2:
25695 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
25696 g_value_take_object (value, interface);
25697 break;
25698
25699 case 3:
25700 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
25701 g_value_take_object (value, interface);
25702 break;
25703
25704 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025705 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorIpmi");
Norman James362a80f2015-09-14 14:04:39 -050025706 g_value_take_object (value, interface);
25707 break;
25708
25709 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025710 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050025711 g_value_take_object (value, interface);
25712 break;
25713
25714 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025715 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050025716 g_value_take_object (value, interface);
25717 break;
25718
25719 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025720 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050025721 g_value_take_object (value, interface);
25722 break;
25723
25724 case 8:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025725 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050025726 g_value_take_object (value, interface);
25727 break;
25728
25729 case 9:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025730 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050025731 g_value_take_object (value, interface);
25732 break;
25733
25734 case 10:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025735 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050025736 g_value_take_object (value, interface);
25737 break;
25738
25739 case 11:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025740 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050025741 g_value_take_object (value, interface);
25742 break;
25743
25744 case 12:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025745 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050025746 g_value_take_object (value, interface);
25747 break;
25748
25749 case 13:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025750 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050025751 g_value_take_object (value, interface);
25752 break;
25753
25754 case 14:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025755 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050025756 g_value_take_object (value, interface);
25757 break;
25758
25759 case 15:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025760 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James362a80f2015-09-14 14:04:39 -050025761 g_value_take_object (value, interface);
25762 break;
25763
25764 case 16:
Norman Jamesdfdaca92015-09-27 22:11:15 -050025765 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
25766 g_value_take_object (value, interface);
25767 break;
25768
25769 case 17:
Norman James362a80f2015-09-14 14:04:39 -050025770 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
25771 g_value_take_object (value, interface);
25772 break;
25773
25774 default:
25775 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
25776 break;
25777 }
25778}
25779
25780static void
25781object_skeleton_class_init (ObjectSkeletonClass *klass)
25782{
25783 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
25784
25785 gobject_class->set_property = object_skeleton_set_property;
25786 gobject_class->get_property = object_skeleton_get_property;
25787
25788 g_object_class_override_property (gobject_class, 1, "occ");
25789 g_object_class_override_property (gobject_class, 2, "fan");
25790 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman Jamesdfdaca92015-09-27 22:11:15 -050025791 g_object_class_override_property (gobject_class, 4, "sensor-ipmi");
25792 g_object_class_override_property (gobject_class, 5, "sensor-threshold");
25793 g_object_class_override_property (gobject_class, 6, "sensor-i2c");
25794 g_object_class_override_property (gobject_class, 7, "sensor-match");
25795 g_object_class_override_property (gobject_class, 8, "process");
25796 g_object_class_override_property (gobject_class, 9, "control");
25797 g_object_class_override_property (gobject_class, 10, "control-bmc");
25798 g_object_class_override_property (gobject_class, 11, "control-host");
25799 g_object_class_override_property (gobject_class, 12, "control-power");
25800 g_object_class_override_property (gobject_class, 13, "watchdog");
25801 g_object_class_override_property (gobject_class, 14, "event-log");
25802 g_object_class_override_property (gobject_class, 15, "flash");
25803 g_object_class_override_property (gobject_class, 16, "button");
25804 g_object_class_override_property (gobject_class, 17, "led");
Norman James362a80f2015-09-14 14:04:39 -050025805}
25806
25807/**
25808 * object_skeleton_new:
25809 * @object_path: An object path.
25810 *
25811 * Creates a new skeleton object.
25812 *
25813 * Returns: (transfer full): The skeleton object.
25814 */
25815ObjectSkeleton *
25816object_skeleton_new (const gchar *object_path)
25817{
25818 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
25819 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
25820}
25821
25822/**
25823 * object_skeleton_set_occ:
25824 * @object: A #ObjectSkeleton.
25825 * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
25826 *
25827 * Sets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object.
25828 */
25829void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
25830{
25831 g_object_set (G_OBJECT (object), "occ", interface_, NULL);
25832}
25833
25834/**
25835 * object_skeleton_set_fan:
25836 * @object: A #ObjectSkeleton.
25837 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
25838 *
25839 * Sets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object.
25840 */
25841void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
25842{
25843 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
25844}
25845
25846/**
25847 * object_skeleton_set_sensor_value:
25848 * @object: A #ObjectSkeleton.
25849 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
25850 *
25851 * Sets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object.
25852 */
25853void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
25854{
25855 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
25856}
25857
25858/**
Norman Jamesdfdaca92015-09-27 22:11:15 -050025859 * object_skeleton_set_sensor_ipmi:
25860 * @object: A #ObjectSkeleton.
25861 * @interface_: (allow-none): A #SensorIpmi or %NULL to clear the interface.
25862 *
25863 * Sets the #SensorIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorIpmi.top_of_page">org.openbmc.SensorIpmi</link> on @object.
25864 */
25865void object_skeleton_set_sensor_ipmi (ObjectSkeleton *object, SensorIpmi *interface_)
25866{
25867 g_object_set (G_OBJECT (object), "sensor-ipmi", interface_, NULL);
25868}
25869
25870/**
Norman James362a80f2015-09-14 14:04:39 -050025871 * object_skeleton_set_sensor_threshold:
25872 * @object: A #ObjectSkeleton.
25873 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
25874 *
25875 * Sets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object.
25876 */
25877void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
25878{
25879 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
25880}
25881
25882/**
25883 * object_skeleton_set_sensor_i2c:
25884 * @object: A #ObjectSkeleton.
25885 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
25886 *
25887 * 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.
25888 */
25889void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
25890{
25891 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
25892}
25893
25894/**
25895 * object_skeleton_set_sensor_match:
25896 * @object: A #ObjectSkeleton.
25897 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
25898 *
25899 * Sets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object.
25900 */
25901void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
25902{
25903 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
25904}
25905
25906/**
25907 * object_skeleton_set_process:
25908 * @object: A #ObjectSkeleton.
25909 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
25910 *
25911 * Sets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object.
25912 */
25913void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
25914{
25915 g_object_set (G_OBJECT (object), "process", interface_, NULL);
25916}
25917
25918/**
25919 * object_skeleton_set_control:
25920 * @object: A #ObjectSkeleton.
25921 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
25922 *
25923 * Sets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object.
25924 */
25925void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
25926{
25927 g_object_set (G_OBJECT (object), "control", interface_, NULL);
25928}
25929
25930/**
25931 * object_skeleton_set_control_bmc:
25932 * @object: A #ObjectSkeleton.
25933 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
25934 *
25935 * Sets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object.
25936 */
25937void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
25938{
25939 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
25940}
25941
25942/**
25943 * object_skeleton_set_control_host:
25944 * @object: A #ObjectSkeleton.
25945 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
25946 *
25947 * Sets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object.
25948 */
25949void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
25950{
25951 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
25952}
25953
25954/**
25955 * object_skeleton_set_control_power:
25956 * @object: A #ObjectSkeleton.
25957 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
25958 *
25959 * Sets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object.
25960 */
25961void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
25962{
25963 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
25964}
25965
25966/**
25967 * object_skeleton_set_watchdog:
25968 * @object: A #ObjectSkeleton.
25969 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
25970 *
25971 * Sets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object.
25972 */
25973void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
25974{
25975 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
25976}
25977
25978/**
25979 * object_skeleton_set_event_log:
25980 * @object: A #ObjectSkeleton.
25981 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
25982 *
25983 * Sets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object.
25984 */
25985void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
25986{
25987 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
25988}
25989
25990/**
25991 * object_skeleton_set_flash:
25992 * @object: A #ObjectSkeleton.
25993 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
25994 *
25995 * Sets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object.
25996 */
25997void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
25998{
25999 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
26000}
26001
26002/**
26003 * object_skeleton_set_button:
26004 * @object: A #ObjectSkeleton.
26005 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
26006 *
26007 * Sets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object.
26008 */
26009void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
26010{
26011 g_object_set (G_OBJECT (object), "button", interface_, NULL);
26012}
26013
26014/**
26015 * object_skeleton_set_led:
26016 * @object: A #ObjectSkeleton.
26017 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
26018 *
26019 * Sets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object.
26020 */
26021void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
26022{
26023 g_object_set (G_OBJECT (object), "led", interface_, NULL);
26024}
26025
26026
26027/* ------------------------------------------------------------------------
26028 * Code for ObjectManager client
26029 * ------------------------------------------------------------------------
26030 */
26031
26032/**
26033 * SECTION:ObjectManagerClient
26034 * @title: ObjectManagerClient
26035 * @short_description: Generated GDBusObjectManagerClient type
26036 *
26037 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
26038 */
26039
26040/**
26041 * ObjectManagerClient:
26042 *
26043 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
26044 */
26045
26046/**
26047 * ObjectManagerClientClass:
26048 * @parent_class: The parent class.
26049 *
26050 * Class structure for #ObjectManagerClient.
26051 */
26052
26053G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
26054
26055static void
26056object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
26057{
26058}
26059
26060static void
26061object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
26062{
26063}
26064
26065/**
26066 * object_manager_client_get_proxy_type:
26067 * @manager: A #GDBusObjectManagerClient.
26068 * @object_path: The object path of the remote object (unused).
26069 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
26070 * @user_data: User data (unused).
26071 *
26072 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
26073 *
26074 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
26075 */
26076GType
26077object_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)
26078{
26079 static gsize once_init_value = 0;
26080 static GHashTable *lookup_hash;
26081 GType ret;
26082
26083 if (interface_name == NULL)
26084 return TYPE_OBJECT_PROXY;
26085 if (g_once_init_enter (&once_init_value))
26086 {
26087 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
26088 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
26089 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
26090 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman Jamesdfdaca92015-09-27 22:11:15 -050026091 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorIpmi", GSIZE_TO_POINTER (TYPE_SENSOR_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050026092 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
26093 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
26094 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
26095 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
26096 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
26097 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
26098 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
26099 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
26100 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
26101 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
26102 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
26103 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
26104 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
26105 g_once_init_leave (&once_init_value, 1);
26106 }
26107 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
26108 if (ret == (GType) 0)
26109 ret = G_TYPE_DBUS_PROXY;
26110 return ret;
26111}
26112
26113/**
26114 * object_manager_client_new:
26115 * @connection: A #GDBusConnection.
26116 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26117 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26118 * @object_path: An object path.
26119 * @cancellable: (allow-none): A #GCancellable or %NULL.
26120 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26121 * @user_data: User data to pass to @callback.
26122 *
26123 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
26124 *
26125 * 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.
26126 * You can then call object_manager_client_new_finish() to get the result of the operation.
26127 *
26128 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
26129 */
26130void
26131object_manager_client_new (
26132 GDBusConnection *connection,
26133 GDBusObjectManagerClientFlags flags,
26134 const gchar *name,
26135 const gchar *object_path,
26136 GCancellable *cancellable,
26137 GAsyncReadyCallback callback,
26138 gpointer user_data)
26139{
26140 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);
26141}
26142
26143/**
26144 * object_manager_client_new_finish:
26145 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
26146 * @error: Return location for error or %NULL
26147 *
26148 * Finishes an operation started with object_manager_client_new().
26149 *
26150 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26151 */
26152GDBusObjectManager *
26153object_manager_client_new_finish (
26154 GAsyncResult *res,
26155 GError **error)
26156{
26157 GObject *ret;
26158 GObject *source_object;
26159 source_object = g_async_result_get_source_object (res);
26160 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26161 g_object_unref (source_object);
26162 if (ret != NULL)
26163 return G_DBUS_OBJECT_MANAGER (ret);
26164 else
26165 return NULL;
26166}
26167
26168/**
26169 * object_manager_client_new_sync:
26170 * @connection: A #GDBusConnection.
26171 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26172 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26173 * @object_path: An object path.
26174 * @cancellable: (allow-none): A #GCancellable or %NULL.
26175 * @error: Return location for error or %NULL
26176 *
26177 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
26178 *
26179 * The calling thread is blocked until a reply is received.
26180 *
26181 * See object_manager_client_new() for the asynchronous version of this constructor.
26182 *
26183 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26184 */
26185GDBusObjectManager *
26186object_manager_client_new_sync (
26187 GDBusConnection *connection,
26188 GDBusObjectManagerClientFlags flags,
26189 const gchar *name,
26190 const gchar *object_path,
26191 GCancellable *cancellable,
26192 GError **error)
26193{
26194 GInitable *ret;
26195 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);
26196 if (ret != NULL)
26197 return G_DBUS_OBJECT_MANAGER (ret);
26198 else
26199 return NULL;
26200}
26201
26202
26203/**
26204 * object_manager_client_new_for_bus:
26205 * @bus_type: A #GBusType.
26206 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26207 * @name: A bus name (well-known or unique).
26208 * @object_path: An object path.
26209 * @cancellable: (allow-none): A #GCancellable or %NULL.
26210 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26211 * @user_data: User data to pass to @callback.
26212 *
26213 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
26214 *
26215 * 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.
26216 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
26217 *
26218 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26219 */
26220void
26221object_manager_client_new_for_bus (
26222 GBusType bus_type,
26223 GDBusObjectManagerClientFlags flags,
26224 const gchar *name,
26225 const gchar *object_path,
26226 GCancellable *cancellable,
26227 GAsyncReadyCallback callback,
26228 gpointer user_data)
26229{
26230 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);
26231}
26232
26233/**
26234 * object_manager_client_new_for_bus_finish:
26235 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
26236 * @error: Return location for error or %NULL
26237 *
26238 * Finishes an operation started with object_manager_client_new_for_bus().
26239 *
26240 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26241 */
26242GDBusObjectManager *
26243object_manager_client_new_for_bus_finish (
26244 GAsyncResult *res,
26245 GError **error)
26246{
26247 GObject *ret;
26248 GObject *source_object;
26249 source_object = g_async_result_get_source_object (res);
26250 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26251 g_object_unref (source_object);
26252 if (ret != NULL)
26253 return G_DBUS_OBJECT_MANAGER (ret);
26254 else
26255 return NULL;
26256}
26257
26258/**
26259 * object_manager_client_new_for_bus_sync:
26260 * @bus_type: A #GBusType.
26261 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
26262 * @name: A bus name (well-known or unique).
26263 * @object_path: An object path.
26264 * @cancellable: (allow-none): A #GCancellable or %NULL.
26265 * @error: Return location for error or %NULL
26266 *
26267 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26268 *
26269 * The calling thread is blocked until a reply is received.
26270 *
26271 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
26272 *
26273 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
26274 */
26275GDBusObjectManager *
26276object_manager_client_new_for_bus_sync (
26277 GBusType bus_type,
26278 GDBusObjectManagerClientFlags flags,
26279 const gchar *name,
26280 const gchar *object_path,
26281 GCancellable *cancellable,
26282 GError **error)
26283{
26284 GInitable *ret;
26285 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);
26286 if (ret != NULL)
26287 return G_DBUS_OBJECT_MANAGER (ret);
26288 else
26289 return NULL;
26290}
26291
26292