blob: 6bd5d91a557a4c3e3213cceaa8fe5e53451b8277 [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 James19e45912015-10-04 20:19:41 -05003610static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3611{
3612 {
3613 -1,
3614 (gchar *) "value",
3615 (gchar *) "v",
3616 NULL
3617 },
3618 FALSE
3619};
3620
3621static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3622{
3623 &_sensor_value_method_info_set_value_IN_ARG_value,
3624 NULL
3625};
3626
3627static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3628{
3629 {
3630 -1,
3631 (gchar *) "setValue",
3632 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3633 NULL,
3634 NULL
3635 },
3636 "handle-set-value",
3637 FALSE
3638};
3639
Norman James362a80f2015-09-14 14:04:39 -05003640static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3641{
3642 &_sensor_value_method_info_init,
3643 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05003644 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05003645 NULL
3646};
3647
3648static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3649{
3650 {
3651 -1,
3652 (gchar *) "value",
3653 (gchar *) "v",
3654 NULL
3655 },
3656 FALSE
3657};
3658
3659static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3660{
3661 {
3662 -1,
3663 (gchar *) "units",
3664 (gchar *) "s",
3665 NULL
3666 },
3667 FALSE
3668};
3669
3670static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3671{
3672 &_sensor_value_signal_info_changed_ARG_value,
3673 &_sensor_value_signal_info_changed_ARG_units,
3674 NULL
3675};
3676
3677static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3678{
3679 {
3680 -1,
3681 (gchar *) "Changed",
3682 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3683 NULL
3684 },
3685 "changed"
3686};
3687
Norman James32e74e22015-09-15 21:28:06 -05003688static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
3689{
3690 {
3691 -1,
3692 (gchar *) "Error",
3693 NULL,
3694 NULL
3695 },
3696 "error"
3697};
3698
Norman James362a80f2015-09-14 14:04:39 -05003699static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3700{
3701 {
3702 -1,
3703 (gchar *) "bus_name",
3704 (gchar *) "s",
3705 NULL
3706 },
3707 FALSE
3708};
3709
3710static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3711{
3712 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3713 NULL
3714};
3715
3716static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3717{
3718 {
3719 -1,
3720 (gchar *) "Heartbeat",
3721 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3722 NULL
3723 },
3724 "heartbeat"
3725};
3726
3727static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3728{
3729 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05003730 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05003731 &_sensor_value_signal_info_heartbeat,
3732 NULL
3733};
3734
3735static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3736{
3737 {
3738 -1,
3739 (gchar *) "value",
3740 (gchar *) "v",
3741 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3742 NULL
3743 },
3744 "value",
3745 FALSE
3746};
3747
3748static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3749{
3750 {
3751 -1,
3752 (gchar *) "units",
3753 (gchar *) "s",
3754 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3755 NULL
3756 },
3757 "units",
3758 FALSE
3759};
3760
3761static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3762{
3763 {
3764 -1,
3765 (gchar *) "poll_interval",
3766 (gchar *) "i",
3767 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3768 NULL
3769 },
3770 "poll-interval",
3771 FALSE
3772};
3773
3774static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3775{
3776 {
3777 -1,
3778 (gchar *) "heatbeat",
3779 (gchar *) "i",
3780 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3781 NULL
3782 },
3783 "heatbeat",
3784 FALSE
3785};
3786
3787static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3788{
3789 {
3790 -1,
3791 (gchar *) "settable",
3792 (gchar *) "b",
3793 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3794 NULL
3795 },
3796 "settable",
3797 FALSE
3798};
3799
Norman James362a80f2015-09-14 14:04:39 -05003800static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3801{
3802 &_sensor_value_property_info_value,
3803 &_sensor_value_property_info_units,
3804 &_sensor_value_property_info_poll_interval,
3805 &_sensor_value_property_info_heatbeat,
3806 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05003807 NULL
3808};
3809
3810static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3811{
3812 {
3813 -1,
3814 (gchar *) "org.openbmc.SensorValue",
3815 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3816 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3817 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3818 NULL
3819 },
3820 "sensor-value",
3821};
3822
3823
3824/**
3825 * sensor_value_interface_info:
3826 *
3827 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3828 *
3829 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3830 */
3831GDBusInterfaceInfo *
3832sensor_value_interface_info (void)
3833{
3834 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3835}
3836
3837/**
3838 * sensor_value_override_properties:
3839 * @klass: The class structure for a #GObject<!-- -->-derived class.
3840 * @property_id_begin: The property id to assign to the first overridden property.
3841 *
3842 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3843 * The properties are overridden in the order they are defined.
3844 *
3845 * Returns: The last property id.
3846 */
3847guint
3848sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3849{
3850 g_object_class_override_property (klass, property_id_begin++, "value");
3851 g_object_class_override_property (klass, property_id_begin++, "units");
3852 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3853 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3854 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05003855 return property_id_begin - 1;
3856}
3857
3858
3859
3860/**
3861 * SensorValue:
3862 *
3863 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3864 */
3865
3866/**
3867 * SensorValueIface:
3868 * @parent_iface: The parent interface.
3869 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3870 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05003871 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05003872 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05003873 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3874 * @get_settable: Getter for the #SensorValue:settable property.
3875 * @get_units: Getter for the #SensorValue:units property.
3876 * @get_value: Getter for the #SensorValue:value property.
3877 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003878 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003879 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3880 *
3881 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3882 */
3883
3884typedef SensorValueIface SensorValueInterface;
3885G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3886
3887static void
3888sensor_value_default_init (SensorValueIface *iface)
3889{
3890 /* GObject signals for incoming D-Bus method calls: */
3891 /**
3892 * SensorValue::handle-init:
3893 * @object: A #SensorValue.
3894 * @invocation: A #GDBusMethodInvocation.
3895 *
3896 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3897 *
3898 * 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.
3899 *
3900 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3901 */
3902 g_signal_new ("handle-init",
3903 G_TYPE_FROM_INTERFACE (iface),
3904 G_SIGNAL_RUN_LAST,
3905 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3906 g_signal_accumulator_true_handled,
3907 NULL,
3908 g_cclosure_marshal_generic,
3909 G_TYPE_BOOLEAN,
3910 1,
3911 G_TYPE_DBUS_METHOD_INVOCATION);
3912
3913 /**
3914 * SensorValue::handle-get-value:
3915 * @object: A #SensorValue.
3916 * @invocation: A #GDBusMethodInvocation.
3917 *
3918 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3919 *
3920 * 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.
3921 *
3922 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3923 */
3924 g_signal_new ("handle-get-value",
3925 G_TYPE_FROM_INTERFACE (iface),
3926 G_SIGNAL_RUN_LAST,
3927 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3928 g_signal_accumulator_true_handled,
3929 NULL,
3930 g_cclosure_marshal_generic,
3931 G_TYPE_BOOLEAN,
3932 1,
3933 G_TYPE_DBUS_METHOD_INVOCATION);
3934
Norman James19e45912015-10-04 20:19:41 -05003935 /**
3936 * SensorValue::handle-set-value:
3937 * @object: A #SensorValue.
3938 * @invocation: A #GDBusMethodInvocation.
3939 * @arg_value: Argument passed by remote caller.
3940 *
3941 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3942 *
3943 * 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_set_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
3944 *
3945 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3946 */
3947 g_signal_new ("handle-set-value",
3948 G_TYPE_FROM_INTERFACE (iface),
3949 G_SIGNAL_RUN_LAST,
3950 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3951 g_signal_accumulator_true_handled,
3952 NULL,
3953 g_cclosure_marshal_generic,
3954 G_TYPE_BOOLEAN,
3955 2,
3956 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3957
Norman James362a80f2015-09-14 14:04:39 -05003958 /* GObject signals for received D-Bus signals: */
3959 /**
3960 * SensorValue::changed:
3961 * @object: A #SensorValue.
3962 * @arg_value: Argument.
3963 * @arg_units: Argument.
3964 *
3965 * 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.
3966 *
3967 * 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.
3968 */
3969 g_signal_new ("changed",
3970 G_TYPE_FROM_INTERFACE (iface),
3971 G_SIGNAL_RUN_LAST,
3972 G_STRUCT_OFFSET (SensorValueIface, changed),
3973 NULL,
3974 NULL,
3975 g_cclosure_marshal_generic,
3976 G_TYPE_NONE,
3977 2, G_TYPE_VARIANT, G_TYPE_STRING);
3978
3979 /**
Norman James32e74e22015-09-15 21:28:06 -05003980 * SensorValue::error:
3981 * @object: A #SensorValue.
3982 *
3983 * 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.
3984 *
3985 * 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.
3986 */
3987 g_signal_new ("error",
3988 G_TYPE_FROM_INTERFACE (iface),
3989 G_SIGNAL_RUN_LAST,
3990 G_STRUCT_OFFSET (SensorValueIface, error),
3991 NULL,
3992 NULL,
3993 g_cclosure_marshal_generic,
3994 G_TYPE_NONE,
3995 0);
3996
3997 /**
Norman James362a80f2015-09-14 14:04:39 -05003998 * SensorValue::heartbeat:
3999 * @object: A #SensorValue.
4000 * @arg_bus_name: Argument.
4001 *
4002 * 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.
4003 *
4004 * 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.
4005 */
4006 g_signal_new ("heartbeat",
4007 G_TYPE_FROM_INTERFACE (iface),
4008 G_SIGNAL_RUN_LAST,
4009 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4010 NULL,
4011 NULL,
4012 g_cclosure_marshal_generic,
4013 G_TYPE_NONE,
4014 1, G_TYPE_STRING);
4015
4016 /* GObject properties for D-Bus properties: */
4017 /**
4018 * SensorValue:value:
4019 *
4020 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4021 *
4022 * 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.
4023 */
4024 g_object_interface_install_property (iface,
4025 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4026 /**
4027 * SensorValue:units:
4028 *
4029 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4030 *
4031 * 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.
4032 */
4033 g_object_interface_install_property (iface,
4034 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4035 /**
4036 * SensorValue:poll-interval:
4037 *
4038 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4039 *
4040 * 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.
4041 */
4042 g_object_interface_install_property (iface,
4043 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4044 /**
4045 * SensorValue:heatbeat:
4046 *
4047 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4048 *
4049 * 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.
4050 */
4051 g_object_interface_install_property (iface,
4052 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4053 /**
4054 * SensorValue:settable:
4055 *
4056 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4057 *
4058 * 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.
4059 */
4060 g_object_interface_install_property (iface,
4061 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004062}
4063
4064/**
4065 * sensor_value_get_value: (skip)
4066 * @object: A #SensorValue.
4067 *
4068 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4069 *
4070 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4071 *
4072 * <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>
4073 *
4074 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4075 */
4076GVariant *
4077sensor_value_get_value (SensorValue *object)
4078{
4079 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4080}
4081
4082/**
4083 * sensor_value_dup_value: (skip)
4084 * @object: A #SensorValue.
4085 *
4086 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4087 *
4088 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4089 *
4090 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4091 */
4092GVariant *
4093sensor_value_dup_value (SensorValue *object)
4094{
4095 GVariant *value;
4096 g_object_get (G_OBJECT (object), "value", &value, NULL);
4097 return value;
4098}
4099
4100/**
4101 * sensor_value_set_value: (skip)
4102 * @object: A #SensorValue.
4103 * @value: The value to set.
4104 *
4105 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4106 *
4107 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4108 */
4109void
4110sensor_value_set_value (SensorValue *object, GVariant *value)
4111{
4112 g_object_set (G_OBJECT (object), "value", value, NULL);
4113}
4114
4115/**
4116 * sensor_value_get_units: (skip)
4117 * @object: A #SensorValue.
4118 *
4119 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4120 *
4121 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4122 *
4123 * <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>
4124 *
4125 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4126 */
4127const gchar *
4128sensor_value_get_units (SensorValue *object)
4129{
4130 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4131}
4132
4133/**
4134 * sensor_value_dup_units: (skip)
4135 * @object: A #SensorValue.
4136 *
4137 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4138 *
4139 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4140 *
4141 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4142 */
4143gchar *
4144sensor_value_dup_units (SensorValue *object)
4145{
4146 gchar *value;
4147 g_object_get (G_OBJECT (object), "units", &value, NULL);
4148 return value;
4149}
4150
4151/**
4152 * sensor_value_set_units: (skip)
4153 * @object: A #SensorValue.
4154 * @value: The value to set.
4155 *
4156 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4157 *
4158 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4159 */
4160void
4161sensor_value_set_units (SensorValue *object, const gchar *value)
4162{
4163 g_object_set (G_OBJECT (object), "units", value, NULL);
4164}
4165
4166/**
4167 * sensor_value_get_poll_interval: (skip)
4168 * @object: A #SensorValue.
4169 *
4170 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4171 *
4172 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4173 *
4174 * Returns: The property value.
4175 */
4176gint
4177sensor_value_get_poll_interval (SensorValue *object)
4178{
4179 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4180}
4181
4182/**
4183 * sensor_value_set_poll_interval: (skip)
4184 * @object: A #SensorValue.
4185 * @value: The value to set.
4186 *
4187 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4188 *
4189 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4190 */
4191void
4192sensor_value_set_poll_interval (SensorValue *object, gint value)
4193{
4194 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4195}
4196
4197/**
4198 * sensor_value_get_heatbeat: (skip)
4199 * @object: A #SensorValue.
4200 *
4201 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4202 *
4203 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4204 *
4205 * Returns: The property value.
4206 */
4207gint
4208sensor_value_get_heatbeat (SensorValue *object)
4209{
4210 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4211}
4212
4213/**
4214 * sensor_value_set_heatbeat: (skip)
4215 * @object: A #SensorValue.
4216 * @value: The value to set.
4217 *
4218 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4219 *
4220 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4221 */
4222void
4223sensor_value_set_heatbeat (SensorValue *object, gint value)
4224{
4225 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4226}
4227
4228/**
4229 * sensor_value_get_settable: (skip)
4230 * @object: A #SensorValue.
4231 *
4232 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4233 *
4234 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4235 *
4236 * Returns: The property value.
4237 */
4238gboolean
4239sensor_value_get_settable (SensorValue *object)
4240{
4241 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4242}
4243
4244/**
4245 * sensor_value_set_settable: (skip)
4246 * @object: A #SensorValue.
4247 * @value: The value to set.
4248 *
4249 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4250 *
4251 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4252 */
4253void
4254sensor_value_set_settable (SensorValue *object, gboolean value)
4255{
4256 g_object_set (G_OBJECT (object), "settable", value, NULL);
4257}
4258
4259/**
Norman James362a80f2015-09-14 14:04:39 -05004260 * sensor_value_emit_changed:
4261 * @object: A #SensorValue.
4262 * @arg_value: Argument to pass with the signal.
4263 * @arg_units: Argument to pass with the signal.
4264 *
4265 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4266 */
4267void
4268sensor_value_emit_changed (
4269 SensorValue *object,
4270 GVariant *arg_value,
4271 const gchar *arg_units)
4272{
4273 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4274}
4275
4276/**
Norman James32e74e22015-09-15 21:28:06 -05004277 * sensor_value_emit_error:
4278 * @object: A #SensorValue.
4279 *
4280 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4281 */
4282void
4283sensor_value_emit_error (
4284 SensorValue *object)
4285{
4286 g_signal_emit_by_name (object, "error");
4287}
4288
4289/**
Norman James362a80f2015-09-14 14:04:39 -05004290 * sensor_value_emit_heartbeat:
4291 * @object: A #SensorValue.
4292 * @arg_bus_name: Argument to pass with the signal.
4293 *
4294 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4295 */
4296void
4297sensor_value_emit_heartbeat (
4298 SensorValue *object,
4299 const gchar *arg_bus_name)
4300{
4301 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4302}
4303
4304/**
4305 * sensor_value_call_init:
4306 * @proxy: A #SensorValueProxy.
4307 * @cancellable: (allow-none): A #GCancellable or %NULL.
4308 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4309 * @user_data: User data to pass to @callback.
4310 *
4311 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4312 * 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.
4313 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4314 *
4315 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4316 */
4317void
4318sensor_value_call_init (
4319 SensorValue *proxy,
4320 GCancellable *cancellable,
4321 GAsyncReadyCallback callback,
4322 gpointer user_data)
4323{
4324 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4325 "init",
4326 g_variant_new ("()"),
4327 G_DBUS_CALL_FLAGS_NONE,
4328 -1,
4329 cancellable,
4330 callback,
4331 user_data);
4332}
4333
4334/**
4335 * sensor_value_call_init_finish:
4336 * @proxy: A #SensorValueProxy.
4337 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4338 * @error: Return location for error or %NULL.
4339 *
4340 * Finishes an operation started with sensor_value_call_init().
4341 *
4342 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4343 */
4344gboolean
4345sensor_value_call_init_finish (
4346 SensorValue *proxy,
4347 GAsyncResult *res,
4348 GError **error)
4349{
4350 GVariant *_ret;
4351 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4352 if (_ret == NULL)
4353 goto _out;
4354 g_variant_get (_ret,
4355 "()");
4356 g_variant_unref (_ret);
4357_out:
4358 return _ret != NULL;
4359}
4360
4361/**
4362 * sensor_value_call_init_sync:
4363 * @proxy: A #SensorValueProxy.
4364 * @cancellable: (allow-none): A #GCancellable or %NULL.
4365 * @error: Return location for error or %NULL.
4366 *
4367 * 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.
4368 *
4369 * See sensor_value_call_init() for the asynchronous version of this method.
4370 *
4371 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4372 */
4373gboolean
4374sensor_value_call_init_sync (
4375 SensorValue *proxy,
4376 GCancellable *cancellable,
4377 GError **error)
4378{
4379 GVariant *_ret;
4380 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4381 "init",
4382 g_variant_new ("()"),
4383 G_DBUS_CALL_FLAGS_NONE,
4384 -1,
4385 cancellable,
4386 error);
4387 if (_ret == NULL)
4388 goto _out;
4389 g_variant_get (_ret,
4390 "()");
4391 g_variant_unref (_ret);
4392_out:
4393 return _ret != NULL;
4394}
4395
4396/**
4397 * sensor_value_call_get_value:
4398 * @proxy: A #SensorValueProxy.
4399 * @cancellable: (allow-none): A #GCancellable or %NULL.
4400 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4401 * @user_data: User data to pass to @callback.
4402 *
4403 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4404 * 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.
4405 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4406 *
4407 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4408 */
4409void
4410sensor_value_call_get_value (
4411 SensorValue *proxy,
4412 GCancellable *cancellable,
4413 GAsyncReadyCallback callback,
4414 gpointer user_data)
4415{
4416 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4417 "getValue",
4418 g_variant_new ("()"),
4419 G_DBUS_CALL_FLAGS_NONE,
4420 -1,
4421 cancellable,
4422 callback,
4423 user_data);
4424}
4425
4426/**
4427 * sensor_value_call_get_value_finish:
4428 * @proxy: A #SensorValueProxy.
4429 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4430 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4431 * @error: Return location for error or %NULL.
4432 *
4433 * Finishes an operation started with sensor_value_call_get_value().
4434 *
4435 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4436 */
4437gboolean
4438sensor_value_call_get_value_finish (
4439 SensorValue *proxy,
4440 GVariant **out_value,
4441 GAsyncResult *res,
4442 GError **error)
4443{
4444 GVariant *_ret;
4445 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4446 if (_ret == NULL)
4447 goto _out;
4448 g_variant_get (_ret,
4449 "(@v)",
4450 out_value);
4451 g_variant_unref (_ret);
4452_out:
4453 return _ret != NULL;
4454}
4455
4456/**
4457 * sensor_value_call_get_value_sync:
4458 * @proxy: A #SensorValueProxy.
4459 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4460 * @cancellable: (allow-none): A #GCancellable or %NULL.
4461 * @error: Return location for error or %NULL.
4462 *
4463 * 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.
4464 *
4465 * See sensor_value_call_get_value() for the asynchronous version of this method.
4466 *
4467 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4468 */
4469gboolean
4470sensor_value_call_get_value_sync (
4471 SensorValue *proxy,
4472 GVariant **out_value,
4473 GCancellable *cancellable,
4474 GError **error)
4475{
4476 GVariant *_ret;
4477 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4478 "getValue",
4479 g_variant_new ("()"),
4480 G_DBUS_CALL_FLAGS_NONE,
4481 -1,
4482 cancellable,
4483 error);
4484 if (_ret == NULL)
4485 goto _out;
4486 g_variant_get (_ret,
4487 "(@v)",
4488 out_value);
4489 g_variant_unref (_ret);
4490_out:
4491 return _ret != NULL;
4492}
4493
4494/**
Norman James19e45912015-10-04 20:19:41 -05004495 * sensor_value_call_set_value:
4496 * @proxy: A #SensorValueProxy.
4497 * @arg_value: Argument to pass with the method invocation.
4498 * @cancellable: (allow-none): A #GCancellable or %NULL.
4499 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4500 * @user_data: User data to pass to @callback.
4501 *
4502 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4503 * 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.
4504 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4505 *
4506 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4507 */
4508void
4509sensor_value_call_set_value (
4510 SensorValue *proxy,
4511 GVariant *arg_value,
4512 GCancellable *cancellable,
4513 GAsyncReadyCallback callback,
4514 gpointer user_data)
4515{
4516 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4517 "setValue",
4518 g_variant_new ("(@v)",
4519 arg_value),
4520 G_DBUS_CALL_FLAGS_NONE,
4521 -1,
4522 cancellable,
4523 callback,
4524 user_data);
4525}
4526
4527/**
4528 * sensor_value_call_set_value_finish:
4529 * @proxy: A #SensorValueProxy.
4530 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4531 * @error: Return location for error or %NULL.
4532 *
4533 * Finishes an operation started with sensor_value_call_set_value().
4534 *
4535 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4536 */
4537gboolean
4538sensor_value_call_set_value_finish (
4539 SensorValue *proxy,
4540 GAsyncResult *res,
4541 GError **error)
4542{
4543 GVariant *_ret;
4544 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4545 if (_ret == NULL)
4546 goto _out;
4547 g_variant_get (_ret,
4548 "()");
4549 g_variant_unref (_ret);
4550_out:
4551 return _ret != NULL;
4552}
4553
4554/**
4555 * sensor_value_call_set_value_sync:
4556 * @proxy: A #SensorValueProxy.
4557 * @arg_value: Argument to pass with the method invocation.
4558 * @cancellable: (allow-none): A #GCancellable or %NULL.
4559 * @error: Return location for error or %NULL.
4560 *
4561 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4562 *
4563 * See sensor_value_call_set_value() for the asynchronous version of this method.
4564 *
4565 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4566 */
4567gboolean
4568sensor_value_call_set_value_sync (
4569 SensorValue *proxy,
4570 GVariant *arg_value,
4571 GCancellable *cancellable,
4572 GError **error)
4573{
4574 GVariant *_ret;
4575 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4576 "setValue",
4577 g_variant_new ("(@v)",
4578 arg_value),
4579 G_DBUS_CALL_FLAGS_NONE,
4580 -1,
4581 cancellable,
4582 error);
4583 if (_ret == NULL)
4584 goto _out;
4585 g_variant_get (_ret,
4586 "()");
4587 g_variant_unref (_ret);
4588_out:
4589 return _ret != NULL;
4590}
4591
4592/**
Norman James362a80f2015-09-14 14:04:39 -05004593 * sensor_value_complete_init:
4594 * @object: A #SensorValue.
4595 * @invocation: (transfer full): A #GDBusMethodInvocation.
4596 *
4597 * 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.
4598 *
4599 * This method will free @invocation, you cannot use it afterwards.
4600 */
4601void
4602sensor_value_complete_init (
4603 SensorValue *object,
4604 GDBusMethodInvocation *invocation)
4605{
4606 g_dbus_method_invocation_return_value (invocation,
4607 g_variant_new ("()"));
4608}
4609
4610/**
4611 * sensor_value_complete_get_value:
4612 * @object: A #SensorValue.
4613 * @invocation: (transfer full): A #GDBusMethodInvocation.
4614 * @value: Parameter to return.
4615 *
4616 * 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.
4617 *
4618 * This method will free @invocation, you cannot use it afterwards.
4619 */
4620void
4621sensor_value_complete_get_value (
4622 SensorValue *object,
4623 GDBusMethodInvocation *invocation,
4624 GVariant *value)
4625{
4626 g_dbus_method_invocation_return_value (invocation,
4627 g_variant_new ("(@v)",
4628 value));
4629}
4630
Norman James19e45912015-10-04 20:19:41 -05004631/**
4632 * sensor_value_complete_set_value:
4633 * @object: A #SensorValue.
4634 * @invocation: (transfer full): A #GDBusMethodInvocation.
4635 *
4636 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
4637 *
4638 * This method will free @invocation, you cannot use it afterwards.
4639 */
4640void
4641sensor_value_complete_set_value (
4642 SensorValue *object,
4643 GDBusMethodInvocation *invocation)
4644{
4645 g_dbus_method_invocation_return_value (invocation,
4646 g_variant_new ("()"));
4647}
4648
Norman James362a80f2015-09-14 14:04:39 -05004649/* ------------------------------------------------------------------------ */
4650
4651/**
4652 * SensorValueProxy:
4653 *
4654 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4655 */
4656
4657/**
4658 * SensorValueProxyClass:
4659 * @parent_class: The parent class.
4660 *
4661 * Class structure for #SensorValueProxy.
4662 */
4663
4664struct _SensorValueProxyPrivate
4665{
4666 GData *qdata;
4667};
4668
4669static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4670
4671#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4672G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4673 G_ADD_PRIVATE (SensorValueProxy)
4674 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4675
4676#else
4677G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4678 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4679
4680#endif
4681static void
4682sensor_value_proxy_finalize (GObject *object)
4683{
4684 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4685 g_datalist_clear (&proxy->priv->qdata);
4686 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4687}
4688
4689static void
4690sensor_value_proxy_get_property (GObject *object,
4691 guint prop_id,
4692 GValue *value,
4693 GParamSpec *pspec G_GNUC_UNUSED)
4694{
4695 const _ExtendedGDBusPropertyInfo *info;
4696 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004697 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004698 info = _sensor_value_property_info_pointers[prop_id - 1];
4699 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4700 if (info->use_gvariant)
4701 {
4702 g_value_set_variant (value, variant);
4703 }
4704 else
4705 {
4706 if (variant != NULL)
4707 g_dbus_gvariant_to_gvalue (variant, value);
4708 }
4709 if (variant != NULL)
4710 g_variant_unref (variant);
4711}
4712
4713static void
4714sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4715 GAsyncResult *res,
4716 gpointer user_data)
4717{
4718 const _ExtendedGDBusPropertyInfo *info = user_data;
4719 GError *error;
4720 GVariant *_ret;
4721 error = NULL;
4722 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4723 if (!_ret)
4724 {
4725 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4726 info->parent_struct.name,
4727 error->message, g_quark_to_string (error->domain), error->code);
4728 g_error_free (error);
4729 }
4730 else
4731 {
4732 g_variant_unref (_ret);
4733 }
4734}
4735
4736static void
4737sensor_value_proxy_set_property (GObject *object,
4738 guint prop_id,
4739 const GValue *value,
4740 GParamSpec *pspec G_GNUC_UNUSED)
4741{
4742 const _ExtendedGDBusPropertyInfo *info;
4743 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004744 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004745 info = _sensor_value_property_info_pointers[prop_id - 1];
4746 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4747 g_dbus_proxy_call (G_DBUS_PROXY (object),
4748 "org.freedesktop.DBus.Properties.Set",
4749 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4750 G_DBUS_CALL_FLAGS_NONE,
4751 -1,
4752 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4753 g_variant_unref (variant);
4754}
4755
4756static void
4757sensor_value_proxy_g_signal (GDBusProxy *proxy,
4758 const gchar *sender_name G_GNUC_UNUSED,
4759 const gchar *signal_name,
4760 GVariant *parameters)
4761{
4762 _ExtendedGDBusSignalInfo *info;
4763 GVariantIter iter;
4764 GVariant *child;
4765 GValue *paramv;
4766 guint num_params;
4767 guint n;
4768 guint signal_id;
4769 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4770 if (info == NULL)
4771 return;
4772 num_params = g_variant_n_children (parameters);
4773 paramv = g_new0 (GValue, num_params + 1);
4774 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4775 g_value_set_object (&paramv[0], proxy);
4776 g_variant_iter_init (&iter, parameters);
4777 n = 1;
4778 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4779 {
4780 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4781 if (arg_info->use_gvariant)
4782 {
4783 g_value_init (&paramv[n], G_TYPE_VARIANT);
4784 g_value_set_variant (&paramv[n], child);
4785 n++;
4786 }
4787 else
4788 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4789 g_variant_unref (child);
4790 }
4791 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4792 g_signal_emitv (paramv, signal_id, 0, NULL);
4793 for (n = 0; n < num_params + 1; n++)
4794 g_value_unset (&paramv[n]);
4795 g_free (paramv);
4796}
4797
4798static void
4799sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4800 GVariant *changed_properties,
4801 const gchar *const *invalidated_properties)
4802{
4803 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4804 guint n;
4805 const gchar *key;
4806 GVariantIter *iter;
4807 _ExtendedGDBusPropertyInfo *info;
4808 g_variant_get (changed_properties, "a{sv}", &iter);
4809 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4810 {
4811 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4812 g_datalist_remove_data (&proxy->priv->qdata, key);
4813 if (info != NULL)
4814 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4815 }
4816 g_variant_iter_free (iter);
4817 for (n = 0; invalidated_properties[n] != NULL; n++)
4818 {
4819 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4820 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4821 if (info != NULL)
4822 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4823 }
4824}
4825
4826static GVariant *
4827sensor_value_proxy_get_value (SensorValue *object)
4828{
4829 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4830 GVariant *variant;
4831 GVariant *value = NULL;
4832 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4833 value = variant;
4834 if (variant != NULL)
4835 g_variant_unref (variant);
4836 return value;
4837}
4838
4839static const gchar *
4840sensor_value_proxy_get_units (SensorValue *object)
4841{
4842 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4843 GVariant *variant;
4844 const gchar *value = NULL;
4845 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4846 if (variant != NULL)
4847 {
4848 value = g_variant_get_string (variant, NULL);
4849 g_variant_unref (variant);
4850 }
4851 return value;
4852}
4853
4854static gint
4855sensor_value_proxy_get_poll_interval (SensorValue *object)
4856{
4857 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4858 GVariant *variant;
4859 gint value = 0;
4860 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4861 if (variant != NULL)
4862 {
4863 value = g_variant_get_int32 (variant);
4864 g_variant_unref (variant);
4865 }
4866 return value;
4867}
4868
4869static gint
4870sensor_value_proxy_get_heatbeat (SensorValue *object)
4871{
4872 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4873 GVariant *variant;
4874 gint value = 0;
4875 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4876 if (variant != NULL)
4877 {
4878 value = g_variant_get_int32 (variant);
4879 g_variant_unref (variant);
4880 }
4881 return value;
4882}
4883
4884static gboolean
4885sensor_value_proxy_get_settable (SensorValue *object)
4886{
4887 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4888 GVariant *variant;
4889 gboolean value = 0;
4890 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4891 if (variant != NULL)
4892 {
4893 value = g_variant_get_boolean (variant);
4894 g_variant_unref (variant);
4895 }
4896 return value;
4897}
4898
Norman James362a80f2015-09-14 14:04:39 -05004899static void
4900sensor_value_proxy_init (SensorValueProxy *proxy)
4901{
4902#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4903 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4904#else
4905 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4906#endif
4907
4908 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4909}
4910
4911static void
4912sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4913{
4914 GObjectClass *gobject_class;
4915 GDBusProxyClass *proxy_class;
4916
4917 gobject_class = G_OBJECT_CLASS (klass);
4918 gobject_class->finalize = sensor_value_proxy_finalize;
4919 gobject_class->get_property = sensor_value_proxy_get_property;
4920 gobject_class->set_property = sensor_value_proxy_set_property;
4921
4922 proxy_class = G_DBUS_PROXY_CLASS (klass);
4923 proxy_class->g_signal = sensor_value_proxy_g_signal;
4924 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4925
4926 sensor_value_override_properties (gobject_class, 1);
4927
4928#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4929 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4930#endif
4931}
4932
4933static void
4934sensor_value_proxy_iface_init (SensorValueIface *iface)
4935{
4936 iface->get_value = sensor_value_proxy_get_value;
4937 iface->get_units = sensor_value_proxy_get_units;
4938 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4939 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4940 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004941}
4942
4943/**
4944 * sensor_value_proxy_new:
4945 * @connection: A #GDBusConnection.
4946 * @flags: Flags from the #GDBusProxyFlags enumeration.
4947 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4948 * @object_path: An object path.
4949 * @cancellable: (allow-none): A #GCancellable or %NULL.
4950 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4951 * @user_data: User data to pass to @callback.
4952 *
4953 * 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.
4954 *
4955 * 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.
4956 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4957 *
4958 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4959 */
4960void
4961sensor_value_proxy_new (
4962 GDBusConnection *connection,
4963 GDBusProxyFlags flags,
4964 const gchar *name,
4965 const gchar *object_path,
4966 GCancellable *cancellable,
4967 GAsyncReadyCallback callback,
4968 gpointer user_data)
4969{
4970 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);
4971}
4972
4973/**
4974 * sensor_value_proxy_new_finish:
4975 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4976 * @error: Return location for error or %NULL
4977 *
4978 * Finishes an operation started with sensor_value_proxy_new().
4979 *
4980 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4981 */
4982SensorValue *
4983sensor_value_proxy_new_finish (
4984 GAsyncResult *res,
4985 GError **error)
4986{
4987 GObject *ret;
4988 GObject *source_object;
4989 source_object = g_async_result_get_source_object (res);
4990 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4991 g_object_unref (source_object);
4992 if (ret != NULL)
4993 return SENSOR_VALUE (ret);
4994 else
4995 return NULL;
4996}
4997
4998/**
4999 * sensor_value_proxy_new_sync:
5000 * @connection: A #GDBusConnection.
5001 * @flags: Flags from the #GDBusProxyFlags enumeration.
5002 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5003 * @object_path: An object path.
5004 * @cancellable: (allow-none): A #GCancellable or %NULL.
5005 * @error: Return location for error or %NULL
5006 *
5007 * 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.
5008 *
5009 * The calling thread is blocked until a reply is received.
5010 *
5011 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5012 *
5013 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5014 */
5015SensorValue *
5016sensor_value_proxy_new_sync (
5017 GDBusConnection *connection,
5018 GDBusProxyFlags flags,
5019 const gchar *name,
5020 const gchar *object_path,
5021 GCancellable *cancellable,
5022 GError **error)
5023{
5024 GInitable *ret;
5025 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);
5026 if (ret != NULL)
5027 return SENSOR_VALUE (ret);
5028 else
5029 return NULL;
5030}
5031
5032
5033/**
5034 * sensor_value_proxy_new_for_bus:
5035 * @bus_type: A #GBusType.
5036 * @flags: Flags from the #GDBusProxyFlags enumeration.
5037 * @name: A bus name (well-known or unique).
5038 * @object_path: An object path.
5039 * @cancellable: (allow-none): A #GCancellable or %NULL.
5040 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5041 * @user_data: User data to pass to @callback.
5042 *
5043 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5044 *
5045 * 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.
5046 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5047 *
5048 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5049 */
5050void
5051sensor_value_proxy_new_for_bus (
5052 GBusType bus_type,
5053 GDBusProxyFlags flags,
5054 const gchar *name,
5055 const gchar *object_path,
5056 GCancellable *cancellable,
5057 GAsyncReadyCallback callback,
5058 gpointer user_data)
5059{
5060 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);
5061}
5062
5063/**
5064 * sensor_value_proxy_new_for_bus_finish:
5065 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5066 * @error: Return location for error or %NULL
5067 *
5068 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5069 *
5070 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5071 */
5072SensorValue *
5073sensor_value_proxy_new_for_bus_finish (
5074 GAsyncResult *res,
5075 GError **error)
5076{
5077 GObject *ret;
5078 GObject *source_object;
5079 source_object = g_async_result_get_source_object (res);
5080 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5081 g_object_unref (source_object);
5082 if (ret != NULL)
5083 return SENSOR_VALUE (ret);
5084 else
5085 return NULL;
5086}
5087
5088/**
5089 * sensor_value_proxy_new_for_bus_sync:
5090 * @bus_type: A #GBusType.
5091 * @flags: Flags from the #GDBusProxyFlags enumeration.
5092 * @name: A bus name (well-known or unique).
5093 * @object_path: An object path.
5094 * @cancellable: (allow-none): A #GCancellable or %NULL.
5095 * @error: Return location for error or %NULL
5096 *
5097 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5098 *
5099 * The calling thread is blocked until a reply is received.
5100 *
5101 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5102 *
5103 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5104 */
5105SensorValue *
5106sensor_value_proxy_new_for_bus_sync (
5107 GBusType bus_type,
5108 GDBusProxyFlags flags,
5109 const gchar *name,
5110 const gchar *object_path,
5111 GCancellable *cancellable,
5112 GError **error)
5113{
5114 GInitable *ret;
5115 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);
5116 if (ret != NULL)
5117 return SENSOR_VALUE (ret);
5118 else
5119 return NULL;
5120}
5121
5122
5123/* ------------------------------------------------------------------------ */
5124
5125/**
5126 * SensorValueSkeleton:
5127 *
5128 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5129 */
5130
5131/**
5132 * SensorValueSkeletonClass:
5133 * @parent_class: The parent class.
5134 *
5135 * Class structure for #SensorValueSkeleton.
5136 */
5137
5138struct _SensorValueSkeletonPrivate
5139{
5140 GValue *properties;
5141 GList *changed_properties;
5142 GSource *changed_properties_idle_source;
5143 GMainContext *context;
5144 GMutex lock;
5145};
5146
5147static void
5148_sensor_value_skeleton_handle_method_call (
5149 GDBusConnection *connection G_GNUC_UNUSED,
5150 const gchar *sender G_GNUC_UNUSED,
5151 const gchar *object_path G_GNUC_UNUSED,
5152 const gchar *interface_name,
5153 const gchar *method_name,
5154 GVariant *parameters,
5155 GDBusMethodInvocation *invocation,
5156 gpointer user_data)
5157{
5158 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5159 _ExtendedGDBusMethodInfo *info;
5160 GVariantIter iter;
5161 GVariant *child;
5162 GValue *paramv;
5163 guint num_params;
5164 guint num_extra;
5165 guint n;
5166 guint signal_id;
5167 GValue return_value = G_VALUE_INIT;
5168 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5169 g_assert (info != NULL);
5170 num_params = g_variant_n_children (parameters);
5171 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5172 n = 0;
5173 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5174 g_value_set_object (&paramv[n++], skeleton);
5175 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5176 g_value_set_object (&paramv[n++], invocation);
5177 if (info->pass_fdlist)
5178 {
5179#ifdef G_OS_UNIX
5180 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5181 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5182#else
5183 g_assert_not_reached ();
5184#endif
5185 }
5186 g_variant_iter_init (&iter, parameters);
5187 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5188 {
5189 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5190 if (arg_info->use_gvariant)
5191 {
5192 g_value_init (&paramv[n], G_TYPE_VARIANT);
5193 g_value_set_variant (&paramv[n], child);
5194 n++;
5195 }
5196 else
5197 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5198 g_variant_unref (child);
5199 }
5200 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5201 g_value_init (&return_value, G_TYPE_BOOLEAN);
5202 g_signal_emitv (paramv, signal_id, 0, &return_value);
5203 if (!g_value_get_boolean (&return_value))
5204 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);
5205 g_value_unset (&return_value);
5206 for (n = 0; n < num_params + num_extra; n++)
5207 g_value_unset (&paramv[n]);
5208 g_free (paramv);
5209}
5210
5211static GVariant *
5212_sensor_value_skeleton_handle_get_property (
5213 GDBusConnection *connection G_GNUC_UNUSED,
5214 const gchar *sender G_GNUC_UNUSED,
5215 const gchar *object_path G_GNUC_UNUSED,
5216 const gchar *interface_name G_GNUC_UNUSED,
5217 const gchar *property_name,
5218 GError **error,
5219 gpointer user_data)
5220{
5221 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5222 GValue value = G_VALUE_INIT;
5223 GParamSpec *pspec;
5224 _ExtendedGDBusPropertyInfo *info;
5225 GVariant *ret;
5226 ret = NULL;
5227 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5228 g_assert (info != NULL);
5229 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5230 if (pspec == NULL)
5231 {
5232 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5233 }
5234 else
5235 {
5236 g_value_init (&value, pspec->value_type);
5237 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5238 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5239 g_value_unset (&value);
5240 }
5241 return ret;
5242}
5243
5244static gboolean
5245_sensor_value_skeleton_handle_set_property (
5246 GDBusConnection *connection G_GNUC_UNUSED,
5247 const gchar *sender G_GNUC_UNUSED,
5248 const gchar *object_path G_GNUC_UNUSED,
5249 const gchar *interface_name G_GNUC_UNUSED,
5250 const gchar *property_name,
5251 GVariant *variant,
5252 GError **error,
5253 gpointer user_data)
5254{
5255 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5256 GValue value = G_VALUE_INIT;
5257 GParamSpec *pspec;
5258 _ExtendedGDBusPropertyInfo *info;
5259 gboolean ret;
5260 ret = FALSE;
5261 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5262 g_assert (info != NULL);
5263 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5264 if (pspec == NULL)
5265 {
5266 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5267 }
5268 else
5269 {
5270 if (info->use_gvariant)
5271 g_value_set_variant (&value, variant);
5272 else
5273 g_dbus_gvariant_to_gvalue (variant, &value);
5274 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5275 g_value_unset (&value);
5276 ret = TRUE;
5277 }
5278 return ret;
5279}
5280
5281static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5282{
5283 _sensor_value_skeleton_handle_method_call,
5284 _sensor_value_skeleton_handle_get_property,
5285 _sensor_value_skeleton_handle_set_property,
5286 {NULL}
5287};
5288
5289static GDBusInterfaceInfo *
5290sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5291{
5292 return sensor_value_interface_info ();
5293}
5294
5295static GDBusInterfaceVTable *
5296sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5297{
5298 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5299}
5300
5301static GVariant *
5302sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5303{
5304 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5305
5306 GVariantBuilder builder;
5307 guint n;
5308 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5309 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5310 goto out;
5311 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5312 {
5313 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5314 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5315 {
5316 GVariant *value;
5317 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);
5318 if (value != NULL)
5319 {
5320 g_variant_take_ref (value);
5321 g_variant_builder_add (&builder, "{sv}", info->name, value);
5322 g_variant_unref (value);
5323 }
5324 }
5325 }
5326out:
5327 return g_variant_builder_end (&builder);
5328}
5329
5330static gboolean _sensor_value_emit_changed (gpointer user_data);
5331
5332static void
5333sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5334{
5335 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5336 gboolean emit_changed = FALSE;
5337
5338 g_mutex_lock (&skeleton->priv->lock);
5339 if (skeleton->priv->changed_properties_idle_source != NULL)
5340 {
5341 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5342 skeleton->priv->changed_properties_idle_source = NULL;
5343 emit_changed = TRUE;
5344 }
5345 g_mutex_unlock (&skeleton->priv->lock);
5346
5347 if (emit_changed)
5348 _sensor_value_emit_changed (skeleton);
5349}
5350
5351static void
5352_sensor_value_on_signal_changed (
5353 SensorValue *object,
5354 GVariant *arg_value,
5355 const gchar *arg_units)
5356{
5357 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5358
5359 GList *connections, *l;
5360 GVariant *signal_variant;
5361 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5362
5363 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5364 arg_value,
5365 arg_units));
5366 for (l = connections; l != NULL; l = l->next)
5367 {
5368 GDBusConnection *connection = l->data;
5369 g_dbus_connection_emit_signal (connection,
5370 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5371 signal_variant, NULL);
5372 }
5373 g_variant_unref (signal_variant);
5374 g_list_free_full (connections, g_object_unref);
5375}
5376
5377static void
Norman James32e74e22015-09-15 21:28:06 -05005378_sensor_value_on_signal_error (
5379 SensorValue *object)
5380{
5381 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5382
5383 GList *connections, *l;
5384 GVariant *signal_variant;
5385 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5386
5387 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5388 for (l = connections; l != NULL; l = l->next)
5389 {
5390 GDBusConnection *connection = l->data;
5391 g_dbus_connection_emit_signal (connection,
5392 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5393 signal_variant, NULL);
5394 }
5395 g_variant_unref (signal_variant);
5396 g_list_free_full (connections, g_object_unref);
5397}
5398
5399static void
Norman James362a80f2015-09-14 14:04:39 -05005400_sensor_value_on_signal_heartbeat (
5401 SensorValue *object,
5402 const gchar *arg_bus_name)
5403{
5404 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5405
5406 GList *connections, *l;
5407 GVariant *signal_variant;
5408 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5409
5410 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5411 arg_bus_name));
5412 for (l = connections; l != NULL; l = l->next)
5413 {
5414 GDBusConnection *connection = l->data;
5415 g_dbus_connection_emit_signal (connection,
5416 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5417 signal_variant, NULL);
5418 }
5419 g_variant_unref (signal_variant);
5420 g_list_free_full (connections, g_object_unref);
5421}
5422
5423static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5424#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5425G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5426 G_ADD_PRIVATE (SensorValueSkeleton)
5427 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5428
5429#else
5430G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5431 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5432
5433#endif
5434static void
5435sensor_value_skeleton_finalize (GObject *object)
5436{
5437 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5438 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005439 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005440 g_value_unset (&skeleton->priv->properties[n]);
5441 g_free (skeleton->priv->properties);
5442 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5443 if (skeleton->priv->changed_properties_idle_source != NULL)
5444 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5445 g_main_context_unref (skeleton->priv->context);
5446 g_mutex_clear (&skeleton->priv->lock);
5447 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5448}
5449
5450static void
5451sensor_value_skeleton_get_property (GObject *object,
5452 guint prop_id,
5453 GValue *value,
5454 GParamSpec *pspec G_GNUC_UNUSED)
5455{
5456 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005457 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005458 g_mutex_lock (&skeleton->priv->lock);
5459 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5460 g_mutex_unlock (&skeleton->priv->lock);
5461}
5462
5463static gboolean
5464_sensor_value_emit_changed (gpointer user_data)
5465{
5466 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5467 GList *l;
5468 GVariantBuilder builder;
5469 GVariantBuilder invalidated_builder;
5470 guint num_changes;
5471
5472 g_mutex_lock (&skeleton->priv->lock);
5473 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5474 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5475 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5476 {
5477 ChangedProperty *cp = l->data;
5478 GVariant *variant;
5479 const GValue *cur_value;
5480
5481 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5482 if (!_g_value_equal (cur_value, &cp->orig_value))
5483 {
5484 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5485 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5486 g_variant_unref (variant);
5487 num_changes++;
5488 }
5489 }
5490 if (num_changes > 0)
5491 {
5492 GList *connections, *ll;
5493 GVariant *signal_variant;
5494 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5495 &builder, &invalidated_builder));
5496 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5497 for (ll = connections; ll != NULL; ll = ll->next)
5498 {
5499 GDBusConnection *connection = ll->data;
5500
5501 g_dbus_connection_emit_signal (connection,
5502 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5503 "org.freedesktop.DBus.Properties",
5504 "PropertiesChanged",
5505 signal_variant,
5506 NULL);
5507 }
5508 g_variant_unref (signal_variant);
5509 g_list_free_full (connections, g_object_unref);
5510 }
5511 else
5512 {
5513 g_variant_builder_clear (&builder);
5514 g_variant_builder_clear (&invalidated_builder);
5515 }
5516 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5517 skeleton->priv->changed_properties = NULL;
5518 skeleton->priv->changed_properties_idle_source = NULL;
5519 g_mutex_unlock (&skeleton->priv->lock);
5520 return FALSE;
5521}
5522
5523static void
5524_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5525{
5526 ChangedProperty *cp;
5527 GList *l;
5528 cp = NULL;
5529 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5530 {
5531 ChangedProperty *i_cp = l->data;
5532 if (i_cp->info == info)
5533 {
5534 cp = i_cp;
5535 break;
5536 }
5537 }
5538 if (cp == NULL)
5539 {
5540 cp = g_new0 (ChangedProperty, 1);
5541 cp->prop_id = prop_id;
5542 cp->info = info;
5543 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5544 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5545 g_value_copy (orig_value, &cp->orig_value);
5546 }
5547}
5548
5549static void
5550sensor_value_skeleton_notify (GObject *object,
5551 GParamSpec *pspec G_GNUC_UNUSED)
5552{
5553 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5554 g_mutex_lock (&skeleton->priv->lock);
5555 if (skeleton->priv->changed_properties != NULL &&
5556 skeleton->priv->changed_properties_idle_source == NULL)
5557 {
5558 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5559 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5560 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5561 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5562 g_source_unref (skeleton->priv->changed_properties_idle_source);
5563 }
5564 g_mutex_unlock (&skeleton->priv->lock);
5565}
5566
5567static void
5568sensor_value_skeleton_set_property (GObject *object,
5569 guint prop_id,
5570 const GValue *value,
5571 GParamSpec *pspec)
5572{
5573 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005574 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005575 g_mutex_lock (&skeleton->priv->lock);
5576 g_object_freeze_notify (object);
5577 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5578 {
5579 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5580 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5581 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5582 g_object_notify_by_pspec (object, pspec);
5583 }
5584 g_mutex_unlock (&skeleton->priv->lock);
5585 g_object_thaw_notify (object);
5586}
5587
5588static void
5589sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5590{
5591#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5592 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5593#else
5594 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5595#endif
5596
5597 g_mutex_init (&skeleton->priv->lock);
5598 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05005599 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05005600 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5601 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5602 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5603 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5604 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05005605}
5606
5607static GVariant *
5608sensor_value_skeleton_get_value (SensorValue *object)
5609{
5610 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5611 GVariant *value;
5612 g_mutex_lock (&skeleton->priv->lock);
5613 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5614 g_mutex_unlock (&skeleton->priv->lock);
5615 return value;
5616}
5617
5618static const gchar *
5619sensor_value_skeleton_get_units (SensorValue *object)
5620{
5621 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5622 const gchar *value;
5623 g_mutex_lock (&skeleton->priv->lock);
5624 value = g_value_get_string (&(skeleton->priv->properties[1]));
5625 g_mutex_unlock (&skeleton->priv->lock);
5626 return value;
5627}
5628
5629static gint
5630sensor_value_skeleton_get_poll_interval (SensorValue *object)
5631{
5632 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5633 gint value;
5634 g_mutex_lock (&skeleton->priv->lock);
5635 value = g_value_get_int (&(skeleton->priv->properties[2]));
5636 g_mutex_unlock (&skeleton->priv->lock);
5637 return value;
5638}
5639
5640static gint
5641sensor_value_skeleton_get_heatbeat (SensorValue *object)
5642{
5643 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5644 gint value;
5645 g_mutex_lock (&skeleton->priv->lock);
5646 value = g_value_get_int (&(skeleton->priv->properties[3]));
5647 g_mutex_unlock (&skeleton->priv->lock);
5648 return value;
5649}
5650
5651static gboolean
5652sensor_value_skeleton_get_settable (SensorValue *object)
5653{
5654 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5655 gboolean value;
5656 g_mutex_lock (&skeleton->priv->lock);
5657 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5658 g_mutex_unlock (&skeleton->priv->lock);
5659 return value;
5660}
5661
Norman James362a80f2015-09-14 14:04:39 -05005662static void
5663sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5664{
5665 GObjectClass *gobject_class;
5666 GDBusInterfaceSkeletonClass *skeleton_class;
5667
5668 gobject_class = G_OBJECT_CLASS (klass);
5669 gobject_class->finalize = sensor_value_skeleton_finalize;
5670 gobject_class->get_property = sensor_value_skeleton_get_property;
5671 gobject_class->set_property = sensor_value_skeleton_set_property;
5672 gobject_class->notify = sensor_value_skeleton_notify;
5673
5674
5675 sensor_value_override_properties (gobject_class, 1);
5676
5677 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5678 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5679 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5680 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5681 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5682
5683#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5684 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5685#endif
5686}
5687
5688static void
5689sensor_value_skeleton_iface_init (SensorValueIface *iface)
5690{
5691 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005692 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005693 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5694 iface->get_value = sensor_value_skeleton_get_value;
5695 iface->get_units = sensor_value_skeleton_get_units;
5696 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5697 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5698 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005699}
5700
5701/**
5702 * sensor_value_skeleton_new:
5703 *
5704 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5705 *
5706 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5707 */
5708SensorValue *
5709sensor_value_skeleton_new (void)
5710{
5711 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5712}
5713
5714/* ------------------------------------------------------------------------
5715 * Code for interface org.openbmc.SensorThreshold
5716 * ------------------------------------------------------------------------
5717 */
5718
5719/**
5720 * SECTION:SensorThreshold
5721 * @title: SensorThreshold
5722 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5723 *
5724 * 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.
5725 */
5726
5727/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5728
5729static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5730{
5731 {
5732 -1,
5733 (gchar *) "state",
5734 (gchar *) "y",
5735 NULL
5736 },
5737 FALSE
5738};
5739
5740static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5741{
5742 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5743 NULL
5744};
5745
5746static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5747{
5748 {
5749 -1,
5750 (gchar *) "getState",
5751 NULL,
5752 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5753 NULL
5754 },
5755 "handle-get-state",
5756 FALSE
5757};
5758
5759static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5760{
5761 &_sensor_threshold_method_info_get_state,
5762 NULL
5763};
5764
5765static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5766{
5767 {
5768 -1,
5769 (gchar *) "Warning",
5770 NULL,
5771 NULL
5772 },
5773 "warning"
5774};
5775
5776static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5777{
5778 {
5779 -1,
5780 (gchar *) "Critical",
5781 NULL,
5782 NULL
5783 },
5784 "critical"
5785};
5786
5787static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5788{
5789 {
5790 -1,
5791 (gchar *) "Normal",
5792 NULL,
5793 NULL
5794 },
5795 "normal"
5796};
5797
5798static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5799{
5800 &_sensor_threshold_signal_info_warning,
5801 &_sensor_threshold_signal_info_critical,
5802 &_sensor_threshold_signal_info_normal,
5803 NULL
5804};
5805
5806static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5807{
5808 {
5809 -1,
5810 (gchar *) "lower_critical",
5811 (gchar *) "v",
5812 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5813 NULL
5814 },
5815 "lower-critical",
5816 FALSE
5817};
5818
5819static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5820{
5821 {
5822 -1,
5823 (gchar *) "lower_warning",
5824 (gchar *) "v",
5825 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5826 NULL
5827 },
5828 "lower-warning",
5829 FALSE
5830};
5831
5832static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
5833{
5834 {
5835 -1,
5836 (gchar *) "upper_warning",
5837 (gchar *) "v",
5838 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5839 NULL
5840 },
5841 "upper-warning",
5842 FALSE
5843};
5844
5845static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
5846{
5847 {
5848 -1,
5849 (gchar *) "upper_critical",
5850 (gchar *) "v",
5851 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5852 NULL
5853 },
5854 "upper-critical",
5855 FALSE
5856};
5857
5858static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
5859{
5860 {
5861 -1,
5862 (gchar *) "state",
5863 (gchar *) "y",
5864 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5865 NULL
5866 },
5867 "state",
5868 FALSE
5869};
5870
5871static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
5872{
5873 &_sensor_threshold_property_info_lower_critical,
5874 &_sensor_threshold_property_info_lower_warning,
5875 &_sensor_threshold_property_info_upper_warning,
5876 &_sensor_threshold_property_info_upper_critical,
5877 &_sensor_threshold_property_info_state,
5878 NULL
5879};
5880
5881static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
5882{
5883 {
5884 -1,
5885 (gchar *) "org.openbmc.SensorThreshold",
5886 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
5887 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
5888 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
5889 NULL
5890 },
5891 "sensor-threshold",
5892};
5893
5894
5895/**
5896 * sensor_threshold_interface_info:
5897 *
5898 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
5899 *
5900 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5901 */
5902GDBusInterfaceInfo *
5903sensor_threshold_interface_info (void)
5904{
5905 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
5906}
5907
5908/**
5909 * sensor_threshold_override_properties:
5910 * @klass: The class structure for a #GObject<!-- -->-derived class.
5911 * @property_id_begin: The property id to assign to the first overridden property.
5912 *
5913 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
5914 * The properties are overridden in the order they are defined.
5915 *
5916 * Returns: The last property id.
5917 */
5918guint
5919sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
5920{
5921 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
5922 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
5923 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
5924 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
5925 g_object_class_override_property (klass, property_id_begin++, "state");
5926 return property_id_begin - 1;
5927}
5928
5929
5930
5931/**
5932 * SensorThreshold:
5933 *
5934 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5935 */
5936
5937/**
5938 * SensorThresholdIface:
5939 * @parent_iface: The parent interface.
5940 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
5941 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
5942 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
5943 * @get_state: Getter for the #SensorThreshold:state property.
5944 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
5945 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
5946 * @critical: Handler for the #SensorThreshold::critical signal.
5947 * @normal: Handler for the #SensorThreshold::normal signal.
5948 * @warning: Handler for the #SensorThreshold::warning signal.
5949 *
5950 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5951 */
5952
5953typedef SensorThresholdIface SensorThresholdInterface;
5954G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
5955
5956static void
5957sensor_threshold_default_init (SensorThresholdIface *iface)
5958{
5959 /* GObject signals for incoming D-Bus method calls: */
5960 /**
5961 * SensorThreshold::handle-get-state:
5962 * @object: A #SensorThreshold.
5963 * @invocation: A #GDBusMethodInvocation.
5964 *
5965 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
5966 *
5967 * 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.
5968 *
5969 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5970 */
5971 g_signal_new ("handle-get-state",
5972 G_TYPE_FROM_INTERFACE (iface),
5973 G_SIGNAL_RUN_LAST,
5974 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
5975 g_signal_accumulator_true_handled,
5976 NULL,
5977 g_cclosure_marshal_generic,
5978 G_TYPE_BOOLEAN,
5979 1,
5980 G_TYPE_DBUS_METHOD_INVOCATION);
5981
5982 /* GObject signals for received D-Bus signals: */
5983 /**
5984 * SensorThreshold::warning:
5985 * @object: A #SensorThreshold.
5986 *
5987 * 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.
5988 *
5989 * 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.
5990 */
5991 g_signal_new ("warning",
5992 G_TYPE_FROM_INTERFACE (iface),
5993 G_SIGNAL_RUN_LAST,
5994 G_STRUCT_OFFSET (SensorThresholdIface, warning),
5995 NULL,
5996 NULL,
5997 g_cclosure_marshal_generic,
5998 G_TYPE_NONE,
5999 0);
6000
6001 /**
6002 * SensorThreshold::critical:
6003 * @object: A #SensorThreshold.
6004 *
6005 * 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.
6006 *
6007 * 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.
6008 */
6009 g_signal_new ("critical",
6010 G_TYPE_FROM_INTERFACE (iface),
6011 G_SIGNAL_RUN_LAST,
6012 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6013 NULL,
6014 NULL,
6015 g_cclosure_marshal_generic,
6016 G_TYPE_NONE,
6017 0);
6018
6019 /**
6020 * SensorThreshold::normal:
6021 * @object: A #SensorThreshold.
6022 *
6023 * 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.
6024 *
6025 * 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.
6026 */
6027 g_signal_new ("normal",
6028 G_TYPE_FROM_INTERFACE (iface),
6029 G_SIGNAL_RUN_LAST,
6030 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6031 NULL,
6032 NULL,
6033 g_cclosure_marshal_generic,
6034 G_TYPE_NONE,
6035 0);
6036
6037 /* GObject properties for D-Bus properties: */
6038 /**
6039 * SensorThreshold:lower-critical:
6040 *
6041 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6042 *
6043 * 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.
6044 */
6045 g_object_interface_install_property (iface,
6046 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6047 /**
6048 * SensorThreshold:lower-warning:
6049 *
6050 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6051 *
6052 * 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.
6053 */
6054 g_object_interface_install_property (iface,
6055 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6056 /**
6057 * SensorThreshold:upper-warning:
6058 *
6059 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6060 *
6061 * 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.
6062 */
6063 g_object_interface_install_property (iface,
6064 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6065 /**
6066 * SensorThreshold:upper-critical:
6067 *
6068 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6069 *
6070 * 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.
6071 */
6072 g_object_interface_install_property (iface,
6073 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6074 /**
6075 * SensorThreshold:state:
6076 *
6077 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6078 *
6079 * 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.
6080 */
6081 g_object_interface_install_property (iface,
6082 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6083}
6084
6085/**
6086 * sensor_threshold_get_lower_critical: (skip)
6087 * @object: A #SensorThreshold.
6088 *
6089 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6090 *
6091 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6092 *
6093 * <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>
6094 *
6095 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6096 */
6097GVariant *
6098sensor_threshold_get_lower_critical (SensorThreshold *object)
6099{
6100 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6101}
6102
6103/**
6104 * sensor_threshold_dup_lower_critical: (skip)
6105 * @object: A #SensorThreshold.
6106 *
6107 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6108 *
6109 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6110 *
6111 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6112 */
6113GVariant *
6114sensor_threshold_dup_lower_critical (SensorThreshold *object)
6115{
6116 GVariant *value;
6117 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6118 return value;
6119}
6120
6121/**
6122 * sensor_threshold_set_lower_critical: (skip)
6123 * @object: A #SensorThreshold.
6124 * @value: The value to set.
6125 *
6126 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6127 *
6128 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6129 */
6130void
6131sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6132{
6133 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6134}
6135
6136/**
6137 * sensor_threshold_get_lower_warning: (skip)
6138 * @object: A #SensorThreshold.
6139 *
6140 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6141 *
6142 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6143 *
6144 * <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>
6145 *
6146 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6147 */
6148GVariant *
6149sensor_threshold_get_lower_warning (SensorThreshold *object)
6150{
6151 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6152}
6153
6154/**
6155 * sensor_threshold_dup_lower_warning: (skip)
6156 * @object: A #SensorThreshold.
6157 *
6158 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6159 *
6160 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6161 *
6162 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6163 */
6164GVariant *
6165sensor_threshold_dup_lower_warning (SensorThreshold *object)
6166{
6167 GVariant *value;
6168 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6169 return value;
6170}
6171
6172/**
6173 * sensor_threshold_set_lower_warning: (skip)
6174 * @object: A #SensorThreshold.
6175 * @value: The value to set.
6176 *
6177 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6178 *
6179 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6180 */
6181void
6182sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6183{
6184 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6185}
6186
6187/**
6188 * sensor_threshold_get_upper_warning: (skip)
6189 * @object: A #SensorThreshold.
6190 *
6191 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6192 *
6193 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6194 *
6195 * <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>
6196 *
6197 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6198 */
6199GVariant *
6200sensor_threshold_get_upper_warning (SensorThreshold *object)
6201{
6202 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6203}
6204
6205/**
6206 * sensor_threshold_dup_upper_warning: (skip)
6207 * @object: A #SensorThreshold.
6208 *
6209 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6210 *
6211 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6212 *
6213 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6214 */
6215GVariant *
6216sensor_threshold_dup_upper_warning (SensorThreshold *object)
6217{
6218 GVariant *value;
6219 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6220 return value;
6221}
6222
6223/**
6224 * sensor_threshold_set_upper_warning: (skip)
6225 * @object: A #SensorThreshold.
6226 * @value: The value to set.
6227 *
6228 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6229 *
6230 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6231 */
6232void
6233sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6234{
6235 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6236}
6237
6238/**
6239 * sensor_threshold_get_upper_critical: (skip)
6240 * @object: A #SensorThreshold.
6241 *
6242 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6243 *
6244 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6245 *
6246 * <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>
6247 *
6248 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6249 */
6250GVariant *
6251sensor_threshold_get_upper_critical (SensorThreshold *object)
6252{
6253 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6254}
6255
6256/**
6257 * sensor_threshold_dup_upper_critical: (skip)
6258 * @object: A #SensorThreshold.
6259 *
6260 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6261 *
6262 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6263 *
6264 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6265 */
6266GVariant *
6267sensor_threshold_dup_upper_critical (SensorThreshold *object)
6268{
6269 GVariant *value;
6270 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6271 return value;
6272}
6273
6274/**
6275 * sensor_threshold_set_upper_critical: (skip)
6276 * @object: A #SensorThreshold.
6277 * @value: The value to set.
6278 *
6279 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6280 *
6281 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6282 */
6283void
6284sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6285{
6286 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6287}
6288
6289/**
6290 * sensor_threshold_get_state: (skip)
6291 * @object: A #SensorThreshold.
6292 *
6293 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6294 *
6295 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6296 *
6297 * Returns: The property value.
6298 */
6299guchar
6300sensor_threshold_get_state (SensorThreshold *object)
6301{
6302 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6303}
6304
6305/**
6306 * sensor_threshold_set_state: (skip)
6307 * @object: A #SensorThreshold.
6308 * @value: The value to set.
6309 *
6310 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6311 *
6312 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6313 */
6314void
6315sensor_threshold_set_state (SensorThreshold *object, guchar value)
6316{
6317 g_object_set (G_OBJECT (object), "state", value, NULL);
6318}
6319
6320/**
6321 * sensor_threshold_emit_warning:
6322 * @object: A #SensorThreshold.
6323 *
6324 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6325 */
6326void
6327sensor_threshold_emit_warning (
6328 SensorThreshold *object)
6329{
6330 g_signal_emit_by_name (object, "warning");
6331}
6332
6333/**
6334 * sensor_threshold_emit_critical:
6335 * @object: A #SensorThreshold.
6336 *
6337 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6338 */
6339void
6340sensor_threshold_emit_critical (
6341 SensorThreshold *object)
6342{
6343 g_signal_emit_by_name (object, "critical");
6344}
6345
6346/**
6347 * sensor_threshold_emit_normal:
6348 * @object: A #SensorThreshold.
6349 *
6350 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6351 */
6352void
6353sensor_threshold_emit_normal (
6354 SensorThreshold *object)
6355{
6356 g_signal_emit_by_name (object, "normal");
6357}
6358
6359/**
6360 * sensor_threshold_call_get_state:
6361 * @proxy: A #SensorThresholdProxy.
6362 * @cancellable: (allow-none): A #GCancellable or %NULL.
6363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6364 * @user_data: User data to pass to @callback.
6365 *
6366 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6367 * 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.
6368 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6369 *
6370 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6371 */
6372void
6373sensor_threshold_call_get_state (
6374 SensorThreshold *proxy,
6375 GCancellable *cancellable,
6376 GAsyncReadyCallback callback,
6377 gpointer user_data)
6378{
6379 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6380 "getState",
6381 g_variant_new ("()"),
6382 G_DBUS_CALL_FLAGS_NONE,
6383 -1,
6384 cancellable,
6385 callback,
6386 user_data);
6387}
6388
6389/**
6390 * sensor_threshold_call_get_state_finish:
6391 * @proxy: A #SensorThresholdProxy.
6392 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6393 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6394 * @error: Return location for error or %NULL.
6395 *
6396 * Finishes an operation started with sensor_threshold_call_get_state().
6397 *
6398 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6399 */
6400gboolean
6401sensor_threshold_call_get_state_finish (
6402 SensorThreshold *proxy,
6403 guchar *out_state,
6404 GAsyncResult *res,
6405 GError **error)
6406{
6407 GVariant *_ret;
6408 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6409 if (_ret == NULL)
6410 goto _out;
6411 g_variant_get (_ret,
6412 "(y)",
6413 out_state);
6414 g_variant_unref (_ret);
6415_out:
6416 return _ret != NULL;
6417}
6418
6419/**
6420 * sensor_threshold_call_get_state_sync:
6421 * @proxy: A #SensorThresholdProxy.
6422 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6423 * @cancellable: (allow-none): A #GCancellable or %NULL.
6424 * @error: Return location for error or %NULL.
6425 *
6426 * 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.
6427 *
6428 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6429 *
6430 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6431 */
6432gboolean
6433sensor_threshold_call_get_state_sync (
6434 SensorThreshold *proxy,
6435 guchar *out_state,
6436 GCancellable *cancellable,
6437 GError **error)
6438{
6439 GVariant *_ret;
6440 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6441 "getState",
6442 g_variant_new ("()"),
6443 G_DBUS_CALL_FLAGS_NONE,
6444 -1,
6445 cancellable,
6446 error);
6447 if (_ret == NULL)
6448 goto _out;
6449 g_variant_get (_ret,
6450 "(y)",
6451 out_state);
6452 g_variant_unref (_ret);
6453_out:
6454 return _ret != NULL;
6455}
6456
6457/**
6458 * sensor_threshold_complete_get_state:
6459 * @object: A #SensorThreshold.
6460 * @invocation: (transfer full): A #GDBusMethodInvocation.
6461 * @state: Parameter to return.
6462 *
6463 * 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.
6464 *
6465 * This method will free @invocation, you cannot use it afterwards.
6466 */
6467void
6468sensor_threshold_complete_get_state (
6469 SensorThreshold *object,
6470 GDBusMethodInvocation *invocation,
6471 guchar state)
6472{
6473 g_dbus_method_invocation_return_value (invocation,
6474 g_variant_new ("(y)",
6475 state));
6476}
6477
6478/* ------------------------------------------------------------------------ */
6479
6480/**
6481 * SensorThresholdProxy:
6482 *
6483 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6484 */
6485
6486/**
6487 * SensorThresholdProxyClass:
6488 * @parent_class: The parent class.
6489 *
6490 * Class structure for #SensorThresholdProxy.
6491 */
6492
6493struct _SensorThresholdProxyPrivate
6494{
6495 GData *qdata;
6496};
6497
6498static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6499
6500#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6501G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6502 G_ADD_PRIVATE (SensorThresholdProxy)
6503 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6504
6505#else
6506G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6507 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6508
6509#endif
6510static void
6511sensor_threshold_proxy_finalize (GObject *object)
6512{
6513 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6514 g_datalist_clear (&proxy->priv->qdata);
6515 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6516}
6517
6518static void
6519sensor_threshold_proxy_get_property (GObject *object,
6520 guint prop_id,
6521 GValue *value,
6522 GParamSpec *pspec G_GNUC_UNUSED)
6523{
6524 const _ExtendedGDBusPropertyInfo *info;
6525 GVariant *variant;
6526 g_assert (prop_id != 0 && prop_id - 1 < 5);
6527 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6528 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6529 if (info->use_gvariant)
6530 {
6531 g_value_set_variant (value, variant);
6532 }
6533 else
6534 {
6535 if (variant != NULL)
6536 g_dbus_gvariant_to_gvalue (variant, value);
6537 }
6538 if (variant != NULL)
6539 g_variant_unref (variant);
6540}
6541
6542static void
6543sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6544 GAsyncResult *res,
6545 gpointer user_data)
6546{
6547 const _ExtendedGDBusPropertyInfo *info = user_data;
6548 GError *error;
6549 GVariant *_ret;
6550 error = NULL;
6551 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6552 if (!_ret)
6553 {
6554 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6555 info->parent_struct.name,
6556 error->message, g_quark_to_string (error->domain), error->code);
6557 g_error_free (error);
6558 }
6559 else
6560 {
6561 g_variant_unref (_ret);
6562 }
6563}
6564
6565static void
6566sensor_threshold_proxy_set_property (GObject *object,
6567 guint prop_id,
6568 const GValue *value,
6569 GParamSpec *pspec G_GNUC_UNUSED)
6570{
6571 const _ExtendedGDBusPropertyInfo *info;
6572 GVariant *variant;
6573 g_assert (prop_id != 0 && prop_id - 1 < 5);
6574 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6575 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6576 g_dbus_proxy_call (G_DBUS_PROXY (object),
6577 "org.freedesktop.DBus.Properties.Set",
6578 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6579 G_DBUS_CALL_FLAGS_NONE,
6580 -1,
6581 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6582 g_variant_unref (variant);
6583}
6584
6585static void
6586sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6587 const gchar *sender_name G_GNUC_UNUSED,
6588 const gchar *signal_name,
6589 GVariant *parameters)
6590{
6591 _ExtendedGDBusSignalInfo *info;
6592 GVariantIter iter;
6593 GVariant *child;
6594 GValue *paramv;
6595 guint num_params;
6596 guint n;
6597 guint signal_id;
6598 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6599 if (info == NULL)
6600 return;
6601 num_params = g_variant_n_children (parameters);
6602 paramv = g_new0 (GValue, num_params + 1);
6603 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6604 g_value_set_object (&paramv[0], proxy);
6605 g_variant_iter_init (&iter, parameters);
6606 n = 1;
6607 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6608 {
6609 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6610 if (arg_info->use_gvariant)
6611 {
6612 g_value_init (&paramv[n], G_TYPE_VARIANT);
6613 g_value_set_variant (&paramv[n], child);
6614 n++;
6615 }
6616 else
6617 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6618 g_variant_unref (child);
6619 }
6620 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6621 g_signal_emitv (paramv, signal_id, 0, NULL);
6622 for (n = 0; n < num_params + 1; n++)
6623 g_value_unset (&paramv[n]);
6624 g_free (paramv);
6625}
6626
6627static void
6628sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6629 GVariant *changed_properties,
6630 const gchar *const *invalidated_properties)
6631{
6632 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6633 guint n;
6634 const gchar *key;
6635 GVariantIter *iter;
6636 _ExtendedGDBusPropertyInfo *info;
6637 g_variant_get (changed_properties, "a{sv}", &iter);
6638 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6639 {
6640 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6641 g_datalist_remove_data (&proxy->priv->qdata, key);
6642 if (info != NULL)
6643 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6644 }
6645 g_variant_iter_free (iter);
6646 for (n = 0; invalidated_properties[n] != NULL; n++)
6647 {
6648 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6649 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6650 if (info != NULL)
6651 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6652 }
6653}
6654
6655static GVariant *
6656sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6657{
6658 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6659 GVariant *variant;
6660 GVariant *value = NULL;
6661 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6662 value = variant;
6663 if (variant != NULL)
6664 g_variant_unref (variant);
6665 return value;
6666}
6667
6668static GVariant *
6669sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6670{
6671 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6672 GVariant *variant;
6673 GVariant *value = NULL;
6674 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6675 value = variant;
6676 if (variant != NULL)
6677 g_variant_unref (variant);
6678 return value;
6679}
6680
6681static GVariant *
6682sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6683{
6684 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6685 GVariant *variant;
6686 GVariant *value = NULL;
6687 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6688 value = variant;
6689 if (variant != NULL)
6690 g_variant_unref (variant);
6691 return value;
6692}
6693
6694static GVariant *
6695sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6696{
6697 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6698 GVariant *variant;
6699 GVariant *value = NULL;
6700 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6701 value = variant;
6702 if (variant != NULL)
6703 g_variant_unref (variant);
6704 return value;
6705}
6706
6707static guchar
6708sensor_threshold_proxy_get_state (SensorThreshold *object)
6709{
6710 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6711 GVariant *variant;
6712 guchar value = 0;
6713 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6714 if (variant != NULL)
6715 {
6716 value = g_variant_get_byte (variant);
6717 g_variant_unref (variant);
6718 }
6719 return value;
6720}
6721
6722static void
6723sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6724{
6725#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6726 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6727#else
6728 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6729#endif
6730
6731 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6732}
6733
6734static void
6735sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6736{
6737 GObjectClass *gobject_class;
6738 GDBusProxyClass *proxy_class;
6739
6740 gobject_class = G_OBJECT_CLASS (klass);
6741 gobject_class->finalize = sensor_threshold_proxy_finalize;
6742 gobject_class->get_property = sensor_threshold_proxy_get_property;
6743 gobject_class->set_property = sensor_threshold_proxy_set_property;
6744
6745 proxy_class = G_DBUS_PROXY_CLASS (klass);
6746 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6747 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6748
6749 sensor_threshold_override_properties (gobject_class, 1);
6750
6751#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6752 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6753#endif
6754}
6755
6756static void
6757sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6758{
6759 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6760 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6761 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6762 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6763 iface->get_state = sensor_threshold_proxy_get_state;
6764}
6765
6766/**
6767 * sensor_threshold_proxy_new:
6768 * @connection: A #GDBusConnection.
6769 * @flags: Flags from the #GDBusProxyFlags enumeration.
6770 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6771 * @object_path: An object path.
6772 * @cancellable: (allow-none): A #GCancellable or %NULL.
6773 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6774 * @user_data: User data to pass to @callback.
6775 *
6776 * 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.
6777 *
6778 * 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.
6779 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6780 *
6781 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6782 */
6783void
6784sensor_threshold_proxy_new (
6785 GDBusConnection *connection,
6786 GDBusProxyFlags flags,
6787 const gchar *name,
6788 const gchar *object_path,
6789 GCancellable *cancellable,
6790 GAsyncReadyCallback callback,
6791 gpointer user_data)
6792{
6793 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);
6794}
6795
6796/**
6797 * sensor_threshold_proxy_new_finish:
6798 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6799 * @error: Return location for error or %NULL
6800 *
6801 * Finishes an operation started with sensor_threshold_proxy_new().
6802 *
6803 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6804 */
6805SensorThreshold *
6806sensor_threshold_proxy_new_finish (
6807 GAsyncResult *res,
6808 GError **error)
6809{
6810 GObject *ret;
6811 GObject *source_object;
6812 source_object = g_async_result_get_source_object (res);
6813 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6814 g_object_unref (source_object);
6815 if (ret != NULL)
6816 return SENSOR_THRESHOLD (ret);
6817 else
6818 return NULL;
6819}
6820
6821/**
6822 * sensor_threshold_proxy_new_sync:
6823 * @connection: A #GDBusConnection.
6824 * @flags: Flags from the #GDBusProxyFlags enumeration.
6825 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6826 * @object_path: An object path.
6827 * @cancellable: (allow-none): A #GCancellable or %NULL.
6828 * @error: Return location for error or %NULL
6829 *
6830 * 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.
6831 *
6832 * The calling thread is blocked until a reply is received.
6833 *
6834 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
6835 *
6836 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6837 */
6838SensorThreshold *
6839sensor_threshold_proxy_new_sync (
6840 GDBusConnection *connection,
6841 GDBusProxyFlags flags,
6842 const gchar *name,
6843 const gchar *object_path,
6844 GCancellable *cancellable,
6845 GError **error)
6846{
6847 GInitable *ret;
6848 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);
6849 if (ret != NULL)
6850 return SENSOR_THRESHOLD (ret);
6851 else
6852 return NULL;
6853}
6854
6855
6856/**
6857 * sensor_threshold_proxy_new_for_bus:
6858 * @bus_type: A #GBusType.
6859 * @flags: Flags from the #GDBusProxyFlags enumeration.
6860 * @name: A bus name (well-known or unique).
6861 * @object_path: An object path.
6862 * @cancellable: (allow-none): A #GCancellable or %NULL.
6863 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6864 * @user_data: User data to pass to @callback.
6865 *
6866 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6867 *
6868 * 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.
6869 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
6870 *
6871 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6872 */
6873void
6874sensor_threshold_proxy_new_for_bus (
6875 GBusType bus_type,
6876 GDBusProxyFlags flags,
6877 const gchar *name,
6878 const gchar *object_path,
6879 GCancellable *cancellable,
6880 GAsyncReadyCallback callback,
6881 gpointer user_data)
6882{
6883 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);
6884}
6885
6886/**
6887 * sensor_threshold_proxy_new_for_bus_finish:
6888 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
6889 * @error: Return location for error or %NULL
6890 *
6891 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
6892 *
6893 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6894 */
6895SensorThreshold *
6896sensor_threshold_proxy_new_for_bus_finish (
6897 GAsyncResult *res,
6898 GError **error)
6899{
6900 GObject *ret;
6901 GObject *source_object;
6902 source_object = g_async_result_get_source_object (res);
6903 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6904 g_object_unref (source_object);
6905 if (ret != NULL)
6906 return SENSOR_THRESHOLD (ret);
6907 else
6908 return NULL;
6909}
6910
6911/**
6912 * sensor_threshold_proxy_new_for_bus_sync:
6913 * @bus_type: A #GBusType.
6914 * @flags: Flags from the #GDBusProxyFlags enumeration.
6915 * @name: A bus name (well-known or unique).
6916 * @object_path: An object path.
6917 * @cancellable: (allow-none): A #GCancellable or %NULL.
6918 * @error: Return location for error or %NULL
6919 *
6920 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6921 *
6922 * The calling thread is blocked until a reply is received.
6923 *
6924 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
6925 *
6926 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6927 */
6928SensorThreshold *
6929sensor_threshold_proxy_new_for_bus_sync (
6930 GBusType bus_type,
6931 GDBusProxyFlags flags,
6932 const gchar *name,
6933 const gchar *object_path,
6934 GCancellable *cancellable,
6935 GError **error)
6936{
6937 GInitable *ret;
6938 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);
6939 if (ret != NULL)
6940 return SENSOR_THRESHOLD (ret);
6941 else
6942 return NULL;
6943}
6944
6945
6946/* ------------------------------------------------------------------------ */
6947
6948/**
6949 * SensorThresholdSkeleton:
6950 *
6951 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
6952 */
6953
6954/**
6955 * SensorThresholdSkeletonClass:
6956 * @parent_class: The parent class.
6957 *
6958 * Class structure for #SensorThresholdSkeleton.
6959 */
6960
6961struct _SensorThresholdSkeletonPrivate
6962{
6963 GValue *properties;
6964 GList *changed_properties;
6965 GSource *changed_properties_idle_source;
6966 GMainContext *context;
6967 GMutex lock;
6968};
6969
6970static void
6971_sensor_threshold_skeleton_handle_method_call (
6972 GDBusConnection *connection G_GNUC_UNUSED,
6973 const gchar *sender G_GNUC_UNUSED,
6974 const gchar *object_path G_GNUC_UNUSED,
6975 const gchar *interface_name,
6976 const gchar *method_name,
6977 GVariant *parameters,
6978 GDBusMethodInvocation *invocation,
6979 gpointer user_data)
6980{
6981 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6982 _ExtendedGDBusMethodInfo *info;
6983 GVariantIter iter;
6984 GVariant *child;
6985 GValue *paramv;
6986 guint num_params;
6987 guint num_extra;
6988 guint n;
6989 guint signal_id;
6990 GValue return_value = G_VALUE_INIT;
6991 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6992 g_assert (info != NULL);
6993 num_params = g_variant_n_children (parameters);
6994 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6995 n = 0;
6996 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
6997 g_value_set_object (&paramv[n++], skeleton);
6998 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6999 g_value_set_object (&paramv[n++], invocation);
7000 if (info->pass_fdlist)
7001 {
7002#ifdef G_OS_UNIX
7003 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7004 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7005#else
7006 g_assert_not_reached ();
7007#endif
7008 }
7009 g_variant_iter_init (&iter, parameters);
7010 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7011 {
7012 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7013 if (arg_info->use_gvariant)
7014 {
7015 g_value_init (&paramv[n], G_TYPE_VARIANT);
7016 g_value_set_variant (&paramv[n], child);
7017 n++;
7018 }
7019 else
7020 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7021 g_variant_unref (child);
7022 }
7023 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7024 g_value_init (&return_value, G_TYPE_BOOLEAN);
7025 g_signal_emitv (paramv, signal_id, 0, &return_value);
7026 if (!g_value_get_boolean (&return_value))
7027 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);
7028 g_value_unset (&return_value);
7029 for (n = 0; n < num_params + num_extra; n++)
7030 g_value_unset (&paramv[n]);
7031 g_free (paramv);
7032}
7033
7034static GVariant *
7035_sensor_threshold_skeleton_handle_get_property (
7036 GDBusConnection *connection G_GNUC_UNUSED,
7037 const gchar *sender G_GNUC_UNUSED,
7038 const gchar *object_path G_GNUC_UNUSED,
7039 const gchar *interface_name G_GNUC_UNUSED,
7040 const gchar *property_name,
7041 GError **error,
7042 gpointer user_data)
7043{
7044 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7045 GValue value = G_VALUE_INIT;
7046 GParamSpec *pspec;
7047 _ExtendedGDBusPropertyInfo *info;
7048 GVariant *ret;
7049 ret = NULL;
7050 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7051 g_assert (info != NULL);
7052 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7053 if (pspec == NULL)
7054 {
7055 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7056 }
7057 else
7058 {
7059 g_value_init (&value, pspec->value_type);
7060 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7061 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7062 g_value_unset (&value);
7063 }
7064 return ret;
7065}
7066
7067static gboolean
7068_sensor_threshold_skeleton_handle_set_property (
7069 GDBusConnection *connection G_GNUC_UNUSED,
7070 const gchar *sender G_GNUC_UNUSED,
7071 const gchar *object_path G_GNUC_UNUSED,
7072 const gchar *interface_name G_GNUC_UNUSED,
7073 const gchar *property_name,
7074 GVariant *variant,
7075 GError **error,
7076 gpointer user_data)
7077{
7078 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7079 GValue value = G_VALUE_INIT;
7080 GParamSpec *pspec;
7081 _ExtendedGDBusPropertyInfo *info;
7082 gboolean ret;
7083 ret = FALSE;
7084 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7085 g_assert (info != NULL);
7086 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7087 if (pspec == NULL)
7088 {
7089 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7090 }
7091 else
7092 {
7093 if (info->use_gvariant)
7094 g_value_set_variant (&value, variant);
7095 else
7096 g_dbus_gvariant_to_gvalue (variant, &value);
7097 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7098 g_value_unset (&value);
7099 ret = TRUE;
7100 }
7101 return ret;
7102}
7103
7104static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7105{
7106 _sensor_threshold_skeleton_handle_method_call,
7107 _sensor_threshold_skeleton_handle_get_property,
7108 _sensor_threshold_skeleton_handle_set_property,
7109 {NULL}
7110};
7111
7112static GDBusInterfaceInfo *
7113sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7114{
7115 return sensor_threshold_interface_info ();
7116}
7117
7118static GDBusInterfaceVTable *
7119sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7120{
7121 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7122}
7123
7124static GVariant *
7125sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7126{
7127 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7128
7129 GVariantBuilder builder;
7130 guint n;
7131 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7132 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7133 goto out;
7134 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7135 {
7136 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7137 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7138 {
7139 GVariant *value;
7140 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);
7141 if (value != NULL)
7142 {
7143 g_variant_take_ref (value);
7144 g_variant_builder_add (&builder, "{sv}", info->name, value);
7145 g_variant_unref (value);
7146 }
7147 }
7148 }
7149out:
7150 return g_variant_builder_end (&builder);
7151}
7152
7153static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7154
7155static void
7156sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7157{
7158 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7159 gboolean emit_changed = FALSE;
7160
7161 g_mutex_lock (&skeleton->priv->lock);
7162 if (skeleton->priv->changed_properties_idle_source != NULL)
7163 {
7164 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7165 skeleton->priv->changed_properties_idle_source = NULL;
7166 emit_changed = TRUE;
7167 }
7168 g_mutex_unlock (&skeleton->priv->lock);
7169
7170 if (emit_changed)
7171 _sensor_threshold_emit_changed (skeleton);
7172}
7173
7174static void
7175_sensor_threshold_on_signal_warning (
7176 SensorThreshold *object)
7177{
7178 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7179
7180 GList *connections, *l;
7181 GVariant *signal_variant;
7182 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7183
7184 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7185 for (l = connections; l != NULL; l = l->next)
7186 {
7187 GDBusConnection *connection = l->data;
7188 g_dbus_connection_emit_signal (connection,
7189 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7190 signal_variant, NULL);
7191 }
7192 g_variant_unref (signal_variant);
7193 g_list_free_full (connections, g_object_unref);
7194}
7195
7196static void
7197_sensor_threshold_on_signal_critical (
7198 SensorThreshold *object)
7199{
7200 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7201
7202 GList *connections, *l;
7203 GVariant *signal_variant;
7204 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7205
7206 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7207 for (l = connections; l != NULL; l = l->next)
7208 {
7209 GDBusConnection *connection = l->data;
7210 g_dbus_connection_emit_signal (connection,
7211 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7212 signal_variant, NULL);
7213 }
7214 g_variant_unref (signal_variant);
7215 g_list_free_full (connections, g_object_unref);
7216}
7217
7218static void
7219_sensor_threshold_on_signal_normal (
7220 SensorThreshold *object)
7221{
7222 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7223
7224 GList *connections, *l;
7225 GVariant *signal_variant;
7226 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7227
7228 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7229 for (l = connections; l != NULL; l = l->next)
7230 {
7231 GDBusConnection *connection = l->data;
7232 g_dbus_connection_emit_signal (connection,
7233 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7234 signal_variant, NULL);
7235 }
7236 g_variant_unref (signal_variant);
7237 g_list_free_full (connections, g_object_unref);
7238}
7239
7240static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7241#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7242G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7243 G_ADD_PRIVATE (SensorThresholdSkeleton)
7244 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7245
7246#else
7247G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7248 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7249
7250#endif
7251static void
7252sensor_threshold_skeleton_finalize (GObject *object)
7253{
7254 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7255 guint n;
7256 for (n = 0; n < 5; n++)
7257 g_value_unset (&skeleton->priv->properties[n]);
7258 g_free (skeleton->priv->properties);
7259 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7260 if (skeleton->priv->changed_properties_idle_source != NULL)
7261 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7262 g_main_context_unref (skeleton->priv->context);
7263 g_mutex_clear (&skeleton->priv->lock);
7264 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7265}
7266
7267static void
7268sensor_threshold_skeleton_get_property (GObject *object,
7269 guint prop_id,
7270 GValue *value,
7271 GParamSpec *pspec G_GNUC_UNUSED)
7272{
7273 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7274 g_assert (prop_id != 0 && prop_id - 1 < 5);
7275 g_mutex_lock (&skeleton->priv->lock);
7276 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7277 g_mutex_unlock (&skeleton->priv->lock);
7278}
7279
7280static gboolean
7281_sensor_threshold_emit_changed (gpointer user_data)
7282{
7283 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7284 GList *l;
7285 GVariantBuilder builder;
7286 GVariantBuilder invalidated_builder;
7287 guint num_changes;
7288
7289 g_mutex_lock (&skeleton->priv->lock);
7290 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7291 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7292 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7293 {
7294 ChangedProperty *cp = l->data;
7295 GVariant *variant;
7296 const GValue *cur_value;
7297
7298 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7299 if (!_g_value_equal (cur_value, &cp->orig_value))
7300 {
7301 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7302 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7303 g_variant_unref (variant);
7304 num_changes++;
7305 }
7306 }
7307 if (num_changes > 0)
7308 {
7309 GList *connections, *ll;
7310 GVariant *signal_variant;
7311 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7312 &builder, &invalidated_builder));
7313 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7314 for (ll = connections; ll != NULL; ll = ll->next)
7315 {
7316 GDBusConnection *connection = ll->data;
7317
7318 g_dbus_connection_emit_signal (connection,
7319 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7320 "org.freedesktop.DBus.Properties",
7321 "PropertiesChanged",
7322 signal_variant,
7323 NULL);
7324 }
7325 g_variant_unref (signal_variant);
7326 g_list_free_full (connections, g_object_unref);
7327 }
7328 else
7329 {
7330 g_variant_builder_clear (&builder);
7331 g_variant_builder_clear (&invalidated_builder);
7332 }
7333 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7334 skeleton->priv->changed_properties = NULL;
7335 skeleton->priv->changed_properties_idle_source = NULL;
7336 g_mutex_unlock (&skeleton->priv->lock);
7337 return FALSE;
7338}
7339
7340static void
7341_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7342{
7343 ChangedProperty *cp;
7344 GList *l;
7345 cp = NULL;
7346 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7347 {
7348 ChangedProperty *i_cp = l->data;
7349 if (i_cp->info == info)
7350 {
7351 cp = i_cp;
7352 break;
7353 }
7354 }
7355 if (cp == NULL)
7356 {
7357 cp = g_new0 (ChangedProperty, 1);
7358 cp->prop_id = prop_id;
7359 cp->info = info;
7360 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7361 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7362 g_value_copy (orig_value, &cp->orig_value);
7363 }
7364}
7365
7366static void
7367sensor_threshold_skeleton_notify (GObject *object,
7368 GParamSpec *pspec G_GNUC_UNUSED)
7369{
7370 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7371 g_mutex_lock (&skeleton->priv->lock);
7372 if (skeleton->priv->changed_properties != NULL &&
7373 skeleton->priv->changed_properties_idle_source == NULL)
7374 {
7375 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7376 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7377 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7378 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7379 g_source_unref (skeleton->priv->changed_properties_idle_source);
7380 }
7381 g_mutex_unlock (&skeleton->priv->lock);
7382}
7383
7384static void
7385sensor_threshold_skeleton_set_property (GObject *object,
7386 guint prop_id,
7387 const GValue *value,
7388 GParamSpec *pspec)
7389{
7390 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7391 g_assert (prop_id != 0 && prop_id - 1 < 5);
7392 g_mutex_lock (&skeleton->priv->lock);
7393 g_object_freeze_notify (object);
7394 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7395 {
7396 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7397 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7398 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7399 g_object_notify_by_pspec (object, pspec);
7400 }
7401 g_mutex_unlock (&skeleton->priv->lock);
7402 g_object_thaw_notify (object);
7403}
7404
7405static void
7406sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7407{
7408#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7409 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7410#else
7411 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7412#endif
7413
7414 g_mutex_init (&skeleton->priv->lock);
7415 skeleton->priv->context = g_main_context_ref_thread_default ();
7416 skeleton->priv->properties = g_new0 (GValue, 5);
7417 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7418 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7419 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7420 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7421 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7422}
7423
7424static GVariant *
7425sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7426{
7427 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7428 GVariant *value;
7429 g_mutex_lock (&skeleton->priv->lock);
7430 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7431 g_mutex_unlock (&skeleton->priv->lock);
7432 return value;
7433}
7434
7435static GVariant *
7436sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7437{
7438 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7439 GVariant *value;
7440 g_mutex_lock (&skeleton->priv->lock);
7441 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7442 g_mutex_unlock (&skeleton->priv->lock);
7443 return value;
7444}
7445
7446static GVariant *
7447sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7448{
7449 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7450 GVariant *value;
7451 g_mutex_lock (&skeleton->priv->lock);
7452 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7453 g_mutex_unlock (&skeleton->priv->lock);
7454 return value;
7455}
7456
7457static GVariant *
7458sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7459{
7460 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7461 GVariant *value;
7462 g_mutex_lock (&skeleton->priv->lock);
7463 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7464 g_mutex_unlock (&skeleton->priv->lock);
7465 return value;
7466}
7467
7468static guchar
7469sensor_threshold_skeleton_get_state (SensorThreshold *object)
7470{
7471 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7472 guchar value;
7473 g_mutex_lock (&skeleton->priv->lock);
7474 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7475 g_mutex_unlock (&skeleton->priv->lock);
7476 return value;
7477}
7478
7479static void
7480sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7481{
7482 GObjectClass *gobject_class;
7483 GDBusInterfaceSkeletonClass *skeleton_class;
7484
7485 gobject_class = G_OBJECT_CLASS (klass);
7486 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7487 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7488 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7489 gobject_class->notify = sensor_threshold_skeleton_notify;
7490
7491
7492 sensor_threshold_override_properties (gobject_class, 1);
7493
7494 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7495 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7496 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7497 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7498 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7499
7500#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7501 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7502#endif
7503}
7504
7505static void
7506sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7507{
7508 iface->warning = _sensor_threshold_on_signal_warning;
7509 iface->critical = _sensor_threshold_on_signal_critical;
7510 iface->normal = _sensor_threshold_on_signal_normal;
7511 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7512 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7513 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7514 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7515 iface->get_state = sensor_threshold_skeleton_get_state;
7516}
7517
7518/**
7519 * sensor_threshold_skeleton_new:
7520 *
7521 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7522 *
7523 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7524 */
7525SensorThreshold *
7526sensor_threshold_skeleton_new (void)
7527{
7528 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7529}
7530
7531/* ------------------------------------------------------------------------
7532 * Code for interface org.openbmc.SensorI2c
7533 * ------------------------------------------------------------------------
7534 */
7535
7536/**
7537 * SECTION:SensorI2c
7538 * @title: SensorI2c
7539 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7540 *
7541 * 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.
7542 */
7543
7544/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7545
7546static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7547{
7548 {
7549 -1,
7550 (gchar *) "dev_path",
7551 (gchar *) "s",
7552 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7553 NULL
7554 },
7555 "dev-path",
7556 FALSE
7557};
7558
7559static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7560{
7561 {
7562 -1,
7563 (gchar *) "address",
7564 (gchar *) "s",
7565 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7566 NULL
7567 },
7568 "address",
7569 FALSE
7570};
7571
7572static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7573{
7574 &_sensor_i2c_property_info_dev_path,
7575 &_sensor_i2c_property_info_address,
7576 NULL
7577};
7578
7579static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7580{
7581 {
7582 -1,
7583 (gchar *) "org.openbmc.SensorI2c",
7584 NULL,
7585 NULL,
7586 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7587 NULL
7588 },
7589 "sensor-i2c",
7590};
7591
7592
7593/**
7594 * sensor_i2c_interface_info:
7595 *
7596 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7597 *
7598 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7599 */
7600GDBusInterfaceInfo *
7601sensor_i2c_interface_info (void)
7602{
7603 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7604}
7605
7606/**
7607 * sensor_i2c_override_properties:
7608 * @klass: The class structure for a #GObject<!-- -->-derived class.
7609 * @property_id_begin: The property id to assign to the first overridden property.
7610 *
7611 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7612 * The properties are overridden in the order they are defined.
7613 *
7614 * Returns: The last property id.
7615 */
7616guint
7617sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7618{
7619 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7620 g_object_class_override_property (klass, property_id_begin++, "address");
7621 return property_id_begin - 1;
7622}
7623
7624
7625
7626/**
7627 * SensorI2c:
7628 *
7629 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7630 */
7631
7632/**
7633 * SensorI2cIface:
7634 * @parent_iface: The parent interface.
7635 * @get_address: Getter for the #SensorI2c:address property.
7636 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7637 *
7638 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7639 */
7640
7641typedef SensorI2cIface SensorI2cInterface;
7642G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7643
7644static void
7645sensor_i2c_default_init (SensorI2cIface *iface)
7646{
7647 /* GObject properties for D-Bus properties: */
7648 /**
7649 * SensorI2c:dev-path:
7650 *
7651 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7652 *
7653 * 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.
7654 */
7655 g_object_interface_install_property (iface,
7656 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7657 /**
7658 * SensorI2c:address:
7659 *
7660 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7661 *
7662 * 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.
7663 */
7664 g_object_interface_install_property (iface,
7665 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7666}
7667
7668/**
7669 * sensor_i2c_get_dev_path: (skip)
7670 * @object: A #SensorI2c.
7671 *
7672 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7673 *
7674 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7675 *
7676 * <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>
7677 *
7678 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7679 */
7680const gchar *
7681sensor_i2c_get_dev_path (SensorI2c *object)
7682{
7683 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7684}
7685
7686/**
7687 * sensor_i2c_dup_dev_path: (skip)
7688 * @object: A #SensorI2c.
7689 *
7690 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7691 *
7692 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7693 *
7694 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7695 */
7696gchar *
7697sensor_i2c_dup_dev_path (SensorI2c *object)
7698{
7699 gchar *value;
7700 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7701 return value;
7702}
7703
7704/**
7705 * sensor_i2c_set_dev_path: (skip)
7706 * @object: A #SensorI2c.
7707 * @value: The value to set.
7708 *
7709 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7710 *
7711 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7712 */
7713void
7714sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7715{
7716 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7717}
7718
7719/**
7720 * sensor_i2c_get_address: (skip)
7721 * @object: A #SensorI2c.
7722 *
7723 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7724 *
7725 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7726 *
7727 * <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>
7728 *
7729 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7730 */
7731const gchar *
7732sensor_i2c_get_address (SensorI2c *object)
7733{
7734 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7735}
7736
7737/**
7738 * sensor_i2c_dup_address: (skip)
7739 * @object: A #SensorI2c.
7740 *
7741 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7742 *
7743 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7744 *
7745 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7746 */
7747gchar *
7748sensor_i2c_dup_address (SensorI2c *object)
7749{
7750 gchar *value;
7751 g_object_get (G_OBJECT (object), "address", &value, NULL);
7752 return value;
7753}
7754
7755/**
7756 * sensor_i2c_set_address: (skip)
7757 * @object: A #SensorI2c.
7758 * @value: The value to set.
7759 *
7760 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7761 *
7762 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7763 */
7764void
7765sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7766{
7767 g_object_set (G_OBJECT (object), "address", value, NULL);
7768}
7769
7770/* ------------------------------------------------------------------------ */
7771
7772/**
7773 * SensorI2cProxy:
7774 *
7775 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7776 */
7777
7778/**
7779 * SensorI2cProxyClass:
7780 * @parent_class: The parent class.
7781 *
7782 * Class structure for #SensorI2cProxy.
7783 */
7784
7785struct _SensorI2cProxyPrivate
7786{
7787 GData *qdata;
7788};
7789
7790static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7791
7792#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7793G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7794 G_ADD_PRIVATE (SensorI2cProxy)
7795 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7796
7797#else
7798G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7799 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7800
7801#endif
7802static void
7803sensor_i2c_proxy_finalize (GObject *object)
7804{
7805 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7806 g_datalist_clear (&proxy->priv->qdata);
7807 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7808}
7809
7810static void
7811sensor_i2c_proxy_get_property (GObject *object,
7812 guint prop_id,
7813 GValue *value,
7814 GParamSpec *pspec G_GNUC_UNUSED)
7815{
7816 const _ExtendedGDBusPropertyInfo *info;
7817 GVariant *variant;
7818 g_assert (prop_id != 0 && prop_id - 1 < 2);
7819 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7820 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7821 if (info->use_gvariant)
7822 {
7823 g_value_set_variant (value, variant);
7824 }
7825 else
7826 {
7827 if (variant != NULL)
7828 g_dbus_gvariant_to_gvalue (variant, value);
7829 }
7830 if (variant != NULL)
7831 g_variant_unref (variant);
7832}
7833
7834static void
7835sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
7836 GAsyncResult *res,
7837 gpointer user_data)
7838{
7839 const _ExtendedGDBusPropertyInfo *info = user_data;
7840 GError *error;
7841 GVariant *_ret;
7842 error = NULL;
7843 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7844 if (!_ret)
7845 {
7846 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
7847 info->parent_struct.name,
7848 error->message, g_quark_to_string (error->domain), error->code);
7849 g_error_free (error);
7850 }
7851 else
7852 {
7853 g_variant_unref (_ret);
7854 }
7855}
7856
7857static void
7858sensor_i2c_proxy_set_property (GObject *object,
7859 guint prop_id,
7860 const GValue *value,
7861 GParamSpec *pspec G_GNUC_UNUSED)
7862{
7863 const _ExtendedGDBusPropertyInfo *info;
7864 GVariant *variant;
7865 g_assert (prop_id != 0 && prop_id - 1 < 2);
7866 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7867 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7868 g_dbus_proxy_call (G_DBUS_PROXY (object),
7869 "org.freedesktop.DBus.Properties.Set",
7870 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
7871 G_DBUS_CALL_FLAGS_NONE,
7872 -1,
7873 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7874 g_variant_unref (variant);
7875}
7876
7877static void
7878sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
7879 const gchar *sender_name G_GNUC_UNUSED,
7880 const gchar *signal_name,
7881 GVariant *parameters)
7882{
7883 _ExtendedGDBusSignalInfo *info;
7884 GVariantIter iter;
7885 GVariant *child;
7886 GValue *paramv;
7887 guint num_params;
7888 guint n;
7889 guint signal_id;
7890 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
7891 if (info == NULL)
7892 return;
7893 num_params = g_variant_n_children (parameters);
7894 paramv = g_new0 (GValue, num_params + 1);
7895 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
7896 g_value_set_object (&paramv[0], proxy);
7897 g_variant_iter_init (&iter, parameters);
7898 n = 1;
7899 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7900 {
7901 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7902 if (arg_info->use_gvariant)
7903 {
7904 g_value_init (&paramv[n], G_TYPE_VARIANT);
7905 g_value_set_variant (&paramv[n], child);
7906 n++;
7907 }
7908 else
7909 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7910 g_variant_unref (child);
7911 }
7912 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7913 g_signal_emitv (paramv, signal_id, 0, NULL);
7914 for (n = 0; n < num_params + 1; n++)
7915 g_value_unset (&paramv[n]);
7916 g_free (paramv);
7917}
7918
7919static void
7920sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
7921 GVariant *changed_properties,
7922 const gchar *const *invalidated_properties)
7923{
7924 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
7925 guint n;
7926 const gchar *key;
7927 GVariantIter *iter;
7928 _ExtendedGDBusPropertyInfo *info;
7929 g_variant_get (changed_properties, "a{sv}", &iter);
7930 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7931 {
7932 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
7933 g_datalist_remove_data (&proxy->priv->qdata, key);
7934 if (info != NULL)
7935 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7936 }
7937 g_variant_iter_free (iter);
7938 for (n = 0; invalidated_properties[n] != NULL; n++)
7939 {
7940 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
7941 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7942 if (info != NULL)
7943 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7944 }
7945}
7946
7947static const gchar *
7948sensor_i2c_proxy_get_dev_path (SensorI2c *object)
7949{
7950 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7951 GVariant *variant;
7952 const gchar *value = NULL;
7953 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
7954 if (variant != NULL)
7955 {
7956 value = g_variant_get_string (variant, NULL);
7957 g_variant_unref (variant);
7958 }
7959 return value;
7960}
7961
7962static const gchar *
7963sensor_i2c_proxy_get_address (SensorI2c *object)
7964{
7965 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7966 GVariant *variant;
7967 const gchar *value = NULL;
7968 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
7969 if (variant != NULL)
7970 {
7971 value = g_variant_get_string (variant, NULL);
7972 g_variant_unref (variant);
7973 }
7974 return value;
7975}
7976
7977static void
7978sensor_i2c_proxy_init (SensorI2cProxy *proxy)
7979{
7980#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7981 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
7982#else
7983 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
7984#endif
7985
7986 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
7987}
7988
7989static void
7990sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
7991{
7992 GObjectClass *gobject_class;
7993 GDBusProxyClass *proxy_class;
7994
7995 gobject_class = G_OBJECT_CLASS (klass);
7996 gobject_class->finalize = sensor_i2c_proxy_finalize;
7997 gobject_class->get_property = sensor_i2c_proxy_get_property;
7998 gobject_class->set_property = sensor_i2c_proxy_set_property;
7999
8000 proxy_class = G_DBUS_PROXY_CLASS (klass);
8001 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8002 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8003
8004 sensor_i2c_override_properties (gobject_class, 1);
8005
8006#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8007 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8008#endif
8009}
8010
8011static void
8012sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8013{
8014 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8015 iface->get_address = sensor_i2c_proxy_get_address;
8016}
8017
8018/**
8019 * sensor_i2c_proxy_new:
8020 * @connection: A #GDBusConnection.
8021 * @flags: Flags from the #GDBusProxyFlags enumeration.
8022 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8023 * @object_path: An object path.
8024 * @cancellable: (allow-none): A #GCancellable or %NULL.
8025 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8026 * @user_data: User data to pass to @callback.
8027 *
8028 * 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.
8029 *
8030 * 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.
8031 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8032 *
8033 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8034 */
8035void
8036sensor_i2c_proxy_new (
8037 GDBusConnection *connection,
8038 GDBusProxyFlags flags,
8039 const gchar *name,
8040 const gchar *object_path,
8041 GCancellable *cancellable,
8042 GAsyncReadyCallback callback,
8043 gpointer user_data)
8044{
8045 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);
8046}
8047
8048/**
8049 * sensor_i2c_proxy_new_finish:
8050 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8051 * @error: Return location for error or %NULL
8052 *
8053 * Finishes an operation started with sensor_i2c_proxy_new().
8054 *
8055 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8056 */
8057SensorI2c *
8058sensor_i2c_proxy_new_finish (
8059 GAsyncResult *res,
8060 GError **error)
8061{
8062 GObject *ret;
8063 GObject *source_object;
8064 source_object = g_async_result_get_source_object (res);
8065 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8066 g_object_unref (source_object);
8067 if (ret != NULL)
8068 return SENSOR_I2C (ret);
8069 else
8070 return NULL;
8071}
8072
8073/**
8074 * sensor_i2c_proxy_new_sync:
8075 * @connection: A #GDBusConnection.
8076 * @flags: Flags from the #GDBusProxyFlags enumeration.
8077 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8078 * @object_path: An object path.
8079 * @cancellable: (allow-none): A #GCancellable or %NULL.
8080 * @error: Return location for error or %NULL
8081 *
8082 * 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.
8083 *
8084 * The calling thread is blocked until a reply is received.
8085 *
8086 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8087 *
8088 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8089 */
8090SensorI2c *
8091sensor_i2c_proxy_new_sync (
8092 GDBusConnection *connection,
8093 GDBusProxyFlags flags,
8094 const gchar *name,
8095 const gchar *object_path,
8096 GCancellable *cancellable,
8097 GError **error)
8098{
8099 GInitable *ret;
8100 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);
8101 if (ret != NULL)
8102 return SENSOR_I2C (ret);
8103 else
8104 return NULL;
8105}
8106
8107
8108/**
8109 * sensor_i2c_proxy_new_for_bus:
8110 * @bus_type: A #GBusType.
8111 * @flags: Flags from the #GDBusProxyFlags enumeration.
8112 * @name: A bus name (well-known or unique).
8113 * @object_path: An object path.
8114 * @cancellable: (allow-none): A #GCancellable or %NULL.
8115 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8116 * @user_data: User data to pass to @callback.
8117 *
8118 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8119 *
8120 * 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.
8121 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8122 *
8123 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8124 */
8125void
8126sensor_i2c_proxy_new_for_bus (
8127 GBusType bus_type,
8128 GDBusProxyFlags flags,
8129 const gchar *name,
8130 const gchar *object_path,
8131 GCancellable *cancellable,
8132 GAsyncReadyCallback callback,
8133 gpointer user_data)
8134{
8135 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);
8136}
8137
8138/**
8139 * sensor_i2c_proxy_new_for_bus_finish:
8140 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8141 * @error: Return location for error or %NULL
8142 *
8143 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8144 *
8145 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8146 */
8147SensorI2c *
8148sensor_i2c_proxy_new_for_bus_finish (
8149 GAsyncResult *res,
8150 GError **error)
8151{
8152 GObject *ret;
8153 GObject *source_object;
8154 source_object = g_async_result_get_source_object (res);
8155 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8156 g_object_unref (source_object);
8157 if (ret != NULL)
8158 return SENSOR_I2C (ret);
8159 else
8160 return NULL;
8161}
8162
8163/**
8164 * sensor_i2c_proxy_new_for_bus_sync:
8165 * @bus_type: A #GBusType.
8166 * @flags: Flags from the #GDBusProxyFlags enumeration.
8167 * @name: A bus name (well-known or unique).
8168 * @object_path: An object path.
8169 * @cancellable: (allow-none): A #GCancellable or %NULL.
8170 * @error: Return location for error or %NULL
8171 *
8172 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8173 *
8174 * The calling thread is blocked until a reply is received.
8175 *
8176 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8177 *
8178 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8179 */
8180SensorI2c *
8181sensor_i2c_proxy_new_for_bus_sync (
8182 GBusType bus_type,
8183 GDBusProxyFlags flags,
8184 const gchar *name,
8185 const gchar *object_path,
8186 GCancellable *cancellable,
8187 GError **error)
8188{
8189 GInitable *ret;
8190 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);
8191 if (ret != NULL)
8192 return SENSOR_I2C (ret);
8193 else
8194 return NULL;
8195}
8196
8197
8198/* ------------------------------------------------------------------------ */
8199
8200/**
8201 * SensorI2cSkeleton:
8202 *
8203 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8204 */
8205
8206/**
8207 * SensorI2cSkeletonClass:
8208 * @parent_class: The parent class.
8209 *
8210 * Class structure for #SensorI2cSkeleton.
8211 */
8212
8213struct _SensorI2cSkeletonPrivate
8214{
8215 GValue *properties;
8216 GList *changed_properties;
8217 GSource *changed_properties_idle_source;
8218 GMainContext *context;
8219 GMutex lock;
8220};
8221
8222static void
8223_sensor_i2c_skeleton_handle_method_call (
8224 GDBusConnection *connection G_GNUC_UNUSED,
8225 const gchar *sender G_GNUC_UNUSED,
8226 const gchar *object_path G_GNUC_UNUSED,
8227 const gchar *interface_name,
8228 const gchar *method_name,
8229 GVariant *parameters,
8230 GDBusMethodInvocation *invocation,
8231 gpointer user_data)
8232{
8233 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8234 _ExtendedGDBusMethodInfo *info;
8235 GVariantIter iter;
8236 GVariant *child;
8237 GValue *paramv;
8238 guint num_params;
8239 guint num_extra;
8240 guint n;
8241 guint signal_id;
8242 GValue return_value = G_VALUE_INIT;
8243 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8244 g_assert (info != NULL);
8245 num_params = g_variant_n_children (parameters);
8246 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8247 n = 0;
8248 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8249 g_value_set_object (&paramv[n++], skeleton);
8250 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8251 g_value_set_object (&paramv[n++], invocation);
8252 if (info->pass_fdlist)
8253 {
8254#ifdef G_OS_UNIX
8255 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8256 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8257#else
8258 g_assert_not_reached ();
8259#endif
8260 }
8261 g_variant_iter_init (&iter, parameters);
8262 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8263 {
8264 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8265 if (arg_info->use_gvariant)
8266 {
8267 g_value_init (&paramv[n], G_TYPE_VARIANT);
8268 g_value_set_variant (&paramv[n], child);
8269 n++;
8270 }
8271 else
8272 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8273 g_variant_unref (child);
8274 }
8275 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8276 g_value_init (&return_value, G_TYPE_BOOLEAN);
8277 g_signal_emitv (paramv, signal_id, 0, &return_value);
8278 if (!g_value_get_boolean (&return_value))
8279 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);
8280 g_value_unset (&return_value);
8281 for (n = 0; n < num_params + num_extra; n++)
8282 g_value_unset (&paramv[n]);
8283 g_free (paramv);
8284}
8285
8286static GVariant *
8287_sensor_i2c_skeleton_handle_get_property (
8288 GDBusConnection *connection G_GNUC_UNUSED,
8289 const gchar *sender G_GNUC_UNUSED,
8290 const gchar *object_path G_GNUC_UNUSED,
8291 const gchar *interface_name G_GNUC_UNUSED,
8292 const gchar *property_name,
8293 GError **error,
8294 gpointer user_data)
8295{
8296 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8297 GValue value = G_VALUE_INIT;
8298 GParamSpec *pspec;
8299 _ExtendedGDBusPropertyInfo *info;
8300 GVariant *ret;
8301 ret = NULL;
8302 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8303 g_assert (info != NULL);
8304 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8305 if (pspec == NULL)
8306 {
8307 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8308 }
8309 else
8310 {
8311 g_value_init (&value, pspec->value_type);
8312 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8313 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8314 g_value_unset (&value);
8315 }
8316 return ret;
8317}
8318
8319static gboolean
8320_sensor_i2c_skeleton_handle_set_property (
8321 GDBusConnection *connection G_GNUC_UNUSED,
8322 const gchar *sender G_GNUC_UNUSED,
8323 const gchar *object_path G_GNUC_UNUSED,
8324 const gchar *interface_name G_GNUC_UNUSED,
8325 const gchar *property_name,
8326 GVariant *variant,
8327 GError **error,
8328 gpointer user_data)
8329{
8330 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8331 GValue value = G_VALUE_INIT;
8332 GParamSpec *pspec;
8333 _ExtendedGDBusPropertyInfo *info;
8334 gboolean ret;
8335 ret = FALSE;
8336 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8337 g_assert (info != NULL);
8338 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8339 if (pspec == NULL)
8340 {
8341 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8342 }
8343 else
8344 {
8345 if (info->use_gvariant)
8346 g_value_set_variant (&value, variant);
8347 else
8348 g_dbus_gvariant_to_gvalue (variant, &value);
8349 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8350 g_value_unset (&value);
8351 ret = TRUE;
8352 }
8353 return ret;
8354}
8355
8356static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8357{
8358 _sensor_i2c_skeleton_handle_method_call,
8359 _sensor_i2c_skeleton_handle_get_property,
8360 _sensor_i2c_skeleton_handle_set_property,
8361 {NULL}
8362};
8363
8364static GDBusInterfaceInfo *
8365sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8366{
8367 return sensor_i2c_interface_info ();
8368}
8369
8370static GDBusInterfaceVTable *
8371sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8372{
8373 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8374}
8375
8376static GVariant *
8377sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8378{
8379 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8380
8381 GVariantBuilder builder;
8382 guint n;
8383 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8384 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8385 goto out;
8386 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8387 {
8388 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8389 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8390 {
8391 GVariant *value;
8392 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);
8393 if (value != NULL)
8394 {
8395 g_variant_take_ref (value);
8396 g_variant_builder_add (&builder, "{sv}", info->name, value);
8397 g_variant_unref (value);
8398 }
8399 }
8400 }
8401out:
8402 return g_variant_builder_end (&builder);
8403}
8404
8405static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8406
8407static void
8408sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8409{
8410 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8411 gboolean emit_changed = FALSE;
8412
8413 g_mutex_lock (&skeleton->priv->lock);
8414 if (skeleton->priv->changed_properties_idle_source != NULL)
8415 {
8416 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8417 skeleton->priv->changed_properties_idle_source = NULL;
8418 emit_changed = TRUE;
8419 }
8420 g_mutex_unlock (&skeleton->priv->lock);
8421
8422 if (emit_changed)
8423 _sensor_i2c_emit_changed (skeleton);
8424}
8425
8426static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8427#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8428G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8429 G_ADD_PRIVATE (SensorI2cSkeleton)
8430 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8431
8432#else
8433G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8434 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8435
8436#endif
8437static void
8438sensor_i2c_skeleton_finalize (GObject *object)
8439{
8440 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8441 guint n;
8442 for (n = 0; n < 2; n++)
8443 g_value_unset (&skeleton->priv->properties[n]);
8444 g_free (skeleton->priv->properties);
8445 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8446 if (skeleton->priv->changed_properties_idle_source != NULL)
8447 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8448 g_main_context_unref (skeleton->priv->context);
8449 g_mutex_clear (&skeleton->priv->lock);
8450 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8451}
8452
8453static void
8454sensor_i2c_skeleton_get_property (GObject *object,
8455 guint prop_id,
8456 GValue *value,
8457 GParamSpec *pspec G_GNUC_UNUSED)
8458{
8459 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8460 g_assert (prop_id != 0 && prop_id - 1 < 2);
8461 g_mutex_lock (&skeleton->priv->lock);
8462 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8463 g_mutex_unlock (&skeleton->priv->lock);
8464}
8465
8466static gboolean
8467_sensor_i2c_emit_changed (gpointer user_data)
8468{
8469 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8470 GList *l;
8471 GVariantBuilder builder;
8472 GVariantBuilder invalidated_builder;
8473 guint num_changes;
8474
8475 g_mutex_lock (&skeleton->priv->lock);
8476 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8477 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8478 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8479 {
8480 ChangedProperty *cp = l->data;
8481 GVariant *variant;
8482 const GValue *cur_value;
8483
8484 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8485 if (!_g_value_equal (cur_value, &cp->orig_value))
8486 {
8487 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8488 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8489 g_variant_unref (variant);
8490 num_changes++;
8491 }
8492 }
8493 if (num_changes > 0)
8494 {
8495 GList *connections, *ll;
8496 GVariant *signal_variant;
8497 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8498 &builder, &invalidated_builder));
8499 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8500 for (ll = connections; ll != NULL; ll = ll->next)
8501 {
8502 GDBusConnection *connection = ll->data;
8503
8504 g_dbus_connection_emit_signal (connection,
8505 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8506 "org.freedesktop.DBus.Properties",
8507 "PropertiesChanged",
8508 signal_variant,
8509 NULL);
8510 }
8511 g_variant_unref (signal_variant);
8512 g_list_free_full (connections, g_object_unref);
8513 }
8514 else
8515 {
8516 g_variant_builder_clear (&builder);
8517 g_variant_builder_clear (&invalidated_builder);
8518 }
8519 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8520 skeleton->priv->changed_properties = NULL;
8521 skeleton->priv->changed_properties_idle_source = NULL;
8522 g_mutex_unlock (&skeleton->priv->lock);
8523 return FALSE;
8524}
8525
8526static void
8527_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8528{
8529 ChangedProperty *cp;
8530 GList *l;
8531 cp = NULL;
8532 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8533 {
8534 ChangedProperty *i_cp = l->data;
8535 if (i_cp->info == info)
8536 {
8537 cp = i_cp;
8538 break;
8539 }
8540 }
8541 if (cp == NULL)
8542 {
8543 cp = g_new0 (ChangedProperty, 1);
8544 cp->prop_id = prop_id;
8545 cp->info = info;
8546 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8547 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8548 g_value_copy (orig_value, &cp->orig_value);
8549 }
8550}
8551
8552static void
8553sensor_i2c_skeleton_notify (GObject *object,
8554 GParamSpec *pspec G_GNUC_UNUSED)
8555{
8556 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8557 g_mutex_lock (&skeleton->priv->lock);
8558 if (skeleton->priv->changed_properties != NULL &&
8559 skeleton->priv->changed_properties_idle_source == NULL)
8560 {
8561 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8562 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8563 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8564 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8565 g_source_unref (skeleton->priv->changed_properties_idle_source);
8566 }
8567 g_mutex_unlock (&skeleton->priv->lock);
8568}
8569
8570static void
8571sensor_i2c_skeleton_set_property (GObject *object,
8572 guint prop_id,
8573 const GValue *value,
8574 GParamSpec *pspec)
8575{
8576 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8577 g_assert (prop_id != 0 && prop_id - 1 < 2);
8578 g_mutex_lock (&skeleton->priv->lock);
8579 g_object_freeze_notify (object);
8580 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8581 {
8582 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8583 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8584 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8585 g_object_notify_by_pspec (object, pspec);
8586 }
8587 g_mutex_unlock (&skeleton->priv->lock);
8588 g_object_thaw_notify (object);
8589}
8590
8591static void
8592sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8593{
8594#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8595 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8596#else
8597 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8598#endif
8599
8600 g_mutex_init (&skeleton->priv->lock);
8601 skeleton->priv->context = g_main_context_ref_thread_default ();
8602 skeleton->priv->properties = g_new0 (GValue, 2);
8603 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8604 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8605}
8606
8607static const gchar *
8608sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8609{
8610 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8611 const gchar *value;
8612 g_mutex_lock (&skeleton->priv->lock);
8613 value = g_value_get_string (&(skeleton->priv->properties[0]));
8614 g_mutex_unlock (&skeleton->priv->lock);
8615 return value;
8616}
8617
8618static const gchar *
8619sensor_i2c_skeleton_get_address (SensorI2c *object)
8620{
8621 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8622 const gchar *value;
8623 g_mutex_lock (&skeleton->priv->lock);
8624 value = g_value_get_string (&(skeleton->priv->properties[1]));
8625 g_mutex_unlock (&skeleton->priv->lock);
8626 return value;
8627}
8628
8629static void
8630sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8631{
8632 GObjectClass *gobject_class;
8633 GDBusInterfaceSkeletonClass *skeleton_class;
8634
8635 gobject_class = G_OBJECT_CLASS (klass);
8636 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8637 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8638 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8639 gobject_class->notify = sensor_i2c_skeleton_notify;
8640
8641
8642 sensor_i2c_override_properties (gobject_class, 1);
8643
8644 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8645 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8646 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8647 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8648 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8649
8650#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8651 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8652#endif
8653}
8654
8655static void
8656sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8657{
8658 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8659 iface->get_address = sensor_i2c_skeleton_get_address;
8660}
8661
8662/**
8663 * sensor_i2c_skeleton_new:
8664 *
8665 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8666 *
8667 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8668 */
8669SensorI2c *
8670sensor_i2c_skeleton_new (void)
8671{
8672 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8673}
8674
8675/* ------------------------------------------------------------------------
8676 * Code for interface org.openbmc.SensorMatch
8677 * ------------------------------------------------------------------------
8678 */
8679
8680/**
8681 * SECTION:SensorMatch
8682 * @title: SensorMatch
8683 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8684 *
8685 * 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.
8686 */
8687
8688/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8689
8690static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8691{
8692 {
8693 -1,
8694 (gchar *) "state",
8695 (gchar *) "y",
8696 NULL
8697 },
8698 FALSE
8699};
8700
8701static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8702{
8703 &_sensor_match_signal_info_sensor_match_ARG_state,
8704 NULL
8705};
8706
8707static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8708{
8709 {
8710 -1,
8711 (gchar *) "SensorMatch",
8712 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8713 NULL
8714 },
8715 "sensor-match"
8716};
8717
8718static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8719{
8720 &_sensor_match_signal_info_sensor_match,
8721 NULL
8722};
8723
8724static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8725{
8726 {
8727 -1,
8728 (gchar *) "match_value",
8729 (gchar *) "v",
8730 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8731 NULL
8732 },
8733 "match-value",
8734 FALSE
8735};
8736
8737static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8738{
8739 {
8740 -1,
8741 (gchar *) "state",
8742 (gchar *) "y",
8743 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8744 NULL
8745 },
8746 "state",
8747 FALSE
8748};
8749
8750static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8751{
8752 &_sensor_match_property_info_match_value,
8753 &_sensor_match_property_info_state,
8754 NULL
8755};
8756
8757static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8758{
8759 {
8760 -1,
8761 (gchar *) "org.openbmc.SensorMatch",
8762 NULL,
8763 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8764 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8765 NULL
8766 },
8767 "sensor-match",
8768};
8769
8770
8771/**
8772 * sensor_match_interface_info:
8773 *
8774 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8775 *
8776 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8777 */
8778GDBusInterfaceInfo *
8779sensor_match_interface_info (void)
8780{
8781 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8782}
8783
8784/**
8785 * sensor_match_override_properties:
8786 * @klass: The class structure for a #GObject<!-- -->-derived class.
8787 * @property_id_begin: The property id to assign to the first overridden property.
8788 *
8789 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8790 * The properties are overridden in the order they are defined.
8791 *
8792 * Returns: The last property id.
8793 */
8794guint
8795sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8796{
8797 g_object_class_override_property (klass, property_id_begin++, "match-value");
8798 g_object_class_override_property (klass, property_id_begin++, "state");
8799 return property_id_begin - 1;
8800}
8801
8802
8803
8804/**
8805 * SensorMatch:
8806 *
8807 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8808 */
8809
8810/**
8811 * SensorMatchIface:
8812 * @parent_iface: The parent interface.
8813 * @get_match_value: Getter for the #SensorMatch:match-value property.
8814 * @get_state: Getter for the #SensorMatch:state property.
8815 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8816 *
8817 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8818 */
8819
8820typedef SensorMatchIface SensorMatchInterface;
8821G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8822
8823static void
8824sensor_match_default_init (SensorMatchIface *iface)
8825{
8826 /* GObject signals for received D-Bus signals: */
8827 /**
8828 * SensorMatch::sensor-match:
8829 * @object: A #SensorMatch.
8830 * @arg_state: Argument.
8831 *
8832 * 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.
8833 *
8834 * 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.
8835 */
8836 g_signal_new ("sensor-match",
8837 G_TYPE_FROM_INTERFACE (iface),
8838 G_SIGNAL_RUN_LAST,
8839 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
8840 NULL,
8841 NULL,
8842 g_cclosure_marshal_generic,
8843 G_TYPE_NONE,
8844 1, G_TYPE_UCHAR);
8845
8846 /* GObject properties for D-Bus properties: */
8847 /**
8848 * SensorMatch:match-value:
8849 *
8850 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
8851 *
8852 * 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.
8853 */
8854 g_object_interface_install_property (iface,
8855 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8856 /**
8857 * SensorMatch:state:
8858 *
8859 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
8860 *
8861 * 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.
8862 */
8863 g_object_interface_install_property (iface,
8864 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8865}
8866
8867/**
8868 * sensor_match_get_match_value: (skip)
8869 * @object: A #SensorMatch.
8870 *
8871 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8872 *
8873 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8874 *
8875 * <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>
8876 *
8877 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8878 */
8879GVariant *
8880sensor_match_get_match_value (SensorMatch *object)
8881{
8882 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
8883}
8884
8885/**
8886 * sensor_match_dup_match_value: (skip)
8887 * @object: A #SensorMatch.
8888 *
8889 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8890 *
8891 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8892 *
8893 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
8894 */
8895GVariant *
8896sensor_match_dup_match_value (SensorMatch *object)
8897{
8898 GVariant *value;
8899 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
8900 return value;
8901}
8902
8903/**
8904 * sensor_match_set_match_value: (skip)
8905 * @object: A #SensorMatch.
8906 * @value: The value to set.
8907 *
8908 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
8909 *
8910 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8911 */
8912void
8913sensor_match_set_match_value (SensorMatch *object, GVariant *value)
8914{
8915 g_object_set (G_OBJECT (object), "match-value", value, NULL);
8916}
8917
8918/**
8919 * sensor_match_get_state: (skip)
8920 * @object: A #SensorMatch.
8921 *
8922 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
8923 *
8924 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8925 *
8926 * Returns: The property value.
8927 */
8928guchar
8929sensor_match_get_state (SensorMatch *object)
8930{
8931 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
8932}
8933
8934/**
8935 * sensor_match_set_state: (skip)
8936 * @object: A #SensorMatch.
8937 * @value: The value to set.
8938 *
8939 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
8940 *
8941 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8942 */
8943void
8944sensor_match_set_state (SensorMatch *object, guchar value)
8945{
8946 g_object_set (G_OBJECT (object), "state", value, NULL);
8947}
8948
8949/**
8950 * sensor_match_emit_sensor_match:
8951 * @object: A #SensorMatch.
8952 * @arg_state: Argument to pass with the signal.
8953 *
8954 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
8955 */
8956void
8957sensor_match_emit_sensor_match (
8958 SensorMatch *object,
8959 guchar arg_state)
8960{
8961 g_signal_emit_by_name (object, "sensor-match", arg_state);
8962}
8963
8964/* ------------------------------------------------------------------------ */
8965
8966/**
8967 * SensorMatchProxy:
8968 *
8969 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
8970 */
8971
8972/**
8973 * SensorMatchProxyClass:
8974 * @parent_class: The parent class.
8975 *
8976 * Class structure for #SensorMatchProxy.
8977 */
8978
8979struct _SensorMatchProxyPrivate
8980{
8981 GData *qdata;
8982};
8983
8984static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
8985
8986#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8987G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8988 G_ADD_PRIVATE (SensorMatchProxy)
8989 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8990
8991#else
8992G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8993 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8994
8995#endif
8996static void
8997sensor_match_proxy_finalize (GObject *object)
8998{
8999 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9000 g_datalist_clear (&proxy->priv->qdata);
9001 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9002}
9003
9004static void
9005sensor_match_proxy_get_property (GObject *object,
9006 guint prop_id,
9007 GValue *value,
9008 GParamSpec *pspec G_GNUC_UNUSED)
9009{
9010 const _ExtendedGDBusPropertyInfo *info;
9011 GVariant *variant;
9012 g_assert (prop_id != 0 && prop_id - 1 < 2);
9013 info = _sensor_match_property_info_pointers[prop_id - 1];
9014 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9015 if (info->use_gvariant)
9016 {
9017 g_value_set_variant (value, variant);
9018 }
9019 else
9020 {
9021 if (variant != NULL)
9022 g_dbus_gvariant_to_gvalue (variant, value);
9023 }
9024 if (variant != NULL)
9025 g_variant_unref (variant);
9026}
9027
9028static void
9029sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9030 GAsyncResult *res,
9031 gpointer user_data)
9032{
9033 const _ExtendedGDBusPropertyInfo *info = user_data;
9034 GError *error;
9035 GVariant *_ret;
9036 error = NULL;
9037 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9038 if (!_ret)
9039 {
9040 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9041 info->parent_struct.name,
9042 error->message, g_quark_to_string (error->domain), error->code);
9043 g_error_free (error);
9044 }
9045 else
9046 {
9047 g_variant_unref (_ret);
9048 }
9049}
9050
9051static void
9052sensor_match_proxy_set_property (GObject *object,
9053 guint prop_id,
9054 const GValue *value,
9055 GParamSpec *pspec G_GNUC_UNUSED)
9056{
9057 const _ExtendedGDBusPropertyInfo *info;
9058 GVariant *variant;
9059 g_assert (prop_id != 0 && prop_id - 1 < 2);
9060 info = _sensor_match_property_info_pointers[prop_id - 1];
9061 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9062 g_dbus_proxy_call (G_DBUS_PROXY (object),
9063 "org.freedesktop.DBus.Properties.Set",
9064 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9065 G_DBUS_CALL_FLAGS_NONE,
9066 -1,
9067 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9068 g_variant_unref (variant);
9069}
9070
9071static void
9072sensor_match_proxy_g_signal (GDBusProxy *proxy,
9073 const gchar *sender_name G_GNUC_UNUSED,
9074 const gchar *signal_name,
9075 GVariant *parameters)
9076{
9077 _ExtendedGDBusSignalInfo *info;
9078 GVariantIter iter;
9079 GVariant *child;
9080 GValue *paramv;
9081 guint num_params;
9082 guint n;
9083 guint signal_id;
9084 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9085 if (info == NULL)
9086 return;
9087 num_params = g_variant_n_children (parameters);
9088 paramv = g_new0 (GValue, num_params + 1);
9089 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9090 g_value_set_object (&paramv[0], proxy);
9091 g_variant_iter_init (&iter, parameters);
9092 n = 1;
9093 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9094 {
9095 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9096 if (arg_info->use_gvariant)
9097 {
9098 g_value_init (&paramv[n], G_TYPE_VARIANT);
9099 g_value_set_variant (&paramv[n], child);
9100 n++;
9101 }
9102 else
9103 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9104 g_variant_unref (child);
9105 }
9106 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9107 g_signal_emitv (paramv, signal_id, 0, NULL);
9108 for (n = 0; n < num_params + 1; n++)
9109 g_value_unset (&paramv[n]);
9110 g_free (paramv);
9111}
9112
9113static void
9114sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9115 GVariant *changed_properties,
9116 const gchar *const *invalidated_properties)
9117{
9118 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9119 guint n;
9120 const gchar *key;
9121 GVariantIter *iter;
9122 _ExtendedGDBusPropertyInfo *info;
9123 g_variant_get (changed_properties, "a{sv}", &iter);
9124 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9125 {
9126 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9127 g_datalist_remove_data (&proxy->priv->qdata, key);
9128 if (info != NULL)
9129 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9130 }
9131 g_variant_iter_free (iter);
9132 for (n = 0; invalidated_properties[n] != NULL; n++)
9133 {
9134 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9135 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9136 if (info != NULL)
9137 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9138 }
9139}
9140
9141static GVariant *
9142sensor_match_proxy_get_match_value (SensorMatch *object)
9143{
9144 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9145 GVariant *variant;
9146 GVariant *value = NULL;
9147 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9148 value = variant;
9149 if (variant != NULL)
9150 g_variant_unref (variant);
9151 return value;
9152}
9153
9154static guchar
9155sensor_match_proxy_get_state (SensorMatch *object)
9156{
9157 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9158 GVariant *variant;
9159 guchar value = 0;
9160 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9161 if (variant != NULL)
9162 {
9163 value = g_variant_get_byte (variant);
9164 g_variant_unref (variant);
9165 }
9166 return value;
9167}
9168
9169static void
9170sensor_match_proxy_init (SensorMatchProxy *proxy)
9171{
9172#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9173 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9174#else
9175 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9176#endif
9177
9178 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9179}
9180
9181static void
9182sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9183{
9184 GObjectClass *gobject_class;
9185 GDBusProxyClass *proxy_class;
9186
9187 gobject_class = G_OBJECT_CLASS (klass);
9188 gobject_class->finalize = sensor_match_proxy_finalize;
9189 gobject_class->get_property = sensor_match_proxy_get_property;
9190 gobject_class->set_property = sensor_match_proxy_set_property;
9191
9192 proxy_class = G_DBUS_PROXY_CLASS (klass);
9193 proxy_class->g_signal = sensor_match_proxy_g_signal;
9194 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9195
9196 sensor_match_override_properties (gobject_class, 1);
9197
9198#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9199 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9200#endif
9201}
9202
9203static void
9204sensor_match_proxy_iface_init (SensorMatchIface *iface)
9205{
9206 iface->get_match_value = sensor_match_proxy_get_match_value;
9207 iface->get_state = sensor_match_proxy_get_state;
9208}
9209
9210/**
9211 * sensor_match_proxy_new:
9212 * @connection: A #GDBusConnection.
9213 * @flags: Flags from the #GDBusProxyFlags enumeration.
9214 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9215 * @object_path: An object path.
9216 * @cancellable: (allow-none): A #GCancellable or %NULL.
9217 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9218 * @user_data: User data to pass to @callback.
9219 *
9220 * 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.
9221 *
9222 * 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.
9223 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9224 *
9225 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9226 */
9227void
9228sensor_match_proxy_new (
9229 GDBusConnection *connection,
9230 GDBusProxyFlags flags,
9231 const gchar *name,
9232 const gchar *object_path,
9233 GCancellable *cancellable,
9234 GAsyncReadyCallback callback,
9235 gpointer user_data)
9236{
9237 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);
9238}
9239
9240/**
9241 * sensor_match_proxy_new_finish:
9242 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9243 * @error: Return location for error or %NULL
9244 *
9245 * Finishes an operation started with sensor_match_proxy_new().
9246 *
9247 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9248 */
9249SensorMatch *
9250sensor_match_proxy_new_finish (
9251 GAsyncResult *res,
9252 GError **error)
9253{
9254 GObject *ret;
9255 GObject *source_object;
9256 source_object = g_async_result_get_source_object (res);
9257 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9258 g_object_unref (source_object);
9259 if (ret != NULL)
9260 return SENSOR_MATCH (ret);
9261 else
9262 return NULL;
9263}
9264
9265/**
9266 * sensor_match_proxy_new_sync:
9267 * @connection: A #GDBusConnection.
9268 * @flags: Flags from the #GDBusProxyFlags enumeration.
9269 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9270 * @object_path: An object path.
9271 * @cancellable: (allow-none): A #GCancellable or %NULL.
9272 * @error: Return location for error or %NULL
9273 *
9274 * 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.
9275 *
9276 * The calling thread is blocked until a reply is received.
9277 *
9278 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9279 *
9280 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9281 */
9282SensorMatch *
9283sensor_match_proxy_new_sync (
9284 GDBusConnection *connection,
9285 GDBusProxyFlags flags,
9286 const gchar *name,
9287 const gchar *object_path,
9288 GCancellable *cancellable,
9289 GError **error)
9290{
9291 GInitable *ret;
9292 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);
9293 if (ret != NULL)
9294 return SENSOR_MATCH (ret);
9295 else
9296 return NULL;
9297}
9298
9299
9300/**
9301 * sensor_match_proxy_new_for_bus:
9302 * @bus_type: A #GBusType.
9303 * @flags: Flags from the #GDBusProxyFlags enumeration.
9304 * @name: A bus name (well-known or unique).
9305 * @object_path: An object path.
9306 * @cancellable: (allow-none): A #GCancellable or %NULL.
9307 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9308 * @user_data: User data to pass to @callback.
9309 *
9310 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9311 *
9312 * 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.
9313 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9314 *
9315 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9316 */
9317void
9318sensor_match_proxy_new_for_bus (
9319 GBusType bus_type,
9320 GDBusProxyFlags flags,
9321 const gchar *name,
9322 const gchar *object_path,
9323 GCancellable *cancellable,
9324 GAsyncReadyCallback callback,
9325 gpointer user_data)
9326{
9327 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);
9328}
9329
9330/**
9331 * sensor_match_proxy_new_for_bus_finish:
9332 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9333 * @error: Return location for error or %NULL
9334 *
9335 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9336 *
9337 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9338 */
9339SensorMatch *
9340sensor_match_proxy_new_for_bus_finish (
9341 GAsyncResult *res,
9342 GError **error)
9343{
9344 GObject *ret;
9345 GObject *source_object;
9346 source_object = g_async_result_get_source_object (res);
9347 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9348 g_object_unref (source_object);
9349 if (ret != NULL)
9350 return SENSOR_MATCH (ret);
9351 else
9352 return NULL;
9353}
9354
9355/**
9356 * sensor_match_proxy_new_for_bus_sync:
9357 * @bus_type: A #GBusType.
9358 * @flags: Flags from the #GDBusProxyFlags enumeration.
9359 * @name: A bus name (well-known or unique).
9360 * @object_path: An object path.
9361 * @cancellable: (allow-none): A #GCancellable or %NULL.
9362 * @error: Return location for error or %NULL
9363 *
9364 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9365 *
9366 * The calling thread is blocked until a reply is received.
9367 *
9368 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9369 *
9370 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9371 */
9372SensorMatch *
9373sensor_match_proxy_new_for_bus_sync (
9374 GBusType bus_type,
9375 GDBusProxyFlags flags,
9376 const gchar *name,
9377 const gchar *object_path,
9378 GCancellable *cancellable,
9379 GError **error)
9380{
9381 GInitable *ret;
9382 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);
9383 if (ret != NULL)
9384 return SENSOR_MATCH (ret);
9385 else
9386 return NULL;
9387}
9388
9389
9390/* ------------------------------------------------------------------------ */
9391
9392/**
9393 * SensorMatchSkeleton:
9394 *
9395 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9396 */
9397
9398/**
9399 * SensorMatchSkeletonClass:
9400 * @parent_class: The parent class.
9401 *
9402 * Class structure for #SensorMatchSkeleton.
9403 */
9404
9405struct _SensorMatchSkeletonPrivate
9406{
9407 GValue *properties;
9408 GList *changed_properties;
9409 GSource *changed_properties_idle_source;
9410 GMainContext *context;
9411 GMutex lock;
9412};
9413
9414static void
9415_sensor_match_skeleton_handle_method_call (
9416 GDBusConnection *connection G_GNUC_UNUSED,
9417 const gchar *sender G_GNUC_UNUSED,
9418 const gchar *object_path G_GNUC_UNUSED,
9419 const gchar *interface_name,
9420 const gchar *method_name,
9421 GVariant *parameters,
9422 GDBusMethodInvocation *invocation,
9423 gpointer user_data)
9424{
9425 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9426 _ExtendedGDBusMethodInfo *info;
9427 GVariantIter iter;
9428 GVariant *child;
9429 GValue *paramv;
9430 guint num_params;
9431 guint num_extra;
9432 guint n;
9433 guint signal_id;
9434 GValue return_value = G_VALUE_INIT;
9435 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9436 g_assert (info != NULL);
9437 num_params = g_variant_n_children (parameters);
9438 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9439 n = 0;
9440 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9441 g_value_set_object (&paramv[n++], skeleton);
9442 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9443 g_value_set_object (&paramv[n++], invocation);
9444 if (info->pass_fdlist)
9445 {
9446#ifdef G_OS_UNIX
9447 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9448 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9449#else
9450 g_assert_not_reached ();
9451#endif
9452 }
9453 g_variant_iter_init (&iter, parameters);
9454 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9455 {
9456 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9457 if (arg_info->use_gvariant)
9458 {
9459 g_value_init (&paramv[n], G_TYPE_VARIANT);
9460 g_value_set_variant (&paramv[n], child);
9461 n++;
9462 }
9463 else
9464 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9465 g_variant_unref (child);
9466 }
9467 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9468 g_value_init (&return_value, G_TYPE_BOOLEAN);
9469 g_signal_emitv (paramv, signal_id, 0, &return_value);
9470 if (!g_value_get_boolean (&return_value))
9471 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);
9472 g_value_unset (&return_value);
9473 for (n = 0; n < num_params + num_extra; n++)
9474 g_value_unset (&paramv[n]);
9475 g_free (paramv);
9476}
9477
9478static GVariant *
9479_sensor_match_skeleton_handle_get_property (
9480 GDBusConnection *connection G_GNUC_UNUSED,
9481 const gchar *sender G_GNUC_UNUSED,
9482 const gchar *object_path G_GNUC_UNUSED,
9483 const gchar *interface_name G_GNUC_UNUSED,
9484 const gchar *property_name,
9485 GError **error,
9486 gpointer user_data)
9487{
9488 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9489 GValue value = G_VALUE_INIT;
9490 GParamSpec *pspec;
9491 _ExtendedGDBusPropertyInfo *info;
9492 GVariant *ret;
9493 ret = NULL;
9494 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9495 g_assert (info != NULL);
9496 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9497 if (pspec == NULL)
9498 {
9499 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9500 }
9501 else
9502 {
9503 g_value_init (&value, pspec->value_type);
9504 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9505 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9506 g_value_unset (&value);
9507 }
9508 return ret;
9509}
9510
9511static gboolean
9512_sensor_match_skeleton_handle_set_property (
9513 GDBusConnection *connection G_GNUC_UNUSED,
9514 const gchar *sender G_GNUC_UNUSED,
9515 const gchar *object_path G_GNUC_UNUSED,
9516 const gchar *interface_name G_GNUC_UNUSED,
9517 const gchar *property_name,
9518 GVariant *variant,
9519 GError **error,
9520 gpointer user_data)
9521{
9522 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9523 GValue value = G_VALUE_INIT;
9524 GParamSpec *pspec;
9525 _ExtendedGDBusPropertyInfo *info;
9526 gboolean ret;
9527 ret = FALSE;
9528 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9529 g_assert (info != NULL);
9530 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9531 if (pspec == NULL)
9532 {
9533 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9534 }
9535 else
9536 {
9537 if (info->use_gvariant)
9538 g_value_set_variant (&value, variant);
9539 else
9540 g_dbus_gvariant_to_gvalue (variant, &value);
9541 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9542 g_value_unset (&value);
9543 ret = TRUE;
9544 }
9545 return ret;
9546}
9547
9548static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9549{
9550 _sensor_match_skeleton_handle_method_call,
9551 _sensor_match_skeleton_handle_get_property,
9552 _sensor_match_skeleton_handle_set_property,
9553 {NULL}
9554};
9555
9556static GDBusInterfaceInfo *
9557sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9558{
9559 return sensor_match_interface_info ();
9560}
9561
9562static GDBusInterfaceVTable *
9563sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9564{
9565 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9566}
9567
9568static GVariant *
9569sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9570{
9571 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9572
9573 GVariantBuilder builder;
9574 guint n;
9575 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9576 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9577 goto out;
9578 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9579 {
9580 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9581 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9582 {
9583 GVariant *value;
9584 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);
9585 if (value != NULL)
9586 {
9587 g_variant_take_ref (value);
9588 g_variant_builder_add (&builder, "{sv}", info->name, value);
9589 g_variant_unref (value);
9590 }
9591 }
9592 }
9593out:
9594 return g_variant_builder_end (&builder);
9595}
9596
9597static gboolean _sensor_match_emit_changed (gpointer user_data);
9598
9599static void
9600sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9601{
9602 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9603 gboolean emit_changed = FALSE;
9604
9605 g_mutex_lock (&skeleton->priv->lock);
9606 if (skeleton->priv->changed_properties_idle_source != NULL)
9607 {
9608 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9609 skeleton->priv->changed_properties_idle_source = NULL;
9610 emit_changed = TRUE;
9611 }
9612 g_mutex_unlock (&skeleton->priv->lock);
9613
9614 if (emit_changed)
9615 _sensor_match_emit_changed (skeleton);
9616}
9617
9618static void
9619_sensor_match_on_signal_sensor_match (
9620 SensorMatch *object,
9621 guchar arg_state)
9622{
9623 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9624
9625 GList *connections, *l;
9626 GVariant *signal_variant;
9627 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9628
9629 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9630 arg_state));
9631 for (l = connections; l != NULL; l = l->next)
9632 {
9633 GDBusConnection *connection = l->data;
9634 g_dbus_connection_emit_signal (connection,
9635 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9636 signal_variant, NULL);
9637 }
9638 g_variant_unref (signal_variant);
9639 g_list_free_full (connections, g_object_unref);
9640}
9641
9642static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9643#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9644G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9645 G_ADD_PRIVATE (SensorMatchSkeleton)
9646 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9647
9648#else
9649G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9650 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9651
9652#endif
9653static void
9654sensor_match_skeleton_finalize (GObject *object)
9655{
9656 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9657 guint n;
9658 for (n = 0; n < 2; n++)
9659 g_value_unset (&skeleton->priv->properties[n]);
9660 g_free (skeleton->priv->properties);
9661 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9662 if (skeleton->priv->changed_properties_idle_source != NULL)
9663 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9664 g_main_context_unref (skeleton->priv->context);
9665 g_mutex_clear (&skeleton->priv->lock);
9666 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9667}
9668
9669static void
9670sensor_match_skeleton_get_property (GObject *object,
9671 guint prop_id,
9672 GValue *value,
9673 GParamSpec *pspec G_GNUC_UNUSED)
9674{
9675 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9676 g_assert (prop_id != 0 && prop_id - 1 < 2);
9677 g_mutex_lock (&skeleton->priv->lock);
9678 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9679 g_mutex_unlock (&skeleton->priv->lock);
9680}
9681
9682static gboolean
9683_sensor_match_emit_changed (gpointer user_data)
9684{
9685 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9686 GList *l;
9687 GVariantBuilder builder;
9688 GVariantBuilder invalidated_builder;
9689 guint num_changes;
9690
9691 g_mutex_lock (&skeleton->priv->lock);
9692 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9693 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9694 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9695 {
9696 ChangedProperty *cp = l->data;
9697 GVariant *variant;
9698 const GValue *cur_value;
9699
9700 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9701 if (!_g_value_equal (cur_value, &cp->orig_value))
9702 {
9703 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9704 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9705 g_variant_unref (variant);
9706 num_changes++;
9707 }
9708 }
9709 if (num_changes > 0)
9710 {
9711 GList *connections, *ll;
9712 GVariant *signal_variant;
9713 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9714 &builder, &invalidated_builder));
9715 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9716 for (ll = connections; ll != NULL; ll = ll->next)
9717 {
9718 GDBusConnection *connection = ll->data;
9719
9720 g_dbus_connection_emit_signal (connection,
9721 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9722 "org.freedesktop.DBus.Properties",
9723 "PropertiesChanged",
9724 signal_variant,
9725 NULL);
9726 }
9727 g_variant_unref (signal_variant);
9728 g_list_free_full (connections, g_object_unref);
9729 }
9730 else
9731 {
9732 g_variant_builder_clear (&builder);
9733 g_variant_builder_clear (&invalidated_builder);
9734 }
9735 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9736 skeleton->priv->changed_properties = NULL;
9737 skeleton->priv->changed_properties_idle_source = NULL;
9738 g_mutex_unlock (&skeleton->priv->lock);
9739 return FALSE;
9740}
9741
9742static void
9743_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9744{
9745 ChangedProperty *cp;
9746 GList *l;
9747 cp = NULL;
9748 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9749 {
9750 ChangedProperty *i_cp = l->data;
9751 if (i_cp->info == info)
9752 {
9753 cp = i_cp;
9754 break;
9755 }
9756 }
9757 if (cp == NULL)
9758 {
9759 cp = g_new0 (ChangedProperty, 1);
9760 cp->prop_id = prop_id;
9761 cp->info = info;
9762 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9763 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9764 g_value_copy (orig_value, &cp->orig_value);
9765 }
9766}
9767
9768static void
9769sensor_match_skeleton_notify (GObject *object,
9770 GParamSpec *pspec G_GNUC_UNUSED)
9771{
9772 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9773 g_mutex_lock (&skeleton->priv->lock);
9774 if (skeleton->priv->changed_properties != NULL &&
9775 skeleton->priv->changed_properties_idle_source == NULL)
9776 {
9777 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9778 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9779 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9780 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9781 g_source_unref (skeleton->priv->changed_properties_idle_source);
9782 }
9783 g_mutex_unlock (&skeleton->priv->lock);
9784}
9785
9786static void
9787sensor_match_skeleton_set_property (GObject *object,
9788 guint prop_id,
9789 const GValue *value,
9790 GParamSpec *pspec)
9791{
9792 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9793 g_assert (prop_id != 0 && prop_id - 1 < 2);
9794 g_mutex_lock (&skeleton->priv->lock);
9795 g_object_freeze_notify (object);
9796 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9797 {
9798 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9799 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9800 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9801 g_object_notify_by_pspec (object, pspec);
9802 }
9803 g_mutex_unlock (&skeleton->priv->lock);
9804 g_object_thaw_notify (object);
9805}
9806
9807static void
9808sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9809{
9810#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9811 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9812#else
9813 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9814#endif
9815
9816 g_mutex_init (&skeleton->priv->lock);
9817 skeleton->priv->context = g_main_context_ref_thread_default ();
9818 skeleton->priv->properties = g_new0 (GValue, 2);
9819 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9820 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9821}
9822
9823static GVariant *
9824sensor_match_skeleton_get_match_value (SensorMatch *object)
9825{
9826 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9827 GVariant *value;
9828 g_mutex_lock (&skeleton->priv->lock);
9829 value = g_value_get_variant (&(skeleton->priv->properties[0]));
9830 g_mutex_unlock (&skeleton->priv->lock);
9831 return value;
9832}
9833
9834static guchar
9835sensor_match_skeleton_get_state (SensorMatch *object)
9836{
9837 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9838 guchar value;
9839 g_mutex_lock (&skeleton->priv->lock);
9840 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
9841 g_mutex_unlock (&skeleton->priv->lock);
9842 return value;
9843}
9844
9845static void
9846sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
9847{
9848 GObjectClass *gobject_class;
9849 GDBusInterfaceSkeletonClass *skeleton_class;
9850
9851 gobject_class = G_OBJECT_CLASS (klass);
9852 gobject_class->finalize = sensor_match_skeleton_finalize;
9853 gobject_class->get_property = sensor_match_skeleton_get_property;
9854 gobject_class->set_property = sensor_match_skeleton_set_property;
9855 gobject_class->notify = sensor_match_skeleton_notify;
9856
9857
9858 sensor_match_override_properties (gobject_class, 1);
9859
9860 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9861 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
9862 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
9863 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
9864 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
9865
9866#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9867 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
9868#endif
9869}
9870
9871static void
9872sensor_match_skeleton_iface_init (SensorMatchIface *iface)
9873{
9874 iface->sensor_match = _sensor_match_on_signal_sensor_match;
9875 iface->get_match_value = sensor_match_skeleton_get_match_value;
9876 iface->get_state = sensor_match_skeleton_get_state;
9877}
9878
9879/**
9880 * sensor_match_skeleton_new:
9881 *
9882 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9883 *
9884 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
9885 */
9886SensorMatch *
9887sensor_match_skeleton_new (void)
9888{
9889 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
9890}
9891
9892/* ------------------------------------------------------------------------
9893 * Code for interface org.openbmc.Process
9894 * ------------------------------------------------------------------------
9895 */
9896
9897/**
9898 * SECTION:Process
9899 * @title: Process
9900 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
9901 *
9902 * 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.
9903 */
9904
9905/* ---- Introspection data for org.openbmc.Process ---- */
9906
9907static const _ExtendedGDBusMethodInfo _process_method_info_stop =
9908{
9909 {
9910 -1,
9911 (gchar *) "stop",
9912 NULL,
9913 NULL,
9914 NULL
9915 },
9916 "handle-stop",
9917 FALSE
9918};
9919
9920static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
9921{
9922 &_process_method_info_stop,
9923 NULL
9924};
9925
9926static const _ExtendedGDBusInterfaceInfo _process_interface_info =
9927{
9928 {
9929 -1,
9930 (gchar *) "org.openbmc.Process",
9931 (GDBusMethodInfo **) &_process_method_info_pointers,
9932 NULL,
9933 NULL,
9934 NULL
9935 },
9936 "process",
9937};
9938
9939
9940/**
9941 * process_interface_info:
9942 *
9943 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
9944 *
9945 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9946 */
9947GDBusInterfaceInfo *
9948process_interface_info (void)
9949{
9950 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
9951}
9952
9953/**
9954 * process_override_properties:
9955 * @klass: The class structure for a #GObject<!-- -->-derived class.
9956 * @property_id_begin: The property id to assign to the first overridden property.
9957 *
9958 * Overrides all #GObject properties in the #Process interface for a concrete class.
9959 * The properties are overridden in the order they are defined.
9960 *
9961 * Returns: The last property id.
9962 */
9963guint
9964process_override_properties (GObjectClass *klass, guint property_id_begin)
9965{
9966 return property_id_begin - 1;
9967}
9968
9969
9970
9971/**
9972 * Process:
9973 *
9974 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9975 */
9976
9977/**
9978 * ProcessIface:
9979 * @parent_iface: The parent interface.
9980 * @handle_stop: Handler for the #Process::handle-stop signal.
9981 *
9982 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9983 */
9984
9985typedef ProcessIface ProcessInterface;
9986G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
9987
9988static void
9989process_default_init (ProcessIface *iface)
9990{
9991 /* GObject signals for incoming D-Bus method calls: */
9992 /**
9993 * Process::handle-stop:
9994 * @object: A #Process.
9995 * @invocation: A #GDBusMethodInvocation.
9996 *
9997 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
9998 *
9999 * 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.
10000 *
10001 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10002 */
10003 g_signal_new ("handle-stop",
10004 G_TYPE_FROM_INTERFACE (iface),
10005 G_SIGNAL_RUN_LAST,
10006 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10007 g_signal_accumulator_true_handled,
10008 NULL,
10009 g_cclosure_marshal_generic,
10010 G_TYPE_BOOLEAN,
10011 1,
10012 G_TYPE_DBUS_METHOD_INVOCATION);
10013
10014}
10015
10016/**
10017 * process_call_stop:
10018 * @proxy: A #ProcessProxy.
10019 * @cancellable: (allow-none): A #GCancellable or %NULL.
10020 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10021 * @user_data: User data to pass to @callback.
10022 *
10023 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10024 * 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.
10025 * You can then call process_call_stop_finish() to get the result of the operation.
10026 *
10027 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10028 */
10029void
10030process_call_stop (
10031 Process *proxy,
10032 GCancellable *cancellable,
10033 GAsyncReadyCallback callback,
10034 gpointer user_data)
10035{
10036 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10037 "stop",
10038 g_variant_new ("()"),
10039 G_DBUS_CALL_FLAGS_NONE,
10040 -1,
10041 cancellable,
10042 callback,
10043 user_data);
10044}
10045
10046/**
10047 * process_call_stop_finish:
10048 * @proxy: A #ProcessProxy.
10049 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10050 * @error: Return location for error or %NULL.
10051 *
10052 * Finishes an operation started with process_call_stop().
10053 *
10054 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10055 */
10056gboolean
10057process_call_stop_finish (
10058 Process *proxy,
10059 GAsyncResult *res,
10060 GError **error)
10061{
10062 GVariant *_ret;
10063 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10064 if (_ret == NULL)
10065 goto _out;
10066 g_variant_get (_ret,
10067 "()");
10068 g_variant_unref (_ret);
10069_out:
10070 return _ret != NULL;
10071}
10072
10073/**
10074 * process_call_stop_sync:
10075 * @proxy: A #ProcessProxy.
10076 * @cancellable: (allow-none): A #GCancellable or %NULL.
10077 * @error: Return location for error or %NULL.
10078 *
10079 * 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.
10080 *
10081 * See process_call_stop() for the asynchronous version of this method.
10082 *
10083 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10084 */
10085gboolean
10086process_call_stop_sync (
10087 Process *proxy,
10088 GCancellable *cancellable,
10089 GError **error)
10090{
10091 GVariant *_ret;
10092 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10093 "stop",
10094 g_variant_new ("()"),
10095 G_DBUS_CALL_FLAGS_NONE,
10096 -1,
10097 cancellable,
10098 error);
10099 if (_ret == NULL)
10100 goto _out;
10101 g_variant_get (_ret,
10102 "()");
10103 g_variant_unref (_ret);
10104_out:
10105 return _ret != NULL;
10106}
10107
10108/**
10109 * process_complete_stop:
10110 * @object: A #Process.
10111 * @invocation: (transfer full): A #GDBusMethodInvocation.
10112 *
10113 * 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.
10114 *
10115 * This method will free @invocation, you cannot use it afterwards.
10116 */
10117void
10118process_complete_stop (
10119 Process *object,
10120 GDBusMethodInvocation *invocation)
10121{
10122 g_dbus_method_invocation_return_value (invocation,
10123 g_variant_new ("()"));
10124}
10125
10126/* ------------------------------------------------------------------------ */
10127
10128/**
10129 * ProcessProxy:
10130 *
10131 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10132 */
10133
10134/**
10135 * ProcessProxyClass:
10136 * @parent_class: The parent class.
10137 *
10138 * Class structure for #ProcessProxy.
10139 */
10140
10141struct _ProcessProxyPrivate
10142{
10143 GData *qdata;
10144};
10145
10146static void process_proxy_iface_init (ProcessIface *iface);
10147
10148#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10149G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10150 G_ADD_PRIVATE (ProcessProxy)
10151 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10152
10153#else
10154G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10155 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10156
10157#endif
10158static void
10159process_proxy_finalize (GObject *object)
10160{
10161 ProcessProxy *proxy = PROCESS_PROXY (object);
10162 g_datalist_clear (&proxy->priv->qdata);
10163 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10164}
10165
10166static void
10167process_proxy_get_property (GObject *object,
10168 guint prop_id,
10169 GValue *value,
10170 GParamSpec *pspec G_GNUC_UNUSED)
10171{
10172}
10173
10174static void
10175process_proxy_set_property (GObject *object,
10176 guint prop_id,
10177 const GValue *value,
10178 GParamSpec *pspec G_GNUC_UNUSED)
10179{
10180}
10181
10182static void
10183process_proxy_g_signal (GDBusProxy *proxy,
10184 const gchar *sender_name G_GNUC_UNUSED,
10185 const gchar *signal_name,
10186 GVariant *parameters)
10187{
10188 _ExtendedGDBusSignalInfo *info;
10189 GVariantIter iter;
10190 GVariant *child;
10191 GValue *paramv;
10192 guint num_params;
10193 guint n;
10194 guint signal_id;
10195 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10196 if (info == NULL)
10197 return;
10198 num_params = g_variant_n_children (parameters);
10199 paramv = g_new0 (GValue, num_params + 1);
10200 g_value_init (&paramv[0], TYPE_PROCESS);
10201 g_value_set_object (&paramv[0], proxy);
10202 g_variant_iter_init (&iter, parameters);
10203 n = 1;
10204 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10205 {
10206 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10207 if (arg_info->use_gvariant)
10208 {
10209 g_value_init (&paramv[n], G_TYPE_VARIANT);
10210 g_value_set_variant (&paramv[n], child);
10211 n++;
10212 }
10213 else
10214 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10215 g_variant_unref (child);
10216 }
10217 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10218 g_signal_emitv (paramv, signal_id, 0, NULL);
10219 for (n = 0; n < num_params + 1; n++)
10220 g_value_unset (&paramv[n]);
10221 g_free (paramv);
10222}
10223
10224static void
10225process_proxy_g_properties_changed (GDBusProxy *_proxy,
10226 GVariant *changed_properties,
10227 const gchar *const *invalidated_properties)
10228{
10229 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10230 guint n;
10231 const gchar *key;
10232 GVariantIter *iter;
10233 _ExtendedGDBusPropertyInfo *info;
10234 g_variant_get (changed_properties, "a{sv}", &iter);
10235 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10236 {
10237 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10238 g_datalist_remove_data (&proxy->priv->qdata, key);
10239 if (info != NULL)
10240 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10241 }
10242 g_variant_iter_free (iter);
10243 for (n = 0; invalidated_properties[n] != NULL; n++)
10244 {
10245 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10246 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10247 if (info != NULL)
10248 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10249 }
10250}
10251
10252static void
10253process_proxy_init (ProcessProxy *proxy)
10254{
10255#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10256 proxy->priv = process_proxy_get_instance_private (proxy);
10257#else
10258 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10259#endif
10260
10261 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10262}
10263
10264static void
10265process_proxy_class_init (ProcessProxyClass *klass)
10266{
10267 GObjectClass *gobject_class;
10268 GDBusProxyClass *proxy_class;
10269
10270 gobject_class = G_OBJECT_CLASS (klass);
10271 gobject_class->finalize = process_proxy_finalize;
10272 gobject_class->get_property = process_proxy_get_property;
10273 gobject_class->set_property = process_proxy_set_property;
10274
10275 proxy_class = G_DBUS_PROXY_CLASS (klass);
10276 proxy_class->g_signal = process_proxy_g_signal;
10277 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10278
10279#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10280 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10281#endif
10282}
10283
10284static void
10285process_proxy_iface_init (ProcessIface *iface)
10286{
10287}
10288
10289/**
10290 * process_proxy_new:
10291 * @connection: A #GDBusConnection.
10292 * @flags: Flags from the #GDBusProxyFlags enumeration.
10293 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10294 * @object_path: An object path.
10295 * @cancellable: (allow-none): A #GCancellable or %NULL.
10296 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10297 * @user_data: User data to pass to @callback.
10298 *
10299 * 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.
10300 *
10301 * 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.
10302 * You can then call process_proxy_new_finish() to get the result of the operation.
10303 *
10304 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10305 */
10306void
10307process_proxy_new (
10308 GDBusConnection *connection,
10309 GDBusProxyFlags flags,
10310 const gchar *name,
10311 const gchar *object_path,
10312 GCancellable *cancellable,
10313 GAsyncReadyCallback callback,
10314 gpointer user_data)
10315{
10316 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);
10317}
10318
10319/**
10320 * process_proxy_new_finish:
10321 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10322 * @error: Return location for error or %NULL
10323 *
10324 * Finishes an operation started with process_proxy_new().
10325 *
10326 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10327 */
10328Process *
10329process_proxy_new_finish (
10330 GAsyncResult *res,
10331 GError **error)
10332{
10333 GObject *ret;
10334 GObject *source_object;
10335 source_object = g_async_result_get_source_object (res);
10336 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10337 g_object_unref (source_object);
10338 if (ret != NULL)
10339 return PROCESS (ret);
10340 else
10341 return NULL;
10342}
10343
10344/**
10345 * process_proxy_new_sync:
10346 * @connection: A #GDBusConnection.
10347 * @flags: Flags from the #GDBusProxyFlags enumeration.
10348 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10349 * @object_path: An object path.
10350 * @cancellable: (allow-none): A #GCancellable or %NULL.
10351 * @error: Return location for error or %NULL
10352 *
10353 * 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.
10354 *
10355 * The calling thread is blocked until a reply is received.
10356 *
10357 * See process_proxy_new() for the asynchronous version of this constructor.
10358 *
10359 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10360 */
10361Process *
10362process_proxy_new_sync (
10363 GDBusConnection *connection,
10364 GDBusProxyFlags flags,
10365 const gchar *name,
10366 const gchar *object_path,
10367 GCancellable *cancellable,
10368 GError **error)
10369{
10370 GInitable *ret;
10371 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);
10372 if (ret != NULL)
10373 return PROCESS (ret);
10374 else
10375 return NULL;
10376}
10377
10378
10379/**
10380 * process_proxy_new_for_bus:
10381 * @bus_type: A #GBusType.
10382 * @flags: Flags from the #GDBusProxyFlags enumeration.
10383 * @name: A bus name (well-known or unique).
10384 * @object_path: An object path.
10385 * @cancellable: (allow-none): A #GCancellable or %NULL.
10386 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10387 * @user_data: User data to pass to @callback.
10388 *
10389 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10390 *
10391 * 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.
10392 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10393 *
10394 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10395 */
10396void
10397process_proxy_new_for_bus (
10398 GBusType bus_type,
10399 GDBusProxyFlags flags,
10400 const gchar *name,
10401 const gchar *object_path,
10402 GCancellable *cancellable,
10403 GAsyncReadyCallback callback,
10404 gpointer user_data)
10405{
10406 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);
10407}
10408
10409/**
10410 * process_proxy_new_for_bus_finish:
10411 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10412 * @error: Return location for error or %NULL
10413 *
10414 * Finishes an operation started with process_proxy_new_for_bus().
10415 *
10416 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10417 */
10418Process *
10419process_proxy_new_for_bus_finish (
10420 GAsyncResult *res,
10421 GError **error)
10422{
10423 GObject *ret;
10424 GObject *source_object;
10425 source_object = g_async_result_get_source_object (res);
10426 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10427 g_object_unref (source_object);
10428 if (ret != NULL)
10429 return PROCESS (ret);
10430 else
10431 return NULL;
10432}
10433
10434/**
10435 * process_proxy_new_for_bus_sync:
10436 * @bus_type: A #GBusType.
10437 * @flags: Flags from the #GDBusProxyFlags enumeration.
10438 * @name: A bus name (well-known or unique).
10439 * @object_path: An object path.
10440 * @cancellable: (allow-none): A #GCancellable or %NULL.
10441 * @error: Return location for error or %NULL
10442 *
10443 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10444 *
10445 * The calling thread is blocked until a reply is received.
10446 *
10447 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10448 *
10449 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10450 */
10451Process *
10452process_proxy_new_for_bus_sync (
10453 GBusType bus_type,
10454 GDBusProxyFlags flags,
10455 const gchar *name,
10456 const gchar *object_path,
10457 GCancellable *cancellable,
10458 GError **error)
10459{
10460 GInitable *ret;
10461 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);
10462 if (ret != NULL)
10463 return PROCESS (ret);
10464 else
10465 return NULL;
10466}
10467
10468
10469/* ------------------------------------------------------------------------ */
10470
10471/**
10472 * ProcessSkeleton:
10473 *
10474 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10475 */
10476
10477/**
10478 * ProcessSkeletonClass:
10479 * @parent_class: The parent class.
10480 *
10481 * Class structure for #ProcessSkeleton.
10482 */
10483
10484struct _ProcessSkeletonPrivate
10485{
10486 GValue *properties;
10487 GList *changed_properties;
10488 GSource *changed_properties_idle_source;
10489 GMainContext *context;
10490 GMutex lock;
10491};
10492
10493static void
10494_process_skeleton_handle_method_call (
10495 GDBusConnection *connection G_GNUC_UNUSED,
10496 const gchar *sender G_GNUC_UNUSED,
10497 const gchar *object_path G_GNUC_UNUSED,
10498 const gchar *interface_name,
10499 const gchar *method_name,
10500 GVariant *parameters,
10501 GDBusMethodInvocation *invocation,
10502 gpointer user_data)
10503{
10504 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10505 _ExtendedGDBusMethodInfo *info;
10506 GVariantIter iter;
10507 GVariant *child;
10508 GValue *paramv;
10509 guint num_params;
10510 guint num_extra;
10511 guint n;
10512 guint signal_id;
10513 GValue return_value = G_VALUE_INIT;
10514 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10515 g_assert (info != NULL);
10516 num_params = g_variant_n_children (parameters);
10517 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10518 n = 0;
10519 g_value_init (&paramv[n], TYPE_PROCESS);
10520 g_value_set_object (&paramv[n++], skeleton);
10521 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10522 g_value_set_object (&paramv[n++], invocation);
10523 if (info->pass_fdlist)
10524 {
10525#ifdef G_OS_UNIX
10526 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10527 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10528#else
10529 g_assert_not_reached ();
10530#endif
10531 }
10532 g_variant_iter_init (&iter, parameters);
10533 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10534 {
10535 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10536 if (arg_info->use_gvariant)
10537 {
10538 g_value_init (&paramv[n], G_TYPE_VARIANT);
10539 g_value_set_variant (&paramv[n], child);
10540 n++;
10541 }
10542 else
10543 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10544 g_variant_unref (child);
10545 }
10546 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10547 g_value_init (&return_value, G_TYPE_BOOLEAN);
10548 g_signal_emitv (paramv, signal_id, 0, &return_value);
10549 if (!g_value_get_boolean (&return_value))
10550 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);
10551 g_value_unset (&return_value);
10552 for (n = 0; n < num_params + num_extra; n++)
10553 g_value_unset (&paramv[n]);
10554 g_free (paramv);
10555}
10556
10557static GVariant *
10558_process_skeleton_handle_get_property (
10559 GDBusConnection *connection G_GNUC_UNUSED,
10560 const gchar *sender G_GNUC_UNUSED,
10561 const gchar *object_path G_GNUC_UNUSED,
10562 const gchar *interface_name G_GNUC_UNUSED,
10563 const gchar *property_name,
10564 GError **error,
10565 gpointer user_data)
10566{
10567 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10568 GValue value = G_VALUE_INIT;
10569 GParamSpec *pspec;
10570 _ExtendedGDBusPropertyInfo *info;
10571 GVariant *ret;
10572 ret = NULL;
10573 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10574 g_assert (info != NULL);
10575 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10576 if (pspec == NULL)
10577 {
10578 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10579 }
10580 else
10581 {
10582 g_value_init (&value, pspec->value_type);
10583 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10584 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10585 g_value_unset (&value);
10586 }
10587 return ret;
10588}
10589
10590static gboolean
10591_process_skeleton_handle_set_property (
10592 GDBusConnection *connection G_GNUC_UNUSED,
10593 const gchar *sender G_GNUC_UNUSED,
10594 const gchar *object_path G_GNUC_UNUSED,
10595 const gchar *interface_name G_GNUC_UNUSED,
10596 const gchar *property_name,
10597 GVariant *variant,
10598 GError **error,
10599 gpointer user_data)
10600{
10601 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10602 GValue value = G_VALUE_INIT;
10603 GParamSpec *pspec;
10604 _ExtendedGDBusPropertyInfo *info;
10605 gboolean ret;
10606 ret = FALSE;
10607 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10608 g_assert (info != NULL);
10609 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10610 if (pspec == NULL)
10611 {
10612 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10613 }
10614 else
10615 {
10616 if (info->use_gvariant)
10617 g_value_set_variant (&value, variant);
10618 else
10619 g_dbus_gvariant_to_gvalue (variant, &value);
10620 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10621 g_value_unset (&value);
10622 ret = TRUE;
10623 }
10624 return ret;
10625}
10626
10627static const GDBusInterfaceVTable _process_skeleton_vtable =
10628{
10629 _process_skeleton_handle_method_call,
10630 _process_skeleton_handle_get_property,
10631 _process_skeleton_handle_set_property,
10632 {NULL}
10633};
10634
10635static GDBusInterfaceInfo *
10636process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10637{
10638 return process_interface_info ();
10639}
10640
10641static GDBusInterfaceVTable *
10642process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10643{
10644 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10645}
10646
10647static GVariant *
10648process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10649{
10650 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10651
10652 GVariantBuilder builder;
10653 guint n;
10654 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10655 if (_process_interface_info.parent_struct.properties == NULL)
10656 goto out;
10657 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10658 {
10659 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10660 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10661 {
10662 GVariant *value;
10663 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);
10664 if (value != NULL)
10665 {
10666 g_variant_take_ref (value);
10667 g_variant_builder_add (&builder, "{sv}", info->name, value);
10668 g_variant_unref (value);
10669 }
10670 }
10671 }
10672out:
10673 return g_variant_builder_end (&builder);
10674}
10675
10676static void
10677process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10678{
10679}
10680
10681static void process_skeleton_iface_init (ProcessIface *iface);
10682#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10683G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10684 G_ADD_PRIVATE (ProcessSkeleton)
10685 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10686
10687#else
10688G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10689 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10690
10691#endif
10692static void
10693process_skeleton_finalize (GObject *object)
10694{
10695 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10696 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10697 if (skeleton->priv->changed_properties_idle_source != NULL)
10698 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10699 g_main_context_unref (skeleton->priv->context);
10700 g_mutex_clear (&skeleton->priv->lock);
10701 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10702}
10703
10704static void
10705process_skeleton_init (ProcessSkeleton *skeleton)
10706{
10707#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10708 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10709#else
10710 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10711#endif
10712
10713 g_mutex_init (&skeleton->priv->lock);
10714 skeleton->priv->context = g_main_context_ref_thread_default ();
10715}
10716
10717static void
10718process_skeleton_class_init (ProcessSkeletonClass *klass)
10719{
10720 GObjectClass *gobject_class;
10721 GDBusInterfaceSkeletonClass *skeleton_class;
10722
10723 gobject_class = G_OBJECT_CLASS (klass);
10724 gobject_class->finalize = process_skeleton_finalize;
10725
10726 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10727 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10728 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10729 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10730 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10731
10732#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10733 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10734#endif
10735}
10736
10737static void
10738process_skeleton_iface_init (ProcessIface *iface)
10739{
10740}
10741
10742/**
10743 * process_skeleton_new:
10744 *
10745 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10746 *
10747 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10748 */
10749Process *
10750process_skeleton_new (void)
10751{
10752 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10753}
10754
10755/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050010756 * Code for interface org.openbmc.SharedResource
10757 * ------------------------------------------------------------------------
10758 */
10759
10760/**
10761 * SECTION:SharedResource
10762 * @title: SharedResource
10763 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
10764 *
10765 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface in C.
10766 */
10767
10768/* ---- Introspection data for org.openbmc.SharedResource ---- */
10769
10770static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
10771{
10772 {
10773 -1,
10774 (gchar *) "name",
10775 (gchar *) "s",
10776 NULL
10777 },
10778 FALSE
10779};
10780
10781static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
10782{
10783 &_shared_resource_method_info_lock_IN_ARG_name,
10784 NULL
10785};
10786
10787static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
10788{
10789 {
10790 -1,
10791 (gchar *) "lock",
10792 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
10793 NULL,
10794 NULL
10795 },
10796 "handle-lock",
10797 FALSE
10798};
10799
10800static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
10801{
10802 {
10803 -1,
10804 (gchar *) "unlock",
10805 NULL,
10806 NULL,
10807 NULL
10808 },
10809 "handle-unlock",
10810 FALSE
10811};
10812
10813static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
10814{
10815 {
10816 -1,
10817 (gchar *) "lock",
10818 (gchar *) "b",
10819 NULL
10820 },
10821 FALSE
10822};
10823
10824static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
10825{
10826 {
10827 -1,
10828 (gchar *) "name",
10829 (gchar *) "s",
10830 NULL
10831 },
10832 FALSE
10833};
10834
10835static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
10836{
10837 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
10838 &_shared_resource_method_info_is_locked_OUT_ARG_name,
10839 NULL
10840};
10841
10842static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
10843{
10844 {
10845 -1,
10846 (gchar *) "isLocked",
10847 NULL,
10848 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
10849 NULL
10850 },
10851 "handle-is-locked",
10852 FALSE
10853};
10854
10855static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
10856{
10857 &_shared_resource_method_info_lock,
10858 &_shared_resource_method_info_unlock,
10859 &_shared_resource_method_info_is_locked,
10860 NULL
10861};
10862
10863static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
10864{
10865 {
10866 -1,
10867 (gchar *) "lock",
10868 (gchar *) "b",
10869 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10870 NULL
10871 },
10872 "lock",
10873 FALSE
10874};
10875
10876static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
10877{
10878 {
10879 -1,
10880 (gchar *) "name",
10881 (gchar *) "s",
10882 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10883 NULL
10884 },
10885 "name",
10886 FALSE
10887};
10888
10889static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
10890{
10891 &_shared_resource_property_info_lock,
10892 &_shared_resource_property_info_name,
10893 NULL
10894};
10895
10896static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
10897{
10898 {
10899 -1,
10900 (gchar *) "org.openbmc.SharedResource",
10901 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
10902 NULL,
10903 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
10904 NULL
10905 },
10906 "shared-resource",
10907};
10908
10909
10910/**
10911 * shared_resource_interface_info:
10912 *
10913 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
10914 *
10915 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10916 */
10917GDBusInterfaceInfo *
10918shared_resource_interface_info (void)
10919{
10920 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
10921}
10922
10923/**
10924 * shared_resource_override_properties:
10925 * @klass: The class structure for a #GObject<!-- -->-derived class.
10926 * @property_id_begin: The property id to assign to the first overridden property.
10927 *
10928 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
10929 * The properties are overridden in the order they are defined.
10930 *
10931 * Returns: The last property id.
10932 */
10933guint
10934shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
10935{
10936 g_object_class_override_property (klass, property_id_begin++, "lock");
10937 g_object_class_override_property (klass, property_id_begin++, "name");
10938 return property_id_begin - 1;
10939}
10940
10941
10942
10943/**
10944 * SharedResource:
10945 *
10946 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10947 */
10948
10949/**
10950 * SharedResourceIface:
10951 * @parent_iface: The parent interface.
10952 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
10953 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
10954 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
10955 * @get_lock: Getter for the #SharedResource:lock property.
10956 * @get_name: Getter for the #SharedResource:name property.
10957 *
10958 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10959 */
10960
10961typedef SharedResourceIface SharedResourceInterface;
10962G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
10963
10964static void
10965shared_resource_default_init (SharedResourceIface *iface)
10966{
10967 /* GObject signals for incoming D-Bus method calls: */
10968 /**
10969 * SharedResource::handle-lock:
10970 * @object: A #SharedResource.
10971 * @invocation: A #GDBusMethodInvocation.
10972 * @arg_name: Argument passed by remote caller.
10973 *
10974 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
10975 *
10976 * 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 shared_resource_complete_lock() 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.
10977 *
10978 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10979 */
10980 g_signal_new ("handle-lock",
10981 G_TYPE_FROM_INTERFACE (iface),
10982 G_SIGNAL_RUN_LAST,
10983 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
10984 g_signal_accumulator_true_handled,
10985 NULL,
10986 g_cclosure_marshal_generic,
10987 G_TYPE_BOOLEAN,
10988 2,
10989 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
10990
10991 /**
10992 * SharedResource::handle-unlock:
10993 * @object: A #SharedResource.
10994 * @invocation: A #GDBusMethodInvocation.
10995 *
10996 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
10997 *
10998 * 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 shared_resource_complete_unlock() 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.
10999 *
11000 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11001 */
11002 g_signal_new ("handle-unlock",
11003 G_TYPE_FROM_INTERFACE (iface),
11004 G_SIGNAL_RUN_LAST,
11005 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
11006 g_signal_accumulator_true_handled,
11007 NULL,
11008 g_cclosure_marshal_generic,
11009 G_TYPE_BOOLEAN,
11010 1,
11011 G_TYPE_DBUS_METHOD_INVOCATION);
11012
11013 /**
11014 * SharedResource::handle-is-locked:
11015 * @object: A #SharedResource.
11016 * @invocation: A #GDBusMethodInvocation.
11017 *
11018 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
11019 *
11020 * 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 shared_resource_complete_is_locked() 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.
11021 *
11022 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11023 */
11024 g_signal_new ("handle-is-locked",
11025 G_TYPE_FROM_INTERFACE (iface),
11026 G_SIGNAL_RUN_LAST,
11027 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
11028 g_signal_accumulator_true_handled,
11029 NULL,
11030 g_cclosure_marshal_generic,
11031 G_TYPE_BOOLEAN,
11032 1,
11033 G_TYPE_DBUS_METHOD_INVOCATION);
11034
11035 /* GObject properties for D-Bus properties: */
11036 /**
11037 * SharedResource:lock:
11038 *
11039 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
11040 *
11041 * 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.
11042 */
11043 g_object_interface_install_property (iface,
11044 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11045 /**
11046 * SharedResource:name:
11047 *
11048 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
11049 *
11050 * 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.
11051 */
11052 g_object_interface_install_property (iface,
11053 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11054}
11055
11056/**
11057 * shared_resource_get_lock: (skip)
11058 * @object: A #SharedResource.
11059 *
11060 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
11061 *
11062 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11063 *
11064 * Returns: The property value.
11065 */
11066gboolean
11067shared_resource_get_lock (SharedResource *object)
11068{
11069 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
11070}
11071
11072/**
11073 * shared_resource_set_lock: (skip)
11074 * @object: A #SharedResource.
11075 * @value: The value to set.
11076 *
11077 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
11078 *
11079 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11080 */
11081void
11082shared_resource_set_lock (SharedResource *object, gboolean value)
11083{
11084 g_object_set (G_OBJECT (object), "lock", value, NULL);
11085}
11086
11087/**
11088 * shared_resource_get_name: (skip)
11089 * @object: A #SharedResource.
11090 *
11091 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11092 *
11093 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11094 *
11095 * <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 shared_resource_dup_name() if on another thread.</warning>
11096 *
11097 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
11098 */
11099const gchar *
11100shared_resource_get_name (SharedResource *object)
11101{
11102 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
11103}
11104
11105/**
11106 * shared_resource_dup_name: (skip)
11107 * @object: A #SharedResource.
11108 *
11109 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11110 *
11111 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11112 *
11113 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
11114 */
11115gchar *
11116shared_resource_dup_name (SharedResource *object)
11117{
11118 gchar *value;
11119 g_object_get (G_OBJECT (object), "name", &value, NULL);
11120 return value;
11121}
11122
11123/**
11124 * shared_resource_set_name: (skip)
11125 * @object: A #SharedResource.
11126 * @value: The value to set.
11127 *
11128 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
11129 *
11130 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11131 */
11132void
11133shared_resource_set_name (SharedResource *object, const gchar *value)
11134{
11135 g_object_set (G_OBJECT (object), "name", value, NULL);
11136}
11137
11138/**
11139 * shared_resource_call_lock:
11140 * @proxy: A #SharedResourceProxy.
11141 * @arg_name: Argument to pass with the method invocation.
11142 * @cancellable: (allow-none): A #GCancellable or %NULL.
11143 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11144 * @user_data: User data to pass to @callback.
11145 *
11146 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
11147 * 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.
11148 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
11149 *
11150 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
11151 */
11152void
11153shared_resource_call_lock (
11154 SharedResource *proxy,
11155 const gchar *arg_name,
11156 GCancellable *cancellable,
11157 GAsyncReadyCallback callback,
11158 gpointer user_data)
11159{
11160 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11161 "lock",
11162 g_variant_new ("(s)",
11163 arg_name),
11164 G_DBUS_CALL_FLAGS_NONE,
11165 -1,
11166 cancellable,
11167 callback,
11168 user_data);
11169}
11170
11171/**
11172 * shared_resource_call_lock_finish:
11173 * @proxy: A #SharedResourceProxy.
11174 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
11175 * @error: Return location for error or %NULL.
11176 *
11177 * Finishes an operation started with shared_resource_call_lock().
11178 *
11179 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11180 */
11181gboolean
11182shared_resource_call_lock_finish (
11183 SharedResource *proxy,
11184 GAsyncResult *res,
11185 GError **error)
11186{
11187 GVariant *_ret;
11188 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11189 if (_ret == NULL)
11190 goto _out;
11191 g_variant_get (_ret,
11192 "()");
11193 g_variant_unref (_ret);
11194_out:
11195 return _ret != NULL;
11196}
11197
11198/**
11199 * shared_resource_call_lock_sync:
11200 * @proxy: A #SharedResourceProxy.
11201 * @arg_name: Argument to pass with the method invocation.
11202 * @cancellable: (allow-none): A #GCancellable or %NULL.
11203 * @error: Return location for error or %NULL.
11204 *
11205 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11206 *
11207 * See shared_resource_call_lock() for the asynchronous version of this method.
11208 *
11209 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11210 */
11211gboolean
11212shared_resource_call_lock_sync (
11213 SharedResource *proxy,
11214 const gchar *arg_name,
11215 GCancellable *cancellable,
11216 GError **error)
11217{
11218 GVariant *_ret;
11219 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11220 "lock",
11221 g_variant_new ("(s)",
11222 arg_name),
11223 G_DBUS_CALL_FLAGS_NONE,
11224 -1,
11225 cancellable,
11226 error);
11227 if (_ret == NULL)
11228 goto _out;
11229 g_variant_get (_ret,
11230 "()");
11231 g_variant_unref (_ret);
11232_out:
11233 return _ret != NULL;
11234}
11235
11236/**
11237 * shared_resource_call_unlock:
11238 * @proxy: A #SharedResourceProxy.
11239 * @cancellable: (allow-none): A #GCancellable or %NULL.
11240 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11241 * @user_data: User data to pass to @callback.
11242 *
11243 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
11244 * 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.
11245 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
11246 *
11247 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
11248 */
11249void
11250shared_resource_call_unlock (
11251 SharedResource *proxy,
11252 GCancellable *cancellable,
11253 GAsyncReadyCallback callback,
11254 gpointer user_data)
11255{
11256 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11257 "unlock",
11258 g_variant_new ("()"),
11259 G_DBUS_CALL_FLAGS_NONE,
11260 -1,
11261 cancellable,
11262 callback,
11263 user_data);
11264}
11265
11266/**
11267 * shared_resource_call_unlock_finish:
11268 * @proxy: A #SharedResourceProxy.
11269 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
11270 * @error: Return location for error or %NULL.
11271 *
11272 * Finishes an operation started with shared_resource_call_unlock().
11273 *
11274 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11275 */
11276gboolean
11277shared_resource_call_unlock_finish (
11278 SharedResource *proxy,
11279 GAsyncResult *res,
11280 GError **error)
11281{
11282 GVariant *_ret;
11283 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11284 if (_ret == NULL)
11285 goto _out;
11286 g_variant_get (_ret,
11287 "()");
11288 g_variant_unref (_ret);
11289_out:
11290 return _ret != NULL;
11291}
11292
11293/**
11294 * shared_resource_call_unlock_sync:
11295 * @proxy: A #SharedResourceProxy.
11296 * @cancellable: (allow-none): A #GCancellable or %NULL.
11297 * @error: Return location for error or %NULL.
11298 *
11299 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11300 *
11301 * See shared_resource_call_unlock() for the asynchronous version of this method.
11302 *
11303 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11304 */
11305gboolean
11306shared_resource_call_unlock_sync (
11307 SharedResource *proxy,
11308 GCancellable *cancellable,
11309 GError **error)
11310{
11311 GVariant *_ret;
11312 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11313 "unlock",
11314 g_variant_new ("()"),
11315 G_DBUS_CALL_FLAGS_NONE,
11316 -1,
11317 cancellable,
11318 error);
11319 if (_ret == NULL)
11320 goto _out;
11321 g_variant_get (_ret,
11322 "()");
11323 g_variant_unref (_ret);
11324_out:
11325 return _ret != NULL;
11326}
11327
11328/**
11329 * shared_resource_call_is_locked:
11330 * @proxy: A #SharedResourceProxy.
11331 * @cancellable: (allow-none): A #GCancellable or %NULL.
11332 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11333 * @user_data: User data to pass to @callback.
11334 *
11335 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11336 * 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.
11337 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11338 *
11339 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11340 */
11341void
11342shared_resource_call_is_locked (
11343 SharedResource *proxy,
11344 GCancellable *cancellable,
11345 GAsyncReadyCallback callback,
11346 gpointer user_data)
11347{
11348 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11349 "isLocked",
11350 g_variant_new ("()"),
11351 G_DBUS_CALL_FLAGS_NONE,
11352 -1,
11353 cancellable,
11354 callback,
11355 user_data);
11356}
11357
11358/**
11359 * shared_resource_call_is_locked_finish:
11360 * @proxy: A #SharedResourceProxy.
11361 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11362 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11363 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11364 * @error: Return location for error or %NULL.
11365 *
11366 * Finishes an operation started with shared_resource_call_is_locked().
11367 *
11368 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11369 */
11370gboolean
11371shared_resource_call_is_locked_finish (
11372 SharedResource *proxy,
11373 gboolean *out_lock,
11374 gchar **out_name,
11375 GAsyncResult *res,
11376 GError **error)
11377{
11378 GVariant *_ret;
11379 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11380 if (_ret == NULL)
11381 goto _out;
11382 g_variant_get (_ret,
11383 "(bs)",
11384 out_lock,
11385 out_name);
11386 g_variant_unref (_ret);
11387_out:
11388 return _ret != NULL;
11389}
11390
11391/**
11392 * shared_resource_call_is_locked_sync:
11393 * @proxy: A #SharedResourceProxy.
11394 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11395 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11396 * @cancellable: (allow-none): A #GCancellable or %NULL.
11397 * @error: Return location for error or %NULL.
11398 *
11399 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11400 *
11401 * See shared_resource_call_is_locked() for the asynchronous version of this method.
11402 *
11403 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11404 */
11405gboolean
11406shared_resource_call_is_locked_sync (
11407 SharedResource *proxy,
11408 gboolean *out_lock,
11409 gchar **out_name,
11410 GCancellable *cancellable,
11411 GError **error)
11412{
11413 GVariant *_ret;
11414 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11415 "isLocked",
11416 g_variant_new ("()"),
11417 G_DBUS_CALL_FLAGS_NONE,
11418 -1,
11419 cancellable,
11420 error);
11421 if (_ret == NULL)
11422 goto _out;
11423 g_variant_get (_ret,
11424 "(bs)",
11425 out_lock,
11426 out_name);
11427 g_variant_unref (_ret);
11428_out:
11429 return _ret != NULL;
11430}
11431
11432/**
11433 * shared_resource_complete_lock:
11434 * @object: A #SharedResource.
11435 * @invocation: (transfer full): A #GDBusMethodInvocation.
11436 *
11437 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</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.
11438 *
11439 * This method will free @invocation, you cannot use it afterwards.
11440 */
11441void
11442shared_resource_complete_lock (
11443 SharedResource *object,
11444 GDBusMethodInvocation *invocation)
11445{
11446 g_dbus_method_invocation_return_value (invocation,
11447 g_variant_new ("()"));
11448}
11449
11450/**
11451 * shared_resource_complete_unlock:
11452 * @object: A #SharedResource.
11453 * @invocation: (transfer full): A #GDBusMethodInvocation.
11454 *
11455 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</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.
11456 *
11457 * This method will free @invocation, you cannot use it afterwards.
11458 */
11459void
11460shared_resource_complete_unlock (
11461 SharedResource *object,
11462 GDBusMethodInvocation *invocation)
11463{
11464 g_dbus_method_invocation_return_value (invocation,
11465 g_variant_new ("()"));
11466}
11467
11468/**
11469 * shared_resource_complete_is_locked:
11470 * @object: A #SharedResource.
11471 * @invocation: (transfer full): A #GDBusMethodInvocation.
11472 * @lock: Parameter to return.
11473 * @name: Parameter to return.
11474 *
11475 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</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.
11476 *
11477 * This method will free @invocation, you cannot use it afterwards.
11478 */
11479void
11480shared_resource_complete_is_locked (
11481 SharedResource *object,
11482 GDBusMethodInvocation *invocation,
11483 gboolean lock,
11484 const gchar *name)
11485{
11486 g_dbus_method_invocation_return_value (invocation,
11487 g_variant_new ("(bs)",
11488 lock,
11489 name));
11490}
11491
11492/* ------------------------------------------------------------------------ */
11493
11494/**
11495 * SharedResourceProxy:
11496 *
11497 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
11498 */
11499
11500/**
11501 * SharedResourceProxyClass:
11502 * @parent_class: The parent class.
11503 *
11504 * Class structure for #SharedResourceProxy.
11505 */
11506
11507struct _SharedResourceProxyPrivate
11508{
11509 GData *qdata;
11510};
11511
11512static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
11513
11514#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11515G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11516 G_ADD_PRIVATE (SharedResourceProxy)
11517 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11518
11519#else
11520G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11521 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11522
11523#endif
11524static void
11525shared_resource_proxy_finalize (GObject *object)
11526{
11527 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11528 g_datalist_clear (&proxy->priv->qdata);
11529 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
11530}
11531
11532static void
11533shared_resource_proxy_get_property (GObject *object,
11534 guint prop_id,
11535 GValue *value,
11536 GParamSpec *pspec G_GNUC_UNUSED)
11537{
11538 const _ExtendedGDBusPropertyInfo *info;
11539 GVariant *variant;
11540 g_assert (prop_id != 0 && prop_id - 1 < 2);
11541 info = _shared_resource_property_info_pointers[prop_id - 1];
11542 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11543 if (info->use_gvariant)
11544 {
11545 g_value_set_variant (value, variant);
11546 }
11547 else
11548 {
11549 if (variant != NULL)
11550 g_dbus_gvariant_to_gvalue (variant, value);
11551 }
11552 if (variant != NULL)
11553 g_variant_unref (variant);
11554}
11555
11556static void
11557shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
11558 GAsyncResult *res,
11559 gpointer user_data)
11560{
11561 const _ExtendedGDBusPropertyInfo *info = user_data;
11562 GError *error;
11563 GVariant *_ret;
11564 error = NULL;
11565 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11566 if (!_ret)
11567 {
11568 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
11569 info->parent_struct.name,
11570 error->message, g_quark_to_string (error->domain), error->code);
11571 g_error_free (error);
11572 }
11573 else
11574 {
11575 g_variant_unref (_ret);
11576 }
11577}
11578
11579static void
11580shared_resource_proxy_set_property (GObject *object,
11581 guint prop_id,
11582 const GValue *value,
11583 GParamSpec *pspec G_GNUC_UNUSED)
11584{
11585 const _ExtendedGDBusPropertyInfo *info;
11586 GVariant *variant;
11587 g_assert (prop_id != 0 && prop_id - 1 < 2);
11588 info = _shared_resource_property_info_pointers[prop_id - 1];
11589 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11590 g_dbus_proxy_call (G_DBUS_PROXY (object),
11591 "org.freedesktop.DBus.Properties.Set",
11592 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
11593 G_DBUS_CALL_FLAGS_NONE,
11594 -1,
11595 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11596 g_variant_unref (variant);
11597}
11598
11599static void
11600shared_resource_proxy_g_signal (GDBusProxy *proxy,
11601 const gchar *sender_name G_GNUC_UNUSED,
11602 const gchar *signal_name,
11603 GVariant *parameters)
11604{
11605 _ExtendedGDBusSignalInfo *info;
11606 GVariantIter iter;
11607 GVariant *child;
11608 GValue *paramv;
11609 guint num_params;
11610 guint n;
11611 guint signal_id;
11612 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
11613 if (info == NULL)
11614 return;
11615 num_params = g_variant_n_children (parameters);
11616 paramv = g_new0 (GValue, num_params + 1);
11617 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
11618 g_value_set_object (&paramv[0], proxy);
11619 g_variant_iter_init (&iter, parameters);
11620 n = 1;
11621 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11622 {
11623 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11624 if (arg_info->use_gvariant)
11625 {
11626 g_value_init (&paramv[n], G_TYPE_VARIANT);
11627 g_value_set_variant (&paramv[n], child);
11628 n++;
11629 }
11630 else
11631 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11632 g_variant_unref (child);
11633 }
11634 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
11635 g_signal_emitv (paramv, signal_id, 0, NULL);
11636 for (n = 0; n < num_params + 1; n++)
11637 g_value_unset (&paramv[n]);
11638 g_free (paramv);
11639}
11640
11641static void
11642shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
11643 GVariant *changed_properties,
11644 const gchar *const *invalidated_properties)
11645{
11646 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
11647 guint n;
11648 const gchar *key;
11649 GVariantIter *iter;
11650 _ExtendedGDBusPropertyInfo *info;
11651 g_variant_get (changed_properties, "a{sv}", &iter);
11652 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11653 {
11654 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
11655 g_datalist_remove_data (&proxy->priv->qdata, key);
11656 if (info != NULL)
11657 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11658 }
11659 g_variant_iter_free (iter);
11660 for (n = 0; invalidated_properties[n] != NULL; n++)
11661 {
11662 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
11663 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11664 if (info != NULL)
11665 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11666 }
11667}
11668
11669static gboolean
11670shared_resource_proxy_get_lock (SharedResource *object)
11671{
11672 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11673 GVariant *variant;
11674 gboolean value = 0;
11675 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
11676 if (variant != NULL)
11677 {
11678 value = g_variant_get_boolean (variant);
11679 g_variant_unref (variant);
11680 }
11681 return value;
11682}
11683
11684static const gchar *
11685shared_resource_proxy_get_name (SharedResource *object)
11686{
11687 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11688 GVariant *variant;
11689 const gchar *value = NULL;
11690 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
11691 if (variant != NULL)
11692 {
11693 value = g_variant_get_string (variant, NULL);
11694 g_variant_unref (variant);
11695 }
11696 return value;
11697}
11698
11699static void
11700shared_resource_proxy_init (SharedResourceProxy *proxy)
11701{
11702#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11703 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
11704#else
11705 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
11706#endif
11707
11708 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
11709}
11710
11711static void
11712shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
11713{
11714 GObjectClass *gobject_class;
11715 GDBusProxyClass *proxy_class;
11716
11717 gobject_class = G_OBJECT_CLASS (klass);
11718 gobject_class->finalize = shared_resource_proxy_finalize;
11719 gobject_class->get_property = shared_resource_proxy_get_property;
11720 gobject_class->set_property = shared_resource_proxy_set_property;
11721
11722 proxy_class = G_DBUS_PROXY_CLASS (klass);
11723 proxy_class->g_signal = shared_resource_proxy_g_signal;
11724 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
11725
11726 shared_resource_override_properties (gobject_class, 1);
11727
11728#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11729 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
11730#endif
11731}
11732
11733static void
11734shared_resource_proxy_iface_init (SharedResourceIface *iface)
11735{
11736 iface->get_lock = shared_resource_proxy_get_lock;
11737 iface->get_name = shared_resource_proxy_get_name;
11738}
11739
11740/**
11741 * shared_resource_proxy_new:
11742 * @connection: A #GDBusConnection.
11743 * @flags: Flags from the #GDBusProxyFlags enumeration.
11744 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11745 * @object_path: An object path.
11746 * @cancellable: (allow-none): A #GCancellable or %NULL.
11747 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11748 * @user_data: User data to pass to @callback.
11749 *
11750 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new() for more details.
11751 *
11752 * 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.
11753 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
11754 *
11755 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
11756 */
11757void
11758shared_resource_proxy_new (
11759 GDBusConnection *connection,
11760 GDBusProxyFlags flags,
11761 const gchar *name,
11762 const gchar *object_path,
11763 GCancellable *cancellable,
11764 GAsyncReadyCallback callback,
11765 gpointer user_data)
11766{
11767 g_async_initable_new_async (TYPE_SHARED_RESOURCE_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.SharedResource", NULL);
11768}
11769
11770/**
11771 * shared_resource_proxy_new_finish:
11772 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
11773 * @error: Return location for error or %NULL
11774 *
11775 * Finishes an operation started with shared_resource_proxy_new().
11776 *
11777 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11778 */
11779SharedResource *
11780shared_resource_proxy_new_finish (
11781 GAsyncResult *res,
11782 GError **error)
11783{
11784 GObject *ret;
11785 GObject *source_object;
11786 source_object = g_async_result_get_source_object (res);
11787 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11788 g_object_unref (source_object);
11789 if (ret != NULL)
11790 return SHARED_RESOURCE (ret);
11791 else
11792 return NULL;
11793}
11794
11795/**
11796 * shared_resource_proxy_new_sync:
11797 * @connection: A #GDBusConnection.
11798 * @flags: Flags from the #GDBusProxyFlags enumeration.
11799 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11800 * @object_path: An object path.
11801 * @cancellable: (allow-none): A #GCancellable or %NULL.
11802 * @error: Return location for error or %NULL
11803 *
11804 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new_sync() for more details.
11805 *
11806 * The calling thread is blocked until a reply is received.
11807 *
11808 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
11809 *
11810 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11811 */
11812SharedResource *
11813shared_resource_proxy_new_sync (
11814 GDBusConnection *connection,
11815 GDBusProxyFlags flags,
11816 const gchar *name,
11817 const gchar *object_path,
11818 GCancellable *cancellable,
11819 GError **error)
11820{
11821 GInitable *ret;
11822 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
11823 if (ret != NULL)
11824 return SHARED_RESOURCE (ret);
11825 else
11826 return NULL;
11827}
11828
11829
11830/**
11831 * shared_resource_proxy_new_for_bus:
11832 * @bus_type: A #GBusType.
11833 * @flags: Flags from the #GDBusProxyFlags enumeration.
11834 * @name: A bus name (well-known or unique).
11835 * @object_path: An object path.
11836 * @cancellable: (allow-none): A #GCancellable or %NULL.
11837 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11838 * @user_data: User data to pass to @callback.
11839 *
11840 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11841 *
11842 * 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.
11843 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
11844 *
11845 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11846 */
11847void
11848shared_resource_proxy_new_for_bus (
11849 GBusType bus_type,
11850 GDBusProxyFlags flags,
11851 const gchar *name,
11852 const gchar *object_path,
11853 GCancellable *cancellable,
11854 GAsyncReadyCallback callback,
11855 gpointer user_data)
11856{
11857 g_async_initable_new_async (TYPE_SHARED_RESOURCE_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.SharedResource", NULL);
11858}
11859
11860/**
11861 * shared_resource_proxy_new_for_bus_finish:
11862 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
11863 * @error: Return location for error or %NULL
11864 *
11865 * Finishes an operation started with shared_resource_proxy_new_for_bus().
11866 *
11867 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11868 */
11869SharedResource *
11870shared_resource_proxy_new_for_bus_finish (
11871 GAsyncResult *res,
11872 GError **error)
11873{
11874 GObject *ret;
11875 GObject *source_object;
11876 source_object = g_async_result_get_source_object (res);
11877 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11878 g_object_unref (source_object);
11879 if (ret != NULL)
11880 return SHARED_RESOURCE (ret);
11881 else
11882 return NULL;
11883}
11884
11885/**
11886 * shared_resource_proxy_new_for_bus_sync:
11887 * @bus_type: A #GBusType.
11888 * @flags: Flags from the #GDBusProxyFlags enumeration.
11889 * @name: A bus name (well-known or unique).
11890 * @object_path: An object path.
11891 * @cancellable: (allow-none): A #GCancellable or %NULL.
11892 * @error: Return location for error or %NULL
11893 *
11894 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11895 *
11896 * The calling thread is blocked until a reply is received.
11897 *
11898 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
11899 *
11900 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11901 */
11902SharedResource *
11903shared_resource_proxy_new_for_bus_sync (
11904 GBusType bus_type,
11905 GDBusProxyFlags flags,
11906 const gchar *name,
11907 const gchar *object_path,
11908 GCancellable *cancellable,
11909 GError **error)
11910{
11911 GInitable *ret;
11912 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
11913 if (ret != NULL)
11914 return SHARED_RESOURCE (ret);
11915 else
11916 return NULL;
11917}
11918
11919
11920/* ------------------------------------------------------------------------ */
11921
11922/**
11923 * SharedResourceSkeleton:
11924 *
11925 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
11926 */
11927
11928/**
11929 * SharedResourceSkeletonClass:
11930 * @parent_class: The parent class.
11931 *
11932 * Class structure for #SharedResourceSkeleton.
11933 */
11934
11935struct _SharedResourceSkeletonPrivate
11936{
11937 GValue *properties;
11938 GList *changed_properties;
11939 GSource *changed_properties_idle_source;
11940 GMainContext *context;
11941 GMutex lock;
11942};
11943
11944static void
11945_shared_resource_skeleton_handle_method_call (
11946 GDBusConnection *connection G_GNUC_UNUSED,
11947 const gchar *sender G_GNUC_UNUSED,
11948 const gchar *object_path G_GNUC_UNUSED,
11949 const gchar *interface_name,
11950 const gchar *method_name,
11951 GVariant *parameters,
11952 GDBusMethodInvocation *invocation,
11953 gpointer user_data)
11954{
11955 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11956 _ExtendedGDBusMethodInfo *info;
11957 GVariantIter iter;
11958 GVariant *child;
11959 GValue *paramv;
11960 guint num_params;
11961 guint num_extra;
11962 guint n;
11963 guint signal_id;
11964 GValue return_value = G_VALUE_INIT;
11965 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11966 g_assert (info != NULL);
11967 num_params = g_variant_n_children (parameters);
11968 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11969 n = 0;
11970 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
11971 g_value_set_object (&paramv[n++], skeleton);
11972 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11973 g_value_set_object (&paramv[n++], invocation);
11974 if (info->pass_fdlist)
11975 {
11976#ifdef G_OS_UNIX
11977 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11978 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11979#else
11980 g_assert_not_reached ();
11981#endif
11982 }
11983 g_variant_iter_init (&iter, parameters);
11984 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11985 {
11986 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11987 if (arg_info->use_gvariant)
11988 {
11989 g_value_init (&paramv[n], G_TYPE_VARIANT);
11990 g_value_set_variant (&paramv[n], child);
11991 n++;
11992 }
11993 else
11994 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11995 g_variant_unref (child);
11996 }
11997 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
11998 g_value_init (&return_value, G_TYPE_BOOLEAN);
11999 g_signal_emitv (paramv, signal_id, 0, &return_value);
12000 if (!g_value_get_boolean (&return_value))
12001 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);
12002 g_value_unset (&return_value);
12003 for (n = 0; n < num_params + num_extra; n++)
12004 g_value_unset (&paramv[n]);
12005 g_free (paramv);
12006}
12007
12008static GVariant *
12009_shared_resource_skeleton_handle_get_property (
12010 GDBusConnection *connection G_GNUC_UNUSED,
12011 const gchar *sender G_GNUC_UNUSED,
12012 const gchar *object_path G_GNUC_UNUSED,
12013 const gchar *interface_name G_GNUC_UNUSED,
12014 const gchar *property_name,
12015 GError **error,
12016 gpointer user_data)
12017{
12018 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12019 GValue value = G_VALUE_INIT;
12020 GParamSpec *pspec;
12021 _ExtendedGDBusPropertyInfo *info;
12022 GVariant *ret;
12023 ret = NULL;
12024 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12025 g_assert (info != NULL);
12026 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12027 if (pspec == NULL)
12028 {
12029 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12030 }
12031 else
12032 {
12033 g_value_init (&value, pspec->value_type);
12034 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12035 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12036 g_value_unset (&value);
12037 }
12038 return ret;
12039}
12040
12041static gboolean
12042_shared_resource_skeleton_handle_set_property (
12043 GDBusConnection *connection G_GNUC_UNUSED,
12044 const gchar *sender G_GNUC_UNUSED,
12045 const gchar *object_path G_GNUC_UNUSED,
12046 const gchar *interface_name G_GNUC_UNUSED,
12047 const gchar *property_name,
12048 GVariant *variant,
12049 GError **error,
12050 gpointer user_data)
12051{
12052 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12053 GValue value = G_VALUE_INIT;
12054 GParamSpec *pspec;
12055 _ExtendedGDBusPropertyInfo *info;
12056 gboolean ret;
12057 ret = FALSE;
12058 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12059 g_assert (info != NULL);
12060 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12061 if (pspec == NULL)
12062 {
12063 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12064 }
12065 else
12066 {
12067 if (info->use_gvariant)
12068 g_value_set_variant (&value, variant);
12069 else
12070 g_dbus_gvariant_to_gvalue (variant, &value);
12071 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12072 g_value_unset (&value);
12073 ret = TRUE;
12074 }
12075 return ret;
12076}
12077
12078static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
12079{
12080 _shared_resource_skeleton_handle_method_call,
12081 _shared_resource_skeleton_handle_get_property,
12082 _shared_resource_skeleton_handle_set_property,
12083 {NULL}
12084};
12085
12086static GDBusInterfaceInfo *
12087shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12088{
12089 return shared_resource_interface_info ();
12090}
12091
12092static GDBusInterfaceVTable *
12093shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12094{
12095 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
12096}
12097
12098static GVariant *
12099shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12100{
12101 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12102
12103 GVariantBuilder builder;
12104 guint n;
12105 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12106 if (_shared_resource_interface_info.parent_struct.properties == NULL)
12107 goto out;
12108 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
12109 {
12110 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
12111 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12112 {
12113 GVariant *value;
12114 value = _shared_resource_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.SharedResource", info->name, NULL, skeleton);
12115 if (value != NULL)
12116 {
12117 g_variant_take_ref (value);
12118 g_variant_builder_add (&builder, "{sv}", info->name, value);
12119 g_variant_unref (value);
12120 }
12121 }
12122 }
12123out:
12124 return g_variant_builder_end (&builder);
12125}
12126
12127static gboolean _shared_resource_emit_changed (gpointer user_data);
12128
12129static void
12130shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12131{
12132 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12133 gboolean emit_changed = FALSE;
12134
12135 g_mutex_lock (&skeleton->priv->lock);
12136 if (skeleton->priv->changed_properties_idle_source != NULL)
12137 {
12138 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12139 skeleton->priv->changed_properties_idle_source = NULL;
12140 emit_changed = TRUE;
12141 }
12142 g_mutex_unlock (&skeleton->priv->lock);
12143
12144 if (emit_changed)
12145 _shared_resource_emit_changed (skeleton);
12146}
12147
12148static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
12149#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12150G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12151 G_ADD_PRIVATE (SharedResourceSkeleton)
12152 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12153
12154#else
12155G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12156 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12157
12158#endif
12159static void
12160shared_resource_skeleton_finalize (GObject *object)
12161{
12162 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12163 guint n;
12164 for (n = 0; n < 2; n++)
12165 g_value_unset (&skeleton->priv->properties[n]);
12166 g_free (skeleton->priv->properties);
12167 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12168 if (skeleton->priv->changed_properties_idle_source != NULL)
12169 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12170 g_main_context_unref (skeleton->priv->context);
12171 g_mutex_clear (&skeleton->priv->lock);
12172 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
12173}
12174
12175static void
12176shared_resource_skeleton_get_property (GObject *object,
12177 guint prop_id,
12178 GValue *value,
12179 GParamSpec *pspec G_GNUC_UNUSED)
12180{
12181 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12182 g_assert (prop_id != 0 && prop_id - 1 < 2);
12183 g_mutex_lock (&skeleton->priv->lock);
12184 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12185 g_mutex_unlock (&skeleton->priv->lock);
12186}
12187
12188static gboolean
12189_shared_resource_emit_changed (gpointer user_data)
12190{
12191 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12192 GList *l;
12193 GVariantBuilder builder;
12194 GVariantBuilder invalidated_builder;
12195 guint num_changes;
12196
12197 g_mutex_lock (&skeleton->priv->lock);
12198 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12199 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12200 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12201 {
12202 ChangedProperty *cp = l->data;
12203 GVariant *variant;
12204 const GValue *cur_value;
12205
12206 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12207 if (!_g_value_equal (cur_value, &cp->orig_value))
12208 {
12209 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12210 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12211 g_variant_unref (variant);
12212 num_changes++;
12213 }
12214 }
12215 if (num_changes > 0)
12216 {
12217 GList *connections, *ll;
12218 GVariant *signal_variant;
12219 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
12220 &builder, &invalidated_builder));
12221 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12222 for (ll = connections; ll != NULL; ll = ll->next)
12223 {
12224 GDBusConnection *connection = ll->data;
12225
12226 g_dbus_connection_emit_signal (connection,
12227 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12228 "org.freedesktop.DBus.Properties",
12229 "PropertiesChanged",
12230 signal_variant,
12231 NULL);
12232 }
12233 g_variant_unref (signal_variant);
12234 g_list_free_full (connections, g_object_unref);
12235 }
12236 else
12237 {
12238 g_variant_builder_clear (&builder);
12239 g_variant_builder_clear (&invalidated_builder);
12240 }
12241 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12242 skeleton->priv->changed_properties = NULL;
12243 skeleton->priv->changed_properties_idle_source = NULL;
12244 g_mutex_unlock (&skeleton->priv->lock);
12245 return FALSE;
12246}
12247
12248static void
12249_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12250{
12251 ChangedProperty *cp;
12252 GList *l;
12253 cp = NULL;
12254 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12255 {
12256 ChangedProperty *i_cp = l->data;
12257 if (i_cp->info == info)
12258 {
12259 cp = i_cp;
12260 break;
12261 }
12262 }
12263 if (cp == NULL)
12264 {
12265 cp = g_new0 (ChangedProperty, 1);
12266 cp->prop_id = prop_id;
12267 cp->info = info;
12268 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12269 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12270 g_value_copy (orig_value, &cp->orig_value);
12271 }
12272}
12273
12274static void
12275shared_resource_skeleton_notify (GObject *object,
12276 GParamSpec *pspec G_GNUC_UNUSED)
12277{
12278 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12279 g_mutex_lock (&skeleton->priv->lock);
12280 if (skeleton->priv->changed_properties != NULL &&
12281 skeleton->priv->changed_properties_idle_source == NULL)
12282 {
12283 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12284 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12285 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12286 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12287 g_source_unref (skeleton->priv->changed_properties_idle_source);
12288 }
12289 g_mutex_unlock (&skeleton->priv->lock);
12290}
12291
12292static void
12293shared_resource_skeleton_set_property (GObject *object,
12294 guint prop_id,
12295 const GValue *value,
12296 GParamSpec *pspec)
12297{
12298 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12299 g_assert (prop_id != 0 && prop_id - 1 < 2);
12300 g_mutex_lock (&skeleton->priv->lock);
12301 g_object_freeze_notify (object);
12302 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12303 {
12304 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12305 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12306 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12307 g_object_notify_by_pspec (object, pspec);
12308 }
12309 g_mutex_unlock (&skeleton->priv->lock);
12310 g_object_thaw_notify (object);
12311}
12312
12313static void
12314shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
12315{
12316#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12317 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
12318#else
12319 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12320#endif
12321
12322 g_mutex_init (&skeleton->priv->lock);
12323 skeleton->priv->context = g_main_context_ref_thread_default ();
12324 skeleton->priv->properties = g_new0 (GValue, 2);
12325 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12326 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12327}
12328
12329static gboolean
12330shared_resource_skeleton_get_lock (SharedResource *object)
12331{
12332 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12333 gboolean value;
12334 g_mutex_lock (&skeleton->priv->lock);
12335 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
12336 g_mutex_unlock (&skeleton->priv->lock);
12337 return value;
12338}
12339
12340static const gchar *
12341shared_resource_skeleton_get_name (SharedResource *object)
12342{
12343 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12344 const gchar *value;
12345 g_mutex_lock (&skeleton->priv->lock);
12346 value = g_value_get_string (&(skeleton->priv->properties[1]));
12347 g_mutex_unlock (&skeleton->priv->lock);
12348 return value;
12349}
12350
12351static void
12352shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12353{
12354 GObjectClass *gobject_class;
12355 GDBusInterfaceSkeletonClass *skeleton_class;
12356
12357 gobject_class = G_OBJECT_CLASS (klass);
12358 gobject_class->finalize = shared_resource_skeleton_finalize;
12359 gobject_class->get_property = shared_resource_skeleton_get_property;
12360 gobject_class->set_property = shared_resource_skeleton_set_property;
12361 gobject_class->notify = shared_resource_skeleton_notify;
12362
12363
12364 shared_resource_override_properties (gobject_class, 1);
12365
12366 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12367 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12368 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12369 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12370 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12371
12372#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12373 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12374#endif
12375}
12376
12377static void
12378shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12379{
12380 iface->get_lock = shared_resource_skeleton_get_lock;
12381 iface->get_name = shared_resource_skeleton_get_name;
12382}
12383
12384/**
12385 * shared_resource_skeleton_new:
12386 *
12387 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12388 *
12389 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12390 */
12391SharedResource *
12392shared_resource_skeleton_new (void)
12393{
12394 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
12395}
12396
12397/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050012398 * Code for interface org.openbmc.Control
12399 * ------------------------------------------------------------------------
12400 */
12401
12402/**
12403 * SECTION:Control
12404 * @title: Control
12405 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
12406 *
12407 * 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.
12408 */
12409
12410/* ---- Introspection data for org.openbmc.Control ---- */
12411
12412static const _ExtendedGDBusMethodInfo _control_method_info_init =
12413{
12414 {
12415 -1,
12416 (gchar *) "init",
12417 NULL,
12418 NULL,
12419 NULL
12420 },
12421 "handle-init",
12422 FALSE
12423};
12424
12425static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
12426{
12427 &_control_method_info_init,
12428 NULL
12429};
12430
12431static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
12432{
12433 {
12434 -1,
12435 (gchar *) "bus_name",
12436 (gchar *) "s",
12437 NULL
12438 },
12439 FALSE
12440};
12441
12442static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
12443{
12444 &_control_signal_info_heartbeat_ARG_bus_name,
12445 NULL
12446};
12447
12448static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
12449{
12450 {
12451 -1,
12452 (gchar *) "Heartbeat",
12453 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
12454 NULL
12455 },
12456 "heartbeat"
12457};
12458
12459static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
12460{
12461 {
12462 -1,
12463 (gchar *) "state_name",
12464 (gchar *) "s",
12465 NULL
12466 },
12467 FALSE
12468};
12469
12470static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
12471{
12472 &_control_signal_info_goto_system_state_ARG_state_name,
12473 NULL
12474};
12475
12476static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
12477{
12478 {
12479 -1,
12480 (gchar *) "GotoSystemState",
12481 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
12482 NULL
12483 },
12484 "goto-system-state"
12485};
12486
12487static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
12488{
12489 &_control_signal_info_heartbeat,
12490 &_control_signal_info_goto_system_state,
12491 NULL
12492};
12493
12494static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
12495{
12496 {
12497 -1,
12498 (gchar *) "poll_interval",
12499 (gchar *) "i",
12500 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
12501 NULL
12502 },
12503 "poll-interval",
12504 FALSE
12505};
12506
12507static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
12508{
12509 {
12510 -1,
12511 (gchar *) "heatbeat",
12512 (gchar *) "i",
12513 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
12514 NULL
12515 },
12516 "heatbeat",
12517 FALSE
12518};
12519
12520static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
12521{
12522 &_control_property_info_poll_interval,
12523 &_control_property_info_heatbeat,
12524 NULL
12525};
12526
12527static const _ExtendedGDBusInterfaceInfo _control_interface_info =
12528{
12529 {
12530 -1,
12531 (gchar *) "org.openbmc.Control",
12532 (GDBusMethodInfo **) &_control_method_info_pointers,
12533 (GDBusSignalInfo **) &_control_signal_info_pointers,
12534 (GDBusPropertyInfo **) &_control_property_info_pointers,
12535 NULL
12536 },
12537 "control",
12538};
12539
12540
12541/**
12542 * control_interface_info:
12543 *
12544 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
12545 *
12546 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12547 */
12548GDBusInterfaceInfo *
12549control_interface_info (void)
12550{
12551 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
12552}
12553
12554/**
12555 * control_override_properties:
12556 * @klass: The class structure for a #GObject<!-- -->-derived class.
12557 * @property_id_begin: The property id to assign to the first overridden property.
12558 *
12559 * Overrides all #GObject properties in the #Control interface for a concrete class.
12560 * The properties are overridden in the order they are defined.
12561 *
12562 * Returns: The last property id.
12563 */
12564guint
12565control_override_properties (GObjectClass *klass, guint property_id_begin)
12566{
12567 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
12568 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
12569 return property_id_begin - 1;
12570}
12571
12572
12573
12574/**
12575 * Control:
12576 *
12577 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12578 */
12579
12580/**
12581 * ControlIface:
12582 * @parent_iface: The parent interface.
12583 * @handle_init: Handler for the #Control::handle-init signal.
12584 * @get_heatbeat: Getter for the #Control:heatbeat property.
12585 * @get_poll_interval: Getter for the #Control:poll-interval property.
12586 * @goto_system_state: Handler for the #Control::goto-system-state signal.
12587 * @heartbeat: Handler for the #Control::heartbeat signal.
12588 *
12589 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12590 */
12591
12592typedef ControlIface ControlInterface;
12593G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
12594
12595static void
12596control_default_init (ControlIface *iface)
12597{
12598 /* GObject signals for incoming D-Bus method calls: */
12599 /**
12600 * Control::handle-init:
12601 * @object: A #Control.
12602 * @invocation: A #GDBusMethodInvocation.
12603 *
12604 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
12605 *
12606 * 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.
12607 *
12608 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12609 */
12610 g_signal_new ("handle-init",
12611 G_TYPE_FROM_INTERFACE (iface),
12612 G_SIGNAL_RUN_LAST,
12613 G_STRUCT_OFFSET (ControlIface, handle_init),
12614 g_signal_accumulator_true_handled,
12615 NULL,
12616 g_cclosure_marshal_generic,
12617 G_TYPE_BOOLEAN,
12618 1,
12619 G_TYPE_DBUS_METHOD_INVOCATION);
12620
12621 /* GObject signals for received D-Bus signals: */
12622 /**
12623 * Control::heartbeat:
12624 * @object: A #Control.
12625 * @arg_bus_name: Argument.
12626 *
12627 * 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.
12628 *
12629 * 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.
12630 */
12631 g_signal_new ("heartbeat",
12632 G_TYPE_FROM_INTERFACE (iface),
12633 G_SIGNAL_RUN_LAST,
12634 G_STRUCT_OFFSET (ControlIface, heartbeat),
12635 NULL,
12636 NULL,
12637 g_cclosure_marshal_generic,
12638 G_TYPE_NONE,
12639 1, G_TYPE_STRING);
12640
12641 /**
12642 * Control::goto-system-state:
12643 * @object: A #Control.
12644 * @arg_state_name: Argument.
12645 *
12646 * 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.
12647 *
12648 * 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.
12649 */
12650 g_signal_new ("goto-system-state",
12651 G_TYPE_FROM_INTERFACE (iface),
12652 G_SIGNAL_RUN_LAST,
12653 G_STRUCT_OFFSET (ControlIface, goto_system_state),
12654 NULL,
12655 NULL,
12656 g_cclosure_marshal_generic,
12657 G_TYPE_NONE,
12658 1, G_TYPE_STRING);
12659
12660 /* GObject properties for D-Bus properties: */
12661 /**
12662 * Control:poll-interval:
12663 *
12664 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
12665 *
12666 * 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.
12667 */
12668 g_object_interface_install_property (iface,
12669 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12670 /**
12671 * Control:heatbeat:
12672 *
12673 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
12674 *
12675 * 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.
12676 */
12677 g_object_interface_install_property (iface,
12678 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12679}
12680
12681/**
12682 * control_get_poll_interval: (skip)
12683 * @object: A #Control.
12684 *
12685 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
12686 *
12687 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12688 *
12689 * Returns: The property value.
12690 */
12691gint
12692control_get_poll_interval (Control *object)
12693{
12694 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
12695}
12696
12697/**
12698 * control_set_poll_interval: (skip)
12699 * @object: A #Control.
12700 * @value: The value to set.
12701 *
12702 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
12703 *
12704 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12705 */
12706void
12707control_set_poll_interval (Control *object, gint value)
12708{
12709 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
12710}
12711
12712/**
12713 * control_get_heatbeat: (skip)
12714 * @object: A #Control.
12715 *
12716 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
12717 *
12718 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
12719 *
12720 * Returns: The property value.
12721 */
12722gint
12723control_get_heatbeat (Control *object)
12724{
12725 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
12726}
12727
12728/**
12729 * control_set_heatbeat: (skip)
12730 * @object: A #Control.
12731 * @value: The value to set.
12732 *
12733 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
12734 *
12735 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
12736 */
12737void
12738control_set_heatbeat (Control *object, gint value)
12739{
12740 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
12741}
12742
12743/**
12744 * control_emit_heartbeat:
12745 * @object: A #Control.
12746 * @arg_bus_name: Argument to pass with the signal.
12747 *
12748 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
12749 */
12750void
12751control_emit_heartbeat (
12752 Control *object,
12753 const gchar *arg_bus_name)
12754{
12755 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
12756}
12757
12758/**
12759 * control_emit_goto_system_state:
12760 * @object: A #Control.
12761 * @arg_state_name: Argument to pass with the signal.
12762 *
12763 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
12764 */
12765void
12766control_emit_goto_system_state (
12767 Control *object,
12768 const gchar *arg_state_name)
12769{
12770 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
12771}
12772
12773/**
12774 * control_call_init:
12775 * @proxy: A #ControlProxy.
12776 * @cancellable: (allow-none): A #GCancellable or %NULL.
12777 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12778 * @user_data: User data to pass to @callback.
12779 *
12780 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
12781 * 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.
12782 * You can then call control_call_init_finish() to get the result of the operation.
12783 *
12784 * See control_call_init_sync() for the synchronous, blocking version of this method.
12785 */
12786void
12787control_call_init (
12788 Control *proxy,
12789 GCancellable *cancellable,
12790 GAsyncReadyCallback callback,
12791 gpointer user_data)
12792{
12793 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12794 "init",
12795 g_variant_new ("()"),
12796 G_DBUS_CALL_FLAGS_NONE,
12797 -1,
12798 cancellable,
12799 callback,
12800 user_data);
12801}
12802
12803/**
12804 * control_call_init_finish:
12805 * @proxy: A #ControlProxy.
12806 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
12807 * @error: Return location for error or %NULL.
12808 *
12809 * Finishes an operation started with control_call_init().
12810 *
12811 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12812 */
12813gboolean
12814control_call_init_finish (
12815 Control *proxy,
12816 GAsyncResult *res,
12817 GError **error)
12818{
12819 GVariant *_ret;
12820 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12821 if (_ret == NULL)
12822 goto _out;
12823 g_variant_get (_ret,
12824 "()");
12825 g_variant_unref (_ret);
12826_out:
12827 return _ret != NULL;
12828}
12829
12830/**
12831 * control_call_init_sync:
12832 * @proxy: A #ControlProxy.
12833 * @cancellable: (allow-none): A #GCancellable or %NULL.
12834 * @error: Return location for error or %NULL.
12835 *
12836 * 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.
12837 *
12838 * See control_call_init() for the asynchronous version of this method.
12839 *
12840 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12841 */
12842gboolean
12843control_call_init_sync (
12844 Control *proxy,
12845 GCancellable *cancellable,
12846 GError **error)
12847{
12848 GVariant *_ret;
12849 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12850 "init",
12851 g_variant_new ("()"),
12852 G_DBUS_CALL_FLAGS_NONE,
12853 -1,
12854 cancellable,
12855 error);
12856 if (_ret == NULL)
12857 goto _out;
12858 g_variant_get (_ret,
12859 "()");
12860 g_variant_unref (_ret);
12861_out:
12862 return _ret != NULL;
12863}
12864
12865/**
12866 * control_complete_init:
12867 * @object: A #Control.
12868 * @invocation: (transfer full): A #GDBusMethodInvocation.
12869 *
12870 * 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.
12871 *
12872 * This method will free @invocation, you cannot use it afterwards.
12873 */
12874void
12875control_complete_init (
12876 Control *object,
12877 GDBusMethodInvocation *invocation)
12878{
12879 g_dbus_method_invocation_return_value (invocation,
12880 g_variant_new ("()"));
12881}
12882
12883/* ------------------------------------------------------------------------ */
12884
12885/**
12886 * ControlProxy:
12887 *
12888 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
12889 */
12890
12891/**
12892 * ControlProxyClass:
12893 * @parent_class: The parent class.
12894 *
12895 * Class structure for #ControlProxy.
12896 */
12897
12898struct _ControlProxyPrivate
12899{
12900 GData *qdata;
12901};
12902
12903static void control_proxy_iface_init (ControlIface *iface);
12904
12905#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12906G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12907 G_ADD_PRIVATE (ControlProxy)
12908 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12909
12910#else
12911G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12912 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12913
12914#endif
12915static void
12916control_proxy_finalize (GObject *object)
12917{
12918 ControlProxy *proxy = CONTROL_PROXY (object);
12919 g_datalist_clear (&proxy->priv->qdata);
12920 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
12921}
12922
12923static void
12924control_proxy_get_property (GObject *object,
12925 guint prop_id,
12926 GValue *value,
12927 GParamSpec *pspec G_GNUC_UNUSED)
12928{
12929 const _ExtendedGDBusPropertyInfo *info;
12930 GVariant *variant;
12931 g_assert (prop_id != 0 && prop_id - 1 < 2);
12932 info = _control_property_info_pointers[prop_id - 1];
12933 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12934 if (info->use_gvariant)
12935 {
12936 g_value_set_variant (value, variant);
12937 }
12938 else
12939 {
12940 if (variant != NULL)
12941 g_dbus_gvariant_to_gvalue (variant, value);
12942 }
12943 if (variant != NULL)
12944 g_variant_unref (variant);
12945}
12946
12947static void
12948control_proxy_set_property_cb (GDBusProxy *proxy,
12949 GAsyncResult *res,
12950 gpointer user_data)
12951{
12952 const _ExtendedGDBusPropertyInfo *info = user_data;
12953 GError *error;
12954 GVariant *_ret;
12955 error = NULL;
12956 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12957 if (!_ret)
12958 {
12959 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
12960 info->parent_struct.name,
12961 error->message, g_quark_to_string (error->domain), error->code);
12962 g_error_free (error);
12963 }
12964 else
12965 {
12966 g_variant_unref (_ret);
12967 }
12968}
12969
12970static void
12971control_proxy_set_property (GObject *object,
12972 guint prop_id,
12973 const GValue *value,
12974 GParamSpec *pspec G_GNUC_UNUSED)
12975{
12976 const _ExtendedGDBusPropertyInfo *info;
12977 GVariant *variant;
12978 g_assert (prop_id != 0 && prop_id - 1 < 2);
12979 info = _control_property_info_pointers[prop_id - 1];
12980 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12981 g_dbus_proxy_call (G_DBUS_PROXY (object),
12982 "org.freedesktop.DBus.Properties.Set",
12983 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
12984 G_DBUS_CALL_FLAGS_NONE,
12985 -1,
12986 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12987 g_variant_unref (variant);
12988}
12989
12990static void
12991control_proxy_g_signal (GDBusProxy *proxy,
12992 const gchar *sender_name G_GNUC_UNUSED,
12993 const gchar *signal_name,
12994 GVariant *parameters)
12995{
12996 _ExtendedGDBusSignalInfo *info;
12997 GVariantIter iter;
12998 GVariant *child;
12999 GValue *paramv;
13000 guint num_params;
13001 guint n;
13002 guint signal_id;
13003 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
13004 if (info == NULL)
13005 return;
13006 num_params = g_variant_n_children (parameters);
13007 paramv = g_new0 (GValue, num_params + 1);
13008 g_value_init (&paramv[0], TYPE_CONTROL);
13009 g_value_set_object (&paramv[0], proxy);
13010 g_variant_iter_init (&iter, parameters);
13011 n = 1;
13012 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13013 {
13014 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13015 if (arg_info->use_gvariant)
13016 {
13017 g_value_init (&paramv[n], G_TYPE_VARIANT);
13018 g_value_set_variant (&paramv[n], child);
13019 n++;
13020 }
13021 else
13022 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13023 g_variant_unref (child);
13024 }
13025 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13026 g_signal_emitv (paramv, signal_id, 0, NULL);
13027 for (n = 0; n < num_params + 1; n++)
13028 g_value_unset (&paramv[n]);
13029 g_free (paramv);
13030}
13031
13032static void
13033control_proxy_g_properties_changed (GDBusProxy *_proxy,
13034 GVariant *changed_properties,
13035 const gchar *const *invalidated_properties)
13036{
13037 ControlProxy *proxy = CONTROL_PROXY (_proxy);
13038 guint n;
13039 const gchar *key;
13040 GVariantIter *iter;
13041 _ExtendedGDBusPropertyInfo *info;
13042 g_variant_get (changed_properties, "a{sv}", &iter);
13043 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13044 {
13045 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
13046 g_datalist_remove_data (&proxy->priv->qdata, key);
13047 if (info != NULL)
13048 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13049 }
13050 g_variant_iter_free (iter);
13051 for (n = 0; invalidated_properties[n] != NULL; n++)
13052 {
13053 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
13054 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13055 if (info != NULL)
13056 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13057 }
13058}
13059
13060static gint
13061control_proxy_get_poll_interval (Control *object)
13062{
13063 ControlProxy *proxy = CONTROL_PROXY (object);
13064 GVariant *variant;
13065 gint value = 0;
13066 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
13067 if (variant != NULL)
13068 {
13069 value = g_variant_get_int32 (variant);
13070 g_variant_unref (variant);
13071 }
13072 return value;
13073}
13074
13075static gint
13076control_proxy_get_heatbeat (Control *object)
13077{
13078 ControlProxy *proxy = CONTROL_PROXY (object);
13079 GVariant *variant;
13080 gint value = 0;
13081 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
13082 if (variant != NULL)
13083 {
13084 value = g_variant_get_int32 (variant);
13085 g_variant_unref (variant);
13086 }
13087 return value;
13088}
13089
13090static void
13091control_proxy_init (ControlProxy *proxy)
13092{
13093#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13094 proxy->priv = control_proxy_get_instance_private (proxy);
13095#else
13096 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
13097#endif
13098
13099 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
13100}
13101
13102static void
13103control_proxy_class_init (ControlProxyClass *klass)
13104{
13105 GObjectClass *gobject_class;
13106 GDBusProxyClass *proxy_class;
13107
13108 gobject_class = G_OBJECT_CLASS (klass);
13109 gobject_class->finalize = control_proxy_finalize;
13110 gobject_class->get_property = control_proxy_get_property;
13111 gobject_class->set_property = control_proxy_set_property;
13112
13113 proxy_class = G_DBUS_PROXY_CLASS (klass);
13114 proxy_class->g_signal = control_proxy_g_signal;
13115 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
13116
13117 control_override_properties (gobject_class, 1);
13118
13119#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13120 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
13121#endif
13122}
13123
13124static void
13125control_proxy_iface_init (ControlIface *iface)
13126{
13127 iface->get_poll_interval = control_proxy_get_poll_interval;
13128 iface->get_heatbeat = control_proxy_get_heatbeat;
13129}
13130
13131/**
13132 * control_proxy_new:
13133 * @connection: A #GDBusConnection.
13134 * @flags: Flags from the #GDBusProxyFlags enumeration.
13135 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13136 * @object_path: An object path.
13137 * @cancellable: (allow-none): A #GCancellable or %NULL.
13138 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13139 * @user_data: User data to pass to @callback.
13140 *
13141 * 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.
13142 *
13143 * 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.
13144 * You can then call control_proxy_new_finish() to get the result of the operation.
13145 *
13146 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
13147 */
13148void
13149control_proxy_new (
13150 GDBusConnection *connection,
13151 GDBusProxyFlags flags,
13152 const gchar *name,
13153 const gchar *object_path,
13154 GCancellable *cancellable,
13155 GAsyncReadyCallback callback,
13156 gpointer user_data)
13157{
13158 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);
13159}
13160
13161/**
13162 * control_proxy_new_finish:
13163 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
13164 * @error: Return location for error or %NULL
13165 *
13166 * Finishes an operation started with control_proxy_new().
13167 *
13168 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13169 */
13170Control *
13171control_proxy_new_finish (
13172 GAsyncResult *res,
13173 GError **error)
13174{
13175 GObject *ret;
13176 GObject *source_object;
13177 source_object = g_async_result_get_source_object (res);
13178 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13179 g_object_unref (source_object);
13180 if (ret != NULL)
13181 return CONTROL (ret);
13182 else
13183 return NULL;
13184}
13185
13186/**
13187 * control_proxy_new_sync:
13188 * @connection: A #GDBusConnection.
13189 * @flags: Flags from the #GDBusProxyFlags enumeration.
13190 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13191 * @object_path: An object path.
13192 * @cancellable: (allow-none): A #GCancellable or %NULL.
13193 * @error: Return location for error or %NULL
13194 *
13195 * 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.
13196 *
13197 * The calling thread is blocked until a reply is received.
13198 *
13199 * See control_proxy_new() for the asynchronous version of this constructor.
13200 *
13201 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13202 */
13203Control *
13204control_proxy_new_sync (
13205 GDBusConnection *connection,
13206 GDBusProxyFlags flags,
13207 const gchar *name,
13208 const gchar *object_path,
13209 GCancellable *cancellable,
13210 GError **error)
13211{
13212 GInitable *ret;
13213 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);
13214 if (ret != NULL)
13215 return CONTROL (ret);
13216 else
13217 return NULL;
13218}
13219
13220
13221/**
13222 * control_proxy_new_for_bus:
13223 * @bus_type: A #GBusType.
13224 * @flags: Flags from the #GDBusProxyFlags enumeration.
13225 * @name: A bus name (well-known or unique).
13226 * @object_path: An object path.
13227 * @cancellable: (allow-none): A #GCancellable or %NULL.
13228 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13229 * @user_data: User data to pass to @callback.
13230 *
13231 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13232 *
13233 * 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.
13234 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
13235 *
13236 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13237 */
13238void
13239control_proxy_new_for_bus (
13240 GBusType bus_type,
13241 GDBusProxyFlags flags,
13242 const gchar *name,
13243 const gchar *object_path,
13244 GCancellable *cancellable,
13245 GAsyncReadyCallback callback,
13246 gpointer user_data)
13247{
13248 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);
13249}
13250
13251/**
13252 * control_proxy_new_for_bus_finish:
13253 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
13254 * @error: Return location for error or %NULL
13255 *
13256 * Finishes an operation started with control_proxy_new_for_bus().
13257 *
13258 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13259 */
13260Control *
13261control_proxy_new_for_bus_finish (
13262 GAsyncResult *res,
13263 GError **error)
13264{
13265 GObject *ret;
13266 GObject *source_object;
13267 source_object = g_async_result_get_source_object (res);
13268 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13269 g_object_unref (source_object);
13270 if (ret != NULL)
13271 return CONTROL (ret);
13272 else
13273 return NULL;
13274}
13275
13276/**
13277 * control_proxy_new_for_bus_sync:
13278 * @bus_type: A #GBusType.
13279 * @flags: Flags from the #GDBusProxyFlags enumeration.
13280 * @name: A bus name (well-known or unique).
13281 * @object_path: An object path.
13282 * @cancellable: (allow-none): A #GCancellable or %NULL.
13283 * @error: Return location for error or %NULL
13284 *
13285 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13286 *
13287 * The calling thread is blocked until a reply is received.
13288 *
13289 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13290 *
13291 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13292 */
13293Control *
13294control_proxy_new_for_bus_sync (
13295 GBusType bus_type,
13296 GDBusProxyFlags flags,
13297 const gchar *name,
13298 const gchar *object_path,
13299 GCancellable *cancellable,
13300 GError **error)
13301{
13302 GInitable *ret;
13303 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);
13304 if (ret != NULL)
13305 return CONTROL (ret);
13306 else
13307 return NULL;
13308}
13309
13310
13311/* ------------------------------------------------------------------------ */
13312
13313/**
13314 * ControlSkeleton:
13315 *
13316 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13317 */
13318
13319/**
13320 * ControlSkeletonClass:
13321 * @parent_class: The parent class.
13322 *
13323 * Class structure for #ControlSkeleton.
13324 */
13325
13326struct _ControlSkeletonPrivate
13327{
13328 GValue *properties;
13329 GList *changed_properties;
13330 GSource *changed_properties_idle_source;
13331 GMainContext *context;
13332 GMutex lock;
13333};
13334
13335static void
13336_control_skeleton_handle_method_call (
13337 GDBusConnection *connection G_GNUC_UNUSED,
13338 const gchar *sender G_GNUC_UNUSED,
13339 const gchar *object_path G_GNUC_UNUSED,
13340 const gchar *interface_name,
13341 const gchar *method_name,
13342 GVariant *parameters,
13343 GDBusMethodInvocation *invocation,
13344 gpointer user_data)
13345{
13346 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13347 _ExtendedGDBusMethodInfo *info;
13348 GVariantIter iter;
13349 GVariant *child;
13350 GValue *paramv;
13351 guint num_params;
13352 guint num_extra;
13353 guint n;
13354 guint signal_id;
13355 GValue return_value = G_VALUE_INIT;
13356 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13357 g_assert (info != NULL);
13358 num_params = g_variant_n_children (parameters);
13359 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13360 n = 0;
13361 g_value_init (&paramv[n], TYPE_CONTROL);
13362 g_value_set_object (&paramv[n++], skeleton);
13363 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13364 g_value_set_object (&paramv[n++], invocation);
13365 if (info->pass_fdlist)
13366 {
13367#ifdef G_OS_UNIX
13368 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13369 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13370#else
13371 g_assert_not_reached ();
13372#endif
13373 }
13374 g_variant_iter_init (&iter, parameters);
13375 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13376 {
13377 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13378 if (arg_info->use_gvariant)
13379 {
13380 g_value_init (&paramv[n], G_TYPE_VARIANT);
13381 g_value_set_variant (&paramv[n], child);
13382 n++;
13383 }
13384 else
13385 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13386 g_variant_unref (child);
13387 }
13388 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13389 g_value_init (&return_value, G_TYPE_BOOLEAN);
13390 g_signal_emitv (paramv, signal_id, 0, &return_value);
13391 if (!g_value_get_boolean (&return_value))
13392 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);
13393 g_value_unset (&return_value);
13394 for (n = 0; n < num_params + num_extra; n++)
13395 g_value_unset (&paramv[n]);
13396 g_free (paramv);
13397}
13398
13399static GVariant *
13400_control_skeleton_handle_get_property (
13401 GDBusConnection *connection G_GNUC_UNUSED,
13402 const gchar *sender G_GNUC_UNUSED,
13403 const gchar *object_path G_GNUC_UNUSED,
13404 const gchar *interface_name G_GNUC_UNUSED,
13405 const gchar *property_name,
13406 GError **error,
13407 gpointer user_data)
13408{
13409 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13410 GValue value = G_VALUE_INIT;
13411 GParamSpec *pspec;
13412 _ExtendedGDBusPropertyInfo *info;
13413 GVariant *ret;
13414 ret = NULL;
13415 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13416 g_assert (info != NULL);
13417 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13418 if (pspec == NULL)
13419 {
13420 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13421 }
13422 else
13423 {
13424 g_value_init (&value, pspec->value_type);
13425 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13426 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13427 g_value_unset (&value);
13428 }
13429 return ret;
13430}
13431
13432static gboolean
13433_control_skeleton_handle_set_property (
13434 GDBusConnection *connection G_GNUC_UNUSED,
13435 const gchar *sender G_GNUC_UNUSED,
13436 const gchar *object_path G_GNUC_UNUSED,
13437 const gchar *interface_name G_GNUC_UNUSED,
13438 const gchar *property_name,
13439 GVariant *variant,
13440 GError **error,
13441 gpointer user_data)
13442{
13443 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13444 GValue value = G_VALUE_INIT;
13445 GParamSpec *pspec;
13446 _ExtendedGDBusPropertyInfo *info;
13447 gboolean ret;
13448 ret = FALSE;
13449 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13450 g_assert (info != NULL);
13451 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13452 if (pspec == NULL)
13453 {
13454 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13455 }
13456 else
13457 {
13458 if (info->use_gvariant)
13459 g_value_set_variant (&value, variant);
13460 else
13461 g_dbus_gvariant_to_gvalue (variant, &value);
13462 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13463 g_value_unset (&value);
13464 ret = TRUE;
13465 }
13466 return ret;
13467}
13468
13469static const GDBusInterfaceVTable _control_skeleton_vtable =
13470{
13471 _control_skeleton_handle_method_call,
13472 _control_skeleton_handle_get_property,
13473 _control_skeleton_handle_set_property,
13474 {NULL}
13475};
13476
13477static GDBusInterfaceInfo *
13478control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13479{
13480 return control_interface_info ();
13481}
13482
13483static GDBusInterfaceVTable *
13484control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13485{
13486 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
13487}
13488
13489static GVariant *
13490control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
13491{
13492 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13493
13494 GVariantBuilder builder;
13495 guint n;
13496 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13497 if (_control_interface_info.parent_struct.properties == NULL)
13498 goto out;
13499 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
13500 {
13501 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
13502 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
13503 {
13504 GVariant *value;
13505 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);
13506 if (value != NULL)
13507 {
13508 g_variant_take_ref (value);
13509 g_variant_builder_add (&builder, "{sv}", info->name, value);
13510 g_variant_unref (value);
13511 }
13512 }
13513 }
13514out:
13515 return g_variant_builder_end (&builder);
13516}
13517
13518static gboolean _control_emit_changed (gpointer user_data);
13519
13520static void
13521control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
13522{
13523 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13524 gboolean emit_changed = FALSE;
13525
13526 g_mutex_lock (&skeleton->priv->lock);
13527 if (skeleton->priv->changed_properties_idle_source != NULL)
13528 {
13529 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13530 skeleton->priv->changed_properties_idle_source = NULL;
13531 emit_changed = TRUE;
13532 }
13533 g_mutex_unlock (&skeleton->priv->lock);
13534
13535 if (emit_changed)
13536 _control_emit_changed (skeleton);
13537}
13538
13539static void
13540_control_on_signal_heartbeat (
13541 Control *object,
13542 const gchar *arg_bus_name)
13543{
13544 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13545
13546 GList *connections, *l;
13547 GVariant *signal_variant;
13548 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13549
13550 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13551 arg_bus_name));
13552 for (l = connections; l != NULL; l = l->next)
13553 {
13554 GDBusConnection *connection = l->data;
13555 g_dbus_connection_emit_signal (connection,
13556 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
13557 signal_variant, NULL);
13558 }
13559 g_variant_unref (signal_variant);
13560 g_list_free_full (connections, g_object_unref);
13561}
13562
13563static void
13564_control_on_signal_goto_system_state (
13565 Control *object,
13566 const gchar *arg_state_name)
13567{
13568 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13569
13570 GList *connections, *l;
13571 GVariant *signal_variant;
13572 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13573
13574 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13575 arg_state_name));
13576 for (l = connections; l != NULL; l = l->next)
13577 {
13578 GDBusConnection *connection = l->data;
13579 g_dbus_connection_emit_signal (connection,
13580 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
13581 signal_variant, NULL);
13582 }
13583 g_variant_unref (signal_variant);
13584 g_list_free_full (connections, g_object_unref);
13585}
13586
13587static void control_skeleton_iface_init (ControlIface *iface);
13588#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13589G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13590 G_ADD_PRIVATE (ControlSkeleton)
13591 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13592
13593#else
13594G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13595 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13596
13597#endif
13598static void
13599control_skeleton_finalize (GObject *object)
13600{
13601 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13602 guint n;
13603 for (n = 0; n < 2; n++)
13604 g_value_unset (&skeleton->priv->properties[n]);
13605 g_free (skeleton->priv->properties);
13606 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13607 if (skeleton->priv->changed_properties_idle_source != NULL)
13608 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13609 g_main_context_unref (skeleton->priv->context);
13610 g_mutex_clear (&skeleton->priv->lock);
13611 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
13612}
13613
13614static void
13615control_skeleton_get_property (GObject *object,
13616 guint prop_id,
13617 GValue *value,
13618 GParamSpec *pspec G_GNUC_UNUSED)
13619{
13620 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13621 g_assert (prop_id != 0 && prop_id - 1 < 2);
13622 g_mutex_lock (&skeleton->priv->lock);
13623 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
13624 g_mutex_unlock (&skeleton->priv->lock);
13625}
13626
13627static gboolean
13628_control_emit_changed (gpointer user_data)
13629{
13630 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13631 GList *l;
13632 GVariantBuilder builder;
13633 GVariantBuilder invalidated_builder;
13634 guint num_changes;
13635
13636 g_mutex_lock (&skeleton->priv->lock);
13637 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13638 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
13639 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
13640 {
13641 ChangedProperty *cp = l->data;
13642 GVariant *variant;
13643 const GValue *cur_value;
13644
13645 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
13646 if (!_g_value_equal (cur_value, &cp->orig_value))
13647 {
13648 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
13649 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
13650 g_variant_unref (variant);
13651 num_changes++;
13652 }
13653 }
13654 if (num_changes > 0)
13655 {
13656 GList *connections, *ll;
13657 GVariant *signal_variant;
13658 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
13659 &builder, &invalidated_builder));
13660 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13661 for (ll = connections; ll != NULL; ll = ll->next)
13662 {
13663 GDBusConnection *connection = ll->data;
13664
13665 g_dbus_connection_emit_signal (connection,
13666 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
13667 "org.freedesktop.DBus.Properties",
13668 "PropertiesChanged",
13669 signal_variant,
13670 NULL);
13671 }
13672 g_variant_unref (signal_variant);
13673 g_list_free_full (connections, g_object_unref);
13674 }
13675 else
13676 {
13677 g_variant_builder_clear (&builder);
13678 g_variant_builder_clear (&invalidated_builder);
13679 }
13680 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13681 skeleton->priv->changed_properties = NULL;
13682 skeleton->priv->changed_properties_idle_source = NULL;
13683 g_mutex_unlock (&skeleton->priv->lock);
13684 return FALSE;
13685}
13686
13687static void
13688_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
13689{
13690 ChangedProperty *cp;
13691 GList *l;
13692 cp = NULL;
13693 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
13694 {
13695 ChangedProperty *i_cp = l->data;
13696 if (i_cp->info == info)
13697 {
13698 cp = i_cp;
13699 break;
13700 }
13701 }
13702 if (cp == NULL)
13703 {
13704 cp = g_new0 (ChangedProperty, 1);
13705 cp->prop_id = prop_id;
13706 cp->info = info;
13707 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
13708 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
13709 g_value_copy (orig_value, &cp->orig_value);
13710 }
13711}
13712
13713static void
13714control_skeleton_notify (GObject *object,
13715 GParamSpec *pspec G_GNUC_UNUSED)
13716{
13717 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13718 g_mutex_lock (&skeleton->priv->lock);
13719 if (skeleton->priv->changed_properties != NULL &&
13720 skeleton->priv->changed_properties_idle_source == NULL)
13721 {
13722 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
13723 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
13724 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
13725 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
13726 g_source_unref (skeleton->priv->changed_properties_idle_source);
13727 }
13728 g_mutex_unlock (&skeleton->priv->lock);
13729}
13730
13731static void
13732control_skeleton_set_property (GObject *object,
13733 guint prop_id,
13734 const GValue *value,
13735 GParamSpec *pspec)
13736{
13737 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13738 g_assert (prop_id != 0 && prop_id - 1 < 2);
13739 g_mutex_lock (&skeleton->priv->lock);
13740 g_object_freeze_notify (object);
13741 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
13742 {
13743 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
13744 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
13745 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
13746 g_object_notify_by_pspec (object, pspec);
13747 }
13748 g_mutex_unlock (&skeleton->priv->lock);
13749 g_object_thaw_notify (object);
13750}
13751
13752static void
13753control_skeleton_init (ControlSkeleton *skeleton)
13754{
13755#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13756 skeleton->priv = control_skeleton_get_instance_private (skeleton);
13757#else
13758 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
13759#endif
13760
13761 g_mutex_init (&skeleton->priv->lock);
13762 skeleton->priv->context = g_main_context_ref_thread_default ();
13763 skeleton->priv->properties = g_new0 (GValue, 2);
13764 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
13765 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
13766}
13767
13768static gint
13769control_skeleton_get_poll_interval (Control *object)
13770{
13771 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13772 gint value;
13773 g_mutex_lock (&skeleton->priv->lock);
13774 value = g_value_get_int (&(skeleton->priv->properties[0]));
13775 g_mutex_unlock (&skeleton->priv->lock);
13776 return value;
13777}
13778
13779static gint
13780control_skeleton_get_heatbeat (Control *object)
13781{
13782 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13783 gint value;
13784 g_mutex_lock (&skeleton->priv->lock);
13785 value = g_value_get_int (&(skeleton->priv->properties[1]));
13786 g_mutex_unlock (&skeleton->priv->lock);
13787 return value;
13788}
13789
13790static void
13791control_skeleton_class_init (ControlSkeletonClass *klass)
13792{
13793 GObjectClass *gobject_class;
13794 GDBusInterfaceSkeletonClass *skeleton_class;
13795
13796 gobject_class = G_OBJECT_CLASS (klass);
13797 gobject_class->finalize = control_skeleton_finalize;
13798 gobject_class->get_property = control_skeleton_get_property;
13799 gobject_class->set_property = control_skeleton_set_property;
13800 gobject_class->notify = control_skeleton_notify;
13801
13802
13803 control_override_properties (gobject_class, 1);
13804
13805 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13806 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
13807 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
13808 skeleton_class->flush = control_skeleton_dbus_interface_flush;
13809 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
13810
13811#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13812 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
13813#endif
13814}
13815
13816static void
13817control_skeleton_iface_init (ControlIface *iface)
13818{
13819 iface->heartbeat = _control_on_signal_heartbeat;
13820 iface->goto_system_state = _control_on_signal_goto_system_state;
13821 iface->get_poll_interval = control_skeleton_get_poll_interval;
13822 iface->get_heatbeat = control_skeleton_get_heatbeat;
13823}
13824
13825/**
13826 * control_skeleton_new:
13827 *
13828 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13829 *
13830 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
13831 */
13832Control *
13833control_skeleton_new (void)
13834{
13835 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
13836}
13837
13838/* ------------------------------------------------------------------------
13839 * Code for interface org.openbmc.control.Bmc
13840 * ------------------------------------------------------------------------
13841 */
13842
13843/**
13844 * SECTION:ControlBmc
13845 * @title: ControlBmc
13846 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
13847 *
13848 * 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.
13849 */
13850
13851/* ---- Introspection data for org.openbmc.control.Bmc ---- */
13852
13853static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
13854{
13855 {
13856 -1,
13857 (gchar *) "place_holder",
13858 NULL,
13859 NULL,
13860 NULL
13861 },
13862 "handle-place-holder",
13863 FALSE
13864};
13865
13866static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
13867{
13868 &_control_bmc_method_info_place_holder,
13869 NULL
13870};
13871
13872static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
13873{
13874 {
13875 -1,
13876 (gchar *) "org.openbmc.control.Bmc",
13877 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
13878 NULL,
13879 NULL,
13880 NULL
13881 },
13882 "control-bmc",
13883};
13884
13885
13886/**
13887 * control_bmc_interface_info:
13888 *
13889 * 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.
13890 *
13891 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13892 */
13893GDBusInterfaceInfo *
13894control_bmc_interface_info (void)
13895{
13896 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
13897}
13898
13899/**
13900 * control_bmc_override_properties:
13901 * @klass: The class structure for a #GObject<!-- -->-derived class.
13902 * @property_id_begin: The property id to assign to the first overridden property.
13903 *
13904 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
13905 * The properties are overridden in the order they are defined.
13906 *
13907 * Returns: The last property id.
13908 */
13909guint
13910control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
13911{
13912 return property_id_begin - 1;
13913}
13914
13915
13916
13917/**
13918 * ControlBmc:
13919 *
13920 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13921 */
13922
13923/**
13924 * ControlBmcIface:
13925 * @parent_iface: The parent interface.
13926 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
13927 *
13928 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13929 */
13930
13931typedef ControlBmcIface ControlBmcInterface;
13932G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
13933
13934static void
13935control_bmc_default_init (ControlBmcIface *iface)
13936{
13937 /* GObject signals for incoming D-Bus method calls: */
13938 /**
13939 * ControlBmc::handle-place-holder:
13940 * @object: A #ControlBmc.
13941 * @invocation: A #GDBusMethodInvocation.
13942 *
13943 * 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.
13944 *
13945 * 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.
13946 *
13947 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13948 */
13949 g_signal_new ("handle-place-holder",
13950 G_TYPE_FROM_INTERFACE (iface),
13951 G_SIGNAL_RUN_LAST,
13952 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
13953 g_signal_accumulator_true_handled,
13954 NULL,
13955 g_cclosure_marshal_generic,
13956 G_TYPE_BOOLEAN,
13957 1,
13958 G_TYPE_DBUS_METHOD_INVOCATION);
13959
13960}
13961
13962/**
13963 * control_bmc_call_place_holder:
13964 * @proxy: A #ControlBmcProxy.
13965 * @cancellable: (allow-none): A #GCancellable or %NULL.
13966 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13967 * @user_data: User data to pass to @callback.
13968 *
13969 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
13970 * 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.
13971 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
13972 *
13973 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
13974 */
13975void
13976control_bmc_call_place_holder (
13977 ControlBmc *proxy,
13978 GCancellable *cancellable,
13979 GAsyncReadyCallback callback,
13980 gpointer user_data)
13981{
13982 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13983 "place_holder",
13984 g_variant_new ("()"),
13985 G_DBUS_CALL_FLAGS_NONE,
13986 -1,
13987 cancellable,
13988 callback,
13989 user_data);
13990}
13991
13992/**
13993 * control_bmc_call_place_holder_finish:
13994 * @proxy: A #ControlBmcProxy.
13995 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
13996 * @error: Return location for error or %NULL.
13997 *
13998 * Finishes an operation started with control_bmc_call_place_holder().
13999 *
14000 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14001 */
14002gboolean
14003control_bmc_call_place_holder_finish (
14004 ControlBmc *proxy,
14005 GAsyncResult *res,
14006 GError **error)
14007{
14008 GVariant *_ret;
14009 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14010 if (_ret == NULL)
14011 goto _out;
14012 g_variant_get (_ret,
14013 "()");
14014 g_variant_unref (_ret);
14015_out:
14016 return _ret != NULL;
14017}
14018
14019/**
14020 * control_bmc_call_place_holder_sync:
14021 * @proxy: A #ControlBmcProxy.
14022 * @cancellable: (allow-none): A #GCancellable or %NULL.
14023 * @error: Return location for error or %NULL.
14024 *
14025 * 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.
14026 *
14027 * See control_bmc_call_place_holder() for the asynchronous version of this method.
14028 *
14029 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14030 */
14031gboolean
14032control_bmc_call_place_holder_sync (
14033 ControlBmc *proxy,
14034 GCancellable *cancellable,
14035 GError **error)
14036{
14037 GVariant *_ret;
14038 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14039 "place_holder",
14040 g_variant_new ("()"),
14041 G_DBUS_CALL_FLAGS_NONE,
14042 -1,
14043 cancellable,
14044 error);
14045 if (_ret == NULL)
14046 goto _out;
14047 g_variant_get (_ret,
14048 "()");
14049 g_variant_unref (_ret);
14050_out:
14051 return _ret != NULL;
14052}
14053
14054/**
14055 * control_bmc_complete_place_holder:
14056 * @object: A #ControlBmc.
14057 * @invocation: (transfer full): A #GDBusMethodInvocation.
14058 *
14059 * 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.
14060 *
14061 * This method will free @invocation, you cannot use it afterwards.
14062 */
14063void
14064control_bmc_complete_place_holder (
14065 ControlBmc *object,
14066 GDBusMethodInvocation *invocation)
14067{
14068 g_dbus_method_invocation_return_value (invocation,
14069 g_variant_new ("()"));
14070}
14071
14072/* ------------------------------------------------------------------------ */
14073
14074/**
14075 * ControlBmcProxy:
14076 *
14077 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
14078 */
14079
14080/**
14081 * ControlBmcProxyClass:
14082 * @parent_class: The parent class.
14083 *
14084 * Class structure for #ControlBmcProxy.
14085 */
14086
14087struct _ControlBmcProxyPrivate
14088{
14089 GData *qdata;
14090};
14091
14092static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
14093
14094#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14095G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14096 G_ADD_PRIVATE (ControlBmcProxy)
14097 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14098
14099#else
14100G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14101 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14102
14103#endif
14104static void
14105control_bmc_proxy_finalize (GObject *object)
14106{
14107 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
14108 g_datalist_clear (&proxy->priv->qdata);
14109 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
14110}
14111
14112static void
14113control_bmc_proxy_get_property (GObject *object,
14114 guint prop_id,
14115 GValue *value,
14116 GParamSpec *pspec G_GNUC_UNUSED)
14117{
14118}
14119
14120static void
14121control_bmc_proxy_set_property (GObject *object,
14122 guint prop_id,
14123 const GValue *value,
14124 GParamSpec *pspec G_GNUC_UNUSED)
14125{
14126}
14127
14128static void
14129control_bmc_proxy_g_signal (GDBusProxy *proxy,
14130 const gchar *sender_name G_GNUC_UNUSED,
14131 const gchar *signal_name,
14132 GVariant *parameters)
14133{
14134 _ExtendedGDBusSignalInfo *info;
14135 GVariantIter iter;
14136 GVariant *child;
14137 GValue *paramv;
14138 guint num_params;
14139 guint n;
14140 guint signal_id;
14141 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
14142 if (info == NULL)
14143 return;
14144 num_params = g_variant_n_children (parameters);
14145 paramv = g_new0 (GValue, num_params + 1);
14146 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
14147 g_value_set_object (&paramv[0], proxy);
14148 g_variant_iter_init (&iter, parameters);
14149 n = 1;
14150 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14151 {
14152 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14153 if (arg_info->use_gvariant)
14154 {
14155 g_value_init (&paramv[n], G_TYPE_VARIANT);
14156 g_value_set_variant (&paramv[n], child);
14157 n++;
14158 }
14159 else
14160 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14161 g_variant_unref (child);
14162 }
14163 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14164 g_signal_emitv (paramv, signal_id, 0, NULL);
14165 for (n = 0; n < num_params + 1; n++)
14166 g_value_unset (&paramv[n]);
14167 g_free (paramv);
14168}
14169
14170static void
14171control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
14172 GVariant *changed_properties,
14173 const gchar *const *invalidated_properties)
14174{
14175 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
14176 guint n;
14177 const gchar *key;
14178 GVariantIter *iter;
14179 _ExtendedGDBusPropertyInfo *info;
14180 g_variant_get (changed_properties, "a{sv}", &iter);
14181 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14182 {
14183 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
14184 g_datalist_remove_data (&proxy->priv->qdata, key);
14185 if (info != NULL)
14186 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14187 }
14188 g_variant_iter_free (iter);
14189 for (n = 0; invalidated_properties[n] != NULL; n++)
14190 {
14191 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
14192 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
14193 if (info != NULL)
14194 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14195 }
14196}
14197
14198static void
14199control_bmc_proxy_init (ControlBmcProxy *proxy)
14200{
14201#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14202 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
14203#else
14204 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
14205#endif
14206
14207 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
14208}
14209
14210static void
14211control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
14212{
14213 GObjectClass *gobject_class;
14214 GDBusProxyClass *proxy_class;
14215
14216 gobject_class = G_OBJECT_CLASS (klass);
14217 gobject_class->finalize = control_bmc_proxy_finalize;
14218 gobject_class->get_property = control_bmc_proxy_get_property;
14219 gobject_class->set_property = control_bmc_proxy_set_property;
14220
14221 proxy_class = G_DBUS_PROXY_CLASS (klass);
14222 proxy_class->g_signal = control_bmc_proxy_g_signal;
14223 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
14224
14225#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14226 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
14227#endif
14228}
14229
14230static void
14231control_bmc_proxy_iface_init (ControlBmcIface *iface)
14232{
14233}
14234
14235/**
14236 * control_bmc_proxy_new:
14237 * @connection: A #GDBusConnection.
14238 * @flags: Flags from the #GDBusProxyFlags enumeration.
14239 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14240 * @object_path: An object path.
14241 * @cancellable: (allow-none): A #GCancellable or %NULL.
14242 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14243 * @user_data: User data to pass to @callback.
14244 *
14245 * 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.
14246 *
14247 * 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.
14248 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
14249 *
14250 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
14251 */
14252void
14253control_bmc_proxy_new (
14254 GDBusConnection *connection,
14255 GDBusProxyFlags flags,
14256 const gchar *name,
14257 const gchar *object_path,
14258 GCancellable *cancellable,
14259 GAsyncReadyCallback callback,
14260 gpointer user_data)
14261{
14262 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);
14263}
14264
14265/**
14266 * control_bmc_proxy_new_finish:
14267 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
14268 * @error: Return location for error or %NULL
14269 *
14270 * Finishes an operation started with control_bmc_proxy_new().
14271 *
14272 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14273 */
14274ControlBmc *
14275control_bmc_proxy_new_finish (
14276 GAsyncResult *res,
14277 GError **error)
14278{
14279 GObject *ret;
14280 GObject *source_object;
14281 source_object = g_async_result_get_source_object (res);
14282 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14283 g_object_unref (source_object);
14284 if (ret != NULL)
14285 return CONTROL_BMC (ret);
14286 else
14287 return NULL;
14288}
14289
14290/**
14291 * control_bmc_proxy_new_sync:
14292 * @connection: A #GDBusConnection.
14293 * @flags: Flags from the #GDBusProxyFlags enumeration.
14294 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14295 * @object_path: An object path.
14296 * @cancellable: (allow-none): A #GCancellable or %NULL.
14297 * @error: Return location for error or %NULL
14298 *
14299 * 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.
14300 *
14301 * The calling thread is blocked until a reply is received.
14302 *
14303 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
14304 *
14305 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14306 */
14307ControlBmc *
14308control_bmc_proxy_new_sync (
14309 GDBusConnection *connection,
14310 GDBusProxyFlags flags,
14311 const gchar *name,
14312 const gchar *object_path,
14313 GCancellable *cancellable,
14314 GError **error)
14315{
14316 GInitable *ret;
14317 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);
14318 if (ret != NULL)
14319 return CONTROL_BMC (ret);
14320 else
14321 return NULL;
14322}
14323
14324
14325/**
14326 * control_bmc_proxy_new_for_bus:
14327 * @bus_type: A #GBusType.
14328 * @flags: Flags from the #GDBusProxyFlags enumeration.
14329 * @name: A bus name (well-known or unique).
14330 * @object_path: An object path.
14331 * @cancellable: (allow-none): A #GCancellable or %NULL.
14332 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14333 * @user_data: User data to pass to @callback.
14334 *
14335 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14336 *
14337 * 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.
14338 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
14339 *
14340 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14341 */
14342void
14343control_bmc_proxy_new_for_bus (
14344 GBusType bus_type,
14345 GDBusProxyFlags flags,
14346 const gchar *name,
14347 const gchar *object_path,
14348 GCancellable *cancellable,
14349 GAsyncReadyCallback callback,
14350 gpointer user_data)
14351{
14352 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);
14353}
14354
14355/**
14356 * control_bmc_proxy_new_for_bus_finish:
14357 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
14358 * @error: Return location for error or %NULL
14359 *
14360 * Finishes an operation started with control_bmc_proxy_new_for_bus().
14361 *
14362 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14363 */
14364ControlBmc *
14365control_bmc_proxy_new_for_bus_finish (
14366 GAsyncResult *res,
14367 GError **error)
14368{
14369 GObject *ret;
14370 GObject *source_object;
14371 source_object = g_async_result_get_source_object (res);
14372 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14373 g_object_unref (source_object);
14374 if (ret != NULL)
14375 return CONTROL_BMC (ret);
14376 else
14377 return NULL;
14378}
14379
14380/**
14381 * control_bmc_proxy_new_for_bus_sync:
14382 * @bus_type: A #GBusType.
14383 * @flags: Flags from the #GDBusProxyFlags enumeration.
14384 * @name: A bus name (well-known or unique).
14385 * @object_path: An object path.
14386 * @cancellable: (allow-none): A #GCancellable or %NULL.
14387 * @error: Return location for error or %NULL
14388 *
14389 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14390 *
14391 * The calling thread is blocked until a reply is received.
14392 *
14393 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
14394 *
14395 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14396 */
14397ControlBmc *
14398control_bmc_proxy_new_for_bus_sync (
14399 GBusType bus_type,
14400 GDBusProxyFlags flags,
14401 const gchar *name,
14402 const gchar *object_path,
14403 GCancellable *cancellable,
14404 GError **error)
14405{
14406 GInitable *ret;
14407 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);
14408 if (ret != NULL)
14409 return CONTROL_BMC (ret);
14410 else
14411 return NULL;
14412}
14413
14414
14415/* ------------------------------------------------------------------------ */
14416
14417/**
14418 * ControlBmcSkeleton:
14419 *
14420 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
14421 */
14422
14423/**
14424 * ControlBmcSkeletonClass:
14425 * @parent_class: The parent class.
14426 *
14427 * Class structure for #ControlBmcSkeleton.
14428 */
14429
14430struct _ControlBmcSkeletonPrivate
14431{
14432 GValue *properties;
14433 GList *changed_properties;
14434 GSource *changed_properties_idle_source;
14435 GMainContext *context;
14436 GMutex lock;
14437};
14438
14439static void
14440_control_bmc_skeleton_handle_method_call (
14441 GDBusConnection *connection G_GNUC_UNUSED,
14442 const gchar *sender G_GNUC_UNUSED,
14443 const gchar *object_path G_GNUC_UNUSED,
14444 const gchar *interface_name,
14445 const gchar *method_name,
14446 GVariant *parameters,
14447 GDBusMethodInvocation *invocation,
14448 gpointer user_data)
14449{
14450 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14451 _ExtendedGDBusMethodInfo *info;
14452 GVariantIter iter;
14453 GVariant *child;
14454 GValue *paramv;
14455 guint num_params;
14456 guint num_extra;
14457 guint n;
14458 guint signal_id;
14459 GValue return_value = G_VALUE_INIT;
14460 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14461 g_assert (info != NULL);
14462 num_params = g_variant_n_children (parameters);
14463 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14464 n = 0;
14465 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
14466 g_value_set_object (&paramv[n++], skeleton);
14467 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14468 g_value_set_object (&paramv[n++], invocation);
14469 if (info->pass_fdlist)
14470 {
14471#ifdef G_OS_UNIX
14472 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14473 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14474#else
14475 g_assert_not_reached ();
14476#endif
14477 }
14478 g_variant_iter_init (&iter, parameters);
14479 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14480 {
14481 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14482 if (arg_info->use_gvariant)
14483 {
14484 g_value_init (&paramv[n], G_TYPE_VARIANT);
14485 g_value_set_variant (&paramv[n], child);
14486 n++;
14487 }
14488 else
14489 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14490 g_variant_unref (child);
14491 }
14492 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14493 g_value_init (&return_value, G_TYPE_BOOLEAN);
14494 g_signal_emitv (paramv, signal_id, 0, &return_value);
14495 if (!g_value_get_boolean (&return_value))
14496 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);
14497 g_value_unset (&return_value);
14498 for (n = 0; n < num_params + num_extra; n++)
14499 g_value_unset (&paramv[n]);
14500 g_free (paramv);
14501}
14502
14503static GVariant *
14504_control_bmc_skeleton_handle_get_property (
14505 GDBusConnection *connection G_GNUC_UNUSED,
14506 const gchar *sender G_GNUC_UNUSED,
14507 const gchar *object_path G_GNUC_UNUSED,
14508 const gchar *interface_name G_GNUC_UNUSED,
14509 const gchar *property_name,
14510 GError **error,
14511 gpointer user_data)
14512{
14513 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14514 GValue value = G_VALUE_INIT;
14515 GParamSpec *pspec;
14516 _ExtendedGDBusPropertyInfo *info;
14517 GVariant *ret;
14518 ret = NULL;
14519 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14520 g_assert (info != NULL);
14521 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14522 if (pspec == NULL)
14523 {
14524 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14525 }
14526 else
14527 {
14528 g_value_init (&value, pspec->value_type);
14529 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14530 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14531 g_value_unset (&value);
14532 }
14533 return ret;
14534}
14535
14536static gboolean
14537_control_bmc_skeleton_handle_set_property (
14538 GDBusConnection *connection G_GNUC_UNUSED,
14539 const gchar *sender G_GNUC_UNUSED,
14540 const gchar *object_path G_GNUC_UNUSED,
14541 const gchar *interface_name G_GNUC_UNUSED,
14542 const gchar *property_name,
14543 GVariant *variant,
14544 GError **error,
14545 gpointer user_data)
14546{
14547 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14548 GValue value = G_VALUE_INIT;
14549 GParamSpec *pspec;
14550 _ExtendedGDBusPropertyInfo *info;
14551 gboolean ret;
14552 ret = FALSE;
14553 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14554 g_assert (info != NULL);
14555 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14556 if (pspec == NULL)
14557 {
14558 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14559 }
14560 else
14561 {
14562 if (info->use_gvariant)
14563 g_value_set_variant (&value, variant);
14564 else
14565 g_dbus_gvariant_to_gvalue (variant, &value);
14566 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14567 g_value_unset (&value);
14568 ret = TRUE;
14569 }
14570 return ret;
14571}
14572
14573static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
14574{
14575 _control_bmc_skeleton_handle_method_call,
14576 _control_bmc_skeleton_handle_get_property,
14577 _control_bmc_skeleton_handle_set_property,
14578 {NULL}
14579};
14580
14581static GDBusInterfaceInfo *
14582control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14583{
14584 return control_bmc_interface_info ();
14585}
14586
14587static GDBusInterfaceVTable *
14588control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14589{
14590 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
14591}
14592
14593static GVariant *
14594control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14595{
14596 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
14597
14598 GVariantBuilder builder;
14599 guint n;
14600 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14601 if (_control_bmc_interface_info.parent_struct.properties == NULL)
14602 goto out;
14603 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
14604 {
14605 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
14606 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14607 {
14608 GVariant *value;
14609 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);
14610 if (value != NULL)
14611 {
14612 g_variant_take_ref (value);
14613 g_variant_builder_add (&builder, "{sv}", info->name, value);
14614 g_variant_unref (value);
14615 }
14616 }
14617 }
14618out:
14619 return g_variant_builder_end (&builder);
14620}
14621
14622static void
14623control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14624{
14625}
14626
14627static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
14628#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14629G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14630 G_ADD_PRIVATE (ControlBmcSkeleton)
14631 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14632
14633#else
14634G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14635 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14636
14637#endif
14638static void
14639control_bmc_skeleton_finalize (GObject *object)
14640{
14641 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
14642 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14643 if (skeleton->priv->changed_properties_idle_source != NULL)
14644 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14645 g_main_context_unref (skeleton->priv->context);
14646 g_mutex_clear (&skeleton->priv->lock);
14647 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
14648}
14649
14650static void
14651control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
14652{
14653#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14654 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
14655#else
14656 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
14657#endif
14658
14659 g_mutex_init (&skeleton->priv->lock);
14660 skeleton->priv->context = g_main_context_ref_thread_default ();
14661}
14662
14663static void
14664control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
14665{
14666 GObjectClass *gobject_class;
14667 GDBusInterfaceSkeletonClass *skeleton_class;
14668
14669 gobject_class = G_OBJECT_CLASS (klass);
14670 gobject_class->finalize = control_bmc_skeleton_finalize;
14671
14672 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14673 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
14674 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
14675 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
14676 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
14677
14678#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14679 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
14680#endif
14681}
14682
14683static void
14684control_bmc_skeleton_iface_init (ControlBmcIface *iface)
14685{
14686}
14687
14688/**
14689 * control_bmc_skeleton_new:
14690 *
14691 * 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>.
14692 *
14693 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
14694 */
14695ControlBmc *
14696control_bmc_skeleton_new (void)
14697{
14698 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
14699}
14700
14701/* ------------------------------------------------------------------------
14702 * Code for interface org.openbmc.control.Host
14703 * ------------------------------------------------------------------------
14704 */
14705
14706/**
14707 * SECTION:ControlHost
14708 * @title: ControlHost
14709 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
14710 *
14711 * 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.
14712 */
14713
14714/* ---- Introspection data for org.openbmc.control.Host ---- */
14715
14716static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
14717{
14718 {
14719 -1,
14720 (gchar *) "boot",
14721 NULL,
14722 NULL,
14723 NULL
14724 },
14725 "handle-boot",
14726 FALSE
14727};
14728
14729static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
14730{
14731 {
14732 -1,
14733 (gchar *) "shutdown",
14734 NULL,
14735 NULL,
14736 NULL
14737 },
14738 "handle-shutdown",
14739 FALSE
14740};
14741
14742static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
14743{
14744 {
14745 -1,
14746 (gchar *) "reboot",
14747 NULL,
14748 NULL,
14749 NULL
14750 },
14751 "handle-reboot",
14752 FALSE
14753};
14754
14755static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
14756{
14757 &_control_host_method_info_boot,
14758 &_control_host_method_info_shutdown,
14759 &_control_host_method_info_reboot,
14760 NULL
14761};
14762
14763static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
14764{
14765 {
14766 -1,
14767 (gchar *) "Booted",
14768 NULL,
14769 NULL
14770 },
14771 "booted"
14772};
14773
14774static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
14775{
14776 &_control_host_signal_info_booted,
14777 NULL
14778};
14779
14780static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
14781{
14782 {
14783 -1,
14784 (gchar *) "org.openbmc.control.Host",
14785 (GDBusMethodInfo **) &_control_host_method_info_pointers,
14786 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
14787 NULL,
14788 NULL
14789 },
14790 "control-host",
14791};
14792
14793
14794/**
14795 * control_host_interface_info:
14796 *
14797 * 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.
14798 *
14799 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14800 */
14801GDBusInterfaceInfo *
14802control_host_interface_info (void)
14803{
14804 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
14805}
14806
14807/**
14808 * control_host_override_properties:
14809 * @klass: The class structure for a #GObject<!-- -->-derived class.
14810 * @property_id_begin: The property id to assign to the first overridden property.
14811 *
14812 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
14813 * The properties are overridden in the order they are defined.
14814 *
14815 * Returns: The last property id.
14816 */
14817guint
14818control_host_override_properties (GObjectClass *klass, guint property_id_begin)
14819{
14820 return property_id_begin - 1;
14821}
14822
14823
14824
14825/**
14826 * ControlHost:
14827 *
14828 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14829 */
14830
14831/**
14832 * ControlHostIface:
14833 * @parent_iface: The parent interface.
14834 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
14835 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
14836 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
14837 * @booted: Handler for the #ControlHost::booted signal.
14838 *
14839 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14840 */
14841
14842typedef ControlHostIface ControlHostInterface;
14843G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
14844
14845static void
14846control_host_default_init (ControlHostIface *iface)
14847{
14848 /* GObject signals for incoming D-Bus method calls: */
14849 /**
14850 * ControlHost::handle-boot:
14851 * @object: A #ControlHost.
14852 * @invocation: A #GDBusMethodInvocation.
14853 *
14854 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
14855 *
14856 * 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.
14857 *
14858 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14859 */
14860 g_signal_new ("handle-boot",
14861 G_TYPE_FROM_INTERFACE (iface),
14862 G_SIGNAL_RUN_LAST,
14863 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
14864 g_signal_accumulator_true_handled,
14865 NULL,
14866 g_cclosure_marshal_generic,
14867 G_TYPE_BOOLEAN,
14868 1,
14869 G_TYPE_DBUS_METHOD_INVOCATION);
14870
14871 /**
14872 * ControlHost::handle-shutdown:
14873 * @object: A #ControlHost.
14874 * @invocation: A #GDBusMethodInvocation.
14875 *
14876 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
14877 *
14878 * 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.
14879 *
14880 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14881 */
14882 g_signal_new ("handle-shutdown",
14883 G_TYPE_FROM_INTERFACE (iface),
14884 G_SIGNAL_RUN_LAST,
14885 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
14886 g_signal_accumulator_true_handled,
14887 NULL,
14888 g_cclosure_marshal_generic,
14889 G_TYPE_BOOLEAN,
14890 1,
14891 G_TYPE_DBUS_METHOD_INVOCATION);
14892
14893 /**
14894 * ControlHost::handle-reboot:
14895 * @object: A #ControlHost.
14896 * @invocation: A #GDBusMethodInvocation.
14897 *
14898 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
14899 *
14900 * 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.
14901 *
14902 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14903 */
14904 g_signal_new ("handle-reboot",
14905 G_TYPE_FROM_INTERFACE (iface),
14906 G_SIGNAL_RUN_LAST,
14907 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
14908 g_signal_accumulator_true_handled,
14909 NULL,
14910 g_cclosure_marshal_generic,
14911 G_TYPE_BOOLEAN,
14912 1,
14913 G_TYPE_DBUS_METHOD_INVOCATION);
14914
14915 /* GObject signals for received D-Bus signals: */
14916 /**
14917 * ControlHost::booted:
14918 * @object: A #ControlHost.
14919 *
14920 * 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.
14921 *
14922 * 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.
14923 */
14924 g_signal_new ("booted",
14925 G_TYPE_FROM_INTERFACE (iface),
14926 G_SIGNAL_RUN_LAST,
14927 G_STRUCT_OFFSET (ControlHostIface, booted),
14928 NULL,
14929 NULL,
14930 g_cclosure_marshal_generic,
14931 G_TYPE_NONE,
14932 0);
14933
14934}
14935
14936/**
14937 * control_host_emit_booted:
14938 * @object: A #ControlHost.
14939 *
14940 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
14941 */
14942void
14943control_host_emit_booted (
14944 ControlHost *object)
14945{
14946 g_signal_emit_by_name (object, "booted");
14947}
14948
14949/**
14950 * control_host_call_boot:
14951 * @proxy: A #ControlHostProxy.
14952 * @cancellable: (allow-none): A #GCancellable or %NULL.
14953 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14954 * @user_data: User data to pass to @callback.
14955 *
14956 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
14957 * 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.
14958 * You can then call control_host_call_boot_finish() to get the result of the operation.
14959 *
14960 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
14961 */
14962void
14963control_host_call_boot (
14964 ControlHost *proxy,
14965 GCancellable *cancellable,
14966 GAsyncReadyCallback callback,
14967 gpointer user_data)
14968{
14969 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14970 "boot",
14971 g_variant_new ("()"),
14972 G_DBUS_CALL_FLAGS_NONE,
14973 -1,
14974 cancellable,
14975 callback,
14976 user_data);
14977}
14978
14979/**
14980 * control_host_call_boot_finish:
14981 * @proxy: A #ControlHostProxy.
14982 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
14983 * @error: Return location for error or %NULL.
14984 *
14985 * Finishes an operation started with control_host_call_boot().
14986 *
14987 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14988 */
14989gboolean
14990control_host_call_boot_finish (
14991 ControlHost *proxy,
14992 GAsyncResult *res,
14993 GError **error)
14994{
14995 GVariant *_ret;
14996 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14997 if (_ret == NULL)
14998 goto _out;
14999 g_variant_get (_ret,
15000 "()");
15001 g_variant_unref (_ret);
15002_out:
15003 return _ret != NULL;
15004}
15005
15006/**
15007 * control_host_call_boot_sync:
15008 * @proxy: A #ControlHostProxy.
15009 * @cancellable: (allow-none): A #GCancellable or %NULL.
15010 * @error: Return location for error or %NULL.
15011 *
15012 * 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.
15013 *
15014 * See control_host_call_boot() for the asynchronous version of this method.
15015 *
15016 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15017 */
15018gboolean
15019control_host_call_boot_sync (
15020 ControlHost *proxy,
15021 GCancellable *cancellable,
15022 GError **error)
15023{
15024 GVariant *_ret;
15025 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15026 "boot",
15027 g_variant_new ("()"),
15028 G_DBUS_CALL_FLAGS_NONE,
15029 -1,
15030 cancellable,
15031 error);
15032 if (_ret == NULL)
15033 goto _out;
15034 g_variant_get (_ret,
15035 "()");
15036 g_variant_unref (_ret);
15037_out:
15038 return _ret != NULL;
15039}
15040
15041/**
15042 * control_host_call_shutdown:
15043 * @proxy: A #ControlHostProxy.
15044 * @cancellable: (allow-none): A #GCancellable or %NULL.
15045 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15046 * @user_data: User data to pass to @callback.
15047 *
15048 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
15049 * 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.
15050 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
15051 *
15052 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
15053 */
15054void
15055control_host_call_shutdown (
15056 ControlHost *proxy,
15057 GCancellable *cancellable,
15058 GAsyncReadyCallback callback,
15059 gpointer user_data)
15060{
15061 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15062 "shutdown",
15063 g_variant_new ("()"),
15064 G_DBUS_CALL_FLAGS_NONE,
15065 -1,
15066 cancellable,
15067 callback,
15068 user_data);
15069}
15070
15071/**
15072 * control_host_call_shutdown_finish:
15073 * @proxy: A #ControlHostProxy.
15074 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
15075 * @error: Return location for error or %NULL.
15076 *
15077 * Finishes an operation started with control_host_call_shutdown().
15078 *
15079 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15080 */
15081gboolean
15082control_host_call_shutdown_finish (
15083 ControlHost *proxy,
15084 GAsyncResult *res,
15085 GError **error)
15086{
15087 GVariant *_ret;
15088 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15089 if (_ret == NULL)
15090 goto _out;
15091 g_variant_get (_ret,
15092 "()");
15093 g_variant_unref (_ret);
15094_out:
15095 return _ret != NULL;
15096}
15097
15098/**
15099 * control_host_call_shutdown_sync:
15100 * @proxy: A #ControlHostProxy.
15101 * @cancellable: (allow-none): A #GCancellable or %NULL.
15102 * @error: Return location for error or %NULL.
15103 *
15104 * 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.
15105 *
15106 * See control_host_call_shutdown() for the asynchronous version of this method.
15107 *
15108 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15109 */
15110gboolean
15111control_host_call_shutdown_sync (
15112 ControlHost *proxy,
15113 GCancellable *cancellable,
15114 GError **error)
15115{
15116 GVariant *_ret;
15117 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15118 "shutdown",
15119 g_variant_new ("()"),
15120 G_DBUS_CALL_FLAGS_NONE,
15121 -1,
15122 cancellable,
15123 error);
15124 if (_ret == NULL)
15125 goto _out;
15126 g_variant_get (_ret,
15127 "()");
15128 g_variant_unref (_ret);
15129_out:
15130 return _ret != NULL;
15131}
15132
15133/**
15134 * control_host_call_reboot:
15135 * @proxy: A #ControlHostProxy.
15136 * @cancellable: (allow-none): A #GCancellable or %NULL.
15137 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15138 * @user_data: User data to pass to @callback.
15139 *
15140 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
15141 * 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.
15142 * You can then call control_host_call_reboot_finish() to get the result of the operation.
15143 *
15144 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
15145 */
15146void
15147control_host_call_reboot (
15148 ControlHost *proxy,
15149 GCancellable *cancellable,
15150 GAsyncReadyCallback callback,
15151 gpointer user_data)
15152{
15153 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15154 "reboot",
15155 g_variant_new ("()"),
15156 G_DBUS_CALL_FLAGS_NONE,
15157 -1,
15158 cancellable,
15159 callback,
15160 user_data);
15161}
15162
15163/**
15164 * control_host_call_reboot_finish:
15165 * @proxy: A #ControlHostProxy.
15166 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
15167 * @error: Return location for error or %NULL.
15168 *
15169 * Finishes an operation started with control_host_call_reboot().
15170 *
15171 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15172 */
15173gboolean
15174control_host_call_reboot_finish (
15175 ControlHost *proxy,
15176 GAsyncResult *res,
15177 GError **error)
15178{
15179 GVariant *_ret;
15180 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15181 if (_ret == NULL)
15182 goto _out;
15183 g_variant_get (_ret,
15184 "()");
15185 g_variant_unref (_ret);
15186_out:
15187 return _ret != NULL;
15188}
15189
15190/**
15191 * control_host_call_reboot_sync:
15192 * @proxy: A #ControlHostProxy.
15193 * @cancellable: (allow-none): A #GCancellable or %NULL.
15194 * @error: Return location for error or %NULL.
15195 *
15196 * 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.
15197 *
15198 * See control_host_call_reboot() for the asynchronous version of this method.
15199 *
15200 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15201 */
15202gboolean
15203control_host_call_reboot_sync (
15204 ControlHost *proxy,
15205 GCancellable *cancellable,
15206 GError **error)
15207{
15208 GVariant *_ret;
15209 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15210 "reboot",
15211 g_variant_new ("()"),
15212 G_DBUS_CALL_FLAGS_NONE,
15213 -1,
15214 cancellable,
15215 error);
15216 if (_ret == NULL)
15217 goto _out;
15218 g_variant_get (_ret,
15219 "()");
15220 g_variant_unref (_ret);
15221_out:
15222 return _ret != NULL;
15223}
15224
15225/**
15226 * control_host_complete_boot:
15227 * @object: A #ControlHost.
15228 * @invocation: (transfer full): A #GDBusMethodInvocation.
15229 *
15230 * 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.
15231 *
15232 * This method will free @invocation, you cannot use it afterwards.
15233 */
15234void
15235control_host_complete_boot (
15236 ControlHost *object,
15237 GDBusMethodInvocation *invocation)
15238{
15239 g_dbus_method_invocation_return_value (invocation,
15240 g_variant_new ("()"));
15241}
15242
15243/**
15244 * control_host_complete_shutdown:
15245 * @object: A #ControlHost.
15246 * @invocation: (transfer full): A #GDBusMethodInvocation.
15247 *
15248 * 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.
15249 *
15250 * This method will free @invocation, you cannot use it afterwards.
15251 */
15252void
15253control_host_complete_shutdown (
15254 ControlHost *object,
15255 GDBusMethodInvocation *invocation)
15256{
15257 g_dbus_method_invocation_return_value (invocation,
15258 g_variant_new ("()"));
15259}
15260
15261/**
15262 * control_host_complete_reboot:
15263 * @object: A #ControlHost.
15264 * @invocation: (transfer full): A #GDBusMethodInvocation.
15265 *
15266 * 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.
15267 *
15268 * This method will free @invocation, you cannot use it afterwards.
15269 */
15270void
15271control_host_complete_reboot (
15272 ControlHost *object,
15273 GDBusMethodInvocation *invocation)
15274{
15275 g_dbus_method_invocation_return_value (invocation,
15276 g_variant_new ("()"));
15277}
15278
15279/* ------------------------------------------------------------------------ */
15280
15281/**
15282 * ControlHostProxy:
15283 *
15284 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
15285 */
15286
15287/**
15288 * ControlHostProxyClass:
15289 * @parent_class: The parent class.
15290 *
15291 * Class structure for #ControlHostProxy.
15292 */
15293
15294struct _ControlHostProxyPrivate
15295{
15296 GData *qdata;
15297};
15298
15299static void control_host_proxy_iface_init (ControlHostIface *iface);
15300
15301#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15302G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15303 G_ADD_PRIVATE (ControlHostProxy)
15304 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15305
15306#else
15307G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15308 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15309
15310#endif
15311static void
15312control_host_proxy_finalize (GObject *object)
15313{
15314 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15315 g_datalist_clear (&proxy->priv->qdata);
15316 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
15317}
15318
15319static void
15320control_host_proxy_get_property (GObject *object,
15321 guint prop_id,
15322 GValue *value,
15323 GParamSpec *pspec G_GNUC_UNUSED)
15324{
15325}
15326
15327static void
15328control_host_proxy_set_property (GObject *object,
15329 guint prop_id,
15330 const GValue *value,
15331 GParamSpec *pspec G_GNUC_UNUSED)
15332{
15333}
15334
15335static void
15336control_host_proxy_g_signal (GDBusProxy *proxy,
15337 const gchar *sender_name G_GNUC_UNUSED,
15338 const gchar *signal_name,
15339 GVariant *parameters)
15340{
15341 _ExtendedGDBusSignalInfo *info;
15342 GVariantIter iter;
15343 GVariant *child;
15344 GValue *paramv;
15345 guint num_params;
15346 guint n;
15347 guint signal_id;
15348 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
15349 if (info == NULL)
15350 return;
15351 num_params = g_variant_n_children (parameters);
15352 paramv = g_new0 (GValue, num_params + 1);
15353 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
15354 g_value_set_object (&paramv[0], proxy);
15355 g_variant_iter_init (&iter, parameters);
15356 n = 1;
15357 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15358 {
15359 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15360 if (arg_info->use_gvariant)
15361 {
15362 g_value_init (&paramv[n], G_TYPE_VARIANT);
15363 g_value_set_variant (&paramv[n], child);
15364 n++;
15365 }
15366 else
15367 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15368 g_variant_unref (child);
15369 }
15370 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15371 g_signal_emitv (paramv, signal_id, 0, NULL);
15372 for (n = 0; n < num_params + 1; n++)
15373 g_value_unset (&paramv[n]);
15374 g_free (paramv);
15375}
15376
15377static void
15378control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
15379 GVariant *changed_properties,
15380 const gchar *const *invalidated_properties)
15381{
15382 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
15383 guint n;
15384 const gchar *key;
15385 GVariantIter *iter;
15386 _ExtendedGDBusPropertyInfo *info;
15387 g_variant_get (changed_properties, "a{sv}", &iter);
15388 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15389 {
15390 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
15391 g_datalist_remove_data (&proxy->priv->qdata, key);
15392 if (info != NULL)
15393 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15394 }
15395 g_variant_iter_free (iter);
15396 for (n = 0; invalidated_properties[n] != NULL; n++)
15397 {
15398 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
15399 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15400 if (info != NULL)
15401 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15402 }
15403}
15404
15405static void
15406control_host_proxy_init (ControlHostProxy *proxy)
15407{
15408#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15409 proxy->priv = control_host_proxy_get_instance_private (proxy);
15410#else
15411 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
15412#endif
15413
15414 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
15415}
15416
15417static void
15418control_host_proxy_class_init (ControlHostProxyClass *klass)
15419{
15420 GObjectClass *gobject_class;
15421 GDBusProxyClass *proxy_class;
15422
15423 gobject_class = G_OBJECT_CLASS (klass);
15424 gobject_class->finalize = control_host_proxy_finalize;
15425 gobject_class->get_property = control_host_proxy_get_property;
15426 gobject_class->set_property = control_host_proxy_set_property;
15427
15428 proxy_class = G_DBUS_PROXY_CLASS (klass);
15429 proxy_class->g_signal = control_host_proxy_g_signal;
15430 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
15431
15432#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15433 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
15434#endif
15435}
15436
15437static void
15438control_host_proxy_iface_init (ControlHostIface *iface)
15439{
15440}
15441
15442/**
15443 * control_host_proxy_new:
15444 * @connection: A #GDBusConnection.
15445 * @flags: Flags from the #GDBusProxyFlags enumeration.
15446 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15447 * @object_path: An object path.
15448 * @cancellable: (allow-none): A #GCancellable or %NULL.
15449 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15450 * @user_data: User data to pass to @callback.
15451 *
15452 * 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.
15453 *
15454 * 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.
15455 * You can then call control_host_proxy_new_finish() to get the result of the operation.
15456 *
15457 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
15458 */
15459void
15460control_host_proxy_new (
15461 GDBusConnection *connection,
15462 GDBusProxyFlags flags,
15463 const gchar *name,
15464 const gchar *object_path,
15465 GCancellable *cancellable,
15466 GAsyncReadyCallback callback,
15467 gpointer user_data)
15468{
15469 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);
15470}
15471
15472/**
15473 * control_host_proxy_new_finish:
15474 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
15475 * @error: Return location for error or %NULL
15476 *
15477 * Finishes an operation started with control_host_proxy_new().
15478 *
15479 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15480 */
15481ControlHost *
15482control_host_proxy_new_finish (
15483 GAsyncResult *res,
15484 GError **error)
15485{
15486 GObject *ret;
15487 GObject *source_object;
15488 source_object = g_async_result_get_source_object (res);
15489 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15490 g_object_unref (source_object);
15491 if (ret != NULL)
15492 return CONTROL_HOST (ret);
15493 else
15494 return NULL;
15495}
15496
15497/**
15498 * control_host_proxy_new_sync:
15499 * @connection: A #GDBusConnection.
15500 * @flags: Flags from the #GDBusProxyFlags enumeration.
15501 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15502 * @object_path: An object path.
15503 * @cancellable: (allow-none): A #GCancellable or %NULL.
15504 * @error: Return location for error or %NULL
15505 *
15506 * 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.
15507 *
15508 * The calling thread is blocked until a reply is received.
15509 *
15510 * See control_host_proxy_new() for the asynchronous version of this constructor.
15511 *
15512 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15513 */
15514ControlHost *
15515control_host_proxy_new_sync (
15516 GDBusConnection *connection,
15517 GDBusProxyFlags flags,
15518 const gchar *name,
15519 const gchar *object_path,
15520 GCancellable *cancellable,
15521 GError **error)
15522{
15523 GInitable *ret;
15524 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);
15525 if (ret != NULL)
15526 return CONTROL_HOST (ret);
15527 else
15528 return NULL;
15529}
15530
15531
15532/**
15533 * control_host_proxy_new_for_bus:
15534 * @bus_type: A #GBusType.
15535 * @flags: Flags from the #GDBusProxyFlags enumeration.
15536 * @name: A bus name (well-known or unique).
15537 * @object_path: An object path.
15538 * @cancellable: (allow-none): A #GCancellable or %NULL.
15539 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15540 * @user_data: User data to pass to @callback.
15541 *
15542 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15543 *
15544 * 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.
15545 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
15546 *
15547 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15548 */
15549void
15550control_host_proxy_new_for_bus (
15551 GBusType bus_type,
15552 GDBusProxyFlags flags,
15553 const gchar *name,
15554 const gchar *object_path,
15555 GCancellable *cancellable,
15556 GAsyncReadyCallback callback,
15557 gpointer user_data)
15558{
15559 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);
15560}
15561
15562/**
15563 * control_host_proxy_new_for_bus_finish:
15564 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
15565 * @error: Return location for error or %NULL
15566 *
15567 * Finishes an operation started with control_host_proxy_new_for_bus().
15568 *
15569 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15570 */
15571ControlHost *
15572control_host_proxy_new_for_bus_finish (
15573 GAsyncResult *res,
15574 GError **error)
15575{
15576 GObject *ret;
15577 GObject *source_object;
15578 source_object = g_async_result_get_source_object (res);
15579 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15580 g_object_unref (source_object);
15581 if (ret != NULL)
15582 return CONTROL_HOST (ret);
15583 else
15584 return NULL;
15585}
15586
15587/**
15588 * control_host_proxy_new_for_bus_sync:
15589 * @bus_type: A #GBusType.
15590 * @flags: Flags from the #GDBusProxyFlags enumeration.
15591 * @name: A bus name (well-known or unique).
15592 * @object_path: An object path.
15593 * @cancellable: (allow-none): A #GCancellable or %NULL.
15594 * @error: Return location for error or %NULL
15595 *
15596 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15597 *
15598 * The calling thread is blocked until a reply is received.
15599 *
15600 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
15601 *
15602 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15603 */
15604ControlHost *
15605control_host_proxy_new_for_bus_sync (
15606 GBusType bus_type,
15607 GDBusProxyFlags flags,
15608 const gchar *name,
15609 const gchar *object_path,
15610 GCancellable *cancellable,
15611 GError **error)
15612{
15613 GInitable *ret;
15614 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);
15615 if (ret != NULL)
15616 return CONTROL_HOST (ret);
15617 else
15618 return NULL;
15619}
15620
15621
15622/* ------------------------------------------------------------------------ */
15623
15624/**
15625 * ControlHostSkeleton:
15626 *
15627 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
15628 */
15629
15630/**
15631 * ControlHostSkeletonClass:
15632 * @parent_class: The parent class.
15633 *
15634 * Class structure for #ControlHostSkeleton.
15635 */
15636
15637struct _ControlHostSkeletonPrivate
15638{
15639 GValue *properties;
15640 GList *changed_properties;
15641 GSource *changed_properties_idle_source;
15642 GMainContext *context;
15643 GMutex lock;
15644};
15645
15646static void
15647_control_host_skeleton_handle_method_call (
15648 GDBusConnection *connection G_GNUC_UNUSED,
15649 const gchar *sender G_GNUC_UNUSED,
15650 const gchar *object_path G_GNUC_UNUSED,
15651 const gchar *interface_name,
15652 const gchar *method_name,
15653 GVariant *parameters,
15654 GDBusMethodInvocation *invocation,
15655 gpointer user_data)
15656{
15657 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15658 _ExtendedGDBusMethodInfo *info;
15659 GVariantIter iter;
15660 GVariant *child;
15661 GValue *paramv;
15662 guint num_params;
15663 guint num_extra;
15664 guint n;
15665 guint signal_id;
15666 GValue return_value = G_VALUE_INIT;
15667 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15668 g_assert (info != NULL);
15669 num_params = g_variant_n_children (parameters);
15670 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15671 n = 0;
15672 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
15673 g_value_set_object (&paramv[n++], skeleton);
15674 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15675 g_value_set_object (&paramv[n++], invocation);
15676 if (info->pass_fdlist)
15677 {
15678#ifdef G_OS_UNIX
15679 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15680 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15681#else
15682 g_assert_not_reached ();
15683#endif
15684 }
15685 g_variant_iter_init (&iter, parameters);
15686 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15687 {
15688 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15689 if (arg_info->use_gvariant)
15690 {
15691 g_value_init (&paramv[n], G_TYPE_VARIANT);
15692 g_value_set_variant (&paramv[n], child);
15693 n++;
15694 }
15695 else
15696 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15697 g_variant_unref (child);
15698 }
15699 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15700 g_value_init (&return_value, G_TYPE_BOOLEAN);
15701 g_signal_emitv (paramv, signal_id, 0, &return_value);
15702 if (!g_value_get_boolean (&return_value))
15703 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);
15704 g_value_unset (&return_value);
15705 for (n = 0; n < num_params + num_extra; n++)
15706 g_value_unset (&paramv[n]);
15707 g_free (paramv);
15708}
15709
15710static GVariant *
15711_control_host_skeleton_handle_get_property (
15712 GDBusConnection *connection G_GNUC_UNUSED,
15713 const gchar *sender G_GNUC_UNUSED,
15714 const gchar *object_path G_GNUC_UNUSED,
15715 const gchar *interface_name G_GNUC_UNUSED,
15716 const gchar *property_name,
15717 GError **error,
15718 gpointer user_data)
15719{
15720 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15721 GValue value = G_VALUE_INIT;
15722 GParamSpec *pspec;
15723 _ExtendedGDBusPropertyInfo *info;
15724 GVariant *ret;
15725 ret = NULL;
15726 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15727 g_assert (info != NULL);
15728 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15729 if (pspec == NULL)
15730 {
15731 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15732 }
15733 else
15734 {
15735 g_value_init (&value, pspec->value_type);
15736 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15737 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15738 g_value_unset (&value);
15739 }
15740 return ret;
15741}
15742
15743static gboolean
15744_control_host_skeleton_handle_set_property (
15745 GDBusConnection *connection G_GNUC_UNUSED,
15746 const gchar *sender G_GNUC_UNUSED,
15747 const gchar *object_path G_GNUC_UNUSED,
15748 const gchar *interface_name G_GNUC_UNUSED,
15749 const gchar *property_name,
15750 GVariant *variant,
15751 GError **error,
15752 gpointer user_data)
15753{
15754 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15755 GValue value = G_VALUE_INIT;
15756 GParamSpec *pspec;
15757 _ExtendedGDBusPropertyInfo *info;
15758 gboolean ret;
15759 ret = FALSE;
15760 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15761 g_assert (info != NULL);
15762 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15763 if (pspec == NULL)
15764 {
15765 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15766 }
15767 else
15768 {
15769 if (info->use_gvariant)
15770 g_value_set_variant (&value, variant);
15771 else
15772 g_dbus_gvariant_to_gvalue (variant, &value);
15773 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15774 g_value_unset (&value);
15775 ret = TRUE;
15776 }
15777 return ret;
15778}
15779
15780static const GDBusInterfaceVTable _control_host_skeleton_vtable =
15781{
15782 _control_host_skeleton_handle_method_call,
15783 _control_host_skeleton_handle_get_property,
15784 _control_host_skeleton_handle_set_property,
15785 {NULL}
15786};
15787
15788static GDBusInterfaceInfo *
15789control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15790{
15791 return control_host_interface_info ();
15792}
15793
15794static GDBusInterfaceVTable *
15795control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15796{
15797 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
15798}
15799
15800static GVariant *
15801control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15802{
15803 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
15804
15805 GVariantBuilder builder;
15806 guint n;
15807 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15808 if (_control_host_interface_info.parent_struct.properties == NULL)
15809 goto out;
15810 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
15811 {
15812 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
15813 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15814 {
15815 GVariant *value;
15816 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);
15817 if (value != NULL)
15818 {
15819 g_variant_take_ref (value);
15820 g_variant_builder_add (&builder, "{sv}", info->name, value);
15821 g_variant_unref (value);
15822 }
15823 }
15824 }
15825out:
15826 return g_variant_builder_end (&builder);
15827}
15828
15829static void
15830control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15831{
15832}
15833
15834static void
15835_control_host_on_signal_booted (
15836 ControlHost *object)
15837{
15838 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15839
15840 GList *connections, *l;
15841 GVariant *signal_variant;
15842 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15843
15844 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15845 for (l = connections; l != NULL; l = l->next)
15846 {
15847 GDBusConnection *connection = l->data;
15848 g_dbus_connection_emit_signal (connection,
15849 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
15850 signal_variant, NULL);
15851 }
15852 g_variant_unref (signal_variant);
15853 g_list_free_full (connections, g_object_unref);
15854}
15855
15856static void control_host_skeleton_iface_init (ControlHostIface *iface);
15857#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15858G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15859 G_ADD_PRIVATE (ControlHostSkeleton)
15860 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15861
15862#else
15863G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15864 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15865
15866#endif
15867static void
15868control_host_skeleton_finalize (GObject *object)
15869{
15870 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15871 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15872 if (skeleton->priv->changed_properties_idle_source != NULL)
15873 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15874 g_main_context_unref (skeleton->priv->context);
15875 g_mutex_clear (&skeleton->priv->lock);
15876 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
15877}
15878
15879static void
15880control_host_skeleton_init (ControlHostSkeleton *skeleton)
15881{
15882#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15883 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
15884#else
15885 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
15886#endif
15887
15888 g_mutex_init (&skeleton->priv->lock);
15889 skeleton->priv->context = g_main_context_ref_thread_default ();
15890}
15891
15892static void
15893control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
15894{
15895 GObjectClass *gobject_class;
15896 GDBusInterfaceSkeletonClass *skeleton_class;
15897
15898 gobject_class = G_OBJECT_CLASS (klass);
15899 gobject_class->finalize = control_host_skeleton_finalize;
15900
15901 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15902 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
15903 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
15904 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
15905 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
15906
15907#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15908 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
15909#endif
15910}
15911
15912static void
15913control_host_skeleton_iface_init (ControlHostIface *iface)
15914{
15915 iface->booted = _control_host_on_signal_booted;
15916}
15917
15918/**
15919 * control_host_skeleton_new:
15920 *
15921 * 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>.
15922 *
15923 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
15924 */
15925ControlHost *
15926control_host_skeleton_new (void)
15927{
15928 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
15929}
15930
15931/* ------------------------------------------------------------------------
15932 * Code for interface org.openbmc.control.Power
15933 * ------------------------------------------------------------------------
15934 */
15935
15936/**
15937 * SECTION:ControlPower
15938 * @title: ControlPower
15939 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
15940 *
15941 * 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.
15942 */
15943
15944/* ---- Introspection data for org.openbmc.control.Power ---- */
15945
15946static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
15947{
15948 {
15949 -1,
15950 (gchar *) "state",
15951 (gchar *) "i",
15952 NULL
15953 },
15954 FALSE
15955};
15956
15957static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
15958{
15959 &_control_power_method_info_set_power_state_IN_ARG_state,
15960 NULL
15961};
15962
15963static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
15964{
15965 {
15966 -1,
15967 (gchar *) "setPowerState",
15968 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
15969 NULL,
15970 NULL
15971 },
15972 "handle-set-power-state",
15973 FALSE
15974};
15975
15976static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
15977{
15978 {
15979 -1,
15980 (gchar *) "state",
15981 (gchar *) "i",
15982 NULL
15983 },
15984 FALSE
15985};
15986
15987static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
15988{
15989 &_control_power_method_info_get_power_state_OUT_ARG_state,
15990 NULL
15991};
15992
15993static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
15994{
15995 {
15996 -1,
15997 (gchar *) "getPowerState",
15998 NULL,
15999 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
16000 NULL
16001 },
16002 "handle-get-power-state",
16003 FALSE
16004};
16005
16006static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
16007{
16008 &_control_power_method_info_set_power_state,
16009 &_control_power_method_info_get_power_state,
16010 NULL
16011};
16012
16013static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
16014{
16015 {
16016 -1,
16017 (gchar *) "PowerGood",
16018 NULL,
16019 NULL
16020 },
16021 "power-good"
16022};
16023
16024static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
16025{
16026 {
16027 -1,
16028 (gchar *) "PowerLost",
16029 NULL,
16030 NULL
16031 },
16032 "power-lost"
16033};
16034
16035static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
16036{
16037 &_control_power_signal_info_power_good,
16038 &_control_power_signal_info_power_lost,
16039 NULL
16040};
16041
16042static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
16043{
16044 {
16045 -1,
16046 (gchar *) "pgood",
16047 (gchar *) "i",
16048 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16049 NULL
16050 },
16051 "pgood",
16052 FALSE
16053};
16054
16055static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
16056{
16057 {
16058 -1,
16059 (gchar *) "state",
16060 (gchar *) "i",
16061 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16062 NULL
16063 },
16064 "state",
16065 FALSE
16066};
16067
Norman James32e74e22015-09-15 21:28:06 -050016068static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
16069{
16070 {
16071 -1,
16072 (gchar *) "pgood_timeout",
16073 (gchar *) "i",
16074 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16075 NULL
16076 },
16077 "pgood-timeout",
16078 FALSE
16079};
16080
Norman James362a80f2015-09-14 14:04:39 -050016081static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
16082{
16083 &_control_power_property_info_pgood,
16084 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050016085 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050016086 NULL
16087};
16088
16089static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
16090{
16091 {
16092 -1,
16093 (gchar *) "org.openbmc.control.Power",
16094 (GDBusMethodInfo **) &_control_power_method_info_pointers,
16095 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
16096 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
16097 NULL
16098 },
16099 "control-power",
16100};
16101
16102
16103/**
16104 * control_power_interface_info:
16105 *
16106 * 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.
16107 *
16108 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16109 */
16110GDBusInterfaceInfo *
16111control_power_interface_info (void)
16112{
16113 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
16114}
16115
16116/**
16117 * control_power_override_properties:
16118 * @klass: The class structure for a #GObject<!-- -->-derived class.
16119 * @property_id_begin: The property id to assign to the first overridden property.
16120 *
16121 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
16122 * The properties are overridden in the order they are defined.
16123 *
16124 * Returns: The last property id.
16125 */
16126guint
16127control_power_override_properties (GObjectClass *klass, guint property_id_begin)
16128{
16129 g_object_class_override_property (klass, property_id_begin++, "pgood");
16130 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050016131 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050016132 return property_id_begin - 1;
16133}
16134
16135
16136
16137/**
16138 * ControlPower:
16139 *
16140 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16141 */
16142
16143/**
16144 * ControlPowerIface:
16145 * @parent_iface: The parent interface.
16146 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
16147 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
16148 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050016149 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050016150 * @get_state: Getter for the #ControlPower:state property.
16151 * @power_good: Handler for the #ControlPower::power-good signal.
16152 * @power_lost: Handler for the #ControlPower::power-lost signal.
16153 *
16154 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16155 */
16156
16157typedef ControlPowerIface ControlPowerInterface;
16158G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
16159
16160static void
16161control_power_default_init (ControlPowerIface *iface)
16162{
16163 /* GObject signals for incoming D-Bus method calls: */
16164 /**
16165 * ControlPower::handle-set-power-state:
16166 * @object: A #ControlPower.
16167 * @invocation: A #GDBusMethodInvocation.
16168 * @arg_state: Argument passed by remote caller.
16169 *
16170 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
16171 *
16172 * 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.
16173 *
16174 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16175 */
16176 g_signal_new ("handle-set-power-state",
16177 G_TYPE_FROM_INTERFACE (iface),
16178 G_SIGNAL_RUN_LAST,
16179 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
16180 g_signal_accumulator_true_handled,
16181 NULL,
16182 g_cclosure_marshal_generic,
16183 G_TYPE_BOOLEAN,
16184 2,
16185 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
16186
16187 /**
16188 * ControlPower::handle-get-power-state:
16189 * @object: A #ControlPower.
16190 * @invocation: A #GDBusMethodInvocation.
16191 *
16192 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
16193 *
16194 * 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.
16195 *
16196 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16197 */
16198 g_signal_new ("handle-get-power-state",
16199 G_TYPE_FROM_INTERFACE (iface),
16200 G_SIGNAL_RUN_LAST,
16201 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
16202 g_signal_accumulator_true_handled,
16203 NULL,
16204 g_cclosure_marshal_generic,
16205 G_TYPE_BOOLEAN,
16206 1,
16207 G_TYPE_DBUS_METHOD_INVOCATION);
16208
16209 /* GObject signals for received D-Bus signals: */
16210 /**
16211 * ControlPower::power-good:
16212 * @object: A #ControlPower.
16213 *
16214 * 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.
16215 *
16216 * 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.
16217 */
16218 g_signal_new ("power-good",
16219 G_TYPE_FROM_INTERFACE (iface),
16220 G_SIGNAL_RUN_LAST,
16221 G_STRUCT_OFFSET (ControlPowerIface, power_good),
16222 NULL,
16223 NULL,
16224 g_cclosure_marshal_generic,
16225 G_TYPE_NONE,
16226 0);
16227
16228 /**
16229 * ControlPower::power-lost:
16230 * @object: A #ControlPower.
16231 *
16232 * 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.
16233 *
16234 * 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.
16235 */
16236 g_signal_new ("power-lost",
16237 G_TYPE_FROM_INTERFACE (iface),
16238 G_SIGNAL_RUN_LAST,
16239 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
16240 NULL,
16241 NULL,
16242 g_cclosure_marshal_generic,
16243 G_TYPE_NONE,
16244 0);
16245
16246 /* GObject properties for D-Bus properties: */
16247 /**
16248 * ControlPower:pgood:
16249 *
16250 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
16251 *
16252 * 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.
16253 */
16254 g_object_interface_install_property (iface,
16255 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16256 /**
16257 * ControlPower:state:
16258 *
16259 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
16260 *
16261 * 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.
16262 */
16263 g_object_interface_install_property (iface,
16264 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 -050016265 /**
16266 * ControlPower:pgood-timeout:
16267 *
16268 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
16269 *
16270 * 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.
16271 */
16272 g_object_interface_install_property (iface,
16273 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 -050016274}
16275
16276/**
16277 * control_power_get_pgood: (skip)
16278 * @object: A #ControlPower.
16279 *
16280 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
16281 *
16282 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16283 *
16284 * Returns: The property value.
16285 */
16286gint
16287control_power_get_pgood (ControlPower *object)
16288{
16289 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
16290}
16291
16292/**
16293 * control_power_set_pgood: (skip)
16294 * @object: A #ControlPower.
16295 * @value: The value to set.
16296 *
16297 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
16298 *
16299 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16300 */
16301void
16302control_power_set_pgood (ControlPower *object, gint value)
16303{
16304 g_object_set (G_OBJECT (object), "pgood", value, NULL);
16305}
16306
16307/**
16308 * control_power_get_state: (skip)
16309 * @object: A #ControlPower.
16310 *
16311 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
16312 *
16313 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16314 *
16315 * Returns: The property value.
16316 */
16317gint
16318control_power_get_state (ControlPower *object)
16319{
16320 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
16321}
16322
16323/**
16324 * control_power_set_state: (skip)
16325 * @object: A #ControlPower.
16326 * @value: The value to set.
16327 *
16328 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
16329 *
16330 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16331 */
16332void
16333control_power_set_state (ControlPower *object, gint value)
16334{
16335 g_object_set (G_OBJECT (object), "state", value, NULL);
16336}
16337
16338/**
Norman James32e74e22015-09-15 21:28:06 -050016339 * control_power_get_pgood_timeout: (skip)
16340 * @object: A #ControlPower.
16341 *
16342 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
16343 *
16344 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16345 *
16346 * Returns: The property value.
16347 */
16348gint
16349control_power_get_pgood_timeout (ControlPower *object)
16350{
16351 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
16352}
16353
16354/**
16355 * control_power_set_pgood_timeout: (skip)
16356 * @object: A #ControlPower.
16357 * @value: The value to set.
16358 *
16359 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
16360 *
16361 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16362 */
16363void
16364control_power_set_pgood_timeout (ControlPower *object, gint value)
16365{
16366 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
16367}
16368
16369/**
Norman James362a80f2015-09-14 14:04:39 -050016370 * control_power_emit_power_good:
16371 * @object: A #ControlPower.
16372 *
16373 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
16374 */
16375void
16376control_power_emit_power_good (
16377 ControlPower *object)
16378{
16379 g_signal_emit_by_name (object, "power-good");
16380}
16381
16382/**
16383 * control_power_emit_power_lost:
16384 * @object: A #ControlPower.
16385 *
16386 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
16387 */
16388void
16389control_power_emit_power_lost (
16390 ControlPower *object)
16391{
16392 g_signal_emit_by_name (object, "power-lost");
16393}
16394
16395/**
16396 * control_power_call_set_power_state:
16397 * @proxy: A #ControlPowerProxy.
16398 * @arg_state: Argument to pass with the method invocation.
16399 * @cancellable: (allow-none): A #GCancellable or %NULL.
16400 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16401 * @user_data: User data to pass to @callback.
16402 *
16403 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
16404 * 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.
16405 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
16406 *
16407 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
16408 */
16409void
16410control_power_call_set_power_state (
16411 ControlPower *proxy,
16412 gint arg_state,
16413 GCancellable *cancellable,
16414 GAsyncReadyCallback callback,
16415 gpointer user_data)
16416{
16417 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16418 "setPowerState",
16419 g_variant_new ("(i)",
16420 arg_state),
16421 G_DBUS_CALL_FLAGS_NONE,
16422 -1,
16423 cancellable,
16424 callback,
16425 user_data);
16426}
16427
16428/**
16429 * control_power_call_set_power_state_finish:
16430 * @proxy: A #ControlPowerProxy.
16431 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
16432 * @error: Return location for error or %NULL.
16433 *
16434 * Finishes an operation started with control_power_call_set_power_state().
16435 *
16436 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16437 */
16438gboolean
16439control_power_call_set_power_state_finish (
16440 ControlPower *proxy,
16441 GAsyncResult *res,
16442 GError **error)
16443{
16444 GVariant *_ret;
16445 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16446 if (_ret == NULL)
16447 goto _out;
16448 g_variant_get (_ret,
16449 "()");
16450 g_variant_unref (_ret);
16451_out:
16452 return _ret != NULL;
16453}
16454
16455/**
16456 * control_power_call_set_power_state_sync:
16457 * @proxy: A #ControlPowerProxy.
16458 * @arg_state: Argument to pass with the method invocation.
16459 * @cancellable: (allow-none): A #GCancellable or %NULL.
16460 * @error: Return location for error or %NULL.
16461 *
16462 * 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.
16463 *
16464 * See control_power_call_set_power_state() for the asynchronous version of this method.
16465 *
16466 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16467 */
16468gboolean
16469control_power_call_set_power_state_sync (
16470 ControlPower *proxy,
16471 gint arg_state,
16472 GCancellable *cancellable,
16473 GError **error)
16474{
16475 GVariant *_ret;
16476 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16477 "setPowerState",
16478 g_variant_new ("(i)",
16479 arg_state),
16480 G_DBUS_CALL_FLAGS_NONE,
16481 -1,
16482 cancellable,
16483 error);
16484 if (_ret == NULL)
16485 goto _out;
16486 g_variant_get (_ret,
16487 "()");
16488 g_variant_unref (_ret);
16489_out:
16490 return _ret != NULL;
16491}
16492
16493/**
16494 * control_power_call_get_power_state:
16495 * @proxy: A #ControlPowerProxy.
16496 * @cancellable: (allow-none): A #GCancellable or %NULL.
16497 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16498 * @user_data: User data to pass to @callback.
16499 *
16500 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
16501 * 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.
16502 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
16503 *
16504 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
16505 */
16506void
16507control_power_call_get_power_state (
16508 ControlPower *proxy,
16509 GCancellable *cancellable,
16510 GAsyncReadyCallback callback,
16511 gpointer user_data)
16512{
16513 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16514 "getPowerState",
16515 g_variant_new ("()"),
16516 G_DBUS_CALL_FLAGS_NONE,
16517 -1,
16518 cancellable,
16519 callback,
16520 user_data);
16521}
16522
16523/**
16524 * control_power_call_get_power_state_finish:
16525 * @proxy: A #ControlPowerProxy.
16526 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16527 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
16528 * @error: Return location for error or %NULL.
16529 *
16530 * Finishes an operation started with control_power_call_get_power_state().
16531 *
16532 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16533 */
16534gboolean
16535control_power_call_get_power_state_finish (
16536 ControlPower *proxy,
16537 gint *out_state,
16538 GAsyncResult *res,
16539 GError **error)
16540{
16541 GVariant *_ret;
16542 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16543 if (_ret == NULL)
16544 goto _out;
16545 g_variant_get (_ret,
16546 "(i)",
16547 out_state);
16548 g_variant_unref (_ret);
16549_out:
16550 return _ret != NULL;
16551}
16552
16553/**
16554 * control_power_call_get_power_state_sync:
16555 * @proxy: A #ControlPowerProxy.
16556 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16557 * @cancellable: (allow-none): A #GCancellable or %NULL.
16558 * @error: Return location for error or %NULL.
16559 *
16560 * 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.
16561 *
16562 * See control_power_call_get_power_state() for the asynchronous version of this method.
16563 *
16564 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16565 */
16566gboolean
16567control_power_call_get_power_state_sync (
16568 ControlPower *proxy,
16569 gint *out_state,
16570 GCancellable *cancellable,
16571 GError **error)
16572{
16573 GVariant *_ret;
16574 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16575 "getPowerState",
16576 g_variant_new ("()"),
16577 G_DBUS_CALL_FLAGS_NONE,
16578 -1,
16579 cancellable,
16580 error);
16581 if (_ret == NULL)
16582 goto _out;
16583 g_variant_get (_ret,
16584 "(i)",
16585 out_state);
16586 g_variant_unref (_ret);
16587_out:
16588 return _ret != NULL;
16589}
16590
16591/**
16592 * control_power_complete_set_power_state:
16593 * @object: A #ControlPower.
16594 * @invocation: (transfer full): A #GDBusMethodInvocation.
16595 *
16596 * 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.
16597 *
16598 * This method will free @invocation, you cannot use it afterwards.
16599 */
16600void
16601control_power_complete_set_power_state (
16602 ControlPower *object,
16603 GDBusMethodInvocation *invocation)
16604{
16605 g_dbus_method_invocation_return_value (invocation,
16606 g_variant_new ("()"));
16607}
16608
16609/**
16610 * control_power_complete_get_power_state:
16611 * @object: A #ControlPower.
16612 * @invocation: (transfer full): A #GDBusMethodInvocation.
16613 * @state: Parameter to return.
16614 *
16615 * 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.
16616 *
16617 * This method will free @invocation, you cannot use it afterwards.
16618 */
16619void
16620control_power_complete_get_power_state (
16621 ControlPower *object,
16622 GDBusMethodInvocation *invocation,
16623 gint state)
16624{
16625 g_dbus_method_invocation_return_value (invocation,
16626 g_variant_new ("(i)",
16627 state));
16628}
16629
16630/* ------------------------------------------------------------------------ */
16631
16632/**
16633 * ControlPowerProxy:
16634 *
16635 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
16636 */
16637
16638/**
16639 * ControlPowerProxyClass:
16640 * @parent_class: The parent class.
16641 *
16642 * Class structure for #ControlPowerProxy.
16643 */
16644
16645struct _ControlPowerProxyPrivate
16646{
16647 GData *qdata;
16648};
16649
16650static void control_power_proxy_iface_init (ControlPowerIface *iface);
16651
16652#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16653G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16654 G_ADD_PRIVATE (ControlPowerProxy)
16655 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16656
16657#else
16658G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16659 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16660
16661#endif
16662static void
16663control_power_proxy_finalize (GObject *object)
16664{
16665 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16666 g_datalist_clear (&proxy->priv->qdata);
16667 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
16668}
16669
16670static void
16671control_power_proxy_get_property (GObject *object,
16672 guint prop_id,
16673 GValue *value,
16674 GParamSpec *pspec G_GNUC_UNUSED)
16675{
16676 const _ExtendedGDBusPropertyInfo *info;
16677 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016678 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016679 info = _control_power_property_info_pointers[prop_id - 1];
16680 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16681 if (info->use_gvariant)
16682 {
16683 g_value_set_variant (value, variant);
16684 }
16685 else
16686 {
16687 if (variant != NULL)
16688 g_dbus_gvariant_to_gvalue (variant, value);
16689 }
16690 if (variant != NULL)
16691 g_variant_unref (variant);
16692}
16693
16694static void
16695control_power_proxy_set_property_cb (GDBusProxy *proxy,
16696 GAsyncResult *res,
16697 gpointer user_data)
16698{
16699 const _ExtendedGDBusPropertyInfo *info = user_data;
16700 GError *error;
16701 GVariant *_ret;
16702 error = NULL;
16703 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16704 if (!_ret)
16705 {
16706 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
16707 info->parent_struct.name,
16708 error->message, g_quark_to_string (error->domain), error->code);
16709 g_error_free (error);
16710 }
16711 else
16712 {
16713 g_variant_unref (_ret);
16714 }
16715}
16716
16717static void
16718control_power_proxy_set_property (GObject *object,
16719 guint prop_id,
16720 const GValue *value,
16721 GParamSpec *pspec G_GNUC_UNUSED)
16722{
16723 const _ExtendedGDBusPropertyInfo *info;
16724 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016725 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016726 info = _control_power_property_info_pointers[prop_id - 1];
16727 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16728 g_dbus_proxy_call (G_DBUS_PROXY (object),
16729 "org.freedesktop.DBus.Properties.Set",
16730 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
16731 G_DBUS_CALL_FLAGS_NONE,
16732 -1,
16733 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16734 g_variant_unref (variant);
16735}
16736
16737static void
16738control_power_proxy_g_signal (GDBusProxy *proxy,
16739 const gchar *sender_name G_GNUC_UNUSED,
16740 const gchar *signal_name,
16741 GVariant *parameters)
16742{
16743 _ExtendedGDBusSignalInfo *info;
16744 GVariantIter iter;
16745 GVariant *child;
16746 GValue *paramv;
16747 guint num_params;
16748 guint n;
16749 guint signal_id;
16750 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
16751 if (info == NULL)
16752 return;
16753 num_params = g_variant_n_children (parameters);
16754 paramv = g_new0 (GValue, num_params + 1);
16755 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
16756 g_value_set_object (&paramv[0], proxy);
16757 g_variant_iter_init (&iter, parameters);
16758 n = 1;
16759 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16760 {
16761 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16762 if (arg_info->use_gvariant)
16763 {
16764 g_value_init (&paramv[n], G_TYPE_VARIANT);
16765 g_value_set_variant (&paramv[n], child);
16766 n++;
16767 }
16768 else
16769 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16770 g_variant_unref (child);
16771 }
16772 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
16773 g_signal_emitv (paramv, signal_id, 0, NULL);
16774 for (n = 0; n < num_params + 1; n++)
16775 g_value_unset (&paramv[n]);
16776 g_free (paramv);
16777}
16778
16779static void
16780control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
16781 GVariant *changed_properties,
16782 const gchar *const *invalidated_properties)
16783{
16784 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
16785 guint n;
16786 const gchar *key;
16787 GVariantIter *iter;
16788 _ExtendedGDBusPropertyInfo *info;
16789 g_variant_get (changed_properties, "a{sv}", &iter);
16790 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16791 {
16792 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
16793 g_datalist_remove_data (&proxy->priv->qdata, key);
16794 if (info != NULL)
16795 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16796 }
16797 g_variant_iter_free (iter);
16798 for (n = 0; invalidated_properties[n] != NULL; n++)
16799 {
16800 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
16801 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16802 if (info != NULL)
16803 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16804 }
16805}
16806
16807static gint
16808control_power_proxy_get_pgood (ControlPower *object)
16809{
16810 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16811 GVariant *variant;
16812 gint value = 0;
16813 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
16814 if (variant != NULL)
16815 {
16816 value = g_variant_get_int32 (variant);
16817 g_variant_unref (variant);
16818 }
16819 return value;
16820}
16821
16822static gint
16823control_power_proxy_get_state (ControlPower *object)
16824{
16825 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16826 GVariant *variant;
16827 gint value = 0;
16828 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
16829 if (variant != NULL)
16830 {
16831 value = g_variant_get_int32 (variant);
16832 g_variant_unref (variant);
16833 }
16834 return value;
16835}
16836
Norman James32e74e22015-09-15 21:28:06 -050016837static gint
16838control_power_proxy_get_pgood_timeout (ControlPower *object)
16839{
16840 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16841 GVariant *variant;
16842 gint value = 0;
16843 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
16844 if (variant != NULL)
16845 {
16846 value = g_variant_get_int32 (variant);
16847 g_variant_unref (variant);
16848 }
16849 return value;
16850}
16851
Norman James362a80f2015-09-14 14:04:39 -050016852static void
16853control_power_proxy_init (ControlPowerProxy *proxy)
16854{
16855#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16856 proxy->priv = control_power_proxy_get_instance_private (proxy);
16857#else
16858 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
16859#endif
16860
16861 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
16862}
16863
16864static void
16865control_power_proxy_class_init (ControlPowerProxyClass *klass)
16866{
16867 GObjectClass *gobject_class;
16868 GDBusProxyClass *proxy_class;
16869
16870 gobject_class = G_OBJECT_CLASS (klass);
16871 gobject_class->finalize = control_power_proxy_finalize;
16872 gobject_class->get_property = control_power_proxy_get_property;
16873 gobject_class->set_property = control_power_proxy_set_property;
16874
16875 proxy_class = G_DBUS_PROXY_CLASS (klass);
16876 proxy_class->g_signal = control_power_proxy_g_signal;
16877 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
16878
16879 control_power_override_properties (gobject_class, 1);
16880
16881#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16882 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
16883#endif
16884}
16885
16886static void
16887control_power_proxy_iface_init (ControlPowerIface *iface)
16888{
16889 iface->get_pgood = control_power_proxy_get_pgood;
16890 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050016891 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050016892}
16893
16894/**
16895 * control_power_proxy_new:
16896 * @connection: A #GDBusConnection.
16897 * @flags: Flags from the #GDBusProxyFlags enumeration.
16898 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16899 * @object_path: An object path.
16900 * @cancellable: (allow-none): A #GCancellable or %NULL.
16901 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16902 * @user_data: User data to pass to @callback.
16903 *
16904 * 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.
16905 *
16906 * 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.
16907 * You can then call control_power_proxy_new_finish() to get the result of the operation.
16908 *
16909 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
16910 */
16911void
16912control_power_proxy_new (
16913 GDBusConnection *connection,
16914 GDBusProxyFlags flags,
16915 const gchar *name,
16916 const gchar *object_path,
16917 GCancellable *cancellable,
16918 GAsyncReadyCallback callback,
16919 gpointer user_data)
16920{
16921 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);
16922}
16923
16924/**
16925 * control_power_proxy_new_finish:
16926 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
16927 * @error: Return location for error or %NULL
16928 *
16929 * Finishes an operation started with control_power_proxy_new().
16930 *
16931 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
16932 */
16933ControlPower *
16934control_power_proxy_new_finish (
16935 GAsyncResult *res,
16936 GError **error)
16937{
16938 GObject *ret;
16939 GObject *source_object;
16940 source_object = g_async_result_get_source_object (res);
16941 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16942 g_object_unref (source_object);
16943 if (ret != NULL)
16944 return CONTROL_POWER (ret);
16945 else
16946 return NULL;
16947}
16948
16949/**
16950 * control_power_proxy_new_sync:
16951 * @connection: A #GDBusConnection.
16952 * @flags: Flags from the #GDBusProxyFlags enumeration.
16953 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16954 * @object_path: An object path.
16955 * @cancellable: (allow-none): A #GCancellable or %NULL.
16956 * @error: Return location for error or %NULL
16957 *
16958 * 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.
16959 *
16960 * The calling thread is blocked until a reply is received.
16961 *
16962 * See control_power_proxy_new() for the asynchronous version of this constructor.
16963 *
16964 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
16965 */
16966ControlPower *
16967control_power_proxy_new_sync (
16968 GDBusConnection *connection,
16969 GDBusProxyFlags flags,
16970 const gchar *name,
16971 const gchar *object_path,
16972 GCancellable *cancellable,
16973 GError **error)
16974{
16975 GInitable *ret;
16976 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);
16977 if (ret != NULL)
16978 return CONTROL_POWER (ret);
16979 else
16980 return NULL;
16981}
16982
16983
16984/**
16985 * control_power_proxy_new_for_bus:
16986 * @bus_type: A #GBusType.
16987 * @flags: Flags from the #GDBusProxyFlags enumeration.
16988 * @name: A bus name (well-known or unique).
16989 * @object_path: An object path.
16990 * @cancellable: (allow-none): A #GCancellable or %NULL.
16991 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16992 * @user_data: User data to pass to @callback.
16993 *
16994 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
16995 *
16996 * 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.
16997 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
16998 *
16999 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17000 */
17001void
17002control_power_proxy_new_for_bus (
17003 GBusType bus_type,
17004 GDBusProxyFlags flags,
17005 const gchar *name,
17006 const gchar *object_path,
17007 GCancellable *cancellable,
17008 GAsyncReadyCallback callback,
17009 gpointer user_data)
17010{
17011 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);
17012}
17013
17014/**
17015 * control_power_proxy_new_for_bus_finish:
17016 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
17017 * @error: Return location for error or %NULL
17018 *
17019 * Finishes an operation started with control_power_proxy_new_for_bus().
17020 *
17021 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17022 */
17023ControlPower *
17024control_power_proxy_new_for_bus_finish (
17025 GAsyncResult *res,
17026 GError **error)
17027{
17028 GObject *ret;
17029 GObject *source_object;
17030 source_object = g_async_result_get_source_object (res);
17031 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17032 g_object_unref (source_object);
17033 if (ret != NULL)
17034 return CONTROL_POWER (ret);
17035 else
17036 return NULL;
17037}
17038
17039/**
17040 * control_power_proxy_new_for_bus_sync:
17041 * @bus_type: A #GBusType.
17042 * @flags: Flags from the #GDBusProxyFlags enumeration.
17043 * @name: A bus name (well-known or unique).
17044 * @object_path: An object path.
17045 * @cancellable: (allow-none): A #GCancellable or %NULL.
17046 * @error: Return location for error or %NULL
17047 *
17048 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17049 *
17050 * The calling thread is blocked until a reply is received.
17051 *
17052 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
17053 *
17054 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17055 */
17056ControlPower *
17057control_power_proxy_new_for_bus_sync (
17058 GBusType bus_type,
17059 GDBusProxyFlags flags,
17060 const gchar *name,
17061 const gchar *object_path,
17062 GCancellable *cancellable,
17063 GError **error)
17064{
17065 GInitable *ret;
17066 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);
17067 if (ret != NULL)
17068 return CONTROL_POWER (ret);
17069 else
17070 return NULL;
17071}
17072
17073
17074/* ------------------------------------------------------------------------ */
17075
17076/**
17077 * ControlPowerSkeleton:
17078 *
17079 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
17080 */
17081
17082/**
17083 * ControlPowerSkeletonClass:
17084 * @parent_class: The parent class.
17085 *
17086 * Class structure for #ControlPowerSkeleton.
17087 */
17088
17089struct _ControlPowerSkeletonPrivate
17090{
17091 GValue *properties;
17092 GList *changed_properties;
17093 GSource *changed_properties_idle_source;
17094 GMainContext *context;
17095 GMutex lock;
17096};
17097
17098static void
17099_control_power_skeleton_handle_method_call (
17100 GDBusConnection *connection G_GNUC_UNUSED,
17101 const gchar *sender G_GNUC_UNUSED,
17102 const gchar *object_path G_GNUC_UNUSED,
17103 const gchar *interface_name,
17104 const gchar *method_name,
17105 GVariant *parameters,
17106 GDBusMethodInvocation *invocation,
17107 gpointer user_data)
17108{
17109 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17110 _ExtendedGDBusMethodInfo *info;
17111 GVariantIter iter;
17112 GVariant *child;
17113 GValue *paramv;
17114 guint num_params;
17115 guint num_extra;
17116 guint n;
17117 guint signal_id;
17118 GValue return_value = G_VALUE_INIT;
17119 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17120 g_assert (info != NULL);
17121 num_params = g_variant_n_children (parameters);
17122 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17123 n = 0;
17124 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
17125 g_value_set_object (&paramv[n++], skeleton);
17126 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17127 g_value_set_object (&paramv[n++], invocation);
17128 if (info->pass_fdlist)
17129 {
17130#ifdef G_OS_UNIX
17131 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17132 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17133#else
17134 g_assert_not_reached ();
17135#endif
17136 }
17137 g_variant_iter_init (&iter, parameters);
17138 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17139 {
17140 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17141 if (arg_info->use_gvariant)
17142 {
17143 g_value_init (&paramv[n], G_TYPE_VARIANT);
17144 g_value_set_variant (&paramv[n], child);
17145 n++;
17146 }
17147 else
17148 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17149 g_variant_unref (child);
17150 }
17151 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17152 g_value_init (&return_value, G_TYPE_BOOLEAN);
17153 g_signal_emitv (paramv, signal_id, 0, &return_value);
17154 if (!g_value_get_boolean (&return_value))
17155 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);
17156 g_value_unset (&return_value);
17157 for (n = 0; n < num_params + num_extra; n++)
17158 g_value_unset (&paramv[n]);
17159 g_free (paramv);
17160}
17161
17162static GVariant *
17163_control_power_skeleton_handle_get_property (
17164 GDBusConnection *connection G_GNUC_UNUSED,
17165 const gchar *sender G_GNUC_UNUSED,
17166 const gchar *object_path G_GNUC_UNUSED,
17167 const gchar *interface_name G_GNUC_UNUSED,
17168 const gchar *property_name,
17169 GError **error,
17170 gpointer user_data)
17171{
17172 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17173 GValue value = G_VALUE_INIT;
17174 GParamSpec *pspec;
17175 _ExtendedGDBusPropertyInfo *info;
17176 GVariant *ret;
17177 ret = NULL;
17178 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17179 g_assert (info != NULL);
17180 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17181 if (pspec == NULL)
17182 {
17183 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17184 }
17185 else
17186 {
17187 g_value_init (&value, pspec->value_type);
17188 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17189 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17190 g_value_unset (&value);
17191 }
17192 return ret;
17193}
17194
17195static gboolean
17196_control_power_skeleton_handle_set_property (
17197 GDBusConnection *connection G_GNUC_UNUSED,
17198 const gchar *sender G_GNUC_UNUSED,
17199 const gchar *object_path G_GNUC_UNUSED,
17200 const gchar *interface_name G_GNUC_UNUSED,
17201 const gchar *property_name,
17202 GVariant *variant,
17203 GError **error,
17204 gpointer user_data)
17205{
17206 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17207 GValue value = G_VALUE_INIT;
17208 GParamSpec *pspec;
17209 _ExtendedGDBusPropertyInfo *info;
17210 gboolean ret;
17211 ret = FALSE;
17212 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17213 g_assert (info != NULL);
17214 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17215 if (pspec == NULL)
17216 {
17217 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17218 }
17219 else
17220 {
17221 if (info->use_gvariant)
17222 g_value_set_variant (&value, variant);
17223 else
17224 g_dbus_gvariant_to_gvalue (variant, &value);
17225 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17226 g_value_unset (&value);
17227 ret = TRUE;
17228 }
17229 return ret;
17230}
17231
17232static const GDBusInterfaceVTable _control_power_skeleton_vtable =
17233{
17234 _control_power_skeleton_handle_method_call,
17235 _control_power_skeleton_handle_get_property,
17236 _control_power_skeleton_handle_set_property,
17237 {NULL}
17238};
17239
17240static GDBusInterfaceInfo *
17241control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17242{
17243 return control_power_interface_info ();
17244}
17245
17246static GDBusInterfaceVTable *
17247control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17248{
17249 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
17250}
17251
17252static GVariant *
17253control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17254{
17255 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17256
17257 GVariantBuilder builder;
17258 guint n;
17259 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17260 if (_control_power_interface_info.parent_struct.properties == NULL)
17261 goto out;
17262 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
17263 {
17264 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
17265 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17266 {
17267 GVariant *value;
17268 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);
17269 if (value != NULL)
17270 {
17271 g_variant_take_ref (value);
17272 g_variant_builder_add (&builder, "{sv}", info->name, value);
17273 g_variant_unref (value);
17274 }
17275 }
17276 }
17277out:
17278 return g_variant_builder_end (&builder);
17279}
17280
17281static gboolean _control_power_emit_changed (gpointer user_data);
17282
17283static void
17284control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17285{
17286 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17287 gboolean emit_changed = FALSE;
17288
17289 g_mutex_lock (&skeleton->priv->lock);
17290 if (skeleton->priv->changed_properties_idle_source != NULL)
17291 {
17292 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17293 skeleton->priv->changed_properties_idle_source = NULL;
17294 emit_changed = TRUE;
17295 }
17296 g_mutex_unlock (&skeleton->priv->lock);
17297
17298 if (emit_changed)
17299 _control_power_emit_changed (skeleton);
17300}
17301
17302static void
17303_control_power_on_signal_power_good (
17304 ControlPower *object)
17305{
17306 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17307
17308 GList *connections, *l;
17309 GVariant *signal_variant;
17310 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17311
17312 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17313 for (l = connections; l != NULL; l = l->next)
17314 {
17315 GDBusConnection *connection = l->data;
17316 g_dbus_connection_emit_signal (connection,
17317 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
17318 signal_variant, NULL);
17319 }
17320 g_variant_unref (signal_variant);
17321 g_list_free_full (connections, g_object_unref);
17322}
17323
17324static void
17325_control_power_on_signal_power_lost (
17326 ControlPower *object)
17327{
17328 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17329
17330 GList *connections, *l;
17331 GVariant *signal_variant;
17332 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17333
17334 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17335 for (l = connections; l != NULL; l = l->next)
17336 {
17337 GDBusConnection *connection = l->data;
17338 g_dbus_connection_emit_signal (connection,
17339 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
17340 signal_variant, NULL);
17341 }
17342 g_variant_unref (signal_variant);
17343 g_list_free_full (connections, g_object_unref);
17344}
17345
17346static void control_power_skeleton_iface_init (ControlPowerIface *iface);
17347#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17348G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17349 G_ADD_PRIVATE (ControlPowerSkeleton)
17350 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17351
17352#else
17353G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17354 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17355
17356#endif
17357static void
17358control_power_skeleton_finalize (GObject *object)
17359{
17360 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17361 guint n;
Norman James32e74e22015-09-15 21:28:06 -050017362 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050017363 g_value_unset (&skeleton->priv->properties[n]);
17364 g_free (skeleton->priv->properties);
17365 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17366 if (skeleton->priv->changed_properties_idle_source != NULL)
17367 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17368 g_main_context_unref (skeleton->priv->context);
17369 g_mutex_clear (&skeleton->priv->lock);
17370 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
17371}
17372
17373static void
17374control_power_skeleton_get_property (GObject *object,
17375 guint prop_id,
17376 GValue *value,
17377 GParamSpec *pspec G_GNUC_UNUSED)
17378{
17379 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017380 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017381 g_mutex_lock (&skeleton->priv->lock);
17382 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17383 g_mutex_unlock (&skeleton->priv->lock);
17384}
17385
17386static gboolean
17387_control_power_emit_changed (gpointer user_data)
17388{
17389 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17390 GList *l;
17391 GVariantBuilder builder;
17392 GVariantBuilder invalidated_builder;
17393 guint num_changes;
17394
17395 g_mutex_lock (&skeleton->priv->lock);
17396 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17397 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17398 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17399 {
17400 ChangedProperty *cp = l->data;
17401 GVariant *variant;
17402 const GValue *cur_value;
17403
17404 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17405 if (!_g_value_equal (cur_value, &cp->orig_value))
17406 {
17407 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17408 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17409 g_variant_unref (variant);
17410 num_changes++;
17411 }
17412 }
17413 if (num_changes > 0)
17414 {
17415 GList *connections, *ll;
17416 GVariant *signal_variant;
17417 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
17418 &builder, &invalidated_builder));
17419 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17420 for (ll = connections; ll != NULL; ll = ll->next)
17421 {
17422 GDBusConnection *connection = ll->data;
17423
17424 g_dbus_connection_emit_signal (connection,
17425 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17426 "org.freedesktop.DBus.Properties",
17427 "PropertiesChanged",
17428 signal_variant,
17429 NULL);
17430 }
17431 g_variant_unref (signal_variant);
17432 g_list_free_full (connections, g_object_unref);
17433 }
17434 else
17435 {
17436 g_variant_builder_clear (&builder);
17437 g_variant_builder_clear (&invalidated_builder);
17438 }
17439 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17440 skeleton->priv->changed_properties = NULL;
17441 skeleton->priv->changed_properties_idle_source = NULL;
17442 g_mutex_unlock (&skeleton->priv->lock);
17443 return FALSE;
17444}
17445
17446static void
17447_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17448{
17449 ChangedProperty *cp;
17450 GList *l;
17451 cp = NULL;
17452 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17453 {
17454 ChangedProperty *i_cp = l->data;
17455 if (i_cp->info == info)
17456 {
17457 cp = i_cp;
17458 break;
17459 }
17460 }
17461 if (cp == NULL)
17462 {
17463 cp = g_new0 (ChangedProperty, 1);
17464 cp->prop_id = prop_id;
17465 cp->info = info;
17466 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17467 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17468 g_value_copy (orig_value, &cp->orig_value);
17469 }
17470}
17471
17472static void
17473control_power_skeleton_notify (GObject *object,
17474 GParamSpec *pspec G_GNUC_UNUSED)
17475{
17476 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17477 g_mutex_lock (&skeleton->priv->lock);
17478 if (skeleton->priv->changed_properties != NULL &&
17479 skeleton->priv->changed_properties_idle_source == NULL)
17480 {
17481 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17482 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17483 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
17484 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17485 g_source_unref (skeleton->priv->changed_properties_idle_source);
17486 }
17487 g_mutex_unlock (&skeleton->priv->lock);
17488}
17489
17490static void
17491control_power_skeleton_set_property (GObject *object,
17492 guint prop_id,
17493 const GValue *value,
17494 GParamSpec *pspec)
17495{
17496 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017497 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017498 g_mutex_lock (&skeleton->priv->lock);
17499 g_object_freeze_notify (object);
17500 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17501 {
17502 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17503 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17504 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17505 g_object_notify_by_pspec (object, pspec);
17506 }
17507 g_mutex_unlock (&skeleton->priv->lock);
17508 g_object_thaw_notify (object);
17509}
17510
17511static void
17512control_power_skeleton_init (ControlPowerSkeleton *skeleton)
17513{
17514#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17515 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
17516#else
17517 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
17518#endif
17519
17520 g_mutex_init (&skeleton->priv->lock);
17521 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050017522 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050017523 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17524 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050017525 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050017526}
17527
17528static gint
17529control_power_skeleton_get_pgood (ControlPower *object)
17530{
17531 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17532 gint value;
17533 g_mutex_lock (&skeleton->priv->lock);
17534 value = g_value_get_int (&(skeleton->priv->properties[0]));
17535 g_mutex_unlock (&skeleton->priv->lock);
17536 return value;
17537}
17538
17539static gint
17540control_power_skeleton_get_state (ControlPower *object)
17541{
17542 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17543 gint value;
17544 g_mutex_lock (&skeleton->priv->lock);
17545 value = g_value_get_int (&(skeleton->priv->properties[1]));
17546 g_mutex_unlock (&skeleton->priv->lock);
17547 return value;
17548}
17549
Norman James32e74e22015-09-15 21:28:06 -050017550static gint
17551control_power_skeleton_get_pgood_timeout (ControlPower *object)
17552{
17553 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17554 gint value;
17555 g_mutex_lock (&skeleton->priv->lock);
17556 value = g_value_get_int (&(skeleton->priv->properties[2]));
17557 g_mutex_unlock (&skeleton->priv->lock);
17558 return value;
17559}
17560
Norman James362a80f2015-09-14 14:04:39 -050017561static void
17562control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
17563{
17564 GObjectClass *gobject_class;
17565 GDBusInterfaceSkeletonClass *skeleton_class;
17566
17567 gobject_class = G_OBJECT_CLASS (klass);
17568 gobject_class->finalize = control_power_skeleton_finalize;
17569 gobject_class->get_property = control_power_skeleton_get_property;
17570 gobject_class->set_property = control_power_skeleton_set_property;
17571 gobject_class->notify = control_power_skeleton_notify;
17572
17573
17574 control_power_override_properties (gobject_class, 1);
17575
17576 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17577 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
17578 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
17579 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
17580 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
17581
17582#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17583 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
17584#endif
17585}
17586
17587static void
17588control_power_skeleton_iface_init (ControlPowerIface *iface)
17589{
17590 iface->power_good = _control_power_on_signal_power_good;
17591 iface->power_lost = _control_power_on_signal_power_lost;
17592 iface->get_pgood = control_power_skeleton_get_pgood;
17593 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017594 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017595}
17596
17597/**
17598 * control_power_skeleton_new:
17599 *
17600 * 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>.
17601 *
17602 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
17603 */
17604ControlPower *
17605control_power_skeleton_new (void)
17606{
17607 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
17608}
17609
17610/* ------------------------------------------------------------------------
17611 * Code for interface org.openbmc.Watchdog
17612 * ------------------------------------------------------------------------
17613 */
17614
17615/**
17616 * SECTION:Watchdog
17617 * @title: Watchdog
17618 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
17619 *
17620 * 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.
17621 */
17622
17623/* ---- Introspection data for org.openbmc.Watchdog ---- */
17624
17625static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
17626{
17627 {
17628 -1,
17629 (gchar *) "start",
17630 NULL,
17631 NULL,
17632 NULL
17633 },
17634 "handle-start",
17635 FALSE
17636};
17637
17638static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
17639{
17640 {
17641 -1,
17642 (gchar *) "poke",
17643 NULL,
17644 NULL,
17645 NULL
17646 },
17647 "handle-poke",
17648 FALSE
17649};
17650
17651static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
17652{
17653 {
17654 -1,
17655 (gchar *) "stop",
17656 NULL,
17657 NULL,
17658 NULL
17659 },
17660 "handle-stop",
17661 FALSE
17662};
17663
17664static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
17665{
17666 &_watchdog_method_info_start,
17667 &_watchdog_method_info_poke,
17668 &_watchdog_method_info_stop,
17669 NULL
17670};
17671
17672static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
17673{
17674 {
17675 -1,
17676 (gchar *) "WatchdogError",
17677 NULL,
17678 NULL
17679 },
17680 "watchdog-error"
17681};
17682
17683static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
17684{
17685 &_watchdog_signal_info_watchdog_error,
17686 NULL
17687};
17688
17689static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
17690{
17691 {
17692 -1,
17693 (gchar *) "watchdog",
17694 (gchar *) "i",
17695 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17696 NULL
17697 },
17698 "watchdog",
17699 FALSE
17700};
17701
17702static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
17703{
17704 {
17705 -1,
17706 (gchar *) "poll_interval",
17707 (gchar *) "i",
17708 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17709 NULL
17710 },
17711 "poll-interval",
17712 FALSE
17713};
17714
17715static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
17716{
17717 &_watchdog_property_info_watchdog,
17718 &_watchdog_property_info_poll_interval,
17719 NULL
17720};
17721
17722static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
17723{
17724 {
17725 -1,
17726 (gchar *) "org.openbmc.Watchdog",
17727 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
17728 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
17729 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
17730 NULL
17731 },
17732 "watchdog",
17733};
17734
17735
17736/**
17737 * watchdog_interface_info:
17738 *
17739 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
17740 *
17741 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17742 */
17743GDBusInterfaceInfo *
17744watchdog_interface_info (void)
17745{
17746 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
17747}
17748
17749/**
17750 * watchdog_override_properties:
17751 * @klass: The class structure for a #GObject<!-- -->-derived class.
17752 * @property_id_begin: The property id to assign to the first overridden property.
17753 *
17754 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
17755 * The properties are overridden in the order they are defined.
17756 *
17757 * Returns: The last property id.
17758 */
17759guint
17760watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
17761{
17762 g_object_class_override_property (klass, property_id_begin++, "watchdog");
17763 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
17764 return property_id_begin - 1;
17765}
17766
17767
17768
17769/**
17770 * Watchdog:
17771 *
17772 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17773 */
17774
17775/**
17776 * WatchdogIface:
17777 * @parent_iface: The parent interface.
17778 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
17779 * @handle_start: Handler for the #Watchdog::handle-start signal.
17780 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
17781 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
17782 * @get_watchdog: Getter for the #Watchdog:watchdog property.
17783 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
17784 *
17785 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17786 */
17787
17788typedef WatchdogIface WatchdogInterface;
17789G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
17790
17791static void
17792watchdog_default_init (WatchdogIface *iface)
17793{
17794 /* GObject signals for incoming D-Bus method calls: */
17795 /**
17796 * Watchdog::handle-start:
17797 * @object: A #Watchdog.
17798 * @invocation: A #GDBusMethodInvocation.
17799 *
17800 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
17801 *
17802 * 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.
17803 *
17804 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17805 */
17806 g_signal_new ("handle-start",
17807 G_TYPE_FROM_INTERFACE (iface),
17808 G_SIGNAL_RUN_LAST,
17809 G_STRUCT_OFFSET (WatchdogIface, handle_start),
17810 g_signal_accumulator_true_handled,
17811 NULL,
17812 g_cclosure_marshal_generic,
17813 G_TYPE_BOOLEAN,
17814 1,
17815 G_TYPE_DBUS_METHOD_INVOCATION);
17816
17817 /**
17818 * Watchdog::handle-poke:
17819 * @object: A #Watchdog.
17820 * @invocation: A #GDBusMethodInvocation.
17821 *
17822 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
17823 *
17824 * 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.
17825 *
17826 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17827 */
17828 g_signal_new ("handle-poke",
17829 G_TYPE_FROM_INTERFACE (iface),
17830 G_SIGNAL_RUN_LAST,
17831 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
17832 g_signal_accumulator_true_handled,
17833 NULL,
17834 g_cclosure_marshal_generic,
17835 G_TYPE_BOOLEAN,
17836 1,
17837 G_TYPE_DBUS_METHOD_INVOCATION);
17838
17839 /**
17840 * Watchdog::handle-stop:
17841 * @object: A #Watchdog.
17842 * @invocation: A #GDBusMethodInvocation.
17843 *
17844 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
17845 *
17846 * 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.
17847 *
17848 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17849 */
17850 g_signal_new ("handle-stop",
17851 G_TYPE_FROM_INTERFACE (iface),
17852 G_SIGNAL_RUN_LAST,
17853 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
17854 g_signal_accumulator_true_handled,
17855 NULL,
17856 g_cclosure_marshal_generic,
17857 G_TYPE_BOOLEAN,
17858 1,
17859 G_TYPE_DBUS_METHOD_INVOCATION);
17860
17861 /* GObject signals for received D-Bus signals: */
17862 /**
17863 * Watchdog::watchdog-error:
17864 * @object: A #Watchdog.
17865 *
17866 * 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.
17867 *
17868 * 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.
17869 */
17870 g_signal_new ("watchdog-error",
17871 G_TYPE_FROM_INTERFACE (iface),
17872 G_SIGNAL_RUN_LAST,
17873 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
17874 NULL,
17875 NULL,
17876 g_cclosure_marshal_generic,
17877 G_TYPE_NONE,
17878 0);
17879
17880 /* GObject properties for D-Bus properties: */
17881 /**
17882 * Watchdog:watchdog:
17883 *
17884 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
17885 *
17886 * 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.
17887 */
17888 g_object_interface_install_property (iface,
17889 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17890 /**
17891 * Watchdog:poll-interval:
17892 *
17893 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
17894 *
17895 * 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.
17896 */
17897 g_object_interface_install_property (iface,
17898 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17899}
17900
17901/**
17902 * watchdog_get_watchdog: (skip)
17903 * @object: A #Watchdog.
17904 *
17905 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
17906 *
17907 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17908 *
17909 * Returns: The property value.
17910 */
17911gint
17912watchdog_get_watchdog (Watchdog *object)
17913{
17914 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
17915}
17916
17917/**
17918 * watchdog_set_watchdog: (skip)
17919 * @object: A #Watchdog.
17920 * @value: The value to set.
17921 *
17922 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
17923 *
17924 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17925 */
17926void
17927watchdog_set_watchdog (Watchdog *object, gint value)
17928{
17929 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
17930}
17931
17932/**
17933 * watchdog_get_poll_interval: (skip)
17934 * @object: A #Watchdog.
17935 *
17936 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
17937 *
17938 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17939 *
17940 * Returns: The property value.
17941 */
17942gint
17943watchdog_get_poll_interval (Watchdog *object)
17944{
17945 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
17946}
17947
17948/**
17949 * watchdog_set_poll_interval: (skip)
17950 * @object: A #Watchdog.
17951 * @value: The value to set.
17952 *
17953 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
17954 *
17955 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17956 */
17957void
17958watchdog_set_poll_interval (Watchdog *object, gint value)
17959{
17960 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
17961}
17962
17963/**
17964 * watchdog_emit_watchdog_error:
17965 * @object: A #Watchdog.
17966 *
17967 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
17968 */
17969void
17970watchdog_emit_watchdog_error (
17971 Watchdog *object)
17972{
17973 g_signal_emit_by_name (object, "watchdog-error");
17974}
17975
17976/**
17977 * watchdog_call_start:
17978 * @proxy: A #WatchdogProxy.
17979 * @cancellable: (allow-none): A #GCancellable or %NULL.
17980 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17981 * @user_data: User data to pass to @callback.
17982 *
17983 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
17984 * 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.
17985 * You can then call watchdog_call_start_finish() to get the result of the operation.
17986 *
17987 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
17988 */
17989void
17990watchdog_call_start (
17991 Watchdog *proxy,
17992 GCancellable *cancellable,
17993 GAsyncReadyCallback callback,
17994 gpointer user_data)
17995{
17996 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17997 "start",
17998 g_variant_new ("()"),
17999 G_DBUS_CALL_FLAGS_NONE,
18000 -1,
18001 cancellable,
18002 callback,
18003 user_data);
18004}
18005
18006/**
18007 * watchdog_call_start_finish:
18008 * @proxy: A #WatchdogProxy.
18009 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
18010 * @error: Return location for error or %NULL.
18011 *
18012 * Finishes an operation started with watchdog_call_start().
18013 *
18014 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18015 */
18016gboolean
18017watchdog_call_start_finish (
18018 Watchdog *proxy,
18019 GAsyncResult *res,
18020 GError **error)
18021{
18022 GVariant *_ret;
18023 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18024 if (_ret == NULL)
18025 goto _out;
18026 g_variant_get (_ret,
18027 "()");
18028 g_variant_unref (_ret);
18029_out:
18030 return _ret != NULL;
18031}
18032
18033/**
18034 * watchdog_call_start_sync:
18035 * @proxy: A #WatchdogProxy.
18036 * @cancellable: (allow-none): A #GCancellable or %NULL.
18037 * @error: Return location for error or %NULL.
18038 *
18039 * 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.
18040 *
18041 * See watchdog_call_start() for the asynchronous version of this method.
18042 *
18043 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18044 */
18045gboolean
18046watchdog_call_start_sync (
18047 Watchdog *proxy,
18048 GCancellable *cancellable,
18049 GError **error)
18050{
18051 GVariant *_ret;
18052 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18053 "start",
18054 g_variant_new ("()"),
18055 G_DBUS_CALL_FLAGS_NONE,
18056 -1,
18057 cancellable,
18058 error);
18059 if (_ret == NULL)
18060 goto _out;
18061 g_variant_get (_ret,
18062 "()");
18063 g_variant_unref (_ret);
18064_out:
18065 return _ret != NULL;
18066}
18067
18068/**
18069 * watchdog_call_poke:
18070 * @proxy: A #WatchdogProxy.
18071 * @cancellable: (allow-none): A #GCancellable or %NULL.
18072 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18073 * @user_data: User data to pass to @callback.
18074 *
18075 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
18076 * 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.
18077 * You can then call watchdog_call_poke_finish() to get the result of the operation.
18078 *
18079 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
18080 */
18081void
18082watchdog_call_poke (
18083 Watchdog *proxy,
18084 GCancellable *cancellable,
18085 GAsyncReadyCallback callback,
18086 gpointer user_data)
18087{
18088 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18089 "poke",
18090 g_variant_new ("()"),
18091 G_DBUS_CALL_FLAGS_NONE,
18092 -1,
18093 cancellable,
18094 callback,
18095 user_data);
18096}
18097
18098/**
18099 * watchdog_call_poke_finish:
18100 * @proxy: A #WatchdogProxy.
18101 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
18102 * @error: Return location for error or %NULL.
18103 *
18104 * Finishes an operation started with watchdog_call_poke().
18105 *
18106 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18107 */
18108gboolean
18109watchdog_call_poke_finish (
18110 Watchdog *proxy,
18111 GAsyncResult *res,
18112 GError **error)
18113{
18114 GVariant *_ret;
18115 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18116 if (_ret == NULL)
18117 goto _out;
18118 g_variant_get (_ret,
18119 "()");
18120 g_variant_unref (_ret);
18121_out:
18122 return _ret != NULL;
18123}
18124
18125/**
18126 * watchdog_call_poke_sync:
18127 * @proxy: A #WatchdogProxy.
18128 * @cancellable: (allow-none): A #GCancellable or %NULL.
18129 * @error: Return location for error or %NULL.
18130 *
18131 * 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.
18132 *
18133 * See watchdog_call_poke() for the asynchronous version of this method.
18134 *
18135 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18136 */
18137gboolean
18138watchdog_call_poke_sync (
18139 Watchdog *proxy,
18140 GCancellable *cancellable,
18141 GError **error)
18142{
18143 GVariant *_ret;
18144 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18145 "poke",
18146 g_variant_new ("()"),
18147 G_DBUS_CALL_FLAGS_NONE,
18148 -1,
18149 cancellable,
18150 error);
18151 if (_ret == NULL)
18152 goto _out;
18153 g_variant_get (_ret,
18154 "()");
18155 g_variant_unref (_ret);
18156_out:
18157 return _ret != NULL;
18158}
18159
18160/**
18161 * watchdog_call_stop:
18162 * @proxy: A #WatchdogProxy.
18163 * @cancellable: (allow-none): A #GCancellable or %NULL.
18164 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18165 * @user_data: User data to pass to @callback.
18166 *
18167 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
18168 * 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.
18169 * You can then call watchdog_call_stop_finish() to get the result of the operation.
18170 *
18171 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
18172 */
18173void
18174watchdog_call_stop (
18175 Watchdog *proxy,
18176 GCancellable *cancellable,
18177 GAsyncReadyCallback callback,
18178 gpointer user_data)
18179{
18180 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18181 "stop",
18182 g_variant_new ("()"),
18183 G_DBUS_CALL_FLAGS_NONE,
18184 -1,
18185 cancellable,
18186 callback,
18187 user_data);
18188}
18189
18190/**
18191 * watchdog_call_stop_finish:
18192 * @proxy: A #WatchdogProxy.
18193 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
18194 * @error: Return location for error or %NULL.
18195 *
18196 * Finishes an operation started with watchdog_call_stop().
18197 *
18198 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18199 */
18200gboolean
18201watchdog_call_stop_finish (
18202 Watchdog *proxy,
18203 GAsyncResult *res,
18204 GError **error)
18205{
18206 GVariant *_ret;
18207 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18208 if (_ret == NULL)
18209 goto _out;
18210 g_variant_get (_ret,
18211 "()");
18212 g_variant_unref (_ret);
18213_out:
18214 return _ret != NULL;
18215}
18216
18217/**
18218 * watchdog_call_stop_sync:
18219 * @proxy: A #WatchdogProxy.
18220 * @cancellable: (allow-none): A #GCancellable or %NULL.
18221 * @error: Return location for error or %NULL.
18222 *
18223 * 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.
18224 *
18225 * See watchdog_call_stop() for the asynchronous version of this method.
18226 *
18227 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18228 */
18229gboolean
18230watchdog_call_stop_sync (
18231 Watchdog *proxy,
18232 GCancellable *cancellable,
18233 GError **error)
18234{
18235 GVariant *_ret;
18236 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18237 "stop",
18238 g_variant_new ("()"),
18239 G_DBUS_CALL_FLAGS_NONE,
18240 -1,
18241 cancellable,
18242 error);
18243 if (_ret == NULL)
18244 goto _out;
18245 g_variant_get (_ret,
18246 "()");
18247 g_variant_unref (_ret);
18248_out:
18249 return _ret != NULL;
18250}
18251
18252/**
18253 * watchdog_complete_start:
18254 * @object: A #Watchdog.
18255 * @invocation: (transfer full): A #GDBusMethodInvocation.
18256 *
18257 * 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.
18258 *
18259 * This method will free @invocation, you cannot use it afterwards.
18260 */
18261void
18262watchdog_complete_start (
18263 Watchdog *object,
18264 GDBusMethodInvocation *invocation)
18265{
18266 g_dbus_method_invocation_return_value (invocation,
18267 g_variant_new ("()"));
18268}
18269
18270/**
18271 * watchdog_complete_poke:
18272 * @object: A #Watchdog.
18273 * @invocation: (transfer full): A #GDBusMethodInvocation.
18274 *
18275 * 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.
18276 *
18277 * This method will free @invocation, you cannot use it afterwards.
18278 */
18279void
18280watchdog_complete_poke (
18281 Watchdog *object,
18282 GDBusMethodInvocation *invocation)
18283{
18284 g_dbus_method_invocation_return_value (invocation,
18285 g_variant_new ("()"));
18286}
18287
18288/**
18289 * watchdog_complete_stop:
18290 * @object: A #Watchdog.
18291 * @invocation: (transfer full): A #GDBusMethodInvocation.
18292 *
18293 * 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.
18294 *
18295 * This method will free @invocation, you cannot use it afterwards.
18296 */
18297void
18298watchdog_complete_stop (
18299 Watchdog *object,
18300 GDBusMethodInvocation *invocation)
18301{
18302 g_dbus_method_invocation_return_value (invocation,
18303 g_variant_new ("()"));
18304}
18305
18306/* ------------------------------------------------------------------------ */
18307
18308/**
18309 * WatchdogProxy:
18310 *
18311 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
18312 */
18313
18314/**
18315 * WatchdogProxyClass:
18316 * @parent_class: The parent class.
18317 *
18318 * Class structure for #WatchdogProxy.
18319 */
18320
18321struct _WatchdogProxyPrivate
18322{
18323 GData *qdata;
18324};
18325
18326static void watchdog_proxy_iface_init (WatchdogIface *iface);
18327
18328#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18329G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
18330 G_ADD_PRIVATE (WatchdogProxy)
18331 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
18332
18333#else
18334G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
18335 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
18336
18337#endif
18338static void
18339watchdog_proxy_finalize (GObject *object)
18340{
18341 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18342 g_datalist_clear (&proxy->priv->qdata);
18343 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
18344}
18345
18346static void
18347watchdog_proxy_get_property (GObject *object,
18348 guint prop_id,
18349 GValue *value,
18350 GParamSpec *pspec G_GNUC_UNUSED)
18351{
18352 const _ExtendedGDBusPropertyInfo *info;
18353 GVariant *variant;
18354 g_assert (prop_id != 0 && prop_id - 1 < 2);
18355 info = _watchdog_property_info_pointers[prop_id - 1];
18356 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
18357 if (info->use_gvariant)
18358 {
18359 g_value_set_variant (value, variant);
18360 }
18361 else
18362 {
18363 if (variant != NULL)
18364 g_dbus_gvariant_to_gvalue (variant, value);
18365 }
18366 if (variant != NULL)
18367 g_variant_unref (variant);
18368}
18369
18370static void
18371watchdog_proxy_set_property_cb (GDBusProxy *proxy,
18372 GAsyncResult *res,
18373 gpointer user_data)
18374{
18375 const _ExtendedGDBusPropertyInfo *info = user_data;
18376 GError *error;
18377 GVariant *_ret;
18378 error = NULL;
18379 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
18380 if (!_ret)
18381 {
18382 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
18383 info->parent_struct.name,
18384 error->message, g_quark_to_string (error->domain), error->code);
18385 g_error_free (error);
18386 }
18387 else
18388 {
18389 g_variant_unref (_ret);
18390 }
18391}
18392
18393static void
18394watchdog_proxy_set_property (GObject *object,
18395 guint prop_id,
18396 const GValue *value,
18397 GParamSpec *pspec G_GNUC_UNUSED)
18398{
18399 const _ExtendedGDBusPropertyInfo *info;
18400 GVariant *variant;
18401 g_assert (prop_id != 0 && prop_id - 1 < 2);
18402 info = _watchdog_property_info_pointers[prop_id - 1];
18403 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
18404 g_dbus_proxy_call (G_DBUS_PROXY (object),
18405 "org.freedesktop.DBus.Properties.Set",
18406 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
18407 G_DBUS_CALL_FLAGS_NONE,
18408 -1,
18409 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
18410 g_variant_unref (variant);
18411}
18412
18413static void
18414watchdog_proxy_g_signal (GDBusProxy *proxy,
18415 const gchar *sender_name G_GNUC_UNUSED,
18416 const gchar *signal_name,
18417 GVariant *parameters)
18418{
18419 _ExtendedGDBusSignalInfo *info;
18420 GVariantIter iter;
18421 GVariant *child;
18422 GValue *paramv;
18423 guint num_params;
18424 guint n;
18425 guint signal_id;
18426 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
18427 if (info == NULL)
18428 return;
18429 num_params = g_variant_n_children (parameters);
18430 paramv = g_new0 (GValue, num_params + 1);
18431 g_value_init (&paramv[0], TYPE_WATCHDOG);
18432 g_value_set_object (&paramv[0], proxy);
18433 g_variant_iter_init (&iter, parameters);
18434 n = 1;
18435 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18436 {
18437 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18438 if (arg_info->use_gvariant)
18439 {
18440 g_value_init (&paramv[n], G_TYPE_VARIANT);
18441 g_value_set_variant (&paramv[n], child);
18442 n++;
18443 }
18444 else
18445 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18446 g_variant_unref (child);
18447 }
18448 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
18449 g_signal_emitv (paramv, signal_id, 0, NULL);
18450 for (n = 0; n < num_params + 1; n++)
18451 g_value_unset (&paramv[n]);
18452 g_free (paramv);
18453}
18454
18455static void
18456watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
18457 GVariant *changed_properties,
18458 const gchar *const *invalidated_properties)
18459{
18460 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
18461 guint n;
18462 const gchar *key;
18463 GVariantIter *iter;
18464 _ExtendedGDBusPropertyInfo *info;
18465 g_variant_get (changed_properties, "a{sv}", &iter);
18466 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18467 {
18468 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
18469 g_datalist_remove_data (&proxy->priv->qdata, key);
18470 if (info != NULL)
18471 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18472 }
18473 g_variant_iter_free (iter);
18474 for (n = 0; invalidated_properties[n] != NULL; n++)
18475 {
18476 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
18477 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18478 if (info != NULL)
18479 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18480 }
18481}
18482
18483static gint
18484watchdog_proxy_get_watchdog (Watchdog *object)
18485{
18486 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18487 GVariant *variant;
18488 gint value = 0;
18489 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
18490 if (variant != NULL)
18491 {
18492 value = g_variant_get_int32 (variant);
18493 g_variant_unref (variant);
18494 }
18495 return value;
18496}
18497
18498static gint
18499watchdog_proxy_get_poll_interval (Watchdog *object)
18500{
18501 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18502 GVariant *variant;
18503 gint value = 0;
18504 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
18505 if (variant != NULL)
18506 {
18507 value = g_variant_get_int32 (variant);
18508 g_variant_unref (variant);
18509 }
18510 return value;
18511}
18512
18513static void
18514watchdog_proxy_init (WatchdogProxy *proxy)
18515{
18516#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18517 proxy->priv = watchdog_proxy_get_instance_private (proxy);
18518#else
18519 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
18520#endif
18521
18522 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
18523}
18524
18525static void
18526watchdog_proxy_class_init (WatchdogProxyClass *klass)
18527{
18528 GObjectClass *gobject_class;
18529 GDBusProxyClass *proxy_class;
18530
18531 gobject_class = G_OBJECT_CLASS (klass);
18532 gobject_class->finalize = watchdog_proxy_finalize;
18533 gobject_class->get_property = watchdog_proxy_get_property;
18534 gobject_class->set_property = watchdog_proxy_set_property;
18535
18536 proxy_class = G_DBUS_PROXY_CLASS (klass);
18537 proxy_class->g_signal = watchdog_proxy_g_signal;
18538 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
18539
18540 watchdog_override_properties (gobject_class, 1);
18541
18542#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18543 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
18544#endif
18545}
18546
18547static void
18548watchdog_proxy_iface_init (WatchdogIface *iface)
18549{
18550 iface->get_watchdog = watchdog_proxy_get_watchdog;
18551 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
18552}
18553
18554/**
18555 * watchdog_proxy_new:
18556 * @connection: A #GDBusConnection.
18557 * @flags: Flags from the #GDBusProxyFlags enumeration.
18558 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18559 * @object_path: An object path.
18560 * @cancellable: (allow-none): A #GCancellable or %NULL.
18561 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18562 * @user_data: User data to pass to @callback.
18563 *
18564 * 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.
18565 *
18566 * 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.
18567 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
18568 *
18569 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
18570 */
18571void
18572watchdog_proxy_new (
18573 GDBusConnection *connection,
18574 GDBusProxyFlags flags,
18575 const gchar *name,
18576 const gchar *object_path,
18577 GCancellable *cancellable,
18578 GAsyncReadyCallback callback,
18579 gpointer user_data)
18580{
18581 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);
18582}
18583
18584/**
18585 * watchdog_proxy_new_finish:
18586 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
18587 * @error: Return location for error or %NULL
18588 *
18589 * Finishes an operation started with watchdog_proxy_new().
18590 *
18591 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18592 */
18593Watchdog *
18594watchdog_proxy_new_finish (
18595 GAsyncResult *res,
18596 GError **error)
18597{
18598 GObject *ret;
18599 GObject *source_object;
18600 source_object = g_async_result_get_source_object (res);
18601 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18602 g_object_unref (source_object);
18603 if (ret != NULL)
18604 return WATCHDOG (ret);
18605 else
18606 return NULL;
18607}
18608
18609/**
18610 * watchdog_proxy_new_sync:
18611 * @connection: A #GDBusConnection.
18612 * @flags: Flags from the #GDBusProxyFlags enumeration.
18613 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18614 * @object_path: An object path.
18615 * @cancellable: (allow-none): A #GCancellable or %NULL.
18616 * @error: Return location for error or %NULL
18617 *
18618 * 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.
18619 *
18620 * The calling thread is blocked until a reply is received.
18621 *
18622 * See watchdog_proxy_new() for the asynchronous version of this constructor.
18623 *
18624 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18625 */
18626Watchdog *
18627watchdog_proxy_new_sync (
18628 GDBusConnection *connection,
18629 GDBusProxyFlags flags,
18630 const gchar *name,
18631 const gchar *object_path,
18632 GCancellable *cancellable,
18633 GError **error)
18634{
18635 GInitable *ret;
18636 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);
18637 if (ret != NULL)
18638 return WATCHDOG (ret);
18639 else
18640 return NULL;
18641}
18642
18643
18644/**
18645 * watchdog_proxy_new_for_bus:
18646 * @bus_type: A #GBusType.
18647 * @flags: Flags from the #GDBusProxyFlags enumeration.
18648 * @name: A bus name (well-known or unique).
18649 * @object_path: An object path.
18650 * @cancellable: (allow-none): A #GCancellable or %NULL.
18651 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18652 * @user_data: User data to pass to @callback.
18653 *
18654 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18655 *
18656 * 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.
18657 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
18658 *
18659 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18660 */
18661void
18662watchdog_proxy_new_for_bus (
18663 GBusType bus_type,
18664 GDBusProxyFlags flags,
18665 const gchar *name,
18666 const gchar *object_path,
18667 GCancellable *cancellable,
18668 GAsyncReadyCallback callback,
18669 gpointer user_data)
18670{
18671 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);
18672}
18673
18674/**
18675 * watchdog_proxy_new_for_bus_finish:
18676 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
18677 * @error: Return location for error or %NULL
18678 *
18679 * Finishes an operation started with watchdog_proxy_new_for_bus().
18680 *
18681 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18682 */
18683Watchdog *
18684watchdog_proxy_new_for_bus_finish (
18685 GAsyncResult *res,
18686 GError **error)
18687{
18688 GObject *ret;
18689 GObject *source_object;
18690 source_object = g_async_result_get_source_object (res);
18691 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18692 g_object_unref (source_object);
18693 if (ret != NULL)
18694 return WATCHDOG (ret);
18695 else
18696 return NULL;
18697}
18698
18699/**
18700 * watchdog_proxy_new_for_bus_sync:
18701 * @bus_type: A #GBusType.
18702 * @flags: Flags from the #GDBusProxyFlags enumeration.
18703 * @name: A bus name (well-known or unique).
18704 * @object_path: An object path.
18705 * @cancellable: (allow-none): A #GCancellable or %NULL.
18706 * @error: Return location for error or %NULL
18707 *
18708 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18709 *
18710 * The calling thread is blocked until a reply is received.
18711 *
18712 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
18713 *
18714 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18715 */
18716Watchdog *
18717watchdog_proxy_new_for_bus_sync (
18718 GBusType bus_type,
18719 GDBusProxyFlags flags,
18720 const gchar *name,
18721 const gchar *object_path,
18722 GCancellable *cancellable,
18723 GError **error)
18724{
18725 GInitable *ret;
18726 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);
18727 if (ret != NULL)
18728 return WATCHDOG (ret);
18729 else
18730 return NULL;
18731}
18732
18733
18734/* ------------------------------------------------------------------------ */
18735
18736/**
18737 * WatchdogSkeleton:
18738 *
18739 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
18740 */
18741
18742/**
18743 * WatchdogSkeletonClass:
18744 * @parent_class: The parent class.
18745 *
18746 * Class structure for #WatchdogSkeleton.
18747 */
18748
18749struct _WatchdogSkeletonPrivate
18750{
18751 GValue *properties;
18752 GList *changed_properties;
18753 GSource *changed_properties_idle_source;
18754 GMainContext *context;
18755 GMutex lock;
18756};
18757
18758static void
18759_watchdog_skeleton_handle_method_call (
18760 GDBusConnection *connection G_GNUC_UNUSED,
18761 const gchar *sender G_GNUC_UNUSED,
18762 const gchar *object_path G_GNUC_UNUSED,
18763 const gchar *interface_name,
18764 const gchar *method_name,
18765 GVariant *parameters,
18766 GDBusMethodInvocation *invocation,
18767 gpointer user_data)
18768{
18769 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
18770 _ExtendedGDBusMethodInfo *info;
18771 GVariantIter iter;
18772 GVariant *child;
18773 GValue *paramv;
18774 guint num_params;
18775 guint num_extra;
18776 guint n;
18777 guint signal_id;
18778 GValue return_value = G_VALUE_INIT;
18779 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18780 g_assert (info != NULL);
18781 num_params = g_variant_n_children (parameters);
18782 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18783 n = 0;
18784 g_value_init (&paramv[n], TYPE_WATCHDOG);
18785 g_value_set_object (&paramv[n++], skeleton);
18786 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18787 g_value_set_object (&paramv[n++], invocation);
18788 if (info->pass_fdlist)
18789 {
18790#ifdef G_OS_UNIX
18791 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18792 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18793#else
18794 g_assert_not_reached ();
18795#endif
18796 }
18797 g_variant_iter_init (&iter, parameters);
18798 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18799 {
18800 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18801 if (arg_info->use_gvariant)
18802 {
18803 g_value_init (&paramv[n], G_TYPE_VARIANT);
18804 g_value_set_variant (&paramv[n], child);
18805 n++;
18806 }
18807 else
18808 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18809 g_variant_unref (child);
18810 }
18811 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
18812 g_value_init (&return_value, G_TYPE_BOOLEAN);
18813 g_signal_emitv (paramv, signal_id, 0, &return_value);
18814 if (!g_value_get_boolean (&return_value))
18815 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);
18816 g_value_unset (&return_value);
18817 for (n = 0; n < num_params + num_extra; n++)
18818 g_value_unset (&paramv[n]);
18819 g_free (paramv);
18820}
18821
18822static GVariant *
18823_watchdog_skeleton_handle_get_property (
18824 GDBusConnection *connection G_GNUC_UNUSED,
18825 const gchar *sender G_GNUC_UNUSED,
18826 const gchar *object_path G_GNUC_UNUSED,
18827 const gchar *interface_name G_GNUC_UNUSED,
18828 const gchar *property_name,
18829 GError **error,
18830 gpointer user_data)
18831{
18832 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
18833 GValue value = G_VALUE_INIT;
18834 GParamSpec *pspec;
18835 _ExtendedGDBusPropertyInfo *info;
18836 GVariant *ret;
18837 ret = NULL;
18838 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
18839 g_assert (info != NULL);
18840 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18841 if (pspec == NULL)
18842 {
18843 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18844 }
18845 else
18846 {
18847 g_value_init (&value, pspec->value_type);
18848 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18849 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18850 g_value_unset (&value);
18851 }
18852 return ret;
18853}
18854
18855static gboolean
18856_watchdog_skeleton_handle_set_property (
18857 GDBusConnection *connection G_GNUC_UNUSED,
18858 const gchar *sender G_GNUC_UNUSED,
18859 const gchar *object_path G_GNUC_UNUSED,
18860 const gchar *interface_name G_GNUC_UNUSED,
18861 const gchar *property_name,
18862 GVariant *variant,
18863 GError **error,
18864 gpointer user_data)
18865{
18866 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
18867 GValue value = G_VALUE_INIT;
18868 GParamSpec *pspec;
18869 _ExtendedGDBusPropertyInfo *info;
18870 gboolean ret;
18871 ret = FALSE;
18872 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
18873 g_assert (info != NULL);
18874 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18875 if (pspec == NULL)
18876 {
18877 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18878 }
18879 else
18880 {
18881 if (info->use_gvariant)
18882 g_value_set_variant (&value, variant);
18883 else
18884 g_dbus_gvariant_to_gvalue (variant, &value);
18885 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18886 g_value_unset (&value);
18887 ret = TRUE;
18888 }
18889 return ret;
18890}
18891
18892static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
18893{
18894 _watchdog_skeleton_handle_method_call,
18895 _watchdog_skeleton_handle_get_property,
18896 _watchdog_skeleton_handle_set_property,
18897 {NULL}
18898};
18899
18900static GDBusInterfaceInfo *
18901watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18902{
18903 return watchdog_interface_info ();
18904}
18905
18906static GDBusInterfaceVTable *
18907watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18908{
18909 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
18910}
18911
18912static GVariant *
18913watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18914{
18915 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
18916
18917 GVariantBuilder builder;
18918 guint n;
18919 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18920 if (_watchdog_interface_info.parent_struct.properties == NULL)
18921 goto out;
18922 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
18923 {
18924 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
18925 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18926 {
18927 GVariant *value;
18928 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);
18929 if (value != NULL)
18930 {
18931 g_variant_take_ref (value);
18932 g_variant_builder_add (&builder, "{sv}", info->name, value);
18933 g_variant_unref (value);
18934 }
18935 }
18936 }
18937out:
18938 return g_variant_builder_end (&builder);
18939}
18940
18941static gboolean _watchdog_emit_changed (gpointer user_data);
18942
18943static void
18944watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18945{
18946 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
18947 gboolean emit_changed = FALSE;
18948
18949 g_mutex_lock (&skeleton->priv->lock);
18950 if (skeleton->priv->changed_properties_idle_source != NULL)
18951 {
18952 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18953 skeleton->priv->changed_properties_idle_source = NULL;
18954 emit_changed = TRUE;
18955 }
18956 g_mutex_unlock (&skeleton->priv->lock);
18957
18958 if (emit_changed)
18959 _watchdog_emit_changed (skeleton);
18960}
18961
18962static void
18963_watchdog_on_signal_watchdog_error (
18964 Watchdog *object)
18965{
18966 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18967
18968 GList *connections, *l;
18969 GVariant *signal_variant;
18970 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18971
18972 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18973 for (l = connections; l != NULL; l = l->next)
18974 {
18975 GDBusConnection *connection = l->data;
18976 g_dbus_connection_emit_signal (connection,
18977 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
18978 signal_variant, NULL);
18979 }
18980 g_variant_unref (signal_variant);
18981 g_list_free_full (connections, g_object_unref);
18982}
18983
18984static void watchdog_skeleton_iface_init (WatchdogIface *iface);
18985#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18986G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18987 G_ADD_PRIVATE (WatchdogSkeleton)
18988 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
18989
18990#else
18991G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18992 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
18993
18994#endif
18995static void
18996watchdog_skeleton_finalize (GObject *object)
18997{
18998 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
18999 guint n;
19000 for (n = 0; n < 2; n++)
19001 g_value_unset (&skeleton->priv->properties[n]);
19002 g_free (skeleton->priv->properties);
19003 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19004 if (skeleton->priv->changed_properties_idle_source != NULL)
19005 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19006 g_main_context_unref (skeleton->priv->context);
19007 g_mutex_clear (&skeleton->priv->lock);
19008 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
19009}
19010
19011static void
19012watchdog_skeleton_get_property (GObject *object,
19013 guint prop_id,
19014 GValue *value,
19015 GParamSpec *pspec G_GNUC_UNUSED)
19016{
19017 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19018 g_assert (prop_id != 0 && prop_id - 1 < 2);
19019 g_mutex_lock (&skeleton->priv->lock);
19020 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
19021 g_mutex_unlock (&skeleton->priv->lock);
19022}
19023
19024static gboolean
19025_watchdog_emit_changed (gpointer user_data)
19026{
19027 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19028 GList *l;
19029 GVariantBuilder builder;
19030 GVariantBuilder invalidated_builder;
19031 guint num_changes;
19032
19033 g_mutex_lock (&skeleton->priv->lock);
19034 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19035 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
19036 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
19037 {
19038 ChangedProperty *cp = l->data;
19039 GVariant *variant;
19040 const GValue *cur_value;
19041
19042 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
19043 if (!_g_value_equal (cur_value, &cp->orig_value))
19044 {
19045 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
19046 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
19047 g_variant_unref (variant);
19048 num_changes++;
19049 }
19050 }
19051 if (num_changes > 0)
19052 {
19053 GList *connections, *ll;
19054 GVariant *signal_variant;
19055 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
19056 &builder, &invalidated_builder));
19057 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19058 for (ll = connections; ll != NULL; ll = ll->next)
19059 {
19060 GDBusConnection *connection = ll->data;
19061
19062 g_dbus_connection_emit_signal (connection,
19063 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
19064 "org.freedesktop.DBus.Properties",
19065 "PropertiesChanged",
19066 signal_variant,
19067 NULL);
19068 }
19069 g_variant_unref (signal_variant);
19070 g_list_free_full (connections, g_object_unref);
19071 }
19072 else
19073 {
19074 g_variant_builder_clear (&builder);
19075 g_variant_builder_clear (&invalidated_builder);
19076 }
19077 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19078 skeleton->priv->changed_properties = NULL;
19079 skeleton->priv->changed_properties_idle_source = NULL;
19080 g_mutex_unlock (&skeleton->priv->lock);
19081 return FALSE;
19082}
19083
19084static void
19085_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
19086{
19087 ChangedProperty *cp;
19088 GList *l;
19089 cp = NULL;
19090 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
19091 {
19092 ChangedProperty *i_cp = l->data;
19093 if (i_cp->info == info)
19094 {
19095 cp = i_cp;
19096 break;
19097 }
19098 }
19099 if (cp == NULL)
19100 {
19101 cp = g_new0 (ChangedProperty, 1);
19102 cp->prop_id = prop_id;
19103 cp->info = info;
19104 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
19105 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
19106 g_value_copy (orig_value, &cp->orig_value);
19107 }
19108}
19109
19110static void
19111watchdog_skeleton_notify (GObject *object,
19112 GParamSpec *pspec G_GNUC_UNUSED)
19113{
19114 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19115 g_mutex_lock (&skeleton->priv->lock);
19116 if (skeleton->priv->changed_properties != NULL &&
19117 skeleton->priv->changed_properties_idle_source == NULL)
19118 {
19119 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
19120 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
19121 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
19122 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
19123 g_source_unref (skeleton->priv->changed_properties_idle_source);
19124 }
19125 g_mutex_unlock (&skeleton->priv->lock);
19126}
19127
19128static void
19129watchdog_skeleton_set_property (GObject *object,
19130 guint prop_id,
19131 const GValue *value,
19132 GParamSpec *pspec)
19133{
19134 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19135 g_assert (prop_id != 0 && prop_id - 1 < 2);
19136 g_mutex_lock (&skeleton->priv->lock);
19137 g_object_freeze_notify (object);
19138 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
19139 {
19140 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
19141 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
19142 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
19143 g_object_notify_by_pspec (object, pspec);
19144 }
19145 g_mutex_unlock (&skeleton->priv->lock);
19146 g_object_thaw_notify (object);
19147}
19148
19149static void
19150watchdog_skeleton_init (WatchdogSkeleton *skeleton)
19151{
19152#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19153 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
19154#else
19155 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
19156#endif
19157
19158 g_mutex_init (&skeleton->priv->lock);
19159 skeleton->priv->context = g_main_context_ref_thread_default ();
19160 skeleton->priv->properties = g_new0 (GValue, 2);
19161 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
19162 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
19163}
19164
19165static gint
19166watchdog_skeleton_get_watchdog (Watchdog *object)
19167{
19168 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19169 gint value;
19170 g_mutex_lock (&skeleton->priv->lock);
19171 value = g_value_get_int (&(skeleton->priv->properties[0]));
19172 g_mutex_unlock (&skeleton->priv->lock);
19173 return value;
19174}
19175
19176static gint
19177watchdog_skeleton_get_poll_interval (Watchdog *object)
19178{
19179 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19180 gint value;
19181 g_mutex_lock (&skeleton->priv->lock);
19182 value = g_value_get_int (&(skeleton->priv->properties[1]));
19183 g_mutex_unlock (&skeleton->priv->lock);
19184 return value;
19185}
19186
19187static void
19188watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
19189{
19190 GObjectClass *gobject_class;
19191 GDBusInterfaceSkeletonClass *skeleton_class;
19192
19193 gobject_class = G_OBJECT_CLASS (klass);
19194 gobject_class->finalize = watchdog_skeleton_finalize;
19195 gobject_class->get_property = watchdog_skeleton_get_property;
19196 gobject_class->set_property = watchdog_skeleton_set_property;
19197 gobject_class->notify = watchdog_skeleton_notify;
19198
19199
19200 watchdog_override_properties (gobject_class, 1);
19201
19202 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
19203 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
19204 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
19205 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
19206 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
19207
19208#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19209 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
19210#endif
19211}
19212
19213static void
19214watchdog_skeleton_iface_init (WatchdogIface *iface)
19215{
19216 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
19217 iface->get_watchdog = watchdog_skeleton_get_watchdog;
19218 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
19219}
19220
19221/**
19222 * watchdog_skeleton_new:
19223 *
19224 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
19225 *
19226 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
19227 */
19228Watchdog *
19229watchdog_skeleton_new (void)
19230{
19231 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
19232}
19233
19234/* ------------------------------------------------------------------------
19235 * Code for interface org.openbmc.EventLog
19236 * ------------------------------------------------------------------------
19237 */
19238
19239/**
19240 * SECTION:EventLog
19241 * @title: EventLog
19242 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
19243 *
19244 * 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.
19245 */
19246
19247/* ---- Introspection data for org.openbmc.EventLog ---- */
19248
Norman James2d1ee892015-09-16 23:13:45 -050019249static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
19250{
19251 {
19252 -1,
19253 (gchar *) "log",
19254 (gchar *) "a(s)",
19255 NULL
19256 },
19257 FALSE
19258};
19259
19260static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
19261{
19262 &_event_log_method_info_get_event_log_OUT_ARG_log,
19263 NULL
19264};
19265
19266static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
19267{
19268 {
19269 -1,
19270 (gchar *) "getEventLog",
19271 NULL,
19272 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
19273 NULL
19274 },
19275 "handle-get-event-log",
19276 FALSE
19277};
19278
19279static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
19280{
19281 &_event_log_method_info_get_event_log,
19282 NULL
19283};
19284
Norman James8abb50c2015-09-16 10:58:16 -050019285static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050019286{
19287 {
19288 -1,
Norman James8abb50c2015-09-16 10:58:16 -050019289 (gchar *) "priority",
19290 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050019291 NULL
19292 },
19293 FALSE
19294};
19295
Norman James362a80f2015-09-14 14:04:39 -050019296static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
19297{
19298 {
19299 -1,
19300 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050019301 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050019302 NULL
19303 },
19304 FALSE
19305};
19306
Norman James88872672015-09-21 16:51:35 -050019307static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
19308{
19309 {
19310 -1,
19311 (gchar *) "rc",
19312 (gchar *) "i",
19313 NULL
19314 },
19315 FALSE
19316};
19317
Norman James362a80f2015-09-14 14:04:39 -050019318static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
19319{
Norman James8abb50c2015-09-16 10:58:16 -050019320 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050019321 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050019322 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050019323 NULL
19324};
19325
19326static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
19327{
19328 {
19329 -1,
19330 (gchar *) "EventLog",
19331 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
19332 NULL
19333 },
19334 "event-log"
19335};
19336
19337static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
19338{
19339 &_event_log_signal_info_event_log,
19340 NULL
19341};
19342
Norman James362a80f2015-09-14 14:04:39 -050019343static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
19344{
19345 {
19346 -1,
19347 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050019348 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050019349 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050019350 NULL,
Norman James362a80f2015-09-14 14:04:39 -050019351 NULL
19352 },
19353 "event-log",
19354};
19355
19356
19357/**
19358 * event_log_interface_info:
19359 *
19360 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
19361 *
19362 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19363 */
19364GDBusInterfaceInfo *
19365event_log_interface_info (void)
19366{
19367 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
19368}
19369
19370/**
19371 * event_log_override_properties:
19372 * @klass: The class structure for a #GObject<!-- -->-derived class.
19373 * @property_id_begin: The property id to assign to the first overridden property.
19374 *
19375 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
19376 * The properties are overridden in the order they are defined.
19377 *
19378 * Returns: The last property id.
19379 */
19380guint
19381event_log_override_properties (GObjectClass *klass, guint property_id_begin)
19382{
Norman James362a80f2015-09-14 14:04:39 -050019383 return property_id_begin - 1;
19384}
19385
19386
19387
19388/**
19389 * EventLog:
19390 *
19391 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
19392 */
19393
19394/**
19395 * EventLogIface:
19396 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050019397 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050019398 * @event_log: Handler for the #EventLog::event-log signal.
19399 *
19400 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
19401 */
19402
19403typedef EventLogIface EventLogInterface;
19404G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
19405
19406static void
19407event_log_default_init (EventLogIface *iface)
19408{
Norman James2d1ee892015-09-16 23:13:45 -050019409 /* GObject signals for incoming D-Bus method calls: */
19410 /**
19411 * EventLog::handle-get-event-log:
19412 * @object: A #EventLog.
19413 * @invocation: A #GDBusMethodInvocation.
19414 *
19415 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
19416 *
19417 * 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.
19418 *
19419 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19420 */
19421 g_signal_new ("handle-get-event-log",
19422 G_TYPE_FROM_INTERFACE (iface),
19423 G_SIGNAL_RUN_LAST,
19424 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
19425 g_signal_accumulator_true_handled,
19426 NULL,
19427 g_cclosure_marshal_generic,
19428 G_TYPE_BOOLEAN,
19429 1,
19430 G_TYPE_DBUS_METHOD_INVOCATION);
19431
Norman James362a80f2015-09-14 14:04:39 -050019432 /* GObject signals for received D-Bus signals: */
19433 /**
19434 * EventLog::event-log:
19435 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050019436 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050019437 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050019438 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050019439 *
19440 * 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.
19441 *
19442 * 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.
19443 */
19444 g_signal_new ("event-log",
19445 G_TYPE_FROM_INTERFACE (iface),
19446 G_SIGNAL_RUN_LAST,
19447 G_STRUCT_OFFSET (EventLogIface, event_log),
19448 NULL,
19449 NULL,
19450 g_cclosure_marshal_generic,
19451 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050019452 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050019453
Norman James362a80f2015-09-14 14:04:39 -050019454}
19455
19456/**
19457 * event_log_emit_event_log:
19458 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050019459 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050019460 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050019461 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050019462 *
19463 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
19464 */
19465void
19466event_log_emit_event_log (
19467 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050019468 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050019469 const gchar *arg_message,
19470 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050019471{
Norman James88872672015-09-21 16:51:35 -050019472 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050019473}
19474
Norman James2d1ee892015-09-16 23:13:45 -050019475/**
19476 * event_log_call_get_event_log:
19477 * @proxy: A #EventLogProxy.
19478 * @cancellable: (allow-none): A #GCancellable or %NULL.
19479 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19480 * @user_data: User data to pass to @callback.
19481 *
19482 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
19483 * 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.
19484 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
19485 *
19486 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
19487 */
19488void
19489event_log_call_get_event_log (
19490 EventLog *proxy,
19491 GCancellable *cancellable,
19492 GAsyncReadyCallback callback,
19493 gpointer user_data)
19494{
19495 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19496 "getEventLog",
19497 g_variant_new ("()"),
19498 G_DBUS_CALL_FLAGS_NONE,
19499 -1,
19500 cancellable,
19501 callback,
19502 user_data);
19503}
19504
19505/**
19506 * event_log_call_get_event_log_finish:
19507 * @proxy: A #EventLogProxy.
19508 * @out_log: (out): Return location for return parameter or %NULL to ignore.
19509 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
19510 * @error: Return location for error or %NULL.
19511 *
19512 * Finishes an operation started with event_log_call_get_event_log().
19513 *
19514 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19515 */
19516gboolean
19517event_log_call_get_event_log_finish (
19518 EventLog *proxy,
19519 GVariant **out_log,
19520 GAsyncResult *res,
19521 GError **error)
19522{
19523 GVariant *_ret;
19524 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19525 if (_ret == NULL)
19526 goto _out;
19527 g_variant_get (_ret,
19528 "(@a(s))",
19529 out_log);
19530 g_variant_unref (_ret);
19531_out:
19532 return _ret != NULL;
19533}
19534
19535/**
19536 * event_log_call_get_event_log_sync:
19537 * @proxy: A #EventLogProxy.
19538 * @out_log: (out): Return location for return parameter or %NULL to ignore.
19539 * @cancellable: (allow-none): A #GCancellable or %NULL.
19540 * @error: Return location for error or %NULL.
19541 *
19542 * 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.
19543 *
19544 * See event_log_call_get_event_log() for the asynchronous version of this method.
19545 *
19546 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19547 */
19548gboolean
19549event_log_call_get_event_log_sync (
19550 EventLog *proxy,
19551 GVariant **out_log,
19552 GCancellable *cancellable,
19553 GError **error)
19554{
19555 GVariant *_ret;
19556 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19557 "getEventLog",
19558 g_variant_new ("()"),
19559 G_DBUS_CALL_FLAGS_NONE,
19560 -1,
19561 cancellable,
19562 error);
19563 if (_ret == NULL)
19564 goto _out;
19565 g_variant_get (_ret,
19566 "(@a(s))",
19567 out_log);
19568 g_variant_unref (_ret);
19569_out:
19570 return _ret != NULL;
19571}
19572
19573/**
19574 * event_log_complete_get_event_log:
19575 * @object: A #EventLog.
19576 * @invocation: (transfer full): A #GDBusMethodInvocation.
19577 * @log: Parameter to return.
19578 *
19579 * 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.
19580 *
19581 * This method will free @invocation, you cannot use it afterwards.
19582 */
19583void
19584event_log_complete_get_event_log (
19585 EventLog *object,
19586 GDBusMethodInvocation *invocation,
19587 GVariant *log)
19588{
19589 g_dbus_method_invocation_return_value (invocation,
19590 g_variant_new ("(@a(s))",
19591 log));
19592}
19593
Norman James362a80f2015-09-14 14:04:39 -050019594/* ------------------------------------------------------------------------ */
19595
19596/**
19597 * EventLogProxy:
19598 *
19599 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
19600 */
19601
19602/**
19603 * EventLogProxyClass:
19604 * @parent_class: The parent class.
19605 *
19606 * Class structure for #EventLogProxy.
19607 */
19608
19609struct _EventLogProxyPrivate
19610{
19611 GData *qdata;
19612};
19613
19614static void event_log_proxy_iface_init (EventLogIface *iface);
19615
19616#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19617G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
19618 G_ADD_PRIVATE (EventLogProxy)
19619 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
19620
19621#else
19622G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
19623 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
19624
19625#endif
19626static void
19627event_log_proxy_finalize (GObject *object)
19628{
19629 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
19630 g_datalist_clear (&proxy->priv->qdata);
19631 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
19632}
19633
19634static void
19635event_log_proxy_get_property (GObject *object,
19636 guint prop_id,
19637 GValue *value,
19638 GParamSpec *pspec G_GNUC_UNUSED)
19639{
Norman James362a80f2015-09-14 14:04:39 -050019640}
19641
19642static void
19643event_log_proxy_set_property (GObject *object,
19644 guint prop_id,
19645 const GValue *value,
19646 GParamSpec *pspec G_GNUC_UNUSED)
19647{
Norman James362a80f2015-09-14 14:04:39 -050019648}
19649
19650static void
19651event_log_proxy_g_signal (GDBusProxy *proxy,
19652 const gchar *sender_name G_GNUC_UNUSED,
19653 const gchar *signal_name,
19654 GVariant *parameters)
19655{
19656 _ExtendedGDBusSignalInfo *info;
19657 GVariantIter iter;
19658 GVariant *child;
19659 GValue *paramv;
19660 guint num_params;
19661 guint n;
19662 guint signal_id;
19663 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
19664 if (info == NULL)
19665 return;
19666 num_params = g_variant_n_children (parameters);
19667 paramv = g_new0 (GValue, num_params + 1);
19668 g_value_init (&paramv[0], TYPE_EVENT_LOG);
19669 g_value_set_object (&paramv[0], proxy);
19670 g_variant_iter_init (&iter, parameters);
19671 n = 1;
19672 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19673 {
19674 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19675 if (arg_info->use_gvariant)
19676 {
19677 g_value_init (&paramv[n], G_TYPE_VARIANT);
19678 g_value_set_variant (&paramv[n], child);
19679 n++;
19680 }
19681 else
19682 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19683 g_variant_unref (child);
19684 }
19685 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
19686 g_signal_emitv (paramv, signal_id, 0, NULL);
19687 for (n = 0; n < num_params + 1; n++)
19688 g_value_unset (&paramv[n]);
19689 g_free (paramv);
19690}
19691
19692static void
19693event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
19694 GVariant *changed_properties,
19695 const gchar *const *invalidated_properties)
19696{
19697 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
19698 guint n;
19699 const gchar *key;
19700 GVariantIter *iter;
19701 _ExtendedGDBusPropertyInfo *info;
19702 g_variant_get (changed_properties, "a{sv}", &iter);
19703 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19704 {
19705 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
19706 g_datalist_remove_data (&proxy->priv->qdata, key);
19707 if (info != NULL)
19708 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19709 }
19710 g_variant_iter_free (iter);
19711 for (n = 0; invalidated_properties[n] != NULL; n++)
19712 {
19713 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
19714 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19715 if (info != NULL)
19716 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19717 }
19718}
19719
Norman James362a80f2015-09-14 14:04:39 -050019720static void
19721event_log_proxy_init (EventLogProxy *proxy)
19722{
19723#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19724 proxy->priv = event_log_proxy_get_instance_private (proxy);
19725#else
19726 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
19727#endif
19728
19729 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
19730}
19731
19732static void
19733event_log_proxy_class_init (EventLogProxyClass *klass)
19734{
19735 GObjectClass *gobject_class;
19736 GDBusProxyClass *proxy_class;
19737
19738 gobject_class = G_OBJECT_CLASS (klass);
19739 gobject_class->finalize = event_log_proxy_finalize;
19740 gobject_class->get_property = event_log_proxy_get_property;
19741 gobject_class->set_property = event_log_proxy_set_property;
19742
19743 proxy_class = G_DBUS_PROXY_CLASS (klass);
19744 proxy_class->g_signal = event_log_proxy_g_signal;
19745 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
19746
Norman James362a80f2015-09-14 14:04:39 -050019747#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19748 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
19749#endif
19750}
19751
19752static void
19753event_log_proxy_iface_init (EventLogIface *iface)
19754{
Norman James362a80f2015-09-14 14:04:39 -050019755}
19756
19757/**
19758 * event_log_proxy_new:
19759 * @connection: A #GDBusConnection.
19760 * @flags: Flags from the #GDBusProxyFlags enumeration.
19761 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19762 * @object_path: An object path.
19763 * @cancellable: (allow-none): A #GCancellable or %NULL.
19764 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19765 * @user_data: User data to pass to @callback.
19766 *
19767 * 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.
19768 *
19769 * 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.
19770 * You can then call event_log_proxy_new_finish() to get the result of the operation.
19771 *
19772 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
19773 */
19774void
19775event_log_proxy_new (
19776 GDBusConnection *connection,
19777 GDBusProxyFlags flags,
19778 const gchar *name,
19779 const gchar *object_path,
19780 GCancellable *cancellable,
19781 GAsyncReadyCallback callback,
19782 gpointer user_data)
19783{
19784 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);
19785}
19786
19787/**
19788 * event_log_proxy_new_finish:
19789 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
19790 * @error: Return location for error or %NULL
19791 *
19792 * Finishes an operation started with event_log_proxy_new().
19793 *
19794 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19795 */
19796EventLog *
19797event_log_proxy_new_finish (
19798 GAsyncResult *res,
19799 GError **error)
19800{
19801 GObject *ret;
19802 GObject *source_object;
19803 source_object = g_async_result_get_source_object (res);
19804 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19805 g_object_unref (source_object);
19806 if (ret != NULL)
19807 return EVENT_LOG (ret);
19808 else
19809 return NULL;
19810}
19811
19812/**
19813 * event_log_proxy_new_sync:
19814 * @connection: A #GDBusConnection.
19815 * @flags: Flags from the #GDBusProxyFlags enumeration.
19816 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19817 * @object_path: An object path.
19818 * @cancellable: (allow-none): A #GCancellable or %NULL.
19819 * @error: Return location for error or %NULL
19820 *
19821 * 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.
19822 *
19823 * The calling thread is blocked until a reply is received.
19824 *
19825 * See event_log_proxy_new() for the asynchronous version of this constructor.
19826 *
19827 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19828 */
19829EventLog *
19830event_log_proxy_new_sync (
19831 GDBusConnection *connection,
19832 GDBusProxyFlags flags,
19833 const gchar *name,
19834 const gchar *object_path,
19835 GCancellable *cancellable,
19836 GError **error)
19837{
19838 GInitable *ret;
19839 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);
19840 if (ret != NULL)
19841 return EVENT_LOG (ret);
19842 else
19843 return NULL;
19844}
19845
19846
19847/**
19848 * event_log_proxy_new_for_bus:
19849 * @bus_type: A #GBusType.
19850 * @flags: Flags from the #GDBusProxyFlags enumeration.
19851 * @name: A bus name (well-known or unique).
19852 * @object_path: An object path.
19853 * @cancellable: (allow-none): A #GCancellable or %NULL.
19854 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19855 * @user_data: User data to pass to @callback.
19856 *
19857 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19858 *
19859 * 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.
19860 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
19861 *
19862 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19863 */
19864void
19865event_log_proxy_new_for_bus (
19866 GBusType bus_type,
19867 GDBusProxyFlags flags,
19868 const gchar *name,
19869 const gchar *object_path,
19870 GCancellable *cancellable,
19871 GAsyncReadyCallback callback,
19872 gpointer user_data)
19873{
19874 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);
19875}
19876
19877/**
19878 * event_log_proxy_new_for_bus_finish:
19879 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
19880 * @error: Return location for error or %NULL
19881 *
19882 * Finishes an operation started with event_log_proxy_new_for_bus().
19883 *
19884 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19885 */
19886EventLog *
19887event_log_proxy_new_for_bus_finish (
19888 GAsyncResult *res,
19889 GError **error)
19890{
19891 GObject *ret;
19892 GObject *source_object;
19893 source_object = g_async_result_get_source_object (res);
19894 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19895 g_object_unref (source_object);
19896 if (ret != NULL)
19897 return EVENT_LOG (ret);
19898 else
19899 return NULL;
19900}
19901
19902/**
19903 * event_log_proxy_new_for_bus_sync:
19904 * @bus_type: A #GBusType.
19905 * @flags: Flags from the #GDBusProxyFlags enumeration.
19906 * @name: A bus name (well-known or unique).
19907 * @object_path: An object path.
19908 * @cancellable: (allow-none): A #GCancellable or %NULL.
19909 * @error: Return location for error or %NULL
19910 *
19911 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19912 *
19913 * The calling thread is blocked until a reply is received.
19914 *
19915 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
19916 *
19917 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19918 */
19919EventLog *
19920event_log_proxy_new_for_bus_sync (
19921 GBusType bus_type,
19922 GDBusProxyFlags flags,
19923 const gchar *name,
19924 const gchar *object_path,
19925 GCancellable *cancellable,
19926 GError **error)
19927{
19928 GInitable *ret;
19929 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);
19930 if (ret != NULL)
19931 return EVENT_LOG (ret);
19932 else
19933 return NULL;
19934}
19935
19936
19937/* ------------------------------------------------------------------------ */
19938
19939/**
19940 * EventLogSkeleton:
19941 *
19942 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
19943 */
19944
19945/**
19946 * EventLogSkeletonClass:
19947 * @parent_class: The parent class.
19948 *
19949 * Class structure for #EventLogSkeleton.
19950 */
19951
19952struct _EventLogSkeletonPrivate
19953{
19954 GValue *properties;
19955 GList *changed_properties;
19956 GSource *changed_properties_idle_source;
19957 GMainContext *context;
19958 GMutex lock;
19959};
19960
19961static void
19962_event_log_skeleton_handle_method_call (
19963 GDBusConnection *connection G_GNUC_UNUSED,
19964 const gchar *sender G_GNUC_UNUSED,
19965 const gchar *object_path G_GNUC_UNUSED,
19966 const gchar *interface_name,
19967 const gchar *method_name,
19968 GVariant *parameters,
19969 GDBusMethodInvocation *invocation,
19970 gpointer user_data)
19971{
19972 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
19973 _ExtendedGDBusMethodInfo *info;
19974 GVariantIter iter;
19975 GVariant *child;
19976 GValue *paramv;
19977 guint num_params;
19978 guint num_extra;
19979 guint n;
19980 guint signal_id;
19981 GValue return_value = G_VALUE_INIT;
19982 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19983 g_assert (info != NULL);
19984 num_params = g_variant_n_children (parameters);
19985 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19986 n = 0;
19987 g_value_init (&paramv[n], TYPE_EVENT_LOG);
19988 g_value_set_object (&paramv[n++], skeleton);
19989 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19990 g_value_set_object (&paramv[n++], invocation);
19991 if (info->pass_fdlist)
19992 {
19993#ifdef G_OS_UNIX
19994 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19995 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19996#else
19997 g_assert_not_reached ();
19998#endif
19999 }
20000 g_variant_iter_init (&iter, parameters);
20001 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20002 {
20003 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
20004 if (arg_info->use_gvariant)
20005 {
20006 g_value_init (&paramv[n], G_TYPE_VARIANT);
20007 g_value_set_variant (&paramv[n], child);
20008 n++;
20009 }
20010 else
20011 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20012 g_variant_unref (child);
20013 }
20014 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
20015 g_value_init (&return_value, G_TYPE_BOOLEAN);
20016 g_signal_emitv (paramv, signal_id, 0, &return_value);
20017 if (!g_value_get_boolean (&return_value))
20018 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);
20019 g_value_unset (&return_value);
20020 for (n = 0; n < num_params + num_extra; n++)
20021 g_value_unset (&paramv[n]);
20022 g_free (paramv);
20023}
20024
20025static GVariant *
20026_event_log_skeleton_handle_get_property (
20027 GDBusConnection *connection G_GNUC_UNUSED,
20028 const gchar *sender G_GNUC_UNUSED,
20029 const gchar *object_path G_GNUC_UNUSED,
20030 const gchar *interface_name G_GNUC_UNUSED,
20031 const gchar *property_name,
20032 GError **error,
20033 gpointer user_data)
20034{
20035 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
20036 GValue value = G_VALUE_INIT;
20037 GParamSpec *pspec;
20038 _ExtendedGDBusPropertyInfo *info;
20039 GVariant *ret;
20040 ret = NULL;
20041 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
20042 g_assert (info != NULL);
20043 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20044 if (pspec == NULL)
20045 {
20046 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20047 }
20048 else
20049 {
20050 g_value_init (&value, pspec->value_type);
20051 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20052 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20053 g_value_unset (&value);
20054 }
20055 return ret;
20056}
20057
20058static gboolean
20059_event_log_skeleton_handle_set_property (
20060 GDBusConnection *connection G_GNUC_UNUSED,
20061 const gchar *sender G_GNUC_UNUSED,
20062 const gchar *object_path G_GNUC_UNUSED,
20063 const gchar *interface_name G_GNUC_UNUSED,
20064 const gchar *property_name,
20065 GVariant *variant,
20066 GError **error,
20067 gpointer user_data)
20068{
20069 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
20070 GValue value = G_VALUE_INIT;
20071 GParamSpec *pspec;
20072 _ExtendedGDBusPropertyInfo *info;
20073 gboolean ret;
20074 ret = FALSE;
20075 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
20076 g_assert (info != NULL);
20077 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20078 if (pspec == NULL)
20079 {
20080 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20081 }
20082 else
20083 {
20084 if (info->use_gvariant)
20085 g_value_set_variant (&value, variant);
20086 else
20087 g_dbus_gvariant_to_gvalue (variant, &value);
20088 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20089 g_value_unset (&value);
20090 ret = TRUE;
20091 }
20092 return ret;
20093}
20094
20095static const GDBusInterfaceVTable _event_log_skeleton_vtable =
20096{
20097 _event_log_skeleton_handle_method_call,
20098 _event_log_skeleton_handle_get_property,
20099 _event_log_skeleton_handle_set_property,
20100 {NULL}
20101};
20102
20103static GDBusInterfaceInfo *
20104event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20105{
20106 return event_log_interface_info ();
20107}
20108
20109static GDBusInterfaceVTable *
20110event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20111{
20112 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
20113}
20114
20115static GVariant *
20116event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20117{
20118 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
20119
20120 GVariantBuilder builder;
20121 guint n;
20122 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20123 if (_event_log_interface_info.parent_struct.properties == NULL)
20124 goto out;
20125 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
20126 {
20127 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
20128 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20129 {
20130 GVariant *value;
20131 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);
20132 if (value != NULL)
20133 {
20134 g_variant_take_ref (value);
20135 g_variant_builder_add (&builder, "{sv}", info->name, value);
20136 g_variant_unref (value);
20137 }
20138 }
20139 }
20140out:
20141 return g_variant_builder_end (&builder);
20142}
20143
Norman James362a80f2015-09-14 14:04:39 -050020144static void
20145event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20146{
Norman James362a80f2015-09-14 14:04:39 -050020147}
20148
20149static void
20150_event_log_on_signal_event_log (
20151 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050020152 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050020153 const gchar *arg_message,
20154 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050020155{
20156 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
20157
20158 GList *connections, *l;
20159 GVariant *signal_variant;
20160 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20161
Norman James88872672015-09-21 16:51:35 -050020162 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050020163 arg_priority,
Norman James88872672015-09-21 16:51:35 -050020164 arg_message,
20165 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050020166 for (l = connections; l != NULL; l = l->next)
20167 {
20168 GDBusConnection *connection = l->data;
20169 g_dbus_connection_emit_signal (connection,
20170 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
20171 signal_variant, NULL);
20172 }
20173 g_variant_unref (signal_variant);
20174 g_list_free_full (connections, g_object_unref);
20175}
20176
20177static void event_log_skeleton_iface_init (EventLogIface *iface);
20178#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20179G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20180 G_ADD_PRIVATE (EventLogSkeleton)
20181 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
20182
20183#else
20184G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20185 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
20186
20187#endif
20188static void
20189event_log_skeleton_finalize (GObject *object)
20190{
20191 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050020192 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20193 if (skeleton->priv->changed_properties_idle_source != NULL)
20194 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20195 g_main_context_unref (skeleton->priv->context);
20196 g_mutex_clear (&skeleton->priv->lock);
20197 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
20198}
20199
20200static void
Norman James362a80f2015-09-14 14:04:39 -050020201event_log_skeleton_init (EventLogSkeleton *skeleton)
20202{
20203#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20204 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
20205#else
20206 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
20207#endif
20208
20209 g_mutex_init (&skeleton->priv->lock);
20210 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050020211}
20212
20213static void
20214event_log_skeleton_class_init (EventLogSkeletonClass *klass)
20215{
20216 GObjectClass *gobject_class;
20217 GDBusInterfaceSkeletonClass *skeleton_class;
20218
20219 gobject_class = G_OBJECT_CLASS (klass);
20220 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050020221
20222 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20223 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
20224 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
20225 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
20226 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
20227
20228#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20229 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
20230#endif
20231}
20232
20233static void
20234event_log_skeleton_iface_init (EventLogIface *iface)
20235{
20236 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050020237}
20238
20239/**
20240 * event_log_skeleton_new:
20241 *
20242 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20243 *
20244 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
20245 */
20246EventLog *
20247event_log_skeleton_new (void)
20248{
20249 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
20250}
20251
20252/* ------------------------------------------------------------------------
20253 * Code for interface org.openbmc.Flash
20254 * ------------------------------------------------------------------------
20255 */
20256
20257/**
20258 * SECTION:Flash
20259 * @title: Flash
20260 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
20261 *
20262 * 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.
20263 */
20264
20265/* ---- Introspection data for org.openbmc.Flash ---- */
20266
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020267static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050020268{
20269 {
20270 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020271 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050020272 (gchar *) "s",
20273 NULL
20274 },
20275 FALSE
20276};
20277
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020278static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050020279{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020280 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050020281 NULL
20282};
20283
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020284static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050020285{
20286 {
20287 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020288 (gchar *) "update",
20289 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020290 NULL,
20291 NULL
20292 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020293 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050020294 FALSE
20295};
20296
Norman Jamesf066e872015-10-07 15:29:51 -050020297static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
20298{
20299 {
20300 -1,
20301 (gchar *) "url",
20302 (gchar *) "s",
20303 NULL
20304 },
20305 FALSE
20306};
20307
20308static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
20309{
20310 {
20311 -1,
20312 (gchar *) "filename",
20313 (gchar *) "s",
20314 NULL
20315 },
20316 FALSE
20317};
20318
20319static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
20320{
20321 &_flash_method_info_update_via_tftp_IN_ARG_url,
20322 &_flash_method_info_update_via_tftp_IN_ARG_filename,
20323 NULL
20324};
20325
20326static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
20327{
20328 {
20329 -1,
20330 (gchar *) "updateViaTftp",
20331 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
20332 NULL,
20333 NULL
20334 },
20335 "handle-update-via-tftp",
20336 FALSE
20337};
20338
Norman James362a80f2015-09-14 14:04:39 -050020339static const _ExtendedGDBusMethodInfo _flash_method_info_init =
20340{
20341 {
20342 -1,
20343 (gchar *) "init",
20344 NULL,
20345 NULL,
20346 NULL
20347 },
20348 "handle-init",
20349 FALSE
20350};
20351
20352static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
20353{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020354 &_flash_method_info_update,
Norman Jamesf066e872015-10-07 15:29:51 -050020355 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050020356 &_flash_method_info_init,
20357 NULL
20358};
20359
20360static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
20361{
20362 {
20363 -1,
20364 (gchar *) "Updated",
20365 NULL,
20366 NULL
20367 },
20368 "updated"
20369};
20370
Norman Jamesf066e872015-10-07 15:29:51 -050020371static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
20372{
20373 {
20374 -1,
20375 (gchar *) "url",
20376 (gchar *) "s",
20377 NULL
20378 },
20379 FALSE
20380};
20381
20382static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
20383{
20384 {
20385 -1,
20386 (gchar *) "filename",
20387 (gchar *) "s",
20388 NULL
20389 },
20390 FALSE
20391};
20392
20393static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
20394{
20395 &_flash_signal_info_download_ARG_url,
20396 &_flash_signal_info_download_ARG_filename,
20397 NULL
20398};
20399
20400static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
20401{
20402 {
20403 -1,
20404 (gchar *) "Download",
20405 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
20406 NULL
20407 },
20408 "download"
20409};
20410
Norman James362a80f2015-09-14 14:04:39 -050020411static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
20412{
20413 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050020414 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050020415 NULL
20416};
20417
Norman James18998182015-10-11 21:54:53 -050020418static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
20419{
20420 {
20421 -1,
20422 (gchar *) "filename",
20423 (gchar *) "s",
20424 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20425 NULL
20426 },
20427 "filename",
20428 FALSE
20429};
20430
20431static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
20432{
20433 {
20434 -1,
20435 (gchar *) "flasher_path",
20436 (gchar *) "s",
20437 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20438 NULL
20439 },
20440 "flasher-path",
20441 FALSE
20442};
20443
20444static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
20445{
20446 {
20447 -1,
20448 (gchar *) "flasher_name",
20449 (gchar *) "s",
20450 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20451 NULL
20452 },
20453 "flasher-name",
20454 FALSE
20455};
20456
20457static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
20458{
20459 {
20460 -1,
20461 (gchar *) "flasher_instance",
20462 (gchar *) "s",
20463 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20464 NULL
20465 },
20466 "flasher-instance",
20467 FALSE
20468};
20469
20470static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
20471{
20472 &_flash_property_info_filename,
20473 &_flash_property_info_flasher_path,
20474 &_flash_property_info_flasher_name,
20475 &_flash_property_info_flasher_instance,
20476 NULL
20477};
20478
Norman James362a80f2015-09-14 14:04:39 -050020479static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
20480{
20481 {
20482 -1,
20483 (gchar *) "org.openbmc.Flash",
20484 (GDBusMethodInfo **) &_flash_method_info_pointers,
20485 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050020486 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020487 NULL
20488 },
20489 "flash",
20490};
20491
20492
20493/**
20494 * flash_interface_info:
20495 *
20496 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
20497 *
20498 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20499 */
20500GDBusInterfaceInfo *
20501flash_interface_info (void)
20502{
20503 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
20504}
20505
20506/**
20507 * flash_override_properties:
20508 * @klass: The class structure for a #GObject<!-- -->-derived class.
20509 * @property_id_begin: The property id to assign to the first overridden property.
20510 *
20511 * Overrides all #GObject properties in the #Flash interface for a concrete class.
20512 * The properties are overridden in the order they are defined.
20513 *
20514 * Returns: The last property id.
20515 */
20516guint
20517flash_override_properties (GObjectClass *klass, guint property_id_begin)
20518{
Norman James18998182015-10-11 21:54:53 -050020519 g_object_class_override_property (klass, property_id_begin++, "filename");
20520 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
20521 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
20522 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James362a80f2015-09-14 14:04:39 -050020523 return property_id_begin - 1;
20524}
20525
20526
20527
20528/**
20529 * Flash:
20530 *
20531 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20532 */
20533
20534/**
20535 * FlashIface:
20536 * @parent_iface: The parent interface.
Norman James362a80f2015-09-14 14:04:39 -050020537 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020538 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050020539 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050020540 * @get_filename: Getter for the #Flash:filename property.
20541 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
20542 * @get_flasher_name: Getter for the #Flash:flasher-name property.
20543 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman Jamesf066e872015-10-07 15:29:51 -050020544 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050020545 * @updated: Handler for the #Flash::updated signal.
20546 *
20547 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20548 */
20549
20550typedef FlashIface FlashInterface;
20551G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
20552
20553static void
20554flash_default_init (FlashIface *iface)
20555{
20556 /* GObject signals for incoming D-Bus method calls: */
20557 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020558 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050020559 * @object: A #Flash.
20560 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020561 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050020562 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020563 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method.
Norman James362a80f2015-09-14 14:04:39 -050020564 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020565 * 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() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
Norman James362a80f2015-09-14 14:04:39 -050020566 *
20567 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20568 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020569 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050020570 G_TYPE_FROM_INTERFACE (iface),
20571 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020572 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050020573 g_signal_accumulator_true_handled,
20574 NULL,
20575 g_cclosure_marshal_generic,
20576 G_TYPE_BOOLEAN,
20577 2,
20578 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
20579
20580 /**
Norman Jamesf066e872015-10-07 15:29:51 -050020581 * Flash::handle-update-via-tftp:
20582 * @object: A #Flash.
20583 * @invocation: A #GDBusMethodInvocation.
20584 * @arg_url: Argument passed by remote caller.
20585 * @arg_filename: Argument passed by remote caller.
20586 *
20587 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
20588 *
20589 * 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_tftp() 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.
20590 *
20591 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20592 */
20593 g_signal_new ("handle-update-via-tftp",
20594 G_TYPE_FROM_INTERFACE (iface),
20595 G_SIGNAL_RUN_LAST,
20596 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
20597 g_signal_accumulator_true_handled,
20598 NULL,
20599 g_cclosure_marshal_generic,
20600 G_TYPE_BOOLEAN,
20601 3,
20602 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
20603
20604 /**
Norman James362a80f2015-09-14 14:04:39 -050020605 * Flash::handle-init:
20606 * @object: A #Flash.
20607 * @invocation: A #GDBusMethodInvocation.
20608 *
20609 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
20610 *
20611 * 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.
20612 *
20613 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20614 */
20615 g_signal_new ("handle-init",
20616 G_TYPE_FROM_INTERFACE (iface),
20617 G_SIGNAL_RUN_LAST,
20618 G_STRUCT_OFFSET (FlashIface, handle_init),
20619 g_signal_accumulator_true_handled,
20620 NULL,
20621 g_cclosure_marshal_generic,
20622 G_TYPE_BOOLEAN,
20623 1,
20624 G_TYPE_DBUS_METHOD_INVOCATION);
20625
20626 /* GObject signals for received D-Bus signals: */
20627 /**
20628 * Flash::updated:
20629 * @object: A #Flash.
20630 *
20631 * 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.
20632 *
20633 * 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.
20634 */
20635 g_signal_new ("updated",
20636 G_TYPE_FROM_INTERFACE (iface),
20637 G_SIGNAL_RUN_LAST,
20638 G_STRUCT_OFFSET (FlashIface, updated),
20639 NULL,
20640 NULL,
20641 g_cclosure_marshal_generic,
20642 G_TYPE_NONE,
20643 0);
20644
Norman Jamesf066e872015-10-07 15:29:51 -050020645 /**
20646 * Flash::download:
20647 * @object: A #Flash.
20648 * @arg_url: Argument.
20649 * @arg_filename: Argument.
20650 *
20651 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> is received.
20652 *
20653 * 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.
20654 */
20655 g_signal_new ("download",
20656 G_TYPE_FROM_INTERFACE (iface),
20657 G_SIGNAL_RUN_LAST,
20658 G_STRUCT_OFFSET (FlashIface, download),
20659 NULL,
20660 NULL,
20661 g_cclosure_marshal_generic,
20662 G_TYPE_NONE,
20663 2, G_TYPE_STRING, G_TYPE_STRING);
20664
Norman James18998182015-10-11 21:54:53 -050020665 /* GObject properties for D-Bus properties: */
20666 /**
20667 * Flash:filename:
20668 *
20669 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
20670 *
20671 * 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.
20672 */
20673 g_object_interface_install_property (iface,
20674 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20675 /**
20676 * Flash:flasher-path:
20677 *
20678 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
20679 *
20680 * 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.
20681 */
20682 g_object_interface_install_property (iface,
20683 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20684 /**
20685 * Flash:flasher-name:
20686 *
20687 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
20688 *
20689 * 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.
20690 */
20691 g_object_interface_install_property (iface,
20692 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20693 /**
20694 * Flash:flasher-instance:
20695 *
20696 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
20697 *
20698 * 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.
20699 */
20700 g_object_interface_install_property (iface,
20701 g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20702}
20703
20704/**
20705 * flash_get_filename: (skip)
20706 * @object: A #Flash.
20707 *
20708 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
20709 *
20710 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20711 *
20712 * <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 flash_dup_filename() if on another thread.</warning>
20713 *
20714 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
20715 */
20716const gchar *
20717flash_get_filename (Flash *object)
20718{
20719 return FLASH_GET_IFACE (object)->get_filename (object);
20720}
20721
20722/**
20723 * flash_dup_filename: (skip)
20724 * @object: A #Flash.
20725 *
20726 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
20727 *
20728 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20729 *
20730 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
20731 */
20732gchar *
20733flash_dup_filename (Flash *object)
20734{
20735 gchar *value;
20736 g_object_get (G_OBJECT (object), "filename", &value, NULL);
20737 return value;
20738}
20739
20740/**
20741 * flash_set_filename: (skip)
20742 * @object: A #Flash.
20743 * @value: The value to set.
20744 *
20745 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
20746 *
20747 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20748 */
20749void
20750flash_set_filename (Flash *object, const gchar *value)
20751{
20752 g_object_set (G_OBJECT (object), "filename", value, NULL);
20753}
20754
20755/**
20756 * flash_get_flasher_path: (skip)
20757 * @object: A #Flash.
20758 *
20759 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
20760 *
20761 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20762 *
20763 * <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 flash_dup_flasher_path() if on another thread.</warning>
20764 *
20765 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
20766 */
20767const gchar *
20768flash_get_flasher_path (Flash *object)
20769{
20770 return FLASH_GET_IFACE (object)->get_flasher_path (object);
20771}
20772
20773/**
20774 * flash_dup_flasher_path: (skip)
20775 * @object: A #Flash.
20776 *
20777 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
20778 *
20779 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20780 *
20781 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
20782 */
20783gchar *
20784flash_dup_flasher_path (Flash *object)
20785{
20786 gchar *value;
20787 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
20788 return value;
20789}
20790
20791/**
20792 * flash_set_flasher_path: (skip)
20793 * @object: A #Flash.
20794 * @value: The value to set.
20795 *
20796 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
20797 *
20798 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20799 */
20800void
20801flash_set_flasher_path (Flash *object, const gchar *value)
20802{
20803 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
20804}
20805
20806/**
20807 * flash_get_flasher_name: (skip)
20808 * @object: A #Flash.
20809 *
20810 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
20811 *
20812 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20813 *
20814 * <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 flash_dup_flasher_name() if on another thread.</warning>
20815 *
20816 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
20817 */
20818const gchar *
20819flash_get_flasher_name (Flash *object)
20820{
20821 return FLASH_GET_IFACE (object)->get_flasher_name (object);
20822}
20823
20824/**
20825 * flash_dup_flasher_name: (skip)
20826 * @object: A #Flash.
20827 *
20828 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
20829 *
20830 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20831 *
20832 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
20833 */
20834gchar *
20835flash_dup_flasher_name (Flash *object)
20836{
20837 gchar *value;
20838 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
20839 return value;
20840}
20841
20842/**
20843 * flash_set_flasher_name: (skip)
20844 * @object: A #Flash.
20845 * @value: The value to set.
20846 *
20847 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
20848 *
20849 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20850 */
20851void
20852flash_set_flasher_name (Flash *object, const gchar *value)
20853{
20854 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
20855}
20856
20857/**
20858 * flash_get_flasher_instance: (skip)
20859 * @object: A #Flash.
20860 *
20861 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
20862 *
20863 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20864 *
20865 * <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 flash_dup_flasher_instance() if on another thread.</warning>
20866 *
20867 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
20868 */
20869const gchar *
20870flash_get_flasher_instance (Flash *object)
20871{
20872 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
20873}
20874
20875/**
20876 * flash_dup_flasher_instance: (skip)
20877 * @object: A #Flash.
20878 *
20879 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
20880 *
20881 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20882 *
20883 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
20884 */
20885gchar *
20886flash_dup_flasher_instance (Flash *object)
20887{
20888 gchar *value;
20889 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
20890 return value;
20891}
20892
20893/**
20894 * flash_set_flasher_instance: (skip)
20895 * @object: A #Flash.
20896 * @value: The value to set.
20897 *
20898 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
20899 *
20900 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20901 */
20902void
20903flash_set_flasher_instance (Flash *object, const gchar *value)
20904{
20905 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050020906}
20907
20908/**
20909 * flash_emit_updated:
20910 * @object: A #Flash.
20911 *
20912 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
20913 */
20914void
20915flash_emit_updated (
20916 Flash *object)
20917{
20918 g_signal_emit_by_name (object, "updated");
20919}
20920
20921/**
Norman Jamesf066e872015-10-07 15:29:51 -050020922 * flash_emit_download:
20923 * @object: A #Flash.
20924 * @arg_url: Argument to pass with the signal.
20925 * @arg_filename: Argument to pass with the signal.
20926 *
20927 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
20928 */
20929void
20930flash_emit_download (
20931 Flash *object,
20932 const gchar *arg_url,
20933 const gchar *arg_filename)
20934{
20935 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
20936}
20937
20938/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020939 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050020940 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020941 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050020942 * @cancellable: (allow-none): A #GCancellable or %NULL.
20943 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20944 * @user_data: User data to pass to @callback.
20945 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020946 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy.
Norman James362a80f2015-09-14 14:04:39 -050020947 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020948 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050020949 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020950 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050020951 */
20952void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020953flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050020954 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020955 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050020956 GCancellable *cancellable,
20957 GAsyncReadyCallback callback,
20958 gpointer user_data)
20959{
20960 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020961 "update",
Norman James362a80f2015-09-14 14:04:39 -050020962 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020963 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050020964 G_DBUS_CALL_FLAGS_NONE,
20965 -1,
20966 cancellable,
20967 callback,
20968 user_data);
20969}
20970
20971/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020972 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050020973 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020974 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050020975 * @error: Return location for error or %NULL.
20976 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020977 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050020978 *
20979 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20980 */
20981gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020982flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050020983 Flash *proxy,
20984 GAsyncResult *res,
20985 GError **error)
20986{
20987 GVariant *_ret;
20988 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20989 if (_ret == NULL)
20990 goto _out;
20991 g_variant_get (_ret,
20992 "()");
20993 g_variant_unref (_ret);
20994_out:
20995 return _ret != NULL;
20996}
20997
20998/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020999 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050021000 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021001 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050021002 * @cancellable: (allow-none): A #GCancellable or %NULL.
21003 * @error: Return location for error or %NULL.
21004 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021005 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman James362a80f2015-09-14 14:04:39 -050021006 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021007 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050021008 *
21009 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21010 */
21011gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021012flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050021013 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021014 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050021015 GCancellable *cancellable,
21016 GError **error)
21017{
21018 GVariant *_ret;
21019 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021020 "update",
Norman James362a80f2015-09-14 14:04:39 -050021021 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021022 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050021023 G_DBUS_CALL_FLAGS_NONE,
21024 -1,
21025 cancellable,
21026 error);
21027 if (_ret == NULL)
21028 goto _out;
21029 g_variant_get (_ret,
21030 "()");
21031 g_variant_unref (_ret);
21032_out:
21033 return _ret != NULL;
21034}
21035
21036/**
Norman Jamesf066e872015-10-07 15:29:51 -050021037 * flash_call_update_via_tftp:
21038 * @proxy: A #FlashProxy.
21039 * @arg_url: Argument to pass with the method invocation.
21040 * @arg_filename: Argument to pass with the method invocation.
21041 * @cancellable: (allow-none): A #GCancellable or %NULL.
21042 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21043 * @user_data: User data to pass to @callback.
21044 *
21045 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
21046 * 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.
21047 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
21048 *
21049 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
21050 */
21051void
21052flash_call_update_via_tftp (
21053 Flash *proxy,
21054 const gchar *arg_url,
21055 const gchar *arg_filename,
21056 GCancellable *cancellable,
21057 GAsyncReadyCallback callback,
21058 gpointer user_data)
21059{
21060 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21061 "updateViaTftp",
21062 g_variant_new ("(ss)",
21063 arg_url,
21064 arg_filename),
21065 G_DBUS_CALL_FLAGS_NONE,
21066 -1,
21067 cancellable,
21068 callback,
21069 user_data);
21070}
21071
21072/**
21073 * flash_call_update_via_tftp_finish:
21074 * @proxy: A #FlashProxy.
21075 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
21076 * @error: Return location for error or %NULL.
21077 *
21078 * Finishes an operation started with flash_call_update_via_tftp().
21079 *
21080 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21081 */
21082gboolean
21083flash_call_update_via_tftp_finish (
21084 Flash *proxy,
21085 GAsyncResult *res,
21086 GError **error)
21087{
21088 GVariant *_ret;
21089 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21090 if (_ret == NULL)
21091 goto _out;
21092 g_variant_get (_ret,
21093 "()");
21094 g_variant_unref (_ret);
21095_out:
21096 return _ret != NULL;
21097}
21098
21099/**
21100 * flash_call_update_via_tftp_sync:
21101 * @proxy: A #FlashProxy.
21102 * @arg_url: Argument to pass with the method invocation.
21103 * @arg_filename: Argument to pass with the method invocation.
21104 * @cancellable: (allow-none): A #GCancellable or %NULL.
21105 * @error: Return location for error or %NULL.
21106 *
21107 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
21108 *
21109 * See flash_call_update_via_tftp() for the asynchronous version of this method.
21110 *
21111 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21112 */
21113gboolean
21114flash_call_update_via_tftp_sync (
21115 Flash *proxy,
21116 const gchar *arg_url,
21117 const gchar *arg_filename,
21118 GCancellable *cancellable,
21119 GError **error)
21120{
21121 GVariant *_ret;
21122 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21123 "updateViaTftp",
21124 g_variant_new ("(ss)",
21125 arg_url,
21126 arg_filename),
21127 G_DBUS_CALL_FLAGS_NONE,
21128 -1,
21129 cancellable,
21130 error);
21131 if (_ret == NULL)
21132 goto _out;
21133 g_variant_get (_ret,
21134 "()");
21135 g_variant_unref (_ret);
21136_out:
21137 return _ret != NULL;
21138}
21139
21140/**
Norman James362a80f2015-09-14 14:04:39 -050021141 * flash_call_init:
21142 * @proxy: A #FlashProxy.
21143 * @cancellable: (allow-none): A #GCancellable or %NULL.
21144 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21145 * @user_data: User data to pass to @callback.
21146 *
21147 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
21148 * 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.
21149 * You can then call flash_call_init_finish() to get the result of the operation.
21150 *
21151 * See flash_call_init_sync() for the synchronous, blocking version of this method.
21152 */
21153void
21154flash_call_init (
21155 Flash *proxy,
21156 GCancellable *cancellable,
21157 GAsyncReadyCallback callback,
21158 gpointer user_data)
21159{
21160 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21161 "init",
21162 g_variant_new ("()"),
21163 G_DBUS_CALL_FLAGS_NONE,
21164 -1,
21165 cancellable,
21166 callback,
21167 user_data);
21168}
21169
21170/**
21171 * flash_call_init_finish:
21172 * @proxy: A #FlashProxy.
21173 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
21174 * @error: Return location for error or %NULL.
21175 *
21176 * Finishes an operation started with flash_call_init().
21177 *
21178 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21179 */
21180gboolean
21181flash_call_init_finish (
21182 Flash *proxy,
21183 GAsyncResult *res,
21184 GError **error)
21185{
21186 GVariant *_ret;
21187 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21188 if (_ret == NULL)
21189 goto _out;
21190 g_variant_get (_ret,
21191 "()");
21192 g_variant_unref (_ret);
21193_out:
21194 return _ret != NULL;
21195}
21196
21197/**
21198 * flash_call_init_sync:
21199 * @proxy: A #FlashProxy.
21200 * @cancellable: (allow-none): A #GCancellable or %NULL.
21201 * @error: Return location for error or %NULL.
21202 *
21203 * 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.
21204 *
21205 * See flash_call_init() for the asynchronous version of this method.
21206 *
21207 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21208 */
21209gboolean
21210flash_call_init_sync (
21211 Flash *proxy,
21212 GCancellable *cancellable,
21213 GError **error)
21214{
21215 GVariant *_ret;
21216 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21217 "init",
21218 g_variant_new ("()"),
21219 G_DBUS_CALL_FLAGS_NONE,
21220 -1,
21221 cancellable,
21222 error);
21223 if (_ret == NULL)
21224 goto _out;
21225 g_variant_get (_ret,
21226 "()");
21227 g_variant_unref (_ret);
21228_out:
21229 return _ret != NULL;
21230}
21231
21232/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021233 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050021234 * @object: A #Flash.
21235 * @invocation: (transfer full): A #GDBusMethodInvocation.
21236 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021237 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman James362a80f2015-09-14 14:04:39 -050021238 *
21239 * This method will free @invocation, you cannot use it afterwards.
21240 */
21241void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021242flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050021243 Flash *object,
21244 GDBusMethodInvocation *invocation)
21245{
21246 g_dbus_method_invocation_return_value (invocation,
21247 g_variant_new ("()"));
21248}
21249
21250/**
Norman Jamesf066e872015-10-07 15:29:51 -050021251 * flash_complete_update_via_tftp:
21252 * @object: A #Flash.
21253 * @invocation: (transfer full): A #GDBusMethodInvocation.
21254 *
21255 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</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.
21256 *
21257 * This method will free @invocation, you cannot use it afterwards.
21258 */
21259void
21260flash_complete_update_via_tftp (
21261 Flash *object,
21262 GDBusMethodInvocation *invocation)
21263{
21264 g_dbus_method_invocation_return_value (invocation,
21265 g_variant_new ("()"));
21266}
21267
21268/**
Norman James362a80f2015-09-14 14:04:39 -050021269 * flash_complete_init:
21270 * @object: A #Flash.
21271 * @invocation: (transfer full): A #GDBusMethodInvocation.
21272 *
21273 * 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.
21274 *
21275 * This method will free @invocation, you cannot use it afterwards.
21276 */
21277void
21278flash_complete_init (
21279 Flash *object,
21280 GDBusMethodInvocation *invocation)
21281{
21282 g_dbus_method_invocation_return_value (invocation,
21283 g_variant_new ("()"));
21284}
21285
21286/* ------------------------------------------------------------------------ */
21287
21288/**
21289 * FlashProxy:
21290 *
21291 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
21292 */
21293
21294/**
21295 * FlashProxyClass:
21296 * @parent_class: The parent class.
21297 *
21298 * Class structure for #FlashProxy.
21299 */
21300
21301struct _FlashProxyPrivate
21302{
21303 GData *qdata;
21304};
21305
21306static void flash_proxy_iface_init (FlashIface *iface);
21307
21308#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21309G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
21310 G_ADD_PRIVATE (FlashProxy)
21311 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
21312
21313#else
21314G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
21315 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
21316
21317#endif
21318static void
21319flash_proxy_finalize (GObject *object)
21320{
21321 FlashProxy *proxy = FLASH_PROXY (object);
21322 g_datalist_clear (&proxy->priv->qdata);
21323 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
21324}
21325
21326static void
21327flash_proxy_get_property (GObject *object,
21328 guint prop_id,
21329 GValue *value,
21330 GParamSpec *pspec G_GNUC_UNUSED)
21331{
Norman James18998182015-10-11 21:54:53 -050021332 const _ExtendedGDBusPropertyInfo *info;
21333 GVariant *variant;
21334 g_assert (prop_id != 0 && prop_id - 1 < 4);
21335 info = _flash_property_info_pointers[prop_id - 1];
21336 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
21337 if (info->use_gvariant)
21338 {
21339 g_value_set_variant (value, variant);
21340 }
21341 else
21342 {
21343 if (variant != NULL)
21344 g_dbus_gvariant_to_gvalue (variant, value);
21345 }
21346 if (variant != NULL)
21347 g_variant_unref (variant);
21348}
21349
21350static void
21351flash_proxy_set_property_cb (GDBusProxy *proxy,
21352 GAsyncResult *res,
21353 gpointer user_data)
21354{
21355 const _ExtendedGDBusPropertyInfo *info = user_data;
21356 GError *error;
21357 GVariant *_ret;
21358 error = NULL;
21359 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
21360 if (!_ret)
21361 {
21362 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
21363 info->parent_struct.name,
21364 error->message, g_quark_to_string (error->domain), error->code);
21365 g_error_free (error);
21366 }
21367 else
21368 {
21369 g_variant_unref (_ret);
21370 }
Norman James362a80f2015-09-14 14:04:39 -050021371}
21372
21373static void
21374flash_proxy_set_property (GObject *object,
21375 guint prop_id,
21376 const GValue *value,
21377 GParamSpec *pspec G_GNUC_UNUSED)
21378{
Norman James18998182015-10-11 21:54:53 -050021379 const _ExtendedGDBusPropertyInfo *info;
21380 GVariant *variant;
21381 g_assert (prop_id != 0 && prop_id - 1 < 4);
21382 info = _flash_property_info_pointers[prop_id - 1];
21383 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
21384 g_dbus_proxy_call (G_DBUS_PROXY (object),
21385 "org.freedesktop.DBus.Properties.Set",
21386 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
21387 G_DBUS_CALL_FLAGS_NONE,
21388 -1,
21389 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
21390 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050021391}
21392
21393static void
21394flash_proxy_g_signal (GDBusProxy *proxy,
21395 const gchar *sender_name G_GNUC_UNUSED,
21396 const gchar *signal_name,
21397 GVariant *parameters)
21398{
21399 _ExtendedGDBusSignalInfo *info;
21400 GVariantIter iter;
21401 GVariant *child;
21402 GValue *paramv;
21403 guint num_params;
21404 guint n;
21405 guint signal_id;
21406 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
21407 if (info == NULL)
21408 return;
21409 num_params = g_variant_n_children (parameters);
21410 paramv = g_new0 (GValue, num_params + 1);
21411 g_value_init (&paramv[0], TYPE_FLASH);
21412 g_value_set_object (&paramv[0], proxy);
21413 g_variant_iter_init (&iter, parameters);
21414 n = 1;
21415 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21416 {
21417 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
21418 if (arg_info->use_gvariant)
21419 {
21420 g_value_init (&paramv[n], G_TYPE_VARIANT);
21421 g_value_set_variant (&paramv[n], child);
21422 n++;
21423 }
21424 else
21425 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21426 g_variant_unref (child);
21427 }
21428 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
21429 g_signal_emitv (paramv, signal_id, 0, NULL);
21430 for (n = 0; n < num_params + 1; n++)
21431 g_value_unset (&paramv[n]);
21432 g_free (paramv);
21433}
21434
21435static void
21436flash_proxy_g_properties_changed (GDBusProxy *_proxy,
21437 GVariant *changed_properties,
21438 const gchar *const *invalidated_properties)
21439{
21440 FlashProxy *proxy = FLASH_PROXY (_proxy);
21441 guint n;
21442 const gchar *key;
21443 GVariantIter *iter;
21444 _ExtendedGDBusPropertyInfo *info;
21445 g_variant_get (changed_properties, "a{sv}", &iter);
21446 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
21447 {
21448 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
21449 g_datalist_remove_data (&proxy->priv->qdata, key);
21450 if (info != NULL)
21451 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21452 }
21453 g_variant_iter_free (iter);
21454 for (n = 0; invalidated_properties[n] != NULL; n++)
21455 {
21456 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
21457 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
21458 if (info != NULL)
21459 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21460 }
21461}
21462
Norman James18998182015-10-11 21:54:53 -050021463static const gchar *
21464flash_proxy_get_filename (Flash *object)
21465{
21466 FlashProxy *proxy = FLASH_PROXY (object);
21467 GVariant *variant;
21468 const gchar *value = NULL;
21469 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
21470 if (variant != NULL)
21471 {
21472 value = g_variant_get_string (variant, NULL);
21473 g_variant_unref (variant);
21474 }
21475 return value;
21476}
21477
21478static const gchar *
21479flash_proxy_get_flasher_path (Flash *object)
21480{
21481 FlashProxy *proxy = FLASH_PROXY (object);
21482 GVariant *variant;
21483 const gchar *value = NULL;
21484 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
21485 if (variant != NULL)
21486 {
21487 value = g_variant_get_string (variant, NULL);
21488 g_variant_unref (variant);
21489 }
21490 return value;
21491}
21492
21493static const gchar *
21494flash_proxy_get_flasher_name (Flash *object)
21495{
21496 FlashProxy *proxy = FLASH_PROXY (object);
21497 GVariant *variant;
21498 const gchar *value = NULL;
21499 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
21500 if (variant != NULL)
21501 {
21502 value = g_variant_get_string (variant, NULL);
21503 g_variant_unref (variant);
21504 }
21505 return value;
21506}
21507
21508static const gchar *
21509flash_proxy_get_flasher_instance (Flash *object)
21510{
21511 FlashProxy *proxy = FLASH_PROXY (object);
21512 GVariant *variant;
21513 const gchar *value = NULL;
21514 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
21515 if (variant != NULL)
21516 {
21517 value = g_variant_get_string (variant, NULL);
21518 g_variant_unref (variant);
21519 }
21520 return value;
21521}
21522
Norman James362a80f2015-09-14 14:04:39 -050021523static void
21524flash_proxy_init (FlashProxy *proxy)
21525{
21526#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21527 proxy->priv = flash_proxy_get_instance_private (proxy);
21528#else
21529 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
21530#endif
21531
21532 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
21533}
21534
21535static void
21536flash_proxy_class_init (FlashProxyClass *klass)
21537{
21538 GObjectClass *gobject_class;
21539 GDBusProxyClass *proxy_class;
21540
21541 gobject_class = G_OBJECT_CLASS (klass);
21542 gobject_class->finalize = flash_proxy_finalize;
21543 gobject_class->get_property = flash_proxy_get_property;
21544 gobject_class->set_property = flash_proxy_set_property;
21545
21546 proxy_class = G_DBUS_PROXY_CLASS (klass);
21547 proxy_class->g_signal = flash_proxy_g_signal;
21548 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
21549
Norman James18998182015-10-11 21:54:53 -050021550 flash_override_properties (gobject_class, 1);
21551
Norman James362a80f2015-09-14 14:04:39 -050021552#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21553 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
21554#endif
21555}
21556
21557static void
21558flash_proxy_iface_init (FlashIface *iface)
21559{
Norman James18998182015-10-11 21:54:53 -050021560 iface->get_filename = flash_proxy_get_filename;
21561 iface->get_flasher_path = flash_proxy_get_flasher_path;
21562 iface->get_flasher_name = flash_proxy_get_flasher_name;
21563 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James362a80f2015-09-14 14:04:39 -050021564}
21565
21566/**
21567 * flash_proxy_new:
21568 * @connection: A #GDBusConnection.
21569 * @flags: Flags from the #GDBusProxyFlags enumeration.
21570 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21571 * @object_path: An object path.
21572 * @cancellable: (allow-none): A #GCancellable or %NULL.
21573 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21574 * @user_data: User data to pass to @callback.
21575 *
21576 * 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.
21577 *
21578 * 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.
21579 * You can then call flash_proxy_new_finish() to get the result of the operation.
21580 *
21581 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
21582 */
21583void
21584flash_proxy_new (
21585 GDBusConnection *connection,
21586 GDBusProxyFlags flags,
21587 const gchar *name,
21588 const gchar *object_path,
21589 GCancellable *cancellable,
21590 GAsyncReadyCallback callback,
21591 gpointer user_data)
21592{
21593 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);
21594}
21595
21596/**
21597 * flash_proxy_new_finish:
21598 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
21599 * @error: Return location for error or %NULL
21600 *
21601 * Finishes an operation started with flash_proxy_new().
21602 *
21603 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21604 */
21605Flash *
21606flash_proxy_new_finish (
21607 GAsyncResult *res,
21608 GError **error)
21609{
21610 GObject *ret;
21611 GObject *source_object;
21612 source_object = g_async_result_get_source_object (res);
21613 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21614 g_object_unref (source_object);
21615 if (ret != NULL)
21616 return FLASH (ret);
21617 else
21618 return NULL;
21619}
21620
21621/**
21622 * flash_proxy_new_sync:
21623 * @connection: A #GDBusConnection.
21624 * @flags: Flags from the #GDBusProxyFlags enumeration.
21625 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21626 * @object_path: An object path.
21627 * @cancellable: (allow-none): A #GCancellable or %NULL.
21628 * @error: Return location for error or %NULL
21629 *
21630 * 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.
21631 *
21632 * The calling thread is blocked until a reply is received.
21633 *
21634 * See flash_proxy_new() for the asynchronous version of this constructor.
21635 *
21636 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21637 */
21638Flash *
21639flash_proxy_new_sync (
21640 GDBusConnection *connection,
21641 GDBusProxyFlags flags,
21642 const gchar *name,
21643 const gchar *object_path,
21644 GCancellable *cancellable,
21645 GError **error)
21646{
21647 GInitable *ret;
21648 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);
21649 if (ret != NULL)
21650 return FLASH (ret);
21651 else
21652 return NULL;
21653}
21654
21655
21656/**
21657 * flash_proxy_new_for_bus:
21658 * @bus_type: A #GBusType.
21659 * @flags: Flags from the #GDBusProxyFlags enumeration.
21660 * @name: A bus name (well-known or unique).
21661 * @object_path: An object path.
21662 * @cancellable: (allow-none): A #GCancellable or %NULL.
21663 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21664 * @user_data: User data to pass to @callback.
21665 *
21666 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21667 *
21668 * 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.
21669 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
21670 *
21671 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21672 */
21673void
21674flash_proxy_new_for_bus (
21675 GBusType bus_type,
21676 GDBusProxyFlags flags,
21677 const gchar *name,
21678 const gchar *object_path,
21679 GCancellable *cancellable,
21680 GAsyncReadyCallback callback,
21681 gpointer user_data)
21682{
21683 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);
21684}
21685
21686/**
21687 * flash_proxy_new_for_bus_finish:
21688 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
21689 * @error: Return location for error or %NULL
21690 *
21691 * Finishes an operation started with flash_proxy_new_for_bus().
21692 *
21693 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21694 */
21695Flash *
21696flash_proxy_new_for_bus_finish (
21697 GAsyncResult *res,
21698 GError **error)
21699{
21700 GObject *ret;
21701 GObject *source_object;
21702 source_object = g_async_result_get_source_object (res);
21703 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21704 g_object_unref (source_object);
21705 if (ret != NULL)
21706 return FLASH (ret);
21707 else
21708 return NULL;
21709}
21710
21711/**
21712 * flash_proxy_new_for_bus_sync:
21713 * @bus_type: A #GBusType.
21714 * @flags: Flags from the #GDBusProxyFlags enumeration.
21715 * @name: A bus name (well-known or unique).
21716 * @object_path: An object path.
21717 * @cancellable: (allow-none): A #GCancellable or %NULL.
21718 * @error: Return location for error or %NULL
21719 *
21720 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21721 *
21722 * The calling thread is blocked until a reply is received.
21723 *
21724 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
21725 *
21726 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21727 */
21728Flash *
21729flash_proxy_new_for_bus_sync (
21730 GBusType bus_type,
21731 GDBusProxyFlags flags,
21732 const gchar *name,
21733 const gchar *object_path,
21734 GCancellable *cancellable,
21735 GError **error)
21736{
21737 GInitable *ret;
21738 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);
21739 if (ret != NULL)
21740 return FLASH (ret);
21741 else
21742 return NULL;
21743}
21744
21745
21746/* ------------------------------------------------------------------------ */
21747
21748/**
21749 * FlashSkeleton:
21750 *
21751 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
21752 */
21753
21754/**
21755 * FlashSkeletonClass:
21756 * @parent_class: The parent class.
21757 *
21758 * Class structure for #FlashSkeleton.
21759 */
21760
21761struct _FlashSkeletonPrivate
21762{
21763 GValue *properties;
21764 GList *changed_properties;
21765 GSource *changed_properties_idle_source;
21766 GMainContext *context;
21767 GMutex lock;
21768};
21769
21770static void
21771_flash_skeleton_handle_method_call (
21772 GDBusConnection *connection G_GNUC_UNUSED,
21773 const gchar *sender G_GNUC_UNUSED,
21774 const gchar *object_path G_GNUC_UNUSED,
21775 const gchar *interface_name,
21776 const gchar *method_name,
21777 GVariant *parameters,
21778 GDBusMethodInvocation *invocation,
21779 gpointer user_data)
21780{
21781 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
21782 _ExtendedGDBusMethodInfo *info;
21783 GVariantIter iter;
21784 GVariant *child;
21785 GValue *paramv;
21786 guint num_params;
21787 guint num_extra;
21788 guint n;
21789 guint signal_id;
21790 GValue return_value = G_VALUE_INIT;
21791 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21792 g_assert (info != NULL);
21793 num_params = g_variant_n_children (parameters);
21794 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21795 n = 0;
21796 g_value_init (&paramv[n], TYPE_FLASH);
21797 g_value_set_object (&paramv[n++], skeleton);
21798 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21799 g_value_set_object (&paramv[n++], invocation);
21800 if (info->pass_fdlist)
21801 {
21802#ifdef G_OS_UNIX
21803 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21804 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21805#else
21806 g_assert_not_reached ();
21807#endif
21808 }
21809 g_variant_iter_init (&iter, parameters);
21810 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21811 {
21812 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21813 if (arg_info->use_gvariant)
21814 {
21815 g_value_init (&paramv[n], G_TYPE_VARIANT);
21816 g_value_set_variant (&paramv[n], child);
21817 n++;
21818 }
21819 else
21820 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21821 g_variant_unref (child);
21822 }
21823 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
21824 g_value_init (&return_value, G_TYPE_BOOLEAN);
21825 g_signal_emitv (paramv, signal_id, 0, &return_value);
21826 if (!g_value_get_boolean (&return_value))
21827 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);
21828 g_value_unset (&return_value);
21829 for (n = 0; n < num_params + num_extra; n++)
21830 g_value_unset (&paramv[n]);
21831 g_free (paramv);
21832}
21833
21834static GVariant *
21835_flash_skeleton_handle_get_property (
21836 GDBusConnection *connection G_GNUC_UNUSED,
21837 const gchar *sender G_GNUC_UNUSED,
21838 const gchar *object_path G_GNUC_UNUSED,
21839 const gchar *interface_name G_GNUC_UNUSED,
21840 const gchar *property_name,
21841 GError **error,
21842 gpointer user_data)
21843{
21844 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
21845 GValue value = G_VALUE_INIT;
21846 GParamSpec *pspec;
21847 _ExtendedGDBusPropertyInfo *info;
21848 GVariant *ret;
21849 ret = NULL;
21850 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
21851 g_assert (info != NULL);
21852 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21853 if (pspec == NULL)
21854 {
21855 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21856 }
21857 else
21858 {
21859 g_value_init (&value, pspec->value_type);
21860 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21861 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21862 g_value_unset (&value);
21863 }
21864 return ret;
21865}
21866
21867static gboolean
21868_flash_skeleton_handle_set_property (
21869 GDBusConnection *connection G_GNUC_UNUSED,
21870 const gchar *sender G_GNUC_UNUSED,
21871 const gchar *object_path G_GNUC_UNUSED,
21872 const gchar *interface_name G_GNUC_UNUSED,
21873 const gchar *property_name,
21874 GVariant *variant,
21875 GError **error,
21876 gpointer user_data)
21877{
21878 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
21879 GValue value = G_VALUE_INIT;
21880 GParamSpec *pspec;
21881 _ExtendedGDBusPropertyInfo *info;
21882 gboolean ret;
21883 ret = FALSE;
21884 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
21885 g_assert (info != NULL);
21886 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21887 if (pspec == NULL)
21888 {
21889 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21890 }
21891 else
21892 {
21893 if (info->use_gvariant)
21894 g_value_set_variant (&value, variant);
21895 else
21896 g_dbus_gvariant_to_gvalue (variant, &value);
21897 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21898 g_value_unset (&value);
21899 ret = TRUE;
21900 }
21901 return ret;
21902}
21903
21904static const GDBusInterfaceVTable _flash_skeleton_vtable =
21905{
21906 _flash_skeleton_handle_method_call,
21907 _flash_skeleton_handle_get_property,
21908 _flash_skeleton_handle_set_property,
21909 {NULL}
21910};
21911
21912static GDBusInterfaceInfo *
21913flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21914{
21915 return flash_interface_info ();
21916}
21917
21918static GDBusInterfaceVTable *
21919flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21920{
21921 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
21922}
21923
21924static GVariant *
21925flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21926{
21927 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
21928
21929 GVariantBuilder builder;
21930 guint n;
21931 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21932 if (_flash_interface_info.parent_struct.properties == NULL)
21933 goto out;
21934 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
21935 {
21936 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
21937 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21938 {
21939 GVariant *value;
21940 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);
21941 if (value != NULL)
21942 {
21943 g_variant_take_ref (value);
21944 g_variant_builder_add (&builder, "{sv}", info->name, value);
21945 g_variant_unref (value);
21946 }
21947 }
21948 }
21949out:
21950 return g_variant_builder_end (&builder);
21951}
21952
Norman James18998182015-10-11 21:54:53 -050021953static gboolean _flash_emit_changed (gpointer user_data);
21954
Norman James362a80f2015-09-14 14:04:39 -050021955static void
21956flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21957{
Norman James18998182015-10-11 21:54:53 -050021958 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
21959 gboolean emit_changed = FALSE;
21960
21961 g_mutex_lock (&skeleton->priv->lock);
21962 if (skeleton->priv->changed_properties_idle_source != NULL)
21963 {
21964 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21965 skeleton->priv->changed_properties_idle_source = NULL;
21966 emit_changed = TRUE;
21967 }
21968 g_mutex_unlock (&skeleton->priv->lock);
21969
21970 if (emit_changed)
21971 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050021972}
21973
21974static void
21975_flash_on_signal_updated (
21976 Flash *object)
21977{
21978 FlashSkeleton *skeleton = FLASH_SKELETON (object);
21979
21980 GList *connections, *l;
21981 GVariant *signal_variant;
21982 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21983
21984 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
21985 for (l = connections; l != NULL; l = l->next)
21986 {
21987 GDBusConnection *connection = l->data;
21988 g_dbus_connection_emit_signal (connection,
21989 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
21990 signal_variant, NULL);
21991 }
21992 g_variant_unref (signal_variant);
21993 g_list_free_full (connections, g_object_unref);
21994}
21995
Norman Jamesf066e872015-10-07 15:29:51 -050021996static void
21997_flash_on_signal_download (
21998 Flash *object,
21999 const gchar *arg_url,
22000 const gchar *arg_filename)
22001{
22002 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22003
22004 GList *connections, *l;
22005 GVariant *signal_variant;
22006 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22007
22008 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
22009 arg_url,
22010 arg_filename));
22011 for (l = connections; l != NULL; l = l->next)
22012 {
22013 GDBusConnection *connection = l->data;
22014 g_dbus_connection_emit_signal (connection,
22015 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
22016 signal_variant, NULL);
22017 }
22018 g_variant_unref (signal_variant);
22019 g_list_free_full (connections, g_object_unref);
22020}
22021
Norman James362a80f2015-09-14 14:04:39 -050022022static void flash_skeleton_iface_init (FlashIface *iface);
22023#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22024G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22025 G_ADD_PRIVATE (FlashSkeleton)
22026 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
22027
22028#else
22029G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22030 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
22031
22032#endif
22033static void
22034flash_skeleton_finalize (GObject *object)
22035{
22036 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050022037 guint n;
22038 for (n = 0; n < 4; n++)
22039 g_value_unset (&skeleton->priv->properties[n]);
22040 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050022041 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22042 if (skeleton->priv->changed_properties_idle_source != NULL)
22043 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22044 g_main_context_unref (skeleton->priv->context);
22045 g_mutex_clear (&skeleton->priv->lock);
22046 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
22047}
22048
22049static void
Norman James18998182015-10-11 21:54:53 -050022050flash_skeleton_get_property (GObject *object,
22051 guint prop_id,
22052 GValue *value,
22053 GParamSpec *pspec G_GNUC_UNUSED)
22054{
22055 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22056 g_assert (prop_id != 0 && prop_id - 1 < 4);
22057 g_mutex_lock (&skeleton->priv->lock);
22058 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
22059 g_mutex_unlock (&skeleton->priv->lock);
22060}
22061
22062static gboolean
22063_flash_emit_changed (gpointer user_data)
22064{
22065 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
22066 GList *l;
22067 GVariantBuilder builder;
22068 GVariantBuilder invalidated_builder;
22069 guint num_changes;
22070
22071 g_mutex_lock (&skeleton->priv->lock);
22072 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22073 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
22074 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
22075 {
22076 ChangedProperty *cp = l->data;
22077 GVariant *variant;
22078 const GValue *cur_value;
22079
22080 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
22081 if (!_g_value_equal (cur_value, &cp->orig_value))
22082 {
22083 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
22084 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
22085 g_variant_unref (variant);
22086 num_changes++;
22087 }
22088 }
22089 if (num_changes > 0)
22090 {
22091 GList *connections, *ll;
22092 GVariant *signal_variant;
22093 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
22094 &builder, &invalidated_builder));
22095 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22096 for (ll = connections; ll != NULL; ll = ll->next)
22097 {
22098 GDBusConnection *connection = ll->data;
22099
22100 g_dbus_connection_emit_signal (connection,
22101 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
22102 "org.freedesktop.DBus.Properties",
22103 "PropertiesChanged",
22104 signal_variant,
22105 NULL);
22106 }
22107 g_variant_unref (signal_variant);
22108 g_list_free_full (connections, g_object_unref);
22109 }
22110 else
22111 {
22112 g_variant_builder_clear (&builder);
22113 g_variant_builder_clear (&invalidated_builder);
22114 }
22115 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22116 skeleton->priv->changed_properties = NULL;
22117 skeleton->priv->changed_properties_idle_source = NULL;
22118 g_mutex_unlock (&skeleton->priv->lock);
22119 return FALSE;
22120}
22121
22122static void
22123_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
22124{
22125 ChangedProperty *cp;
22126 GList *l;
22127 cp = NULL;
22128 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
22129 {
22130 ChangedProperty *i_cp = l->data;
22131 if (i_cp->info == info)
22132 {
22133 cp = i_cp;
22134 break;
22135 }
22136 }
22137 if (cp == NULL)
22138 {
22139 cp = g_new0 (ChangedProperty, 1);
22140 cp->prop_id = prop_id;
22141 cp->info = info;
22142 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
22143 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
22144 g_value_copy (orig_value, &cp->orig_value);
22145 }
22146}
22147
22148static void
22149flash_skeleton_notify (GObject *object,
22150 GParamSpec *pspec G_GNUC_UNUSED)
22151{
22152 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22153 g_mutex_lock (&skeleton->priv->lock);
22154 if (skeleton->priv->changed_properties != NULL &&
22155 skeleton->priv->changed_properties_idle_source == NULL)
22156 {
22157 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
22158 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
22159 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
22160 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
22161 g_source_unref (skeleton->priv->changed_properties_idle_source);
22162 }
22163 g_mutex_unlock (&skeleton->priv->lock);
22164}
22165
22166static void
22167flash_skeleton_set_property (GObject *object,
22168 guint prop_id,
22169 const GValue *value,
22170 GParamSpec *pspec)
22171{
22172 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22173 g_assert (prop_id != 0 && prop_id - 1 < 4);
22174 g_mutex_lock (&skeleton->priv->lock);
22175 g_object_freeze_notify (object);
22176 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
22177 {
22178 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
22179 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
22180 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
22181 g_object_notify_by_pspec (object, pspec);
22182 }
22183 g_mutex_unlock (&skeleton->priv->lock);
22184 g_object_thaw_notify (object);
22185}
22186
22187static void
Norman James362a80f2015-09-14 14:04:39 -050022188flash_skeleton_init (FlashSkeleton *skeleton)
22189{
22190#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22191 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
22192#else
22193 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
22194#endif
22195
22196 g_mutex_init (&skeleton->priv->lock);
22197 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James18998182015-10-11 21:54:53 -050022198 skeleton->priv->properties = g_new0 (GValue, 4);
22199 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
22200 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
22201 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
22202 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
22203}
22204
22205static const gchar *
22206flash_skeleton_get_filename (Flash *object)
22207{
22208 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22209 const gchar *value;
22210 g_mutex_lock (&skeleton->priv->lock);
22211 value = g_value_get_string (&(skeleton->priv->properties[0]));
22212 g_mutex_unlock (&skeleton->priv->lock);
22213 return value;
22214}
22215
22216static const gchar *
22217flash_skeleton_get_flasher_path (Flash *object)
22218{
22219 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22220 const gchar *value;
22221 g_mutex_lock (&skeleton->priv->lock);
22222 value = g_value_get_string (&(skeleton->priv->properties[1]));
22223 g_mutex_unlock (&skeleton->priv->lock);
22224 return value;
22225}
22226
22227static const gchar *
22228flash_skeleton_get_flasher_name (Flash *object)
22229{
22230 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22231 const gchar *value;
22232 g_mutex_lock (&skeleton->priv->lock);
22233 value = g_value_get_string (&(skeleton->priv->properties[2]));
22234 g_mutex_unlock (&skeleton->priv->lock);
22235 return value;
22236}
22237
22238static const gchar *
22239flash_skeleton_get_flasher_instance (Flash *object)
22240{
22241 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22242 const gchar *value;
22243 g_mutex_lock (&skeleton->priv->lock);
22244 value = g_value_get_string (&(skeleton->priv->properties[3]));
22245 g_mutex_unlock (&skeleton->priv->lock);
22246 return value;
Norman James362a80f2015-09-14 14:04:39 -050022247}
22248
22249static void
22250flash_skeleton_class_init (FlashSkeletonClass *klass)
22251{
22252 GObjectClass *gobject_class;
22253 GDBusInterfaceSkeletonClass *skeleton_class;
22254
22255 gobject_class = G_OBJECT_CLASS (klass);
22256 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050022257 gobject_class->get_property = flash_skeleton_get_property;
22258 gobject_class->set_property = flash_skeleton_set_property;
22259 gobject_class->notify = flash_skeleton_notify;
22260
22261
22262 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050022263
22264 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
22265 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
22266 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
22267 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
22268 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
22269
22270#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22271 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
22272#endif
22273}
22274
22275static void
22276flash_skeleton_iface_init (FlashIface *iface)
22277{
22278 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050022279 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050022280 iface->get_filename = flash_skeleton_get_filename;
22281 iface->get_flasher_path = flash_skeleton_get_flasher_path;
22282 iface->get_flasher_name = flash_skeleton_get_flasher_name;
22283 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James362a80f2015-09-14 14:04:39 -050022284}
22285
22286/**
22287 * flash_skeleton_new:
22288 *
22289 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
22290 *
22291 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
22292 */
22293Flash *
22294flash_skeleton_new (void)
22295{
22296 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
22297}
22298
22299/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050022300 * Code for interface org.openbmc.FlashControl
22301 * ------------------------------------------------------------------------
22302 */
22303
22304/**
22305 * SECTION:FlashControl
22306 * @title: FlashControl
22307 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
22308 *
22309 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface in C.
22310 */
22311
22312/* ---- Introspection data for org.openbmc.FlashControl ---- */
22313
22314static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
22315{
22316 {
22317 -1,
22318 (gchar *) "type",
22319 (gchar *) "s",
22320 NULL
22321 },
22322 FALSE
22323};
22324
22325static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
22326{
22327 {
22328 -1,
22329 (gchar *) "filename",
22330 (gchar *) "s",
22331 NULL
22332 },
22333 FALSE
22334};
22335
22336static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
22337{
22338 &_flash_control_method_info_flash_IN_ARG_type,
22339 &_flash_control_method_info_flash_IN_ARG_filename,
22340 NULL
22341};
22342
22343static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
22344{
22345 {
22346 -1,
22347 (gchar *) "flash",
22348 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
22349 NULL,
22350 NULL
22351 },
22352 "handle-flash",
22353 FALSE
22354};
22355
22356static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
22357{
22358 &_flash_control_method_info_flash,
22359 NULL
22360};
22361
22362static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
22363{
22364 {
22365 -1,
22366 (gchar *) "filename",
22367 (gchar *) "s",
22368 NULL
22369 },
22370 FALSE
22371};
22372
22373static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
22374{
22375 &_flash_control_signal_info_done_ARG_filename,
22376 NULL
22377};
22378
22379static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
22380{
22381 {
22382 -1,
22383 (gchar *) "Done",
22384 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
22385 NULL
22386 },
22387 "done"
22388};
22389
22390static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
22391{
22392 {
22393 -1,
22394 (gchar *) "filename",
22395 (gchar *) "s",
22396 NULL
22397 },
22398 FALSE
22399};
22400
22401static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
22402{
22403 &_flash_control_signal_info_error_ARG_filename,
22404 NULL
22405};
22406
22407static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
22408{
22409 {
22410 -1,
22411 (gchar *) "Error",
22412 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
22413 NULL
22414 },
22415 "error"
22416};
22417
22418static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
22419{
22420 {
22421 -1,
22422 (gchar *) "filename",
22423 (gchar *) "s",
22424 NULL
22425 },
22426 FALSE
22427};
22428
22429static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
22430{
22431 {
22432 -1,
22433 (gchar *) "progress",
22434 (gchar *) "y",
22435 NULL
22436 },
22437 FALSE
22438};
22439
22440static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
22441{
22442 &_flash_control_signal_info_progress_ARG_filename,
22443 &_flash_control_signal_info_progress_ARG_progress,
22444 NULL
22445};
22446
22447static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
22448{
22449 {
22450 -1,
22451 (gchar *) "Progress",
22452 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
22453 NULL
22454 },
22455 "progress"
22456};
22457
22458static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
22459{
22460 &_flash_control_signal_info_done,
22461 &_flash_control_signal_info_error,
22462 &_flash_control_signal_info_progress,
22463 NULL
22464};
22465
22466static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
22467{
22468 {
22469 -1,
22470 (gchar *) "filename",
22471 (gchar *) "s",
22472 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22473 NULL
22474 },
22475 "filename",
22476 FALSE
22477};
22478
22479static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
22480{
22481 {
22482 -1,
22483 (gchar *) "type",
22484 (gchar *) "s",
22485 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22486 NULL
22487 },
22488 "type",
22489 FALSE
22490};
22491
22492static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
22493{
22494 &_flash_control_property_info_filename,
22495 &_flash_control_property_info_type_,
22496 NULL
22497};
22498
22499static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
22500{
22501 {
22502 -1,
22503 (gchar *) "org.openbmc.FlashControl",
22504 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
22505 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
22506 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
22507 NULL
22508 },
22509 "flash-control",
22510};
22511
22512
22513/**
22514 * flash_control_interface_info:
22515 *
22516 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
22517 *
22518 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22519 */
22520GDBusInterfaceInfo *
22521flash_control_interface_info (void)
22522{
22523 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
22524}
22525
22526/**
22527 * flash_control_override_properties:
22528 * @klass: The class structure for a #GObject<!-- -->-derived class.
22529 * @property_id_begin: The property id to assign to the first overridden property.
22530 *
22531 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
22532 * The properties are overridden in the order they are defined.
22533 *
22534 * Returns: The last property id.
22535 */
22536guint
22537flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
22538{
22539 g_object_class_override_property (klass, property_id_begin++, "filename");
22540 g_object_class_override_property (klass, property_id_begin++, "type");
22541 return property_id_begin - 1;
22542}
22543
22544
22545
22546/**
22547 * FlashControl:
22548 *
22549 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
22550 */
22551
22552/**
22553 * FlashControlIface:
22554 * @parent_iface: The parent interface.
22555 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
22556 * @get_filename: Getter for the #FlashControl:filename property.
22557 * @get_type_: Getter for the #FlashControl:type property.
22558 * @done: Handler for the #FlashControl::done signal.
22559 * @error: Handler for the #FlashControl::error signal.
22560 * @progress: Handler for the #FlashControl::progress signal.
22561 *
22562 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
22563 */
22564
22565typedef FlashControlIface FlashControlInterface;
22566G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
22567
22568static void
22569flash_control_default_init (FlashControlIface *iface)
22570{
22571 /* GObject signals for incoming D-Bus method calls: */
22572 /**
22573 * FlashControl::handle-flash:
22574 * @object: A #FlashControl.
22575 * @invocation: A #GDBusMethodInvocation.
22576 * @arg_type: Argument passed by remote caller.
22577 * @arg_filename: Argument passed by remote caller.
22578 *
22579 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
22580 *
22581 * 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_control_complete_flash() 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.
22582 *
22583 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22584 */
22585 g_signal_new ("handle-flash",
22586 G_TYPE_FROM_INTERFACE (iface),
22587 G_SIGNAL_RUN_LAST,
22588 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
22589 g_signal_accumulator_true_handled,
22590 NULL,
22591 g_cclosure_marshal_generic,
22592 G_TYPE_BOOLEAN,
22593 3,
22594 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
22595
22596 /* GObject signals for received D-Bus signals: */
22597 /**
22598 * FlashControl::done:
22599 * @object: A #FlashControl.
22600 * @arg_filename: Argument.
22601 *
22602 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> is received.
22603 *
22604 * 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.
22605 */
22606 g_signal_new ("done",
22607 G_TYPE_FROM_INTERFACE (iface),
22608 G_SIGNAL_RUN_LAST,
22609 G_STRUCT_OFFSET (FlashControlIface, done),
22610 NULL,
22611 NULL,
22612 g_cclosure_marshal_generic,
22613 G_TYPE_NONE,
22614 1, G_TYPE_STRING);
22615
22616 /**
22617 * FlashControl::error:
22618 * @object: A #FlashControl.
22619 * @arg_filename: Argument.
22620 *
22621 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> is received.
22622 *
22623 * 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.
22624 */
22625 g_signal_new ("error",
22626 G_TYPE_FROM_INTERFACE (iface),
22627 G_SIGNAL_RUN_LAST,
22628 G_STRUCT_OFFSET (FlashControlIface, error),
22629 NULL,
22630 NULL,
22631 g_cclosure_marshal_generic,
22632 G_TYPE_NONE,
22633 1, G_TYPE_STRING);
22634
22635 /**
22636 * FlashControl::progress:
22637 * @object: A #FlashControl.
22638 * @arg_filename: Argument.
22639 * @arg_progress: Argument.
22640 *
22641 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> is received.
22642 *
22643 * 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.
22644 */
22645 g_signal_new ("progress",
22646 G_TYPE_FROM_INTERFACE (iface),
22647 G_SIGNAL_RUN_LAST,
22648 G_STRUCT_OFFSET (FlashControlIface, progress),
22649 NULL,
22650 NULL,
22651 g_cclosure_marshal_generic,
22652 G_TYPE_NONE,
22653 2, G_TYPE_STRING, G_TYPE_UCHAR);
22654
22655 /* GObject properties for D-Bus properties: */
22656 /**
22657 * FlashControl:filename:
22658 *
22659 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
22660 *
22661 * 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.
22662 */
22663 g_object_interface_install_property (iface,
22664 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22665 /**
22666 * FlashControl:type:
22667 *
22668 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
22669 *
22670 * 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.
22671 */
22672 g_object_interface_install_property (iface,
22673 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22674}
22675
22676/**
22677 * flash_control_get_filename: (skip)
22678 * @object: A #FlashControl.
22679 *
22680 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
22681 *
22682 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22683 *
22684 * <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 flash_control_dup_filename() if on another thread.</warning>
22685 *
22686 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22687 */
22688const gchar *
22689flash_control_get_filename (FlashControl *object)
22690{
22691 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
22692}
22693
22694/**
22695 * flash_control_dup_filename: (skip)
22696 * @object: A #FlashControl.
22697 *
22698 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
22699 *
22700 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22701 *
22702 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22703 */
22704gchar *
22705flash_control_dup_filename (FlashControl *object)
22706{
22707 gchar *value;
22708 g_object_get (G_OBJECT (object), "filename", &value, NULL);
22709 return value;
22710}
22711
22712/**
22713 * flash_control_set_filename: (skip)
22714 * @object: A #FlashControl.
22715 * @value: The value to set.
22716 *
22717 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
22718 *
22719 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22720 */
22721void
22722flash_control_set_filename (FlashControl *object, const gchar *value)
22723{
22724 g_object_set (G_OBJECT (object), "filename", value, NULL);
22725}
22726
22727/**
22728 * flash_control_get_type_: (skip)
22729 * @object: A #FlashControl.
22730 *
22731 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
22732 *
22733 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22734 *
22735 * <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 flash_control_dup_type_() if on another thread.</warning>
22736 *
22737 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22738 */
22739const gchar *
22740flash_control_get_type_ (FlashControl *object)
22741{
22742 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
22743}
22744
22745/**
22746 * flash_control_dup_type_: (skip)
22747 * @object: A #FlashControl.
22748 *
22749 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
22750 *
22751 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22752 *
22753 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22754 */
22755gchar *
22756flash_control_dup_type_ (FlashControl *object)
22757{
22758 gchar *value;
22759 g_object_get (G_OBJECT (object), "type", &value, NULL);
22760 return value;
22761}
22762
22763/**
22764 * flash_control_set_type_: (skip)
22765 * @object: A #FlashControl.
22766 * @value: The value to set.
22767 *
22768 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
22769 *
22770 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22771 */
22772void
22773flash_control_set_type_ (FlashControl *object, const gchar *value)
22774{
22775 g_object_set (G_OBJECT (object), "type", value, NULL);
22776}
22777
22778/**
22779 * flash_control_emit_done:
22780 * @object: A #FlashControl.
22781 * @arg_filename: Argument to pass with the signal.
22782 *
22783 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
22784 */
22785void
22786flash_control_emit_done (
22787 FlashControl *object,
22788 const gchar *arg_filename)
22789{
22790 g_signal_emit_by_name (object, "done", arg_filename);
22791}
22792
22793/**
22794 * flash_control_emit_error:
22795 * @object: A #FlashControl.
22796 * @arg_filename: Argument to pass with the signal.
22797 *
22798 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
22799 */
22800void
22801flash_control_emit_error (
22802 FlashControl *object,
22803 const gchar *arg_filename)
22804{
22805 g_signal_emit_by_name (object, "error", arg_filename);
22806}
22807
22808/**
22809 * flash_control_emit_progress:
22810 * @object: A #FlashControl.
22811 * @arg_filename: Argument to pass with the signal.
22812 * @arg_progress: Argument to pass with the signal.
22813 *
22814 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
22815 */
22816void
22817flash_control_emit_progress (
22818 FlashControl *object,
22819 const gchar *arg_filename,
22820 guchar arg_progress)
22821{
22822 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
22823}
22824
22825/**
22826 * flash_control_call_flash:
22827 * @proxy: A #FlashControlProxy.
22828 * @arg_type: Argument to pass with the method invocation.
22829 * @arg_filename: Argument to pass with the method invocation.
22830 * @cancellable: (allow-none): A #GCancellable or %NULL.
22831 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22832 * @user_data: User data to pass to @callback.
22833 *
22834 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
22835 * 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.
22836 * You can then call flash_control_call_flash_finish() to get the result of the operation.
22837 *
22838 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
22839 */
22840void
22841flash_control_call_flash (
22842 FlashControl *proxy,
22843 const gchar *arg_type,
22844 const gchar *arg_filename,
22845 GCancellable *cancellable,
22846 GAsyncReadyCallback callback,
22847 gpointer user_data)
22848{
22849 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22850 "flash",
22851 g_variant_new ("(ss)",
22852 arg_type,
22853 arg_filename),
22854 G_DBUS_CALL_FLAGS_NONE,
22855 -1,
22856 cancellable,
22857 callback,
22858 user_data);
22859}
22860
22861/**
22862 * flash_control_call_flash_finish:
22863 * @proxy: A #FlashControlProxy.
22864 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
22865 * @error: Return location for error or %NULL.
22866 *
22867 * Finishes an operation started with flash_control_call_flash().
22868 *
22869 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22870 */
22871gboolean
22872flash_control_call_flash_finish (
22873 FlashControl *proxy,
22874 GAsyncResult *res,
22875 GError **error)
22876{
22877 GVariant *_ret;
22878 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22879 if (_ret == NULL)
22880 goto _out;
22881 g_variant_get (_ret,
22882 "()");
22883 g_variant_unref (_ret);
22884_out:
22885 return _ret != NULL;
22886}
22887
22888/**
22889 * flash_control_call_flash_sync:
22890 * @proxy: A #FlashControlProxy.
22891 * @arg_type: Argument to pass with the method invocation.
22892 * @arg_filename: Argument to pass with the method invocation.
22893 * @cancellable: (allow-none): A #GCancellable or %NULL.
22894 * @error: Return location for error or %NULL.
22895 *
22896 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22897 *
22898 * See flash_control_call_flash() for the asynchronous version of this method.
22899 *
22900 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22901 */
22902gboolean
22903flash_control_call_flash_sync (
22904 FlashControl *proxy,
22905 const gchar *arg_type,
22906 const gchar *arg_filename,
22907 GCancellable *cancellable,
22908 GError **error)
22909{
22910 GVariant *_ret;
22911 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22912 "flash",
22913 g_variant_new ("(ss)",
22914 arg_type,
22915 arg_filename),
22916 G_DBUS_CALL_FLAGS_NONE,
22917 -1,
22918 cancellable,
22919 error);
22920 if (_ret == NULL)
22921 goto _out;
22922 g_variant_get (_ret,
22923 "()");
22924 g_variant_unref (_ret);
22925_out:
22926 return _ret != NULL;
22927}
22928
22929/**
22930 * flash_control_complete_flash:
22931 * @object: A #FlashControl.
22932 * @invocation: (transfer full): A #GDBusMethodInvocation.
22933 *
22934 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</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.
22935 *
22936 * This method will free @invocation, you cannot use it afterwards.
22937 */
22938void
22939flash_control_complete_flash (
22940 FlashControl *object,
22941 GDBusMethodInvocation *invocation)
22942{
22943 g_dbus_method_invocation_return_value (invocation,
22944 g_variant_new ("()"));
22945}
22946
22947/* ------------------------------------------------------------------------ */
22948
22949/**
22950 * FlashControlProxy:
22951 *
22952 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
22953 */
22954
22955/**
22956 * FlashControlProxyClass:
22957 * @parent_class: The parent class.
22958 *
22959 * Class structure for #FlashControlProxy.
22960 */
22961
22962struct _FlashControlProxyPrivate
22963{
22964 GData *qdata;
22965};
22966
22967static void flash_control_proxy_iface_init (FlashControlIface *iface);
22968
22969#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22970G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
22971 G_ADD_PRIVATE (FlashControlProxy)
22972 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
22973
22974#else
22975G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
22976 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
22977
22978#endif
22979static void
22980flash_control_proxy_finalize (GObject *object)
22981{
22982 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
22983 g_datalist_clear (&proxy->priv->qdata);
22984 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
22985}
22986
22987static void
22988flash_control_proxy_get_property (GObject *object,
22989 guint prop_id,
22990 GValue *value,
22991 GParamSpec *pspec G_GNUC_UNUSED)
22992{
22993 const _ExtendedGDBusPropertyInfo *info;
22994 GVariant *variant;
22995 g_assert (prop_id != 0 && prop_id - 1 < 2);
22996 info = _flash_control_property_info_pointers[prop_id - 1];
22997 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22998 if (info->use_gvariant)
22999 {
23000 g_value_set_variant (value, variant);
23001 }
23002 else
23003 {
23004 if (variant != NULL)
23005 g_dbus_gvariant_to_gvalue (variant, value);
23006 }
23007 if (variant != NULL)
23008 g_variant_unref (variant);
23009}
23010
23011static void
23012flash_control_proxy_set_property_cb (GDBusProxy *proxy,
23013 GAsyncResult *res,
23014 gpointer user_data)
23015{
23016 const _ExtendedGDBusPropertyInfo *info = user_data;
23017 GError *error;
23018 GVariant *_ret;
23019 error = NULL;
23020 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
23021 if (!_ret)
23022 {
23023 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
23024 info->parent_struct.name,
23025 error->message, g_quark_to_string (error->domain), error->code);
23026 g_error_free (error);
23027 }
23028 else
23029 {
23030 g_variant_unref (_ret);
23031 }
23032}
23033
23034static void
23035flash_control_proxy_set_property (GObject *object,
23036 guint prop_id,
23037 const GValue *value,
23038 GParamSpec *pspec G_GNUC_UNUSED)
23039{
23040 const _ExtendedGDBusPropertyInfo *info;
23041 GVariant *variant;
23042 g_assert (prop_id != 0 && prop_id - 1 < 2);
23043 info = _flash_control_property_info_pointers[prop_id - 1];
23044 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
23045 g_dbus_proxy_call (G_DBUS_PROXY (object),
23046 "org.freedesktop.DBus.Properties.Set",
23047 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
23048 G_DBUS_CALL_FLAGS_NONE,
23049 -1,
23050 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
23051 g_variant_unref (variant);
23052}
23053
23054static void
23055flash_control_proxy_g_signal (GDBusProxy *proxy,
23056 const gchar *sender_name G_GNUC_UNUSED,
23057 const gchar *signal_name,
23058 GVariant *parameters)
23059{
23060 _ExtendedGDBusSignalInfo *info;
23061 GVariantIter iter;
23062 GVariant *child;
23063 GValue *paramv;
23064 guint num_params;
23065 guint n;
23066 guint signal_id;
23067 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
23068 if (info == NULL)
23069 return;
23070 num_params = g_variant_n_children (parameters);
23071 paramv = g_new0 (GValue, num_params + 1);
23072 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
23073 g_value_set_object (&paramv[0], proxy);
23074 g_variant_iter_init (&iter, parameters);
23075 n = 1;
23076 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23077 {
23078 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23079 if (arg_info->use_gvariant)
23080 {
23081 g_value_init (&paramv[n], G_TYPE_VARIANT);
23082 g_value_set_variant (&paramv[n], child);
23083 n++;
23084 }
23085 else
23086 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23087 g_variant_unref (child);
23088 }
23089 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
23090 g_signal_emitv (paramv, signal_id, 0, NULL);
23091 for (n = 0; n < num_params + 1; n++)
23092 g_value_unset (&paramv[n]);
23093 g_free (paramv);
23094}
23095
23096static void
23097flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
23098 GVariant *changed_properties,
23099 const gchar *const *invalidated_properties)
23100{
23101 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
23102 guint n;
23103 const gchar *key;
23104 GVariantIter *iter;
23105 _ExtendedGDBusPropertyInfo *info;
23106 g_variant_get (changed_properties, "a{sv}", &iter);
23107 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23108 {
23109 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
23110 g_datalist_remove_data (&proxy->priv->qdata, key);
23111 if (info != NULL)
23112 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23113 }
23114 g_variant_iter_free (iter);
23115 for (n = 0; invalidated_properties[n] != NULL; n++)
23116 {
23117 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
23118 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23119 if (info != NULL)
23120 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23121 }
23122}
23123
23124static const gchar *
23125flash_control_proxy_get_filename (FlashControl *object)
23126{
23127 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
23128 GVariant *variant;
23129 const gchar *value = NULL;
23130 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
23131 if (variant != NULL)
23132 {
23133 value = g_variant_get_string (variant, NULL);
23134 g_variant_unref (variant);
23135 }
23136 return value;
23137}
23138
23139static const gchar *
23140flash_control_proxy_get_type_ (FlashControl *object)
23141{
23142 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
23143 GVariant *variant;
23144 const gchar *value = NULL;
23145 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
23146 if (variant != NULL)
23147 {
23148 value = g_variant_get_string (variant, NULL);
23149 g_variant_unref (variant);
23150 }
23151 return value;
23152}
23153
23154static void
23155flash_control_proxy_init (FlashControlProxy *proxy)
23156{
23157#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23158 proxy->priv = flash_control_proxy_get_instance_private (proxy);
23159#else
23160 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
23161#endif
23162
23163 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
23164}
23165
23166static void
23167flash_control_proxy_class_init (FlashControlProxyClass *klass)
23168{
23169 GObjectClass *gobject_class;
23170 GDBusProxyClass *proxy_class;
23171
23172 gobject_class = G_OBJECT_CLASS (klass);
23173 gobject_class->finalize = flash_control_proxy_finalize;
23174 gobject_class->get_property = flash_control_proxy_get_property;
23175 gobject_class->set_property = flash_control_proxy_set_property;
23176
23177 proxy_class = G_DBUS_PROXY_CLASS (klass);
23178 proxy_class->g_signal = flash_control_proxy_g_signal;
23179 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
23180
23181 flash_control_override_properties (gobject_class, 1);
23182
23183#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23184 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
23185#endif
23186}
23187
23188static void
23189flash_control_proxy_iface_init (FlashControlIface *iface)
23190{
23191 iface->get_filename = flash_control_proxy_get_filename;
23192 iface->get_type_ = flash_control_proxy_get_type_;
23193}
23194
23195/**
23196 * flash_control_proxy_new:
23197 * @connection: A #GDBusConnection.
23198 * @flags: Flags from the #GDBusProxyFlags enumeration.
23199 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23200 * @object_path: An object path.
23201 * @cancellable: (allow-none): A #GCancellable or %NULL.
23202 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23203 * @user_data: User data to pass to @callback.
23204 *
23205 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new() for more details.
23206 *
23207 * 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.
23208 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
23209 *
23210 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
23211 */
23212void
23213flash_control_proxy_new (
23214 GDBusConnection *connection,
23215 GDBusProxyFlags flags,
23216 const gchar *name,
23217 const gchar *object_path,
23218 GCancellable *cancellable,
23219 GAsyncReadyCallback callback,
23220 gpointer user_data)
23221{
23222 g_async_initable_new_async (TYPE_FLASH_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.FlashControl", NULL);
23223}
23224
23225/**
23226 * flash_control_proxy_new_finish:
23227 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
23228 * @error: Return location for error or %NULL
23229 *
23230 * Finishes an operation started with flash_control_proxy_new().
23231 *
23232 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23233 */
23234FlashControl *
23235flash_control_proxy_new_finish (
23236 GAsyncResult *res,
23237 GError **error)
23238{
23239 GObject *ret;
23240 GObject *source_object;
23241 source_object = g_async_result_get_source_object (res);
23242 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23243 g_object_unref (source_object);
23244 if (ret != NULL)
23245 return FLASH_CONTROL (ret);
23246 else
23247 return NULL;
23248}
23249
23250/**
23251 * flash_control_proxy_new_sync:
23252 * @connection: A #GDBusConnection.
23253 * @flags: Flags from the #GDBusProxyFlags enumeration.
23254 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23255 * @object_path: An object path.
23256 * @cancellable: (allow-none): A #GCancellable or %NULL.
23257 * @error: Return location for error or %NULL
23258 *
23259 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new_sync() for more details.
23260 *
23261 * The calling thread is blocked until a reply is received.
23262 *
23263 * See flash_control_proxy_new() for the asynchronous version of this constructor.
23264 *
23265 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23266 */
23267FlashControl *
23268flash_control_proxy_new_sync (
23269 GDBusConnection *connection,
23270 GDBusProxyFlags flags,
23271 const gchar *name,
23272 const gchar *object_path,
23273 GCancellable *cancellable,
23274 GError **error)
23275{
23276 GInitable *ret;
23277 ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL);
23278 if (ret != NULL)
23279 return FLASH_CONTROL (ret);
23280 else
23281 return NULL;
23282}
23283
23284
23285/**
23286 * flash_control_proxy_new_for_bus:
23287 * @bus_type: A #GBusType.
23288 * @flags: Flags from the #GDBusProxyFlags enumeration.
23289 * @name: A bus name (well-known or unique).
23290 * @object_path: An object path.
23291 * @cancellable: (allow-none): A #GCancellable or %NULL.
23292 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23293 * @user_data: User data to pass to @callback.
23294 *
23295 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23296 *
23297 * 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.
23298 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
23299 *
23300 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23301 */
23302void
23303flash_control_proxy_new_for_bus (
23304 GBusType bus_type,
23305 GDBusProxyFlags flags,
23306 const gchar *name,
23307 const gchar *object_path,
23308 GCancellable *cancellable,
23309 GAsyncReadyCallback callback,
23310 gpointer user_data)
23311{
23312 g_async_initable_new_async (TYPE_FLASH_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.FlashControl", NULL);
23313}
23314
23315/**
23316 * flash_control_proxy_new_for_bus_finish:
23317 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
23318 * @error: Return location for error or %NULL
23319 *
23320 * Finishes an operation started with flash_control_proxy_new_for_bus().
23321 *
23322 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23323 */
23324FlashControl *
23325flash_control_proxy_new_for_bus_finish (
23326 GAsyncResult *res,
23327 GError **error)
23328{
23329 GObject *ret;
23330 GObject *source_object;
23331 source_object = g_async_result_get_source_object (res);
23332 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23333 g_object_unref (source_object);
23334 if (ret != NULL)
23335 return FLASH_CONTROL (ret);
23336 else
23337 return NULL;
23338}
23339
23340/**
23341 * flash_control_proxy_new_for_bus_sync:
23342 * @bus_type: A #GBusType.
23343 * @flags: Flags from the #GDBusProxyFlags enumeration.
23344 * @name: A bus name (well-known or unique).
23345 * @object_path: An object path.
23346 * @cancellable: (allow-none): A #GCancellable or %NULL.
23347 * @error: Return location for error or %NULL
23348 *
23349 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23350 *
23351 * The calling thread is blocked until a reply is received.
23352 *
23353 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
23354 *
23355 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23356 */
23357FlashControl *
23358flash_control_proxy_new_for_bus_sync (
23359 GBusType bus_type,
23360 GDBusProxyFlags flags,
23361 const gchar *name,
23362 const gchar *object_path,
23363 GCancellable *cancellable,
23364 GError **error)
23365{
23366 GInitable *ret;
23367 ret = g_initable_new (TYPE_FLASH_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.FlashControl", NULL);
23368 if (ret != NULL)
23369 return FLASH_CONTROL (ret);
23370 else
23371 return NULL;
23372}
23373
23374
23375/* ------------------------------------------------------------------------ */
23376
23377/**
23378 * FlashControlSkeleton:
23379 *
23380 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
23381 */
23382
23383/**
23384 * FlashControlSkeletonClass:
23385 * @parent_class: The parent class.
23386 *
23387 * Class structure for #FlashControlSkeleton.
23388 */
23389
23390struct _FlashControlSkeletonPrivate
23391{
23392 GValue *properties;
23393 GList *changed_properties;
23394 GSource *changed_properties_idle_source;
23395 GMainContext *context;
23396 GMutex lock;
23397};
23398
23399static void
23400_flash_control_skeleton_handle_method_call (
23401 GDBusConnection *connection G_GNUC_UNUSED,
23402 const gchar *sender G_GNUC_UNUSED,
23403 const gchar *object_path G_GNUC_UNUSED,
23404 const gchar *interface_name,
23405 const gchar *method_name,
23406 GVariant *parameters,
23407 GDBusMethodInvocation *invocation,
23408 gpointer user_data)
23409{
23410 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23411 _ExtendedGDBusMethodInfo *info;
23412 GVariantIter iter;
23413 GVariant *child;
23414 GValue *paramv;
23415 guint num_params;
23416 guint num_extra;
23417 guint n;
23418 guint signal_id;
23419 GValue return_value = G_VALUE_INIT;
23420 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23421 g_assert (info != NULL);
23422 num_params = g_variant_n_children (parameters);
23423 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23424 n = 0;
23425 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
23426 g_value_set_object (&paramv[n++], skeleton);
23427 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23428 g_value_set_object (&paramv[n++], invocation);
23429 if (info->pass_fdlist)
23430 {
23431#ifdef G_OS_UNIX
23432 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23433 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23434#else
23435 g_assert_not_reached ();
23436#endif
23437 }
23438 g_variant_iter_init (&iter, parameters);
23439 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23440 {
23441 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23442 if (arg_info->use_gvariant)
23443 {
23444 g_value_init (&paramv[n], G_TYPE_VARIANT);
23445 g_value_set_variant (&paramv[n], child);
23446 n++;
23447 }
23448 else
23449 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23450 g_variant_unref (child);
23451 }
23452 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
23453 g_value_init (&return_value, G_TYPE_BOOLEAN);
23454 g_signal_emitv (paramv, signal_id, 0, &return_value);
23455 if (!g_value_get_boolean (&return_value))
23456 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);
23457 g_value_unset (&return_value);
23458 for (n = 0; n < num_params + num_extra; n++)
23459 g_value_unset (&paramv[n]);
23460 g_free (paramv);
23461}
23462
23463static GVariant *
23464_flash_control_skeleton_handle_get_property (
23465 GDBusConnection *connection G_GNUC_UNUSED,
23466 const gchar *sender G_GNUC_UNUSED,
23467 const gchar *object_path G_GNUC_UNUSED,
23468 const gchar *interface_name G_GNUC_UNUSED,
23469 const gchar *property_name,
23470 GError **error,
23471 gpointer user_data)
23472{
23473 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23474 GValue value = G_VALUE_INIT;
23475 GParamSpec *pspec;
23476 _ExtendedGDBusPropertyInfo *info;
23477 GVariant *ret;
23478 ret = NULL;
23479 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
23480 g_assert (info != NULL);
23481 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23482 if (pspec == NULL)
23483 {
23484 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23485 }
23486 else
23487 {
23488 g_value_init (&value, pspec->value_type);
23489 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23490 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23491 g_value_unset (&value);
23492 }
23493 return ret;
23494}
23495
23496static gboolean
23497_flash_control_skeleton_handle_set_property (
23498 GDBusConnection *connection G_GNUC_UNUSED,
23499 const gchar *sender G_GNUC_UNUSED,
23500 const gchar *object_path G_GNUC_UNUSED,
23501 const gchar *interface_name G_GNUC_UNUSED,
23502 const gchar *property_name,
23503 GVariant *variant,
23504 GError **error,
23505 gpointer user_data)
23506{
23507 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23508 GValue value = G_VALUE_INIT;
23509 GParamSpec *pspec;
23510 _ExtendedGDBusPropertyInfo *info;
23511 gboolean ret;
23512 ret = FALSE;
23513 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
23514 g_assert (info != NULL);
23515 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23516 if (pspec == NULL)
23517 {
23518 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23519 }
23520 else
23521 {
23522 if (info->use_gvariant)
23523 g_value_set_variant (&value, variant);
23524 else
23525 g_dbus_gvariant_to_gvalue (variant, &value);
23526 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23527 g_value_unset (&value);
23528 ret = TRUE;
23529 }
23530 return ret;
23531}
23532
23533static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
23534{
23535 _flash_control_skeleton_handle_method_call,
23536 _flash_control_skeleton_handle_get_property,
23537 _flash_control_skeleton_handle_set_property,
23538 {NULL}
23539};
23540
23541static GDBusInterfaceInfo *
23542flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23543{
23544 return flash_control_interface_info ();
23545}
23546
23547static GDBusInterfaceVTable *
23548flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23549{
23550 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
23551}
23552
23553static GVariant *
23554flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23555{
23556 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
23557
23558 GVariantBuilder builder;
23559 guint n;
23560 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23561 if (_flash_control_interface_info.parent_struct.properties == NULL)
23562 goto out;
23563 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
23564 {
23565 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
23566 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23567 {
23568 GVariant *value;
23569 value = _flash_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.FlashControl", info->name, NULL, skeleton);
23570 if (value != NULL)
23571 {
23572 g_variant_take_ref (value);
23573 g_variant_builder_add (&builder, "{sv}", info->name, value);
23574 g_variant_unref (value);
23575 }
23576 }
23577 }
23578out:
23579 return g_variant_builder_end (&builder);
23580}
23581
23582static gboolean _flash_control_emit_changed (gpointer user_data);
23583
23584static void
23585flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23586{
23587 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
23588 gboolean emit_changed = FALSE;
23589
23590 g_mutex_lock (&skeleton->priv->lock);
23591 if (skeleton->priv->changed_properties_idle_source != NULL)
23592 {
23593 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23594 skeleton->priv->changed_properties_idle_source = NULL;
23595 emit_changed = TRUE;
23596 }
23597 g_mutex_unlock (&skeleton->priv->lock);
23598
23599 if (emit_changed)
23600 _flash_control_emit_changed (skeleton);
23601}
23602
23603static void
23604_flash_control_on_signal_done (
23605 FlashControl *object,
23606 const gchar *arg_filename)
23607{
23608 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23609
23610 GList *connections, *l;
23611 GVariant *signal_variant;
23612 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23613
23614 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
23615 arg_filename));
23616 for (l = connections; l != NULL; l = l->next)
23617 {
23618 GDBusConnection *connection = l->data;
23619 g_dbus_connection_emit_signal (connection,
23620 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
23621 signal_variant, NULL);
23622 }
23623 g_variant_unref (signal_variant);
23624 g_list_free_full (connections, g_object_unref);
23625}
23626
23627static void
23628_flash_control_on_signal_error (
23629 FlashControl *object,
23630 const gchar *arg_filename)
23631{
23632 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23633
23634 GList *connections, *l;
23635 GVariant *signal_variant;
23636 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23637
23638 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
23639 arg_filename));
23640 for (l = connections; l != NULL; l = l->next)
23641 {
23642 GDBusConnection *connection = l->data;
23643 g_dbus_connection_emit_signal (connection,
23644 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
23645 signal_variant, NULL);
23646 }
23647 g_variant_unref (signal_variant);
23648 g_list_free_full (connections, g_object_unref);
23649}
23650
23651static void
23652_flash_control_on_signal_progress (
23653 FlashControl *object,
23654 const gchar *arg_filename,
23655 guchar arg_progress)
23656{
23657 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23658
23659 GList *connections, *l;
23660 GVariant *signal_variant;
23661 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23662
23663 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
23664 arg_filename,
23665 arg_progress));
23666 for (l = connections; l != NULL; l = l->next)
23667 {
23668 GDBusConnection *connection = l->data;
23669 g_dbus_connection_emit_signal (connection,
23670 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
23671 signal_variant, NULL);
23672 }
23673 g_variant_unref (signal_variant);
23674 g_list_free_full (connections, g_object_unref);
23675}
23676
23677static void flash_control_skeleton_iface_init (FlashControlIface *iface);
23678#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23679G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23680 G_ADD_PRIVATE (FlashControlSkeleton)
23681 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
23682
23683#else
23684G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23685 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
23686
23687#endif
23688static void
23689flash_control_skeleton_finalize (GObject *object)
23690{
23691 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23692 guint n;
23693 for (n = 0; n < 2; n++)
23694 g_value_unset (&skeleton->priv->properties[n]);
23695 g_free (skeleton->priv->properties);
23696 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23697 if (skeleton->priv->changed_properties_idle_source != NULL)
23698 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23699 g_main_context_unref (skeleton->priv->context);
23700 g_mutex_clear (&skeleton->priv->lock);
23701 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
23702}
23703
23704static void
23705flash_control_skeleton_get_property (GObject *object,
23706 guint prop_id,
23707 GValue *value,
23708 GParamSpec *pspec G_GNUC_UNUSED)
23709{
23710 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23711 g_assert (prop_id != 0 && prop_id - 1 < 2);
23712 g_mutex_lock (&skeleton->priv->lock);
23713 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23714 g_mutex_unlock (&skeleton->priv->lock);
23715}
23716
23717static gboolean
23718_flash_control_emit_changed (gpointer user_data)
23719{
23720 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23721 GList *l;
23722 GVariantBuilder builder;
23723 GVariantBuilder invalidated_builder;
23724 guint num_changes;
23725
23726 g_mutex_lock (&skeleton->priv->lock);
23727 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23728 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23729 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23730 {
23731 ChangedProperty *cp = l->data;
23732 GVariant *variant;
23733 const GValue *cur_value;
23734
23735 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23736 if (!_g_value_equal (cur_value, &cp->orig_value))
23737 {
23738 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23739 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23740 g_variant_unref (variant);
23741 num_changes++;
23742 }
23743 }
23744 if (num_changes > 0)
23745 {
23746 GList *connections, *ll;
23747 GVariant *signal_variant;
23748 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
23749 &builder, &invalidated_builder));
23750 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23751 for (ll = connections; ll != NULL; ll = ll->next)
23752 {
23753 GDBusConnection *connection = ll->data;
23754
23755 g_dbus_connection_emit_signal (connection,
23756 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23757 "org.freedesktop.DBus.Properties",
23758 "PropertiesChanged",
23759 signal_variant,
23760 NULL);
23761 }
23762 g_variant_unref (signal_variant);
23763 g_list_free_full (connections, g_object_unref);
23764 }
23765 else
23766 {
23767 g_variant_builder_clear (&builder);
23768 g_variant_builder_clear (&invalidated_builder);
23769 }
23770 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23771 skeleton->priv->changed_properties = NULL;
23772 skeleton->priv->changed_properties_idle_source = NULL;
23773 g_mutex_unlock (&skeleton->priv->lock);
23774 return FALSE;
23775}
23776
23777static void
23778_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23779{
23780 ChangedProperty *cp;
23781 GList *l;
23782 cp = NULL;
23783 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23784 {
23785 ChangedProperty *i_cp = l->data;
23786 if (i_cp->info == info)
23787 {
23788 cp = i_cp;
23789 break;
23790 }
23791 }
23792 if (cp == NULL)
23793 {
23794 cp = g_new0 (ChangedProperty, 1);
23795 cp->prop_id = prop_id;
23796 cp->info = info;
23797 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23798 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23799 g_value_copy (orig_value, &cp->orig_value);
23800 }
23801}
23802
23803static void
23804flash_control_skeleton_notify (GObject *object,
23805 GParamSpec *pspec G_GNUC_UNUSED)
23806{
23807 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23808 g_mutex_lock (&skeleton->priv->lock);
23809 if (skeleton->priv->changed_properties != NULL &&
23810 skeleton->priv->changed_properties_idle_source == NULL)
23811 {
23812 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23813 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23814 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23815 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23816 g_source_unref (skeleton->priv->changed_properties_idle_source);
23817 }
23818 g_mutex_unlock (&skeleton->priv->lock);
23819}
23820
23821static void
23822flash_control_skeleton_set_property (GObject *object,
23823 guint prop_id,
23824 const GValue *value,
23825 GParamSpec *pspec)
23826{
23827 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23828 g_assert (prop_id != 0 && prop_id - 1 < 2);
23829 g_mutex_lock (&skeleton->priv->lock);
23830 g_object_freeze_notify (object);
23831 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23832 {
23833 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23834 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23835 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23836 g_object_notify_by_pspec (object, pspec);
23837 }
23838 g_mutex_unlock (&skeleton->priv->lock);
23839 g_object_thaw_notify (object);
23840}
23841
23842static void
23843flash_control_skeleton_init (FlashControlSkeleton *skeleton)
23844{
23845#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23846 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
23847#else
23848 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
23849#endif
23850
23851 g_mutex_init (&skeleton->priv->lock);
23852 skeleton->priv->context = g_main_context_ref_thread_default ();
23853 skeleton->priv->properties = g_new0 (GValue, 2);
23854 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
23855 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23856}
23857
23858static const gchar *
23859flash_control_skeleton_get_filename (FlashControl *object)
23860{
23861 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23862 const gchar *value;
23863 g_mutex_lock (&skeleton->priv->lock);
23864 value = g_value_get_string (&(skeleton->priv->properties[0]));
23865 g_mutex_unlock (&skeleton->priv->lock);
23866 return value;
23867}
23868
23869static const gchar *
23870flash_control_skeleton_get_type_ (FlashControl *object)
23871{
23872 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23873 const gchar *value;
23874 g_mutex_lock (&skeleton->priv->lock);
23875 value = g_value_get_string (&(skeleton->priv->properties[1]));
23876 g_mutex_unlock (&skeleton->priv->lock);
23877 return value;
23878}
23879
23880static void
23881flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
23882{
23883 GObjectClass *gobject_class;
23884 GDBusInterfaceSkeletonClass *skeleton_class;
23885
23886 gobject_class = G_OBJECT_CLASS (klass);
23887 gobject_class->finalize = flash_control_skeleton_finalize;
23888 gobject_class->get_property = flash_control_skeleton_get_property;
23889 gobject_class->set_property = flash_control_skeleton_set_property;
23890 gobject_class->notify = flash_control_skeleton_notify;
23891
23892
23893 flash_control_override_properties (gobject_class, 1);
23894
23895 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23896 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
23897 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
23898 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
23899 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
23900
23901#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23902 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
23903#endif
23904}
23905
23906static void
23907flash_control_skeleton_iface_init (FlashControlIface *iface)
23908{
23909 iface->done = _flash_control_on_signal_done;
23910 iface->error = _flash_control_on_signal_error;
23911 iface->progress = _flash_control_on_signal_progress;
23912 iface->get_filename = flash_control_skeleton_get_filename;
23913 iface->get_type_ = flash_control_skeleton_get_type_;
23914}
23915
23916/**
23917 * flash_control_skeleton_new:
23918 *
23919 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
23920 *
23921 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
23922 */
23923FlashControl *
23924flash_control_skeleton_new (void)
23925{
23926 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
23927}
23928
23929/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050023930 * Code for interface org.openbmc.Button
23931 * ------------------------------------------------------------------------
23932 */
23933
23934/**
23935 * SECTION:Button
23936 * @title: Button
23937 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
23938 *
23939 * 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.
23940 */
23941
23942/* ---- Introspection data for org.openbmc.Button ---- */
23943
23944static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
23945{
23946 {
23947 -1,
23948 (gchar *) "state",
23949 (gchar *) "b",
23950 NULL
23951 },
23952 FALSE
23953};
23954
23955static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
23956{
23957 &_button_method_info_is_on_OUT_ARG_state,
23958 NULL
23959};
23960
23961static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
23962{
23963 {
23964 -1,
23965 (gchar *) "isOn",
23966 NULL,
23967 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
23968 NULL
23969 },
23970 "handle-is-on",
23971 FALSE
23972};
23973
23974static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
23975{
23976 {
23977 -1,
23978 (gchar *) "simButtonPress",
23979 NULL,
23980 NULL,
23981 NULL
23982 },
23983 "handle-sim-button-press",
23984 FALSE
23985};
23986
23987static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
23988{
23989 {
23990 -1,
23991 (gchar *) "simButtonLongPress",
23992 NULL,
23993 NULL,
23994 NULL
23995 },
23996 "handle-sim-button-long-press",
23997 FALSE
23998};
23999
24000static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
24001{
24002 &_button_method_info_is_on,
24003 &_button_method_info_sim_button_press,
24004 &_button_method_info_sim_button_long_press,
24005 NULL
24006};
24007
24008static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
24009{
24010 {
24011 -1,
24012 (gchar *) "ButtonRelease",
24013 NULL,
24014 NULL
24015 },
24016 "button-release"
24017};
24018
24019static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
24020{
24021 {
24022 -1,
24023 (gchar *) "ButtonPressed",
24024 NULL,
24025 NULL
24026 },
24027 "button-pressed"
24028};
24029
24030static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
24031{
24032 {
24033 -1,
24034 (gchar *) "ButtonPressedLong",
24035 NULL,
24036 NULL
24037 },
24038 "button-pressed-long"
24039};
24040
24041static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
24042{
24043 &_button_signal_info_button_release,
24044 &_button_signal_info_button_pressed,
24045 &_button_signal_info_button_pressed_long,
24046 NULL
24047};
24048
24049static const _ExtendedGDBusPropertyInfo _button_property_info_state =
24050{
24051 {
24052 -1,
24053 (gchar *) "state",
24054 (gchar *) "b",
24055 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24056 NULL
24057 },
24058 "state",
24059 FALSE
24060};
24061
24062static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
24063{
24064 &_button_property_info_state,
24065 NULL
24066};
24067
24068static const _ExtendedGDBusInterfaceInfo _button_interface_info =
24069{
24070 {
24071 -1,
24072 (gchar *) "org.openbmc.Button",
24073 (GDBusMethodInfo **) &_button_method_info_pointers,
24074 (GDBusSignalInfo **) &_button_signal_info_pointers,
24075 (GDBusPropertyInfo **) &_button_property_info_pointers,
24076 NULL
24077 },
24078 "button",
24079};
24080
24081
24082/**
24083 * button_interface_info:
24084 *
24085 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
24086 *
24087 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24088 */
24089GDBusInterfaceInfo *
24090button_interface_info (void)
24091{
24092 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
24093}
24094
24095/**
24096 * button_override_properties:
24097 * @klass: The class structure for a #GObject<!-- -->-derived class.
24098 * @property_id_begin: The property id to assign to the first overridden property.
24099 *
24100 * Overrides all #GObject properties in the #Button interface for a concrete class.
24101 * The properties are overridden in the order they are defined.
24102 *
24103 * Returns: The last property id.
24104 */
24105guint
24106button_override_properties (GObjectClass *klass, guint property_id_begin)
24107{
24108 g_object_class_override_property (klass, property_id_begin++, "state");
24109 return property_id_begin - 1;
24110}
24111
24112
24113
24114/**
24115 * Button:
24116 *
24117 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
24118 */
24119
24120/**
24121 * ButtonIface:
24122 * @parent_iface: The parent interface.
24123 * @handle_is_on: Handler for the #Button::handle-is-on signal.
24124 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
24125 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
24126 * @get_state: Getter for the #Button:state property.
24127 * @button_pressed: Handler for the #Button::button-pressed signal.
24128 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
24129 * @button_release: Handler for the #Button::button-release signal.
24130 *
24131 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
24132 */
24133
24134typedef ButtonIface ButtonInterface;
24135G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
24136
24137static void
24138button_default_init (ButtonIface *iface)
24139{
24140 /* GObject signals for incoming D-Bus method calls: */
24141 /**
24142 * Button::handle-is-on:
24143 * @object: A #Button.
24144 * @invocation: A #GDBusMethodInvocation.
24145 *
24146 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
24147 *
24148 * 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.
24149 *
24150 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24151 */
24152 g_signal_new ("handle-is-on",
24153 G_TYPE_FROM_INTERFACE (iface),
24154 G_SIGNAL_RUN_LAST,
24155 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
24156 g_signal_accumulator_true_handled,
24157 NULL,
24158 g_cclosure_marshal_generic,
24159 G_TYPE_BOOLEAN,
24160 1,
24161 G_TYPE_DBUS_METHOD_INVOCATION);
24162
24163 /**
24164 * Button::handle-sim-button-press:
24165 * @object: A #Button.
24166 * @invocation: A #GDBusMethodInvocation.
24167 *
24168 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
24169 *
24170 * 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.
24171 *
24172 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24173 */
24174 g_signal_new ("handle-sim-button-press",
24175 G_TYPE_FROM_INTERFACE (iface),
24176 G_SIGNAL_RUN_LAST,
24177 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
24178 g_signal_accumulator_true_handled,
24179 NULL,
24180 g_cclosure_marshal_generic,
24181 G_TYPE_BOOLEAN,
24182 1,
24183 G_TYPE_DBUS_METHOD_INVOCATION);
24184
24185 /**
24186 * Button::handle-sim-button-long-press:
24187 * @object: A #Button.
24188 * @invocation: A #GDBusMethodInvocation.
24189 *
24190 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
24191 *
24192 * 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.
24193 *
24194 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24195 */
24196 g_signal_new ("handle-sim-button-long-press",
24197 G_TYPE_FROM_INTERFACE (iface),
24198 G_SIGNAL_RUN_LAST,
24199 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
24200 g_signal_accumulator_true_handled,
24201 NULL,
24202 g_cclosure_marshal_generic,
24203 G_TYPE_BOOLEAN,
24204 1,
24205 G_TYPE_DBUS_METHOD_INVOCATION);
24206
24207 /* GObject signals for received D-Bus signals: */
24208 /**
24209 * Button::button-release:
24210 * @object: A #Button.
24211 *
24212 * 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.
24213 *
24214 * 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.
24215 */
24216 g_signal_new ("button-release",
24217 G_TYPE_FROM_INTERFACE (iface),
24218 G_SIGNAL_RUN_LAST,
24219 G_STRUCT_OFFSET (ButtonIface, button_release),
24220 NULL,
24221 NULL,
24222 g_cclosure_marshal_generic,
24223 G_TYPE_NONE,
24224 0);
24225
24226 /**
24227 * Button::button-pressed:
24228 * @object: A #Button.
24229 *
24230 * 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.
24231 *
24232 * 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.
24233 */
24234 g_signal_new ("button-pressed",
24235 G_TYPE_FROM_INTERFACE (iface),
24236 G_SIGNAL_RUN_LAST,
24237 G_STRUCT_OFFSET (ButtonIface, button_pressed),
24238 NULL,
24239 NULL,
24240 g_cclosure_marshal_generic,
24241 G_TYPE_NONE,
24242 0);
24243
24244 /**
24245 * Button::button-pressed-long:
24246 * @object: A #Button.
24247 *
24248 * 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.
24249 *
24250 * 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.
24251 */
24252 g_signal_new ("button-pressed-long",
24253 G_TYPE_FROM_INTERFACE (iface),
24254 G_SIGNAL_RUN_LAST,
24255 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
24256 NULL,
24257 NULL,
24258 g_cclosure_marshal_generic,
24259 G_TYPE_NONE,
24260 0);
24261
24262 /* GObject properties for D-Bus properties: */
24263 /**
24264 * Button:state:
24265 *
24266 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
24267 *
24268 * 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.
24269 */
24270 g_object_interface_install_property (iface,
24271 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24272}
24273
24274/**
24275 * button_get_state: (skip)
24276 * @object: A #Button.
24277 *
24278 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
24279 *
24280 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24281 *
24282 * Returns: The property value.
24283 */
24284gboolean
24285button_get_state (Button *object)
24286{
24287 return BUTTON_GET_IFACE (object)->get_state (object);
24288}
24289
24290/**
24291 * button_set_state: (skip)
24292 * @object: A #Button.
24293 * @value: The value to set.
24294 *
24295 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
24296 *
24297 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24298 */
24299void
24300button_set_state (Button *object, gboolean value)
24301{
24302 g_object_set (G_OBJECT (object), "state", value, NULL);
24303}
24304
24305/**
24306 * button_emit_button_release:
24307 * @object: A #Button.
24308 *
24309 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
24310 */
24311void
24312button_emit_button_release (
24313 Button *object)
24314{
24315 g_signal_emit_by_name (object, "button-release");
24316}
24317
24318/**
24319 * button_emit_button_pressed:
24320 * @object: A #Button.
24321 *
24322 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
24323 */
24324void
24325button_emit_button_pressed (
24326 Button *object)
24327{
24328 g_signal_emit_by_name (object, "button-pressed");
24329}
24330
24331/**
24332 * button_emit_button_pressed_long:
24333 * @object: A #Button.
24334 *
24335 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
24336 */
24337void
24338button_emit_button_pressed_long (
24339 Button *object)
24340{
24341 g_signal_emit_by_name (object, "button-pressed-long");
24342}
24343
24344/**
24345 * button_call_is_on:
24346 * @proxy: A #ButtonProxy.
24347 * @cancellable: (allow-none): A #GCancellable or %NULL.
24348 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24349 * @user_data: User data to pass to @callback.
24350 *
24351 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
24352 * 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.
24353 * You can then call button_call_is_on_finish() to get the result of the operation.
24354 *
24355 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
24356 */
24357void
24358button_call_is_on (
24359 Button *proxy,
24360 GCancellable *cancellable,
24361 GAsyncReadyCallback callback,
24362 gpointer user_data)
24363{
24364 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24365 "isOn",
24366 g_variant_new ("()"),
24367 G_DBUS_CALL_FLAGS_NONE,
24368 -1,
24369 cancellable,
24370 callback,
24371 user_data);
24372}
24373
24374/**
24375 * button_call_is_on_finish:
24376 * @proxy: A #ButtonProxy.
24377 * @out_state: (out): Return location for return parameter or %NULL to ignore.
24378 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
24379 * @error: Return location for error or %NULL.
24380 *
24381 * Finishes an operation started with button_call_is_on().
24382 *
24383 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24384 */
24385gboolean
24386button_call_is_on_finish (
24387 Button *proxy,
24388 gboolean *out_state,
24389 GAsyncResult *res,
24390 GError **error)
24391{
24392 GVariant *_ret;
24393 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24394 if (_ret == NULL)
24395 goto _out;
24396 g_variant_get (_ret,
24397 "(b)",
24398 out_state);
24399 g_variant_unref (_ret);
24400_out:
24401 return _ret != NULL;
24402}
24403
24404/**
24405 * button_call_is_on_sync:
24406 * @proxy: A #ButtonProxy.
24407 * @out_state: (out): Return location for return parameter or %NULL to ignore.
24408 * @cancellable: (allow-none): A #GCancellable or %NULL.
24409 * @error: Return location for error or %NULL.
24410 *
24411 * 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.
24412 *
24413 * See button_call_is_on() for the asynchronous version of this method.
24414 *
24415 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24416 */
24417gboolean
24418button_call_is_on_sync (
24419 Button *proxy,
24420 gboolean *out_state,
24421 GCancellable *cancellable,
24422 GError **error)
24423{
24424 GVariant *_ret;
24425 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24426 "isOn",
24427 g_variant_new ("()"),
24428 G_DBUS_CALL_FLAGS_NONE,
24429 -1,
24430 cancellable,
24431 error);
24432 if (_ret == NULL)
24433 goto _out;
24434 g_variant_get (_ret,
24435 "(b)",
24436 out_state);
24437 g_variant_unref (_ret);
24438_out:
24439 return _ret != NULL;
24440}
24441
24442/**
24443 * button_call_sim_button_press:
24444 * @proxy: A #ButtonProxy.
24445 * @cancellable: (allow-none): A #GCancellable or %NULL.
24446 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24447 * @user_data: User data to pass to @callback.
24448 *
24449 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
24450 * 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.
24451 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
24452 *
24453 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
24454 */
24455void
24456button_call_sim_button_press (
24457 Button *proxy,
24458 GCancellable *cancellable,
24459 GAsyncReadyCallback callback,
24460 gpointer user_data)
24461{
24462 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24463 "simButtonPress",
24464 g_variant_new ("()"),
24465 G_DBUS_CALL_FLAGS_NONE,
24466 -1,
24467 cancellable,
24468 callback,
24469 user_data);
24470}
24471
24472/**
24473 * button_call_sim_button_press_finish:
24474 * @proxy: A #ButtonProxy.
24475 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
24476 * @error: Return location for error or %NULL.
24477 *
24478 * Finishes an operation started with button_call_sim_button_press().
24479 *
24480 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24481 */
24482gboolean
24483button_call_sim_button_press_finish (
24484 Button *proxy,
24485 GAsyncResult *res,
24486 GError **error)
24487{
24488 GVariant *_ret;
24489 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24490 if (_ret == NULL)
24491 goto _out;
24492 g_variant_get (_ret,
24493 "()");
24494 g_variant_unref (_ret);
24495_out:
24496 return _ret != NULL;
24497}
24498
24499/**
24500 * button_call_sim_button_press_sync:
24501 * @proxy: A #ButtonProxy.
24502 * @cancellable: (allow-none): A #GCancellable or %NULL.
24503 * @error: Return location for error or %NULL.
24504 *
24505 * 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.
24506 *
24507 * See button_call_sim_button_press() for the asynchronous version of this method.
24508 *
24509 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24510 */
24511gboolean
24512button_call_sim_button_press_sync (
24513 Button *proxy,
24514 GCancellable *cancellable,
24515 GError **error)
24516{
24517 GVariant *_ret;
24518 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24519 "simButtonPress",
24520 g_variant_new ("()"),
24521 G_DBUS_CALL_FLAGS_NONE,
24522 -1,
24523 cancellable,
24524 error);
24525 if (_ret == NULL)
24526 goto _out;
24527 g_variant_get (_ret,
24528 "()");
24529 g_variant_unref (_ret);
24530_out:
24531 return _ret != NULL;
24532}
24533
24534/**
24535 * button_call_sim_button_long_press:
24536 * @proxy: A #ButtonProxy.
24537 * @cancellable: (allow-none): A #GCancellable or %NULL.
24538 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24539 * @user_data: User data to pass to @callback.
24540 *
24541 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
24542 * 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.
24543 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
24544 *
24545 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
24546 */
24547void
24548button_call_sim_button_long_press (
24549 Button *proxy,
24550 GCancellable *cancellable,
24551 GAsyncReadyCallback callback,
24552 gpointer user_data)
24553{
24554 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24555 "simButtonLongPress",
24556 g_variant_new ("()"),
24557 G_DBUS_CALL_FLAGS_NONE,
24558 -1,
24559 cancellable,
24560 callback,
24561 user_data);
24562}
24563
24564/**
24565 * button_call_sim_button_long_press_finish:
24566 * @proxy: A #ButtonProxy.
24567 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
24568 * @error: Return location for error or %NULL.
24569 *
24570 * Finishes an operation started with button_call_sim_button_long_press().
24571 *
24572 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24573 */
24574gboolean
24575button_call_sim_button_long_press_finish (
24576 Button *proxy,
24577 GAsyncResult *res,
24578 GError **error)
24579{
24580 GVariant *_ret;
24581 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24582 if (_ret == NULL)
24583 goto _out;
24584 g_variant_get (_ret,
24585 "()");
24586 g_variant_unref (_ret);
24587_out:
24588 return _ret != NULL;
24589}
24590
24591/**
24592 * button_call_sim_button_long_press_sync:
24593 * @proxy: A #ButtonProxy.
24594 * @cancellable: (allow-none): A #GCancellable or %NULL.
24595 * @error: Return location for error or %NULL.
24596 *
24597 * 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.
24598 *
24599 * See button_call_sim_button_long_press() for the asynchronous version of this method.
24600 *
24601 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24602 */
24603gboolean
24604button_call_sim_button_long_press_sync (
24605 Button *proxy,
24606 GCancellable *cancellable,
24607 GError **error)
24608{
24609 GVariant *_ret;
24610 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24611 "simButtonLongPress",
24612 g_variant_new ("()"),
24613 G_DBUS_CALL_FLAGS_NONE,
24614 -1,
24615 cancellable,
24616 error);
24617 if (_ret == NULL)
24618 goto _out;
24619 g_variant_get (_ret,
24620 "()");
24621 g_variant_unref (_ret);
24622_out:
24623 return _ret != NULL;
24624}
24625
24626/**
24627 * button_complete_is_on:
24628 * @object: A #Button.
24629 * @invocation: (transfer full): A #GDBusMethodInvocation.
24630 * @state: Parameter to return.
24631 *
24632 * 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.
24633 *
24634 * This method will free @invocation, you cannot use it afterwards.
24635 */
24636void
24637button_complete_is_on (
24638 Button *object,
24639 GDBusMethodInvocation *invocation,
24640 gboolean state)
24641{
24642 g_dbus_method_invocation_return_value (invocation,
24643 g_variant_new ("(b)",
24644 state));
24645}
24646
24647/**
24648 * button_complete_sim_button_press:
24649 * @object: A #Button.
24650 * @invocation: (transfer full): A #GDBusMethodInvocation.
24651 *
24652 * 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.
24653 *
24654 * This method will free @invocation, you cannot use it afterwards.
24655 */
24656void
24657button_complete_sim_button_press (
24658 Button *object,
24659 GDBusMethodInvocation *invocation)
24660{
24661 g_dbus_method_invocation_return_value (invocation,
24662 g_variant_new ("()"));
24663}
24664
24665/**
24666 * button_complete_sim_button_long_press:
24667 * @object: A #Button.
24668 * @invocation: (transfer full): A #GDBusMethodInvocation.
24669 *
24670 * 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.
24671 *
24672 * This method will free @invocation, you cannot use it afterwards.
24673 */
24674void
24675button_complete_sim_button_long_press (
24676 Button *object,
24677 GDBusMethodInvocation *invocation)
24678{
24679 g_dbus_method_invocation_return_value (invocation,
24680 g_variant_new ("()"));
24681}
24682
24683/* ------------------------------------------------------------------------ */
24684
24685/**
24686 * ButtonProxy:
24687 *
24688 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
24689 */
24690
24691/**
24692 * ButtonProxyClass:
24693 * @parent_class: The parent class.
24694 *
24695 * Class structure for #ButtonProxy.
24696 */
24697
24698struct _ButtonProxyPrivate
24699{
24700 GData *qdata;
24701};
24702
24703static void button_proxy_iface_init (ButtonIface *iface);
24704
24705#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24706G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
24707 G_ADD_PRIVATE (ButtonProxy)
24708 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
24709
24710#else
24711G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
24712 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
24713
24714#endif
24715static void
24716button_proxy_finalize (GObject *object)
24717{
24718 ButtonProxy *proxy = BUTTON_PROXY (object);
24719 g_datalist_clear (&proxy->priv->qdata);
24720 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
24721}
24722
24723static void
24724button_proxy_get_property (GObject *object,
24725 guint prop_id,
24726 GValue *value,
24727 GParamSpec *pspec G_GNUC_UNUSED)
24728{
24729 const _ExtendedGDBusPropertyInfo *info;
24730 GVariant *variant;
24731 g_assert (prop_id != 0 && prop_id - 1 < 1);
24732 info = _button_property_info_pointers[prop_id - 1];
24733 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
24734 if (info->use_gvariant)
24735 {
24736 g_value_set_variant (value, variant);
24737 }
24738 else
24739 {
24740 if (variant != NULL)
24741 g_dbus_gvariant_to_gvalue (variant, value);
24742 }
24743 if (variant != NULL)
24744 g_variant_unref (variant);
24745}
24746
24747static void
24748button_proxy_set_property_cb (GDBusProxy *proxy,
24749 GAsyncResult *res,
24750 gpointer user_data)
24751{
24752 const _ExtendedGDBusPropertyInfo *info = user_data;
24753 GError *error;
24754 GVariant *_ret;
24755 error = NULL;
24756 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
24757 if (!_ret)
24758 {
24759 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
24760 info->parent_struct.name,
24761 error->message, g_quark_to_string (error->domain), error->code);
24762 g_error_free (error);
24763 }
24764 else
24765 {
24766 g_variant_unref (_ret);
24767 }
24768}
24769
24770static void
24771button_proxy_set_property (GObject *object,
24772 guint prop_id,
24773 const GValue *value,
24774 GParamSpec *pspec G_GNUC_UNUSED)
24775{
24776 const _ExtendedGDBusPropertyInfo *info;
24777 GVariant *variant;
24778 g_assert (prop_id != 0 && prop_id - 1 < 1);
24779 info = _button_property_info_pointers[prop_id - 1];
24780 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
24781 g_dbus_proxy_call (G_DBUS_PROXY (object),
24782 "org.freedesktop.DBus.Properties.Set",
24783 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
24784 G_DBUS_CALL_FLAGS_NONE,
24785 -1,
24786 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
24787 g_variant_unref (variant);
24788}
24789
24790static void
24791button_proxy_g_signal (GDBusProxy *proxy,
24792 const gchar *sender_name G_GNUC_UNUSED,
24793 const gchar *signal_name,
24794 GVariant *parameters)
24795{
24796 _ExtendedGDBusSignalInfo *info;
24797 GVariantIter iter;
24798 GVariant *child;
24799 GValue *paramv;
24800 guint num_params;
24801 guint n;
24802 guint signal_id;
24803 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
24804 if (info == NULL)
24805 return;
24806 num_params = g_variant_n_children (parameters);
24807 paramv = g_new0 (GValue, num_params + 1);
24808 g_value_init (&paramv[0], TYPE_BUTTON);
24809 g_value_set_object (&paramv[0], proxy);
24810 g_variant_iter_init (&iter, parameters);
24811 n = 1;
24812 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24813 {
24814 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
24815 if (arg_info->use_gvariant)
24816 {
24817 g_value_init (&paramv[n], G_TYPE_VARIANT);
24818 g_value_set_variant (&paramv[n], child);
24819 n++;
24820 }
24821 else
24822 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24823 g_variant_unref (child);
24824 }
24825 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
24826 g_signal_emitv (paramv, signal_id, 0, NULL);
24827 for (n = 0; n < num_params + 1; n++)
24828 g_value_unset (&paramv[n]);
24829 g_free (paramv);
24830}
24831
24832static void
24833button_proxy_g_properties_changed (GDBusProxy *_proxy,
24834 GVariant *changed_properties,
24835 const gchar *const *invalidated_properties)
24836{
24837 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
24838 guint n;
24839 const gchar *key;
24840 GVariantIter *iter;
24841 _ExtendedGDBusPropertyInfo *info;
24842 g_variant_get (changed_properties, "a{sv}", &iter);
24843 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
24844 {
24845 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
24846 g_datalist_remove_data (&proxy->priv->qdata, key);
24847 if (info != NULL)
24848 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24849 }
24850 g_variant_iter_free (iter);
24851 for (n = 0; invalidated_properties[n] != NULL; n++)
24852 {
24853 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
24854 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
24855 if (info != NULL)
24856 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24857 }
24858}
24859
24860static gboolean
24861button_proxy_get_state (Button *object)
24862{
24863 ButtonProxy *proxy = BUTTON_PROXY (object);
24864 GVariant *variant;
24865 gboolean value = 0;
24866 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
24867 if (variant != NULL)
24868 {
24869 value = g_variant_get_boolean (variant);
24870 g_variant_unref (variant);
24871 }
24872 return value;
24873}
24874
24875static void
24876button_proxy_init (ButtonProxy *proxy)
24877{
24878#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24879 proxy->priv = button_proxy_get_instance_private (proxy);
24880#else
24881 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
24882#endif
24883
24884 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
24885}
24886
24887static void
24888button_proxy_class_init (ButtonProxyClass *klass)
24889{
24890 GObjectClass *gobject_class;
24891 GDBusProxyClass *proxy_class;
24892
24893 gobject_class = G_OBJECT_CLASS (klass);
24894 gobject_class->finalize = button_proxy_finalize;
24895 gobject_class->get_property = button_proxy_get_property;
24896 gobject_class->set_property = button_proxy_set_property;
24897
24898 proxy_class = G_DBUS_PROXY_CLASS (klass);
24899 proxy_class->g_signal = button_proxy_g_signal;
24900 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
24901
24902 button_override_properties (gobject_class, 1);
24903
24904#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24905 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
24906#endif
24907}
24908
24909static void
24910button_proxy_iface_init (ButtonIface *iface)
24911{
24912 iface->get_state = button_proxy_get_state;
24913}
24914
24915/**
24916 * button_proxy_new:
24917 * @connection: A #GDBusConnection.
24918 * @flags: Flags from the #GDBusProxyFlags enumeration.
24919 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24920 * @object_path: An object path.
24921 * @cancellable: (allow-none): A #GCancellable or %NULL.
24922 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24923 * @user_data: User data to pass to @callback.
24924 *
24925 * 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.
24926 *
24927 * 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.
24928 * You can then call button_proxy_new_finish() to get the result of the operation.
24929 *
24930 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
24931 */
24932void
24933button_proxy_new (
24934 GDBusConnection *connection,
24935 GDBusProxyFlags flags,
24936 const gchar *name,
24937 const gchar *object_path,
24938 GCancellable *cancellable,
24939 GAsyncReadyCallback callback,
24940 gpointer user_data)
24941{
24942 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);
24943}
24944
24945/**
24946 * button_proxy_new_finish:
24947 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
24948 * @error: Return location for error or %NULL
24949 *
24950 * Finishes an operation started with button_proxy_new().
24951 *
24952 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
24953 */
24954Button *
24955button_proxy_new_finish (
24956 GAsyncResult *res,
24957 GError **error)
24958{
24959 GObject *ret;
24960 GObject *source_object;
24961 source_object = g_async_result_get_source_object (res);
24962 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24963 g_object_unref (source_object);
24964 if (ret != NULL)
24965 return BUTTON (ret);
24966 else
24967 return NULL;
24968}
24969
24970/**
24971 * button_proxy_new_sync:
24972 * @connection: A #GDBusConnection.
24973 * @flags: Flags from the #GDBusProxyFlags enumeration.
24974 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24975 * @object_path: An object path.
24976 * @cancellable: (allow-none): A #GCancellable or %NULL.
24977 * @error: Return location for error or %NULL
24978 *
24979 * 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.
24980 *
24981 * The calling thread is blocked until a reply is received.
24982 *
24983 * See button_proxy_new() for the asynchronous version of this constructor.
24984 *
24985 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
24986 */
24987Button *
24988button_proxy_new_sync (
24989 GDBusConnection *connection,
24990 GDBusProxyFlags flags,
24991 const gchar *name,
24992 const gchar *object_path,
24993 GCancellable *cancellable,
24994 GError **error)
24995{
24996 GInitable *ret;
24997 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);
24998 if (ret != NULL)
24999 return BUTTON (ret);
25000 else
25001 return NULL;
25002}
25003
25004
25005/**
25006 * button_proxy_new_for_bus:
25007 * @bus_type: A #GBusType.
25008 * @flags: Flags from the #GDBusProxyFlags enumeration.
25009 * @name: A bus name (well-known or unique).
25010 * @object_path: An object path.
25011 * @cancellable: (allow-none): A #GCancellable or %NULL.
25012 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25013 * @user_data: User data to pass to @callback.
25014 *
25015 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
25016 *
25017 * 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.
25018 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
25019 *
25020 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25021 */
25022void
25023button_proxy_new_for_bus (
25024 GBusType bus_type,
25025 GDBusProxyFlags flags,
25026 const gchar *name,
25027 const gchar *object_path,
25028 GCancellable *cancellable,
25029 GAsyncReadyCallback callback,
25030 gpointer user_data)
25031{
25032 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);
25033}
25034
25035/**
25036 * button_proxy_new_for_bus_finish:
25037 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
25038 * @error: Return location for error or %NULL
25039 *
25040 * Finishes an operation started with button_proxy_new_for_bus().
25041 *
25042 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25043 */
25044Button *
25045button_proxy_new_for_bus_finish (
25046 GAsyncResult *res,
25047 GError **error)
25048{
25049 GObject *ret;
25050 GObject *source_object;
25051 source_object = g_async_result_get_source_object (res);
25052 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25053 g_object_unref (source_object);
25054 if (ret != NULL)
25055 return BUTTON (ret);
25056 else
25057 return NULL;
25058}
25059
25060/**
25061 * button_proxy_new_for_bus_sync:
25062 * @bus_type: A #GBusType.
25063 * @flags: Flags from the #GDBusProxyFlags enumeration.
25064 * @name: A bus name (well-known or unique).
25065 * @object_path: An object path.
25066 * @cancellable: (allow-none): A #GCancellable or %NULL.
25067 * @error: Return location for error or %NULL
25068 *
25069 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25070 *
25071 * The calling thread is blocked until a reply is received.
25072 *
25073 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
25074 *
25075 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25076 */
25077Button *
25078button_proxy_new_for_bus_sync (
25079 GBusType bus_type,
25080 GDBusProxyFlags flags,
25081 const gchar *name,
25082 const gchar *object_path,
25083 GCancellable *cancellable,
25084 GError **error)
25085{
25086 GInitable *ret;
25087 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);
25088 if (ret != NULL)
25089 return BUTTON (ret);
25090 else
25091 return NULL;
25092}
25093
25094
25095/* ------------------------------------------------------------------------ */
25096
25097/**
25098 * ButtonSkeleton:
25099 *
25100 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
25101 */
25102
25103/**
25104 * ButtonSkeletonClass:
25105 * @parent_class: The parent class.
25106 *
25107 * Class structure for #ButtonSkeleton.
25108 */
25109
25110struct _ButtonSkeletonPrivate
25111{
25112 GValue *properties;
25113 GList *changed_properties;
25114 GSource *changed_properties_idle_source;
25115 GMainContext *context;
25116 GMutex lock;
25117};
25118
25119static void
25120_button_skeleton_handle_method_call (
25121 GDBusConnection *connection G_GNUC_UNUSED,
25122 const gchar *sender G_GNUC_UNUSED,
25123 const gchar *object_path G_GNUC_UNUSED,
25124 const gchar *interface_name,
25125 const gchar *method_name,
25126 GVariant *parameters,
25127 GDBusMethodInvocation *invocation,
25128 gpointer user_data)
25129{
25130 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25131 _ExtendedGDBusMethodInfo *info;
25132 GVariantIter iter;
25133 GVariant *child;
25134 GValue *paramv;
25135 guint num_params;
25136 guint num_extra;
25137 guint n;
25138 guint signal_id;
25139 GValue return_value = G_VALUE_INIT;
25140 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
25141 g_assert (info != NULL);
25142 num_params = g_variant_n_children (parameters);
25143 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
25144 n = 0;
25145 g_value_init (&paramv[n], TYPE_BUTTON);
25146 g_value_set_object (&paramv[n++], skeleton);
25147 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
25148 g_value_set_object (&paramv[n++], invocation);
25149 if (info->pass_fdlist)
25150 {
25151#ifdef G_OS_UNIX
25152 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
25153 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
25154#else
25155 g_assert_not_reached ();
25156#endif
25157 }
25158 g_variant_iter_init (&iter, parameters);
25159 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25160 {
25161 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
25162 if (arg_info->use_gvariant)
25163 {
25164 g_value_init (&paramv[n], G_TYPE_VARIANT);
25165 g_value_set_variant (&paramv[n], child);
25166 n++;
25167 }
25168 else
25169 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25170 g_variant_unref (child);
25171 }
25172 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
25173 g_value_init (&return_value, G_TYPE_BOOLEAN);
25174 g_signal_emitv (paramv, signal_id, 0, &return_value);
25175 if (!g_value_get_boolean (&return_value))
25176 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);
25177 g_value_unset (&return_value);
25178 for (n = 0; n < num_params + num_extra; n++)
25179 g_value_unset (&paramv[n]);
25180 g_free (paramv);
25181}
25182
25183static GVariant *
25184_button_skeleton_handle_get_property (
25185 GDBusConnection *connection G_GNUC_UNUSED,
25186 const gchar *sender G_GNUC_UNUSED,
25187 const gchar *object_path G_GNUC_UNUSED,
25188 const gchar *interface_name G_GNUC_UNUSED,
25189 const gchar *property_name,
25190 GError **error,
25191 gpointer user_data)
25192{
25193 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25194 GValue value = G_VALUE_INIT;
25195 GParamSpec *pspec;
25196 _ExtendedGDBusPropertyInfo *info;
25197 GVariant *ret;
25198 ret = NULL;
25199 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
25200 g_assert (info != NULL);
25201 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25202 if (pspec == NULL)
25203 {
25204 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25205 }
25206 else
25207 {
25208 g_value_init (&value, pspec->value_type);
25209 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25210 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
25211 g_value_unset (&value);
25212 }
25213 return ret;
25214}
25215
25216static gboolean
25217_button_skeleton_handle_set_property (
25218 GDBusConnection *connection G_GNUC_UNUSED,
25219 const gchar *sender G_GNUC_UNUSED,
25220 const gchar *object_path G_GNUC_UNUSED,
25221 const gchar *interface_name G_GNUC_UNUSED,
25222 const gchar *property_name,
25223 GVariant *variant,
25224 GError **error,
25225 gpointer user_data)
25226{
25227 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25228 GValue value = G_VALUE_INIT;
25229 GParamSpec *pspec;
25230 _ExtendedGDBusPropertyInfo *info;
25231 gboolean ret;
25232 ret = FALSE;
25233 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
25234 g_assert (info != NULL);
25235 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25236 if (pspec == NULL)
25237 {
25238 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25239 }
25240 else
25241 {
25242 if (info->use_gvariant)
25243 g_value_set_variant (&value, variant);
25244 else
25245 g_dbus_gvariant_to_gvalue (variant, &value);
25246 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25247 g_value_unset (&value);
25248 ret = TRUE;
25249 }
25250 return ret;
25251}
25252
25253static const GDBusInterfaceVTable _button_skeleton_vtable =
25254{
25255 _button_skeleton_handle_method_call,
25256 _button_skeleton_handle_get_property,
25257 _button_skeleton_handle_set_property,
25258 {NULL}
25259};
25260
25261static GDBusInterfaceInfo *
25262button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25263{
25264 return button_interface_info ();
25265}
25266
25267static GDBusInterfaceVTable *
25268button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25269{
25270 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
25271}
25272
25273static GVariant *
25274button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25275{
25276 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
25277
25278 GVariantBuilder builder;
25279 guint n;
25280 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25281 if (_button_interface_info.parent_struct.properties == NULL)
25282 goto out;
25283 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
25284 {
25285 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
25286 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25287 {
25288 GVariant *value;
25289 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);
25290 if (value != NULL)
25291 {
25292 g_variant_take_ref (value);
25293 g_variant_builder_add (&builder, "{sv}", info->name, value);
25294 g_variant_unref (value);
25295 }
25296 }
25297 }
25298out:
25299 return g_variant_builder_end (&builder);
25300}
25301
25302static gboolean _button_emit_changed (gpointer user_data);
25303
25304static void
25305button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25306{
25307 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
25308 gboolean emit_changed = FALSE;
25309
25310 g_mutex_lock (&skeleton->priv->lock);
25311 if (skeleton->priv->changed_properties_idle_source != NULL)
25312 {
25313 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25314 skeleton->priv->changed_properties_idle_source = NULL;
25315 emit_changed = TRUE;
25316 }
25317 g_mutex_unlock (&skeleton->priv->lock);
25318
25319 if (emit_changed)
25320 _button_emit_changed (skeleton);
25321}
25322
25323static void
25324_button_on_signal_button_release (
25325 Button *object)
25326{
25327 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25328
25329 GList *connections, *l;
25330 GVariant *signal_variant;
25331 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25332
25333 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25334 for (l = connections; l != NULL; l = l->next)
25335 {
25336 GDBusConnection *connection = l->data;
25337 g_dbus_connection_emit_signal (connection,
25338 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
25339 signal_variant, NULL);
25340 }
25341 g_variant_unref (signal_variant);
25342 g_list_free_full (connections, g_object_unref);
25343}
25344
25345static void
25346_button_on_signal_button_pressed (
25347 Button *object)
25348{
25349 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25350
25351 GList *connections, *l;
25352 GVariant *signal_variant;
25353 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25354
25355 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25356 for (l = connections; l != NULL; l = l->next)
25357 {
25358 GDBusConnection *connection = l->data;
25359 g_dbus_connection_emit_signal (connection,
25360 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
25361 signal_variant, NULL);
25362 }
25363 g_variant_unref (signal_variant);
25364 g_list_free_full (connections, g_object_unref);
25365}
25366
25367static void
25368_button_on_signal_button_pressed_long (
25369 Button *object)
25370{
25371 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25372
25373 GList *connections, *l;
25374 GVariant *signal_variant;
25375 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25376
25377 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25378 for (l = connections; l != NULL; l = l->next)
25379 {
25380 GDBusConnection *connection = l->data;
25381 g_dbus_connection_emit_signal (connection,
25382 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
25383 signal_variant, NULL);
25384 }
25385 g_variant_unref (signal_variant);
25386 g_list_free_full (connections, g_object_unref);
25387}
25388
25389static void button_skeleton_iface_init (ButtonIface *iface);
25390#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25391G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25392 G_ADD_PRIVATE (ButtonSkeleton)
25393 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
25394
25395#else
25396G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25397 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
25398
25399#endif
25400static void
25401button_skeleton_finalize (GObject *object)
25402{
25403 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25404 guint n;
25405 for (n = 0; n < 1; n++)
25406 g_value_unset (&skeleton->priv->properties[n]);
25407 g_free (skeleton->priv->properties);
25408 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25409 if (skeleton->priv->changed_properties_idle_source != NULL)
25410 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25411 g_main_context_unref (skeleton->priv->context);
25412 g_mutex_clear (&skeleton->priv->lock);
25413 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
25414}
25415
25416static void
25417button_skeleton_get_property (GObject *object,
25418 guint prop_id,
25419 GValue *value,
25420 GParamSpec *pspec G_GNUC_UNUSED)
25421{
25422 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25423 g_assert (prop_id != 0 && prop_id - 1 < 1);
25424 g_mutex_lock (&skeleton->priv->lock);
25425 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
25426 g_mutex_unlock (&skeleton->priv->lock);
25427}
25428
25429static gboolean
25430_button_emit_changed (gpointer user_data)
25431{
25432 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25433 GList *l;
25434 GVariantBuilder builder;
25435 GVariantBuilder invalidated_builder;
25436 guint num_changes;
25437
25438 g_mutex_lock (&skeleton->priv->lock);
25439 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25440 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
25441 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
25442 {
25443 ChangedProperty *cp = l->data;
25444 GVariant *variant;
25445 const GValue *cur_value;
25446
25447 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
25448 if (!_g_value_equal (cur_value, &cp->orig_value))
25449 {
25450 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
25451 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
25452 g_variant_unref (variant);
25453 num_changes++;
25454 }
25455 }
25456 if (num_changes > 0)
25457 {
25458 GList *connections, *ll;
25459 GVariant *signal_variant;
25460 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
25461 &builder, &invalidated_builder));
25462 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25463 for (ll = connections; ll != NULL; ll = ll->next)
25464 {
25465 GDBusConnection *connection = ll->data;
25466
25467 g_dbus_connection_emit_signal (connection,
25468 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25469 "org.freedesktop.DBus.Properties",
25470 "PropertiesChanged",
25471 signal_variant,
25472 NULL);
25473 }
25474 g_variant_unref (signal_variant);
25475 g_list_free_full (connections, g_object_unref);
25476 }
25477 else
25478 {
25479 g_variant_builder_clear (&builder);
25480 g_variant_builder_clear (&invalidated_builder);
25481 }
25482 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25483 skeleton->priv->changed_properties = NULL;
25484 skeleton->priv->changed_properties_idle_source = NULL;
25485 g_mutex_unlock (&skeleton->priv->lock);
25486 return FALSE;
25487}
25488
25489static void
25490_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25491{
25492 ChangedProperty *cp;
25493 GList *l;
25494 cp = NULL;
25495 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25496 {
25497 ChangedProperty *i_cp = l->data;
25498 if (i_cp->info == info)
25499 {
25500 cp = i_cp;
25501 break;
25502 }
25503 }
25504 if (cp == NULL)
25505 {
25506 cp = g_new0 (ChangedProperty, 1);
25507 cp->prop_id = prop_id;
25508 cp->info = info;
25509 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25510 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25511 g_value_copy (orig_value, &cp->orig_value);
25512 }
25513}
25514
25515static void
25516button_skeleton_notify (GObject *object,
25517 GParamSpec *pspec G_GNUC_UNUSED)
25518{
25519 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25520 g_mutex_lock (&skeleton->priv->lock);
25521 if (skeleton->priv->changed_properties != NULL &&
25522 skeleton->priv->changed_properties_idle_source == NULL)
25523 {
25524 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25525 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25526 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
25527 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25528 g_source_unref (skeleton->priv->changed_properties_idle_source);
25529 }
25530 g_mutex_unlock (&skeleton->priv->lock);
25531}
25532
25533static void
25534button_skeleton_set_property (GObject *object,
25535 guint prop_id,
25536 const GValue *value,
25537 GParamSpec *pspec)
25538{
25539 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25540 g_assert (prop_id != 0 && prop_id - 1 < 1);
25541 g_mutex_lock (&skeleton->priv->lock);
25542 g_object_freeze_notify (object);
25543 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25544 {
25545 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
25546 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
25547 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25548 g_object_notify_by_pspec (object, pspec);
25549 }
25550 g_mutex_unlock (&skeleton->priv->lock);
25551 g_object_thaw_notify (object);
25552}
25553
25554static void
25555button_skeleton_init (ButtonSkeleton *skeleton)
25556{
25557#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25558 skeleton->priv = button_skeleton_get_instance_private (skeleton);
25559#else
25560 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
25561#endif
25562
25563 g_mutex_init (&skeleton->priv->lock);
25564 skeleton->priv->context = g_main_context_ref_thread_default ();
25565 skeleton->priv->properties = g_new0 (GValue, 1);
25566 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
25567}
25568
25569static gboolean
25570button_skeleton_get_state (Button *object)
25571{
25572 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25573 gboolean value;
25574 g_mutex_lock (&skeleton->priv->lock);
25575 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
25576 g_mutex_unlock (&skeleton->priv->lock);
25577 return value;
25578}
25579
25580static void
25581button_skeleton_class_init (ButtonSkeletonClass *klass)
25582{
25583 GObjectClass *gobject_class;
25584 GDBusInterfaceSkeletonClass *skeleton_class;
25585
25586 gobject_class = G_OBJECT_CLASS (klass);
25587 gobject_class->finalize = button_skeleton_finalize;
25588 gobject_class->get_property = button_skeleton_get_property;
25589 gobject_class->set_property = button_skeleton_set_property;
25590 gobject_class->notify = button_skeleton_notify;
25591
25592
25593 button_override_properties (gobject_class, 1);
25594
25595 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
25596 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
25597 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
25598 skeleton_class->flush = button_skeleton_dbus_interface_flush;
25599 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
25600
25601#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25602 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
25603#endif
25604}
25605
25606static void
25607button_skeleton_iface_init (ButtonIface *iface)
25608{
25609 iface->button_release = _button_on_signal_button_release;
25610 iface->button_pressed = _button_on_signal_button_pressed;
25611 iface->button_pressed_long = _button_on_signal_button_pressed_long;
25612 iface->get_state = button_skeleton_get_state;
25613}
25614
25615/**
25616 * button_skeleton_new:
25617 *
25618 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25619 *
25620 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
25621 */
25622Button *
25623button_skeleton_new (void)
25624{
25625 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
25626}
25627
25628/* ------------------------------------------------------------------------
25629 * Code for interface org.openbmc.Led
25630 * ------------------------------------------------------------------------
25631 */
25632
25633/**
25634 * SECTION:Led
25635 * @title: Led
25636 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
25637 *
25638 * 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.
25639 */
25640
25641/* ---- Introspection data for org.openbmc.Led ---- */
25642
25643static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
25644{
25645 {
25646 -1,
25647 (gchar *) "setOn",
25648 NULL,
25649 NULL,
25650 NULL
25651 },
25652 "handle-set-on",
25653 FALSE
25654};
25655
25656static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
25657{
25658 {
25659 -1,
25660 (gchar *) "setOff",
25661 NULL,
25662 NULL,
25663 NULL
25664 },
25665 "handle-set-off",
25666 FALSE
25667};
25668
25669static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
25670{
25671 {
25672 -1,
25673 (gchar *) "setBlinkSlow",
25674 NULL,
25675 NULL,
25676 NULL
25677 },
25678 "handle-set-blink-slow",
25679 FALSE
25680};
25681
25682static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
25683{
25684 {
25685 -1,
25686 (gchar *) "setBlinkFast",
25687 NULL,
25688 NULL,
25689 NULL
25690 },
25691 "handle-set-blink-fast",
25692 FALSE
25693};
25694
25695static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
25696{
25697 &_led_method_info_set_on,
25698 &_led_method_info_set_off,
25699 &_led_method_info_set_blink_slow,
25700 &_led_method_info_set_blink_fast,
25701 NULL
25702};
25703
25704static const _ExtendedGDBusPropertyInfo _led_property_info_color =
25705{
25706 {
25707 -1,
25708 (gchar *) "color",
25709 (gchar *) "i",
25710 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25711 NULL
25712 },
25713 "color",
25714 FALSE
25715};
25716
25717static const _ExtendedGDBusPropertyInfo _led_property_info_function =
25718{
25719 {
25720 -1,
25721 (gchar *) "function",
25722 (gchar *) "s",
25723 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25724 NULL
25725 },
25726 "function",
25727 FALSE
25728};
25729
25730static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
25731{
25732 &_led_property_info_color,
25733 &_led_property_info_function,
25734 NULL
25735};
25736
25737static const _ExtendedGDBusInterfaceInfo _led_interface_info =
25738{
25739 {
25740 -1,
25741 (gchar *) "org.openbmc.Led",
25742 (GDBusMethodInfo **) &_led_method_info_pointers,
25743 NULL,
25744 (GDBusPropertyInfo **) &_led_property_info_pointers,
25745 NULL
25746 },
25747 "led",
25748};
25749
25750
25751/**
25752 * led_interface_info:
25753 *
25754 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
25755 *
25756 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
25757 */
25758GDBusInterfaceInfo *
25759led_interface_info (void)
25760{
25761 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
25762}
25763
25764/**
25765 * led_override_properties:
25766 * @klass: The class structure for a #GObject<!-- -->-derived class.
25767 * @property_id_begin: The property id to assign to the first overridden property.
25768 *
25769 * Overrides all #GObject properties in the #Led interface for a concrete class.
25770 * The properties are overridden in the order they are defined.
25771 *
25772 * Returns: The last property id.
25773 */
25774guint
25775led_override_properties (GObjectClass *klass, guint property_id_begin)
25776{
25777 g_object_class_override_property (klass, property_id_begin++, "color");
25778 g_object_class_override_property (klass, property_id_begin++, "function");
25779 return property_id_begin - 1;
25780}
25781
25782
25783
25784/**
25785 * Led:
25786 *
25787 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
25788 */
25789
25790/**
25791 * LedIface:
25792 * @parent_iface: The parent interface.
25793 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
25794 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
25795 * @handle_set_off: Handler for the #Led::handle-set-off signal.
25796 * @handle_set_on: Handler for the #Led::handle-set-on signal.
25797 * @get_color: Getter for the #Led:color property.
25798 * @get_function: Getter for the #Led:function property.
25799 *
25800 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
25801 */
25802
25803typedef LedIface LedInterface;
25804G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
25805
25806static void
25807led_default_init (LedIface *iface)
25808{
25809 /* GObject signals for incoming D-Bus method calls: */
25810 /**
25811 * Led::handle-set-on:
25812 * @object: A #Led.
25813 * @invocation: A #GDBusMethodInvocation.
25814 *
25815 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
25816 *
25817 * 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.
25818 *
25819 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25820 */
25821 g_signal_new ("handle-set-on",
25822 G_TYPE_FROM_INTERFACE (iface),
25823 G_SIGNAL_RUN_LAST,
25824 G_STRUCT_OFFSET (LedIface, handle_set_on),
25825 g_signal_accumulator_true_handled,
25826 NULL,
25827 g_cclosure_marshal_generic,
25828 G_TYPE_BOOLEAN,
25829 1,
25830 G_TYPE_DBUS_METHOD_INVOCATION);
25831
25832 /**
25833 * Led::handle-set-off:
25834 * @object: A #Led.
25835 * @invocation: A #GDBusMethodInvocation.
25836 *
25837 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
25838 *
25839 * 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.
25840 *
25841 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25842 */
25843 g_signal_new ("handle-set-off",
25844 G_TYPE_FROM_INTERFACE (iface),
25845 G_SIGNAL_RUN_LAST,
25846 G_STRUCT_OFFSET (LedIface, handle_set_off),
25847 g_signal_accumulator_true_handled,
25848 NULL,
25849 g_cclosure_marshal_generic,
25850 G_TYPE_BOOLEAN,
25851 1,
25852 G_TYPE_DBUS_METHOD_INVOCATION);
25853
25854 /**
25855 * Led::handle-set-blink-slow:
25856 * @object: A #Led.
25857 * @invocation: A #GDBusMethodInvocation.
25858 *
25859 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
25860 *
25861 * 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.
25862 *
25863 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25864 */
25865 g_signal_new ("handle-set-blink-slow",
25866 G_TYPE_FROM_INTERFACE (iface),
25867 G_SIGNAL_RUN_LAST,
25868 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
25869 g_signal_accumulator_true_handled,
25870 NULL,
25871 g_cclosure_marshal_generic,
25872 G_TYPE_BOOLEAN,
25873 1,
25874 G_TYPE_DBUS_METHOD_INVOCATION);
25875
25876 /**
25877 * Led::handle-set-blink-fast:
25878 * @object: A #Led.
25879 * @invocation: A #GDBusMethodInvocation.
25880 *
25881 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
25882 *
25883 * 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.
25884 *
25885 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25886 */
25887 g_signal_new ("handle-set-blink-fast",
25888 G_TYPE_FROM_INTERFACE (iface),
25889 G_SIGNAL_RUN_LAST,
25890 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
25891 g_signal_accumulator_true_handled,
25892 NULL,
25893 g_cclosure_marshal_generic,
25894 G_TYPE_BOOLEAN,
25895 1,
25896 G_TYPE_DBUS_METHOD_INVOCATION);
25897
25898 /* GObject properties for D-Bus properties: */
25899 /**
25900 * Led:color:
25901 *
25902 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
25903 *
25904 * 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.
25905 */
25906 g_object_interface_install_property (iface,
25907 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
25908 /**
25909 * Led:function:
25910 *
25911 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
25912 *
25913 * 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.
25914 */
25915 g_object_interface_install_property (iface,
25916 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
25917}
25918
25919/**
25920 * led_get_color: (skip)
25921 * @object: A #Led.
25922 *
25923 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
25924 *
25925 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25926 *
25927 * Returns: The property value.
25928 */
25929gint
25930led_get_color (Led *object)
25931{
25932 return LED_GET_IFACE (object)->get_color (object);
25933}
25934
25935/**
25936 * led_set_color: (skip)
25937 * @object: A #Led.
25938 * @value: The value to set.
25939 *
25940 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
25941 *
25942 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25943 */
25944void
25945led_set_color (Led *object, gint value)
25946{
25947 g_object_set (G_OBJECT (object), "color", value, NULL);
25948}
25949
25950/**
25951 * led_get_function: (skip)
25952 * @object: A #Led.
25953 *
25954 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
25955 *
25956 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25957 *
25958 * <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>
25959 *
25960 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
25961 */
25962const gchar *
25963led_get_function (Led *object)
25964{
25965 return LED_GET_IFACE (object)->get_function (object);
25966}
25967
25968/**
25969 * led_dup_function: (skip)
25970 * @object: A #Led.
25971 *
25972 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
25973 *
25974 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25975 *
25976 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
25977 */
25978gchar *
25979led_dup_function (Led *object)
25980{
25981 gchar *value;
25982 g_object_get (G_OBJECT (object), "function", &value, NULL);
25983 return value;
25984}
25985
25986/**
25987 * led_set_function: (skip)
25988 * @object: A #Led.
25989 * @value: The value to set.
25990 *
25991 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
25992 *
25993 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25994 */
25995void
25996led_set_function (Led *object, const gchar *value)
25997{
25998 g_object_set (G_OBJECT (object), "function", value, NULL);
25999}
26000
26001/**
26002 * led_call_set_on:
26003 * @proxy: A #LedProxy.
26004 * @cancellable: (allow-none): A #GCancellable or %NULL.
26005 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26006 * @user_data: User data to pass to @callback.
26007 *
26008 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
26009 * 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.
26010 * You can then call led_call_set_on_finish() to get the result of the operation.
26011 *
26012 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
26013 */
26014void
26015led_call_set_on (
26016 Led *proxy,
26017 GCancellable *cancellable,
26018 GAsyncReadyCallback callback,
26019 gpointer user_data)
26020{
26021 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26022 "setOn",
26023 g_variant_new ("()"),
26024 G_DBUS_CALL_FLAGS_NONE,
26025 -1,
26026 cancellable,
26027 callback,
26028 user_data);
26029}
26030
26031/**
26032 * led_call_set_on_finish:
26033 * @proxy: A #LedProxy.
26034 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
26035 * @error: Return location for error or %NULL.
26036 *
26037 * Finishes an operation started with led_call_set_on().
26038 *
26039 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26040 */
26041gboolean
26042led_call_set_on_finish (
26043 Led *proxy,
26044 GAsyncResult *res,
26045 GError **error)
26046{
26047 GVariant *_ret;
26048 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26049 if (_ret == NULL)
26050 goto _out;
26051 g_variant_get (_ret,
26052 "()");
26053 g_variant_unref (_ret);
26054_out:
26055 return _ret != NULL;
26056}
26057
26058/**
26059 * led_call_set_on_sync:
26060 * @proxy: A #LedProxy.
26061 * @cancellable: (allow-none): A #GCancellable or %NULL.
26062 * @error: Return location for error or %NULL.
26063 *
26064 * 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.
26065 *
26066 * See led_call_set_on() for the asynchronous version of this method.
26067 *
26068 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26069 */
26070gboolean
26071led_call_set_on_sync (
26072 Led *proxy,
26073 GCancellable *cancellable,
26074 GError **error)
26075{
26076 GVariant *_ret;
26077 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26078 "setOn",
26079 g_variant_new ("()"),
26080 G_DBUS_CALL_FLAGS_NONE,
26081 -1,
26082 cancellable,
26083 error);
26084 if (_ret == NULL)
26085 goto _out;
26086 g_variant_get (_ret,
26087 "()");
26088 g_variant_unref (_ret);
26089_out:
26090 return _ret != NULL;
26091}
26092
26093/**
26094 * led_call_set_off:
26095 * @proxy: A #LedProxy.
26096 * @cancellable: (allow-none): A #GCancellable or %NULL.
26097 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26098 * @user_data: User data to pass to @callback.
26099 *
26100 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
26101 * 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.
26102 * You can then call led_call_set_off_finish() to get the result of the operation.
26103 *
26104 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
26105 */
26106void
26107led_call_set_off (
26108 Led *proxy,
26109 GCancellable *cancellable,
26110 GAsyncReadyCallback callback,
26111 gpointer user_data)
26112{
26113 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26114 "setOff",
26115 g_variant_new ("()"),
26116 G_DBUS_CALL_FLAGS_NONE,
26117 -1,
26118 cancellable,
26119 callback,
26120 user_data);
26121}
26122
26123/**
26124 * led_call_set_off_finish:
26125 * @proxy: A #LedProxy.
26126 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
26127 * @error: Return location for error or %NULL.
26128 *
26129 * Finishes an operation started with led_call_set_off().
26130 *
26131 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26132 */
26133gboolean
26134led_call_set_off_finish (
26135 Led *proxy,
26136 GAsyncResult *res,
26137 GError **error)
26138{
26139 GVariant *_ret;
26140 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26141 if (_ret == NULL)
26142 goto _out;
26143 g_variant_get (_ret,
26144 "()");
26145 g_variant_unref (_ret);
26146_out:
26147 return _ret != NULL;
26148}
26149
26150/**
26151 * led_call_set_off_sync:
26152 * @proxy: A #LedProxy.
26153 * @cancellable: (allow-none): A #GCancellable or %NULL.
26154 * @error: Return location for error or %NULL.
26155 *
26156 * 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.
26157 *
26158 * See led_call_set_off() for the asynchronous version of this method.
26159 *
26160 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26161 */
26162gboolean
26163led_call_set_off_sync (
26164 Led *proxy,
26165 GCancellable *cancellable,
26166 GError **error)
26167{
26168 GVariant *_ret;
26169 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26170 "setOff",
26171 g_variant_new ("()"),
26172 G_DBUS_CALL_FLAGS_NONE,
26173 -1,
26174 cancellable,
26175 error);
26176 if (_ret == NULL)
26177 goto _out;
26178 g_variant_get (_ret,
26179 "()");
26180 g_variant_unref (_ret);
26181_out:
26182 return _ret != NULL;
26183}
26184
26185/**
26186 * led_call_set_blink_slow:
26187 * @proxy: A #LedProxy.
26188 * @cancellable: (allow-none): A #GCancellable or %NULL.
26189 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26190 * @user_data: User data to pass to @callback.
26191 *
26192 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
26193 * 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.
26194 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
26195 *
26196 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
26197 */
26198void
26199led_call_set_blink_slow (
26200 Led *proxy,
26201 GCancellable *cancellable,
26202 GAsyncReadyCallback callback,
26203 gpointer user_data)
26204{
26205 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26206 "setBlinkSlow",
26207 g_variant_new ("()"),
26208 G_DBUS_CALL_FLAGS_NONE,
26209 -1,
26210 cancellable,
26211 callback,
26212 user_data);
26213}
26214
26215/**
26216 * led_call_set_blink_slow_finish:
26217 * @proxy: A #LedProxy.
26218 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
26219 * @error: Return location for error or %NULL.
26220 *
26221 * Finishes an operation started with led_call_set_blink_slow().
26222 *
26223 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26224 */
26225gboolean
26226led_call_set_blink_slow_finish (
26227 Led *proxy,
26228 GAsyncResult *res,
26229 GError **error)
26230{
26231 GVariant *_ret;
26232 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26233 if (_ret == NULL)
26234 goto _out;
26235 g_variant_get (_ret,
26236 "()");
26237 g_variant_unref (_ret);
26238_out:
26239 return _ret != NULL;
26240}
26241
26242/**
26243 * led_call_set_blink_slow_sync:
26244 * @proxy: A #LedProxy.
26245 * @cancellable: (allow-none): A #GCancellable or %NULL.
26246 * @error: Return location for error or %NULL.
26247 *
26248 * 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.
26249 *
26250 * See led_call_set_blink_slow() for the asynchronous version of this method.
26251 *
26252 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26253 */
26254gboolean
26255led_call_set_blink_slow_sync (
26256 Led *proxy,
26257 GCancellable *cancellable,
26258 GError **error)
26259{
26260 GVariant *_ret;
26261 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26262 "setBlinkSlow",
26263 g_variant_new ("()"),
26264 G_DBUS_CALL_FLAGS_NONE,
26265 -1,
26266 cancellable,
26267 error);
26268 if (_ret == NULL)
26269 goto _out;
26270 g_variant_get (_ret,
26271 "()");
26272 g_variant_unref (_ret);
26273_out:
26274 return _ret != NULL;
26275}
26276
26277/**
26278 * led_call_set_blink_fast:
26279 * @proxy: A #LedProxy.
26280 * @cancellable: (allow-none): A #GCancellable or %NULL.
26281 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26282 * @user_data: User data to pass to @callback.
26283 *
26284 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
26285 * 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.
26286 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
26287 *
26288 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
26289 */
26290void
26291led_call_set_blink_fast (
26292 Led *proxy,
26293 GCancellable *cancellable,
26294 GAsyncReadyCallback callback,
26295 gpointer user_data)
26296{
26297 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26298 "setBlinkFast",
26299 g_variant_new ("()"),
26300 G_DBUS_CALL_FLAGS_NONE,
26301 -1,
26302 cancellable,
26303 callback,
26304 user_data);
26305}
26306
26307/**
26308 * led_call_set_blink_fast_finish:
26309 * @proxy: A #LedProxy.
26310 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
26311 * @error: Return location for error or %NULL.
26312 *
26313 * Finishes an operation started with led_call_set_blink_fast().
26314 *
26315 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26316 */
26317gboolean
26318led_call_set_blink_fast_finish (
26319 Led *proxy,
26320 GAsyncResult *res,
26321 GError **error)
26322{
26323 GVariant *_ret;
26324 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26325 if (_ret == NULL)
26326 goto _out;
26327 g_variant_get (_ret,
26328 "()");
26329 g_variant_unref (_ret);
26330_out:
26331 return _ret != NULL;
26332}
26333
26334/**
26335 * led_call_set_blink_fast_sync:
26336 * @proxy: A #LedProxy.
26337 * @cancellable: (allow-none): A #GCancellable or %NULL.
26338 * @error: Return location for error or %NULL.
26339 *
26340 * 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.
26341 *
26342 * See led_call_set_blink_fast() for the asynchronous version of this method.
26343 *
26344 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26345 */
26346gboolean
26347led_call_set_blink_fast_sync (
26348 Led *proxy,
26349 GCancellable *cancellable,
26350 GError **error)
26351{
26352 GVariant *_ret;
26353 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26354 "setBlinkFast",
26355 g_variant_new ("()"),
26356 G_DBUS_CALL_FLAGS_NONE,
26357 -1,
26358 cancellable,
26359 error);
26360 if (_ret == NULL)
26361 goto _out;
26362 g_variant_get (_ret,
26363 "()");
26364 g_variant_unref (_ret);
26365_out:
26366 return _ret != NULL;
26367}
26368
26369/**
26370 * led_complete_set_on:
26371 * @object: A #Led.
26372 * @invocation: (transfer full): A #GDBusMethodInvocation.
26373 *
26374 * 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.
26375 *
26376 * This method will free @invocation, you cannot use it afterwards.
26377 */
26378void
26379led_complete_set_on (
26380 Led *object,
26381 GDBusMethodInvocation *invocation)
26382{
26383 g_dbus_method_invocation_return_value (invocation,
26384 g_variant_new ("()"));
26385}
26386
26387/**
26388 * led_complete_set_off:
26389 * @object: A #Led.
26390 * @invocation: (transfer full): A #GDBusMethodInvocation.
26391 *
26392 * 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.
26393 *
26394 * This method will free @invocation, you cannot use it afterwards.
26395 */
26396void
26397led_complete_set_off (
26398 Led *object,
26399 GDBusMethodInvocation *invocation)
26400{
26401 g_dbus_method_invocation_return_value (invocation,
26402 g_variant_new ("()"));
26403}
26404
26405/**
26406 * led_complete_set_blink_slow:
26407 * @object: A #Led.
26408 * @invocation: (transfer full): A #GDBusMethodInvocation.
26409 *
26410 * 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.
26411 *
26412 * This method will free @invocation, you cannot use it afterwards.
26413 */
26414void
26415led_complete_set_blink_slow (
26416 Led *object,
26417 GDBusMethodInvocation *invocation)
26418{
26419 g_dbus_method_invocation_return_value (invocation,
26420 g_variant_new ("()"));
26421}
26422
26423/**
26424 * led_complete_set_blink_fast:
26425 * @object: A #Led.
26426 * @invocation: (transfer full): A #GDBusMethodInvocation.
26427 *
26428 * 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.
26429 *
26430 * This method will free @invocation, you cannot use it afterwards.
26431 */
26432void
26433led_complete_set_blink_fast (
26434 Led *object,
26435 GDBusMethodInvocation *invocation)
26436{
26437 g_dbus_method_invocation_return_value (invocation,
26438 g_variant_new ("()"));
26439}
26440
26441/* ------------------------------------------------------------------------ */
26442
26443/**
26444 * LedProxy:
26445 *
26446 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
26447 */
26448
26449/**
26450 * LedProxyClass:
26451 * @parent_class: The parent class.
26452 *
26453 * Class structure for #LedProxy.
26454 */
26455
26456struct _LedProxyPrivate
26457{
26458 GData *qdata;
26459};
26460
26461static void led_proxy_iface_init (LedIface *iface);
26462
26463#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26464G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
26465 G_ADD_PRIVATE (LedProxy)
26466 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
26467
26468#else
26469G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
26470 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
26471
26472#endif
26473static void
26474led_proxy_finalize (GObject *object)
26475{
26476 LedProxy *proxy = LED_PROXY (object);
26477 g_datalist_clear (&proxy->priv->qdata);
26478 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
26479}
26480
26481static void
26482led_proxy_get_property (GObject *object,
26483 guint prop_id,
26484 GValue *value,
26485 GParamSpec *pspec G_GNUC_UNUSED)
26486{
26487 const _ExtendedGDBusPropertyInfo *info;
26488 GVariant *variant;
26489 g_assert (prop_id != 0 && prop_id - 1 < 2);
26490 info = _led_property_info_pointers[prop_id - 1];
26491 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
26492 if (info->use_gvariant)
26493 {
26494 g_value_set_variant (value, variant);
26495 }
26496 else
26497 {
26498 if (variant != NULL)
26499 g_dbus_gvariant_to_gvalue (variant, value);
26500 }
26501 if (variant != NULL)
26502 g_variant_unref (variant);
26503}
26504
26505static void
26506led_proxy_set_property_cb (GDBusProxy *proxy,
26507 GAsyncResult *res,
26508 gpointer user_data)
26509{
26510 const _ExtendedGDBusPropertyInfo *info = user_data;
26511 GError *error;
26512 GVariant *_ret;
26513 error = NULL;
26514 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
26515 if (!_ret)
26516 {
26517 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
26518 info->parent_struct.name,
26519 error->message, g_quark_to_string (error->domain), error->code);
26520 g_error_free (error);
26521 }
26522 else
26523 {
26524 g_variant_unref (_ret);
26525 }
26526}
26527
26528static void
26529led_proxy_set_property (GObject *object,
26530 guint prop_id,
26531 const GValue *value,
26532 GParamSpec *pspec G_GNUC_UNUSED)
26533{
26534 const _ExtendedGDBusPropertyInfo *info;
26535 GVariant *variant;
26536 g_assert (prop_id != 0 && prop_id - 1 < 2);
26537 info = _led_property_info_pointers[prop_id - 1];
26538 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
26539 g_dbus_proxy_call (G_DBUS_PROXY (object),
26540 "org.freedesktop.DBus.Properties.Set",
26541 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
26542 G_DBUS_CALL_FLAGS_NONE,
26543 -1,
26544 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
26545 g_variant_unref (variant);
26546}
26547
26548static void
26549led_proxy_g_signal (GDBusProxy *proxy,
26550 const gchar *sender_name G_GNUC_UNUSED,
26551 const gchar *signal_name,
26552 GVariant *parameters)
26553{
26554 _ExtendedGDBusSignalInfo *info;
26555 GVariantIter iter;
26556 GVariant *child;
26557 GValue *paramv;
26558 guint num_params;
26559 guint n;
26560 guint signal_id;
26561 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
26562 if (info == NULL)
26563 return;
26564 num_params = g_variant_n_children (parameters);
26565 paramv = g_new0 (GValue, num_params + 1);
26566 g_value_init (&paramv[0], TYPE_LED);
26567 g_value_set_object (&paramv[0], proxy);
26568 g_variant_iter_init (&iter, parameters);
26569 n = 1;
26570 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26571 {
26572 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26573 if (arg_info->use_gvariant)
26574 {
26575 g_value_init (&paramv[n], G_TYPE_VARIANT);
26576 g_value_set_variant (&paramv[n], child);
26577 n++;
26578 }
26579 else
26580 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26581 g_variant_unref (child);
26582 }
26583 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
26584 g_signal_emitv (paramv, signal_id, 0, NULL);
26585 for (n = 0; n < num_params + 1; n++)
26586 g_value_unset (&paramv[n]);
26587 g_free (paramv);
26588}
26589
26590static void
26591led_proxy_g_properties_changed (GDBusProxy *_proxy,
26592 GVariant *changed_properties,
26593 const gchar *const *invalidated_properties)
26594{
26595 LedProxy *proxy = LED_PROXY (_proxy);
26596 guint n;
26597 const gchar *key;
26598 GVariantIter *iter;
26599 _ExtendedGDBusPropertyInfo *info;
26600 g_variant_get (changed_properties, "a{sv}", &iter);
26601 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26602 {
26603 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
26604 g_datalist_remove_data (&proxy->priv->qdata, key);
26605 if (info != NULL)
26606 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26607 }
26608 g_variant_iter_free (iter);
26609 for (n = 0; invalidated_properties[n] != NULL; n++)
26610 {
26611 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
26612 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26613 if (info != NULL)
26614 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26615 }
26616}
26617
26618static gint
26619led_proxy_get_color (Led *object)
26620{
26621 LedProxy *proxy = LED_PROXY (object);
26622 GVariant *variant;
26623 gint value = 0;
26624 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
26625 if (variant != NULL)
26626 {
26627 value = g_variant_get_int32 (variant);
26628 g_variant_unref (variant);
26629 }
26630 return value;
26631}
26632
26633static const gchar *
26634led_proxy_get_function (Led *object)
26635{
26636 LedProxy *proxy = LED_PROXY (object);
26637 GVariant *variant;
26638 const gchar *value = NULL;
26639 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
26640 if (variant != NULL)
26641 {
26642 value = g_variant_get_string (variant, NULL);
26643 g_variant_unref (variant);
26644 }
26645 return value;
26646}
26647
26648static void
26649led_proxy_init (LedProxy *proxy)
26650{
26651#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26652 proxy->priv = led_proxy_get_instance_private (proxy);
26653#else
26654 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
26655#endif
26656
26657 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
26658}
26659
26660static void
26661led_proxy_class_init (LedProxyClass *klass)
26662{
26663 GObjectClass *gobject_class;
26664 GDBusProxyClass *proxy_class;
26665
26666 gobject_class = G_OBJECT_CLASS (klass);
26667 gobject_class->finalize = led_proxy_finalize;
26668 gobject_class->get_property = led_proxy_get_property;
26669 gobject_class->set_property = led_proxy_set_property;
26670
26671 proxy_class = G_DBUS_PROXY_CLASS (klass);
26672 proxy_class->g_signal = led_proxy_g_signal;
26673 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
26674
26675 led_override_properties (gobject_class, 1);
26676
26677#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26678 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
26679#endif
26680}
26681
26682static void
26683led_proxy_iface_init (LedIface *iface)
26684{
26685 iface->get_color = led_proxy_get_color;
26686 iface->get_function = led_proxy_get_function;
26687}
26688
26689/**
26690 * led_proxy_new:
26691 * @connection: A #GDBusConnection.
26692 * @flags: Flags from the #GDBusProxyFlags enumeration.
26693 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26694 * @object_path: An object path.
26695 * @cancellable: (allow-none): A #GCancellable or %NULL.
26696 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26697 * @user_data: User data to pass to @callback.
26698 *
26699 * 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.
26700 *
26701 * 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.
26702 * You can then call led_proxy_new_finish() to get the result of the operation.
26703 *
26704 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
26705 */
26706void
26707led_proxy_new (
26708 GDBusConnection *connection,
26709 GDBusProxyFlags flags,
26710 const gchar *name,
26711 const gchar *object_path,
26712 GCancellable *cancellable,
26713 GAsyncReadyCallback callback,
26714 gpointer user_data)
26715{
26716 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);
26717}
26718
26719/**
26720 * led_proxy_new_finish:
26721 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
26722 * @error: Return location for error or %NULL
26723 *
26724 * Finishes an operation started with led_proxy_new().
26725 *
26726 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
26727 */
26728Led *
26729led_proxy_new_finish (
26730 GAsyncResult *res,
26731 GError **error)
26732{
26733 GObject *ret;
26734 GObject *source_object;
26735 source_object = g_async_result_get_source_object (res);
26736 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26737 g_object_unref (source_object);
26738 if (ret != NULL)
26739 return LED (ret);
26740 else
26741 return NULL;
26742}
26743
26744/**
26745 * led_proxy_new_sync:
26746 * @connection: A #GDBusConnection.
26747 * @flags: Flags from the #GDBusProxyFlags enumeration.
26748 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26749 * @object_path: An object path.
26750 * @cancellable: (allow-none): A #GCancellable or %NULL.
26751 * @error: Return location for error or %NULL
26752 *
26753 * 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.
26754 *
26755 * The calling thread is blocked until a reply is received.
26756 *
26757 * See led_proxy_new() for the asynchronous version of this constructor.
26758 *
26759 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
26760 */
26761Led *
26762led_proxy_new_sync (
26763 GDBusConnection *connection,
26764 GDBusProxyFlags flags,
26765 const gchar *name,
26766 const gchar *object_path,
26767 GCancellable *cancellable,
26768 GError **error)
26769{
26770 GInitable *ret;
26771 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);
26772 if (ret != NULL)
26773 return LED (ret);
26774 else
26775 return NULL;
26776}
26777
26778
26779/**
26780 * led_proxy_new_for_bus:
26781 * @bus_type: A #GBusType.
26782 * @flags: Flags from the #GDBusProxyFlags enumeration.
26783 * @name: A bus name (well-known or unique).
26784 * @object_path: An object path.
26785 * @cancellable: (allow-none): A #GCancellable or %NULL.
26786 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26787 * @user_data: User data to pass to @callback.
26788 *
26789 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
26790 *
26791 * 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.
26792 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
26793 *
26794 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26795 */
26796void
26797led_proxy_new_for_bus (
26798 GBusType bus_type,
26799 GDBusProxyFlags flags,
26800 const gchar *name,
26801 const gchar *object_path,
26802 GCancellable *cancellable,
26803 GAsyncReadyCallback callback,
26804 gpointer user_data)
26805{
26806 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);
26807}
26808
26809/**
26810 * led_proxy_new_for_bus_finish:
26811 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
26812 * @error: Return location for error or %NULL
26813 *
26814 * Finishes an operation started with led_proxy_new_for_bus().
26815 *
26816 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
26817 */
26818Led *
26819led_proxy_new_for_bus_finish (
26820 GAsyncResult *res,
26821 GError **error)
26822{
26823 GObject *ret;
26824 GObject *source_object;
26825 source_object = g_async_result_get_source_object (res);
26826 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26827 g_object_unref (source_object);
26828 if (ret != NULL)
26829 return LED (ret);
26830 else
26831 return NULL;
26832}
26833
26834/**
26835 * led_proxy_new_for_bus_sync:
26836 * @bus_type: A #GBusType.
26837 * @flags: Flags from the #GDBusProxyFlags enumeration.
26838 * @name: A bus name (well-known or unique).
26839 * @object_path: An object path.
26840 * @cancellable: (allow-none): A #GCancellable or %NULL.
26841 * @error: Return location for error or %NULL
26842 *
26843 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26844 *
26845 * The calling thread is blocked until a reply is received.
26846 *
26847 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
26848 *
26849 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
26850 */
26851Led *
26852led_proxy_new_for_bus_sync (
26853 GBusType bus_type,
26854 GDBusProxyFlags flags,
26855 const gchar *name,
26856 const gchar *object_path,
26857 GCancellable *cancellable,
26858 GError **error)
26859{
26860 GInitable *ret;
26861 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);
26862 if (ret != NULL)
26863 return LED (ret);
26864 else
26865 return NULL;
26866}
26867
26868
26869/* ------------------------------------------------------------------------ */
26870
26871/**
26872 * LedSkeleton:
26873 *
26874 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
26875 */
26876
26877/**
26878 * LedSkeletonClass:
26879 * @parent_class: The parent class.
26880 *
26881 * Class structure for #LedSkeleton.
26882 */
26883
26884struct _LedSkeletonPrivate
26885{
26886 GValue *properties;
26887 GList *changed_properties;
26888 GSource *changed_properties_idle_source;
26889 GMainContext *context;
26890 GMutex lock;
26891};
26892
26893static void
26894_led_skeleton_handle_method_call (
26895 GDBusConnection *connection G_GNUC_UNUSED,
26896 const gchar *sender G_GNUC_UNUSED,
26897 const gchar *object_path G_GNUC_UNUSED,
26898 const gchar *interface_name,
26899 const gchar *method_name,
26900 GVariant *parameters,
26901 GDBusMethodInvocation *invocation,
26902 gpointer user_data)
26903{
26904 LedSkeleton *skeleton = LED_SKELETON (user_data);
26905 _ExtendedGDBusMethodInfo *info;
26906 GVariantIter iter;
26907 GVariant *child;
26908 GValue *paramv;
26909 guint num_params;
26910 guint num_extra;
26911 guint n;
26912 guint signal_id;
26913 GValue return_value = G_VALUE_INIT;
26914 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
26915 g_assert (info != NULL);
26916 num_params = g_variant_n_children (parameters);
26917 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
26918 n = 0;
26919 g_value_init (&paramv[n], TYPE_LED);
26920 g_value_set_object (&paramv[n++], skeleton);
26921 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
26922 g_value_set_object (&paramv[n++], invocation);
26923 if (info->pass_fdlist)
26924 {
26925#ifdef G_OS_UNIX
26926 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
26927 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
26928#else
26929 g_assert_not_reached ();
26930#endif
26931 }
26932 g_variant_iter_init (&iter, parameters);
26933 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26934 {
26935 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
26936 if (arg_info->use_gvariant)
26937 {
26938 g_value_init (&paramv[n], G_TYPE_VARIANT);
26939 g_value_set_variant (&paramv[n], child);
26940 n++;
26941 }
26942 else
26943 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26944 g_variant_unref (child);
26945 }
26946 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
26947 g_value_init (&return_value, G_TYPE_BOOLEAN);
26948 g_signal_emitv (paramv, signal_id, 0, &return_value);
26949 if (!g_value_get_boolean (&return_value))
26950 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);
26951 g_value_unset (&return_value);
26952 for (n = 0; n < num_params + num_extra; n++)
26953 g_value_unset (&paramv[n]);
26954 g_free (paramv);
26955}
26956
26957static GVariant *
26958_led_skeleton_handle_get_property (
26959 GDBusConnection *connection G_GNUC_UNUSED,
26960 const gchar *sender G_GNUC_UNUSED,
26961 const gchar *object_path G_GNUC_UNUSED,
26962 const gchar *interface_name G_GNUC_UNUSED,
26963 const gchar *property_name,
26964 GError **error,
26965 gpointer user_data)
26966{
26967 LedSkeleton *skeleton = LED_SKELETON (user_data);
26968 GValue value = G_VALUE_INIT;
26969 GParamSpec *pspec;
26970 _ExtendedGDBusPropertyInfo *info;
26971 GVariant *ret;
26972 ret = NULL;
26973 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
26974 g_assert (info != NULL);
26975 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26976 if (pspec == NULL)
26977 {
26978 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26979 }
26980 else
26981 {
26982 g_value_init (&value, pspec->value_type);
26983 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26984 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
26985 g_value_unset (&value);
26986 }
26987 return ret;
26988}
26989
26990static gboolean
26991_led_skeleton_handle_set_property (
26992 GDBusConnection *connection G_GNUC_UNUSED,
26993 const gchar *sender G_GNUC_UNUSED,
26994 const gchar *object_path G_GNUC_UNUSED,
26995 const gchar *interface_name G_GNUC_UNUSED,
26996 const gchar *property_name,
26997 GVariant *variant,
26998 GError **error,
26999 gpointer user_data)
27000{
27001 LedSkeleton *skeleton = LED_SKELETON (user_data);
27002 GValue value = G_VALUE_INIT;
27003 GParamSpec *pspec;
27004 _ExtendedGDBusPropertyInfo *info;
27005 gboolean ret;
27006 ret = FALSE;
27007 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
27008 g_assert (info != NULL);
27009 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27010 if (pspec == NULL)
27011 {
27012 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27013 }
27014 else
27015 {
27016 if (info->use_gvariant)
27017 g_value_set_variant (&value, variant);
27018 else
27019 g_dbus_gvariant_to_gvalue (variant, &value);
27020 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27021 g_value_unset (&value);
27022 ret = TRUE;
27023 }
27024 return ret;
27025}
27026
27027static const GDBusInterfaceVTable _led_skeleton_vtable =
27028{
27029 _led_skeleton_handle_method_call,
27030 _led_skeleton_handle_get_property,
27031 _led_skeleton_handle_set_property,
27032 {NULL}
27033};
27034
27035static GDBusInterfaceInfo *
27036led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27037{
27038 return led_interface_info ();
27039}
27040
27041static GDBusInterfaceVTable *
27042led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27043{
27044 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
27045}
27046
27047static GVariant *
27048led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
27049{
27050 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
27051
27052 GVariantBuilder builder;
27053 guint n;
27054 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27055 if (_led_interface_info.parent_struct.properties == NULL)
27056 goto out;
27057 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
27058 {
27059 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
27060 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
27061 {
27062 GVariant *value;
27063 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);
27064 if (value != NULL)
27065 {
27066 g_variant_take_ref (value);
27067 g_variant_builder_add (&builder, "{sv}", info->name, value);
27068 g_variant_unref (value);
27069 }
27070 }
27071 }
27072out:
27073 return g_variant_builder_end (&builder);
27074}
27075
27076static gboolean _led_emit_changed (gpointer user_data);
27077
27078static void
27079led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
27080{
27081 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
27082 gboolean emit_changed = FALSE;
27083
27084 g_mutex_lock (&skeleton->priv->lock);
27085 if (skeleton->priv->changed_properties_idle_source != NULL)
27086 {
27087 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27088 skeleton->priv->changed_properties_idle_source = NULL;
27089 emit_changed = TRUE;
27090 }
27091 g_mutex_unlock (&skeleton->priv->lock);
27092
27093 if (emit_changed)
27094 _led_emit_changed (skeleton);
27095}
27096
27097static void led_skeleton_iface_init (LedIface *iface);
27098#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27099G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27100 G_ADD_PRIVATE (LedSkeleton)
27101 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
27102
27103#else
27104G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27105 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
27106
27107#endif
27108static void
27109led_skeleton_finalize (GObject *object)
27110{
27111 LedSkeleton *skeleton = LED_SKELETON (object);
27112 guint n;
27113 for (n = 0; n < 2; n++)
27114 g_value_unset (&skeleton->priv->properties[n]);
27115 g_free (skeleton->priv->properties);
27116 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27117 if (skeleton->priv->changed_properties_idle_source != NULL)
27118 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27119 g_main_context_unref (skeleton->priv->context);
27120 g_mutex_clear (&skeleton->priv->lock);
27121 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
27122}
27123
27124static void
27125led_skeleton_get_property (GObject *object,
27126 guint prop_id,
27127 GValue *value,
27128 GParamSpec *pspec G_GNUC_UNUSED)
27129{
27130 LedSkeleton *skeleton = LED_SKELETON (object);
27131 g_assert (prop_id != 0 && prop_id - 1 < 2);
27132 g_mutex_lock (&skeleton->priv->lock);
27133 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
27134 g_mutex_unlock (&skeleton->priv->lock);
27135}
27136
27137static gboolean
27138_led_emit_changed (gpointer user_data)
27139{
27140 LedSkeleton *skeleton = LED_SKELETON (user_data);
27141 GList *l;
27142 GVariantBuilder builder;
27143 GVariantBuilder invalidated_builder;
27144 guint num_changes;
27145
27146 g_mutex_lock (&skeleton->priv->lock);
27147 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27148 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
27149 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
27150 {
27151 ChangedProperty *cp = l->data;
27152 GVariant *variant;
27153 const GValue *cur_value;
27154
27155 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
27156 if (!_g_value_equal (cur_value, &cp->orig_value))
27157 {
27158 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
27159 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
27160 g_variant_unref (variant);
27161 num_changes++;
27162 }
27163 }
27164 if (num_changes > 0)
27165 {
27166 GList *connections, *ll;
27167 GVariant *signal_variant;
27168 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
27169 &builder, &invalidated_builder));
27170 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27171 for (ll = connections; ll != NULL; ll = ll->next)
27172 {
27173 GDBusConnection *connection = ll->data;
27174
27175 g_dbus_connection_emit_signal (connection,
27176 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
27177 "org.freedesktop.DBus.Properties",
27178 "PropertiesChanged",
27179 signal_variant,
27180 NULL);
27181 }
27182 g_variant_unref (signal_variant);
27183 g_list_free_full (connections, g_object_unref);
27184 }
27185 else
27186 {
27187 g_variant_builder_clear (&builder);
27188 g_variant_builder_clear (&invalidated_builder);
27189 }
27190 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27191 skeleton->priv->changed_properties = NULL;
27192 skeleton->priv->changed_properties_idle_source = NULL;
27193 g_mutex_unlock (&skeleton->priv->lock);
27194 return FALSE;
27195}
27196
27197static void
27198_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
27199{
27200 ChangedProperty *cp;
27201 GList *l;
27202 cp = NULL;
27203 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
27204 {
27205 ChangedProperty *i_cp = l->data;
27206 if (i_cp->info == info)
27207 {
27208 cp = i_cp;
27209 break;
27210 }
27211 }
27212 if (cp == NULL)
27213 {
27214 cp = g_new0 (ChangedProperty, 1);
27215 cp->prop_id = prop_id;
27216 cp->info = info;
27217 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
27218 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
27219 g_value_copy (orig_value, &cp->orig_value);
27220 }
27221}
27222
27223static void
27224led_skeleton_notify (GObject *object,
27225 GParamSpec *pspec G_GNUC_UNUSED)
27226{
27227 LedSkeleton *skeleton = LED_SKELETON (object);
27228 g_mutex_lock (&skeleton->priv->lock);
27229 if (skeleton->priv->changed_properties != NULL &&
27230 skeleton->priv->changed_properties_idle_source == NULL)
27231 {
27232 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
27233 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
27234 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
27235 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
27236 g_source_unref (skeleton->priv->changed_properties_idle_source);
27237 }
27238 g_mutex_unlock (&skeleton->priv->lock);
27239}
27240
27241static void
27242led_skeleton_set_property (GObject *object,
27243 guint prop_id,
27244 const GValue *value,
27245 GParamSpec *pspec)
27246{
27247 LedSkeleton *skeleton = LED_SKELETON (object);
27248 g_assert (prop_id != 0 && prop_id - 1 < 2);
27249 g_mutex_lock (&skeleton->priv->lock);
27250 g_object_freeze_notify (object);
27251 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
27252 {
27253 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
27254 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
27255 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
27256 g_object_notify_by_pspec (object, pspec);
27257 }
27258 g_mutex_unlock (&skeleton->priv->lock);
27259 g_object_thaw_notify (object);
27260}
27261
27262static void
27263led_skeleton_init (LedSkeleton *skeleton)
27264{
27265#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27266 skeleton->priv = led_skeleton_get_instance_private (skeleton);
27267#else
27268 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
27269#endif
27270
27271 g_mutex_init (&skeleton->priv->lock);
27272 skeleton->priv->context = g_main_context_ref_thread_default ();
27273 skeleton->priv->properties = g_new0 (GValue, 2);
27274 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
27275 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
27276}
27277
27278static gint
27279led_skeleton_get_color (Led *object)
27280{
27281 LedSkeleton *skeleton = LED_SKELETON (object);
27282 gint value;
27283 g_mutex_lock (&skeleton->priv->lock);
27284 value = g_value_get_int (&(skeleton->priv->properties[0]));
27285 g_mutex_unlock (&skeleton->priv->lock);
27286 return value;
27287}
27288
27289static const gchar *
27290led_skeleton_get_function (Led *object)
27291{
27292 LedSkeleton *skeleton = LED_SKELETON (object);
27293 const gchar *value;
27294 g_mutex_lock (&skeleton->priv->lock);
27295 value = g_value_get_string (&(skeleton->priv->properties[1]));
27296 g_mutex_unlock (&skeleton->priv->lock);
27297 return value;
27298}
27299
27300static void
27301led_skeleton_class_init (LedSkeletonClass *klass)
27302{
27303 GObjectClass *gobject_class;
27304 GDBusInterfaceSkeletonClass *skeleton_class;
27305
27306 gobject_class = G_OBJECT_CLASS (klass);
27307 gobject_class->finalize = led_skeleton_finalize;
27308 gobject_class->get_property = led_skeleton_get_property;
27309 gobject_class->set_property = led_skeleton_set_property;
27310 gobject_class->notify = led_skeleton_notify;
27311
27312
27313 led_override_properties (gobject_class, 1);
27314
27315 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27316 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
27317 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
27318 skeleton_class->flush = led_skeleton_dbus_interface_flush;
27319 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
27320
27321#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27322 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
27323#endif
27324}
27325
27326static void
27327led_skeleton_iface_init (LedIface *iface)
27328{
27329 iface->get_color = led_skeleton_get_color;
27330 iface->get_function = led_skeleton_get_function;
27331}
27332
27333/**
27334 * led_skeleton_new:
27335 *
27336 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27337 *
27338 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
27339 */
27340Led *
27341led_skeleton_new (void)
27342{
27343 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
27344}
27345
27346/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050027347 * Code for interface org.openbmc.HostIpmi
27348 * ------------------------------------------------------------------------
27349 */
27350
27351/**
27352 * SECTION:HostIpmi
27353 * @title: HostIpmi
27354 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
27355 *
27356 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface in C.
27357 */
27358
27359/* ---- Introspection data for org.openbmc.HostIpmi ---- */
27360
27361static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
27362{
27363 {
27364 -1,
27365 (gchar *) "seq",
27366 (gchar *) "y",
27367 NULL
27368 },
27369 FALSE
27370};
27371
27372static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
27373{
27374 {
27375 -1,
27376 (gchar *) "netfn",
27377 (gchar *) "y",
27378 NULL
27379 },
27380 FALSE
27381};
27382
27383static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
27384{
27385 {
27386 -1,
27387 (gchar *) "cmd",
27388 (gchar *) "y",
27389 NULL
27390 },
27391 FALSE
27392};
27393
27394static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
27395{
27396 {
27397 -1,
27398 (gchar *) "data",
27399 (gchar *) "ay",
27400 NULL
27401 },
27402 FALSE
27403};
27404
27405static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
27406{
27407 &_host_ipmi_method_info_send_message_IN_ARG_seq,
27408 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
27409 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
27410 &_host_ipmi_method_info_send_message_IN_ARG_data,
27411 NULL
27412};
27413
27414static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
27415{
27416 {
27417 -1,
27418 (gchar *) "unnamed_arg4",
27419 (gchar *) "x",
27420 NULL
27421 },
27422 FALSE
27423};
27424
27425static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
27426{
27427 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
27428 NULL
27429};
27430
27431static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
27432{
27433 {
27434 -1,
27435 (gchar *) "sendMessage",
27436 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
27437 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
27438 NULL
27439 },
27440 "handle-send-message",
27441 FALSE
27442};
27443
27444static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
27445{
27446 &_host_ipmi_method_info_send_message,
27447 NULL
27448};
27449
27450static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
27451{
27452 {
27453 -1,
27454 (gchar *) "seq",
27455 (gchar *) "y",
27456 NULL
27457 },
27458 FALSE
27459};
27460
27461static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
27462{
27463 {
27464 -1,
27465 (gchar *) "netfn",
27466 (gchar *) "y",
27467 NULL
27468 },
27469 FALSE
27470};
27471
27472static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
27473{
27474 {
27475 -1,
27476 (gchar *) "cmd",
27477 (gchar *) "y",
27478 NULL
27479 },
27480 FALSE
27481};
27482
27483static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
27484{
27485 {
27486 -1,
27487 (gchar *) "data",
27488 (gchar *) "ay",
27489 NULL
27490 },
27491 FALSE
27492};
27493
27494static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
27495{
27496 &_host_ipmi_signal_info_received_message_ARG_seq,
27497 &_host_ipmi_signal_info_received_message_ARG_netfn,
27498 &_host_ipmi_signal_info_received_message_ARG_cmd,
27499 &_host_ipmi_signal_info_received_message_ARG_data,
27500 NULL
27501};
27502
27503static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
27504{
27505 {
27506 -1,
27507 (gchar *) "ReceivedMessage",
27508 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
27509 NULL
27510 },
27511 "received-message"
27512};
27513
27514static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
27515{
27516 &_host_ipmi_signal_info_received_message,
27517 NULL
27518};
27519
27520static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
27521{
27522 {
27523 -1,
27524 (gchar *) "org.openbmc.HostIpmi",
27525 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
27526 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
27527 NULL,
27528 NULL
27529 },
27530 "host-ipmi",
27531};
27532
27533
27534/**
27535 * host_ipmi_interface_info:
27536 *
27537 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
27538 *
27539 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
27540 */
27541GDBusInterfaceInfo *
27542host_ipmi_interface_info (void)
27543{
27544 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
27545}
27546
27547/**
27548 * host_ipmi_override_properties:
27549 * @klass: The class structure for a #GObject<!-- -->-derived class.
27550 * @property_id_begin: The property id to assign to the first overridden property.
27551 *
27552 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
27553 * The properties are overridden in the order they are defined.
27554 *
27555 * Returns: The last property id.
27556 */
27557guint
27558host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
27559{
27560 return property_id_begin - 1;
27561}
27562
27563
27564
27565/**
27566 * HostIpmi:
27567 *
27568 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
27569 */
27570
27571/**
27572 * HostIpmiIface:
27573 * @parent_iface: The parent interface.
27574 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
27575 * @received_message: Handler for the #HostIpmi::received-message signal.
27576 *
27577 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
27578 */
27579
27580typedef HostIpmiIface HostIpmiInterface;
27581G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
27582
27583static void
27584host_ipmi_default_init (HostIpmiIface *iface)
27585{
27586 /* GObject signals for incoming D-Bus method calls: */
27587 /**
27588 * HostIpmi::handle-send-message:
27589 * @object: A #HostIpmi.
27590 * @invocation: A #GDBusMethodInvocation.
27591 * @arg_seq: Argument passed by remote caller.
27592 * @arg_netfn: Argument passed by remote caller.
27593 * @arg_cmd: Argument passed by remote caller.
27594 * @arg_data: Argument passed by remote caller.
27595 *
27596 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
27597 *
27598 * 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 host_ipmi_complete_send_message() 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.
27599 *
27600 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27601 */
27602 g_signal_new ("handle-send-message",
27603 G_TYPE_FROM_INTERFACE (iface),
27604 G_SIGNAL_RUN_LAST,
27605 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
27606 g_signal_accumulator_true_handled,
27607 NULL,
27608 g_cclosure_marshal_generic,
27609 G_TYPE_BOOLEAN,
27610 5,
27611 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
27612
27613 /* GObject signals for received D-Bus signals: */
27614 /**
27615 * HostIpmi::received-message:
27616 * @object: A #HostIpmi.
27617 * @arg_seq: Argument.
27618 * @arg_netfn: Argument.
27619 * @arg_cmd: Argument.
27620 * @arg_data: Argument.
27621 *
27622 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> is received.
27623 *
27624 * 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.
27625 */
27626 g_signal_new ("received-message",
27627 G_TYPE_FROM_INTERFACE (iface),
27628 G_SIGNAL_RUN_LAST,
27629 G_STRUCT_OFFSET (HostIpmiIface, received_message),
27630 NULL,
27631 NULL,
27632 g_cclosure_marshal_generic,
27633 G_TYPE_NONE,
27634 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
27635
27636}
27637
27638/**
27639 * host_ipmi_emit_received_message:
27640 * @object: A #HostIpmi.
27641 * @arg_seq: Argument to pass with the signal.
27642 * @arg_netfn: Argument to pass with the signal.
27643 * @arg_cmd: Argument to pass with the signal.
27644 * @arg_data: Argument to pass with the signal.
27645 *
27646 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
27647 */
27648void
27649host_ipmi_emit_received_message (
27650 HostIpmi *object,
27651 guchar arg_seq,
27652 guchar arg_netfn,
27653 guchar arg_cmd,
27654 const gchar *arg_data)
27655{
27656 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
27657}
27658
27659/**
27660 * host_ipmi_call_send_message:
27661 * @proxy: A #HostIpmiProxy.
27662 * @arg_seq: Argument to pass with the method invocation.
27663 * @arg_netfn: Argument to pass with the method invocation.
27664 * @arg_cmd: Argument to pass with the method invocation.
27665 * @arg_data: Argument to pass with the method invocation.
27666 * @cancellable: (allow-none): A #GCancellable or %NULL.
27667 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27668 * @user_data: User data to pass to @callback.
27669 *
27670 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
27671 * 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.
27672 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
27673 *
27674 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
27675 */
27676void
27677host_ipmi_call_send_message (
27678 HostIpmi *proxy,
27679 guchar arg_seq,
27680 guchar arg_netfn,
27681 guchar arg_cmd,
27682 const gchar *arg_data,
27683 GCancellable *cancellable,
27684 GAsyncReadyCallback callback,
27685 gpointer user_data)
27686{
27687 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27688 "sendMessage",
27689 g_variant_new ("(yyy^ay)",
27690 arg_seq,
27691 arg_netfn,
27692 arg_cmd,
27693 arg_data),
27694 G_DBUS_CALL_FLAGS_NONE,
27695 -1,
27696 cancellable,
27697 callback,
27698 user_data);
27699}
27700
27701/**
27702 * host_ipmi_call_send_message_finish:
27703 * @proxy: A #HostIpmiProxy.
27704 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
27705 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
27706 * @error: Return location for error or %NULL.
27707 *
27708 * Finishes an operation started with host_ipmi_call_send_message().
27709 *
27710 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27711 */
27712gboolean
27713host_ipmi_call_send_message_finish (
27714 HostIpmi *proxy,
27715 gint64 *out_unnamed_arg4,
27716 GAsyncResult *res,
27717 GError **error)
27718{
27719 GVariant *_ret;
27720 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27721 if (_ret == NULL)
27722 goto _out;
27723 g_variant_get (_ret,
27724 "(x)",
27725 out_unnamed_arg4);
27726 g_variant_unref (_ret);
27727_out:
27728 return _ret != NULL;
27729}
27730
27731/**
27732 * host_ipmi_call_send_message_sync:
27733 * @proxy: A #HostIpmiProxy.
27734 * @arg_seq: Argument to pass with the method invocation.
27735 * @arg_netfn: Argument to pass with the method invocation.
27736 * @arg_cmd: Argument to pass with the method invocation.
27737 * @arg_data: Argument to pass with the method invocation.
27738 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
27739 * @cancellable: (allow-none): A #GCancellable or %NULL.
27740 * @error: Return location for error or %NULL.
27741 *
27742 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27743 *
27744 * See host_ipmi_call_send_message() for the asynchronous version of this method.
27745 *
27746 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27747 */
27748gboolean
27749host_ipmi_call_send_message_sync (
27750 HostIpmi *proxy,
27751 guchar arg_seq,
27752 guchar arg_netfn,
27753 guchar arg_cmd,
27754 const gchar *arg_data,
27755 gint64 *out_unnamed_arg4,
27756 GCancellable *cancellable,
27757 GError **error)
27758{
27759 GVariant *_ret;
27760 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27761 "sendMessage",
27762 g_variant_new ("(yyy^ay)",
27763 arg_seq,
27764 arg_netfn,
27765 arg_cmd,
27766 arg_data),
27767 G_DBUS_CALL_FLAGS_NONE,
27768 -1,
27769 cancellable,
27770 error);
27771 if (_ret == NULL)
27772 goto _out;
27773 g_variant_get (_ret,
27774 "(x)",
27775 out_unnamed_arg4);
27776 g_variant_unref (_ret);
27777_out:
27778 return _ret != NULL;
27779}
27780
27781/**
27782 * host_ipmi_complete_send_message:
27783 * @object: A #HostIpmi.
27784 * @invocation: (transfer full): A #GDBusMethodInvocation.
27785 * @unnamed_arg4: Parameter to return.
27786 *
27787 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</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.
27788 *
27789 * This method will free @invocation, you cannot use it afterwards.
27790 */
27791void
27792host_ipmi_complete_send_message (
27793 HostIpmi *object,
27794 GDBusMethodInvocation *invocation,
27795 gint64 unnamed_arg4)
27796{
27797 g_dbus_method_invocation_return_value (invocation,
27798 g_variant_new ("(x)",
27799 unnamed_arg4));
27800}
27801
27802/* ------------------------------------------------------------------------ */
27803
27804/**
27805 * HostIpmiProxy:
27806 *
27807 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
27808 */
27809
27810/**
27811 * HostIpmiProxyClass:
27812 * @parent_class: The parent class.
27813 *
27814 * Class structure for #HostIpmiProxy.
27815 */
27816
27817struct _HostIpmiProxyPrivate
27818{
27819 GData *qdata;
27820};
27821
27822static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
27823
27824#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27825G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
27826 G_ADD_PRIVATE (HostIpmiProxy)
27827 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
27828
27829#else
27830G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
27831 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
27832
27833#endif
27834static void
27835host_ipmi_proxy_finalize (GObject *object)
27836{
27837 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
27838 g_datalist_clear (&proxy->priv->qdata);
27839 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
27840}
27841
27842static void
27843host_ipmi_proxy_get_property (GObject *object,
27844 guint prop_id,
27845 GValue *value,
27846 GParamSpec *pspec G_GNUC_UNUSED)
27847{
27848}
27849
27850static void
27851host_ipmi_proxy_set_property (GObject *object,
27852 guint prop_id,
27853 const GValue *value,
27854 GParamSpec *pspec G_GNUC_UNUSED)
27855{
27856}
27857
27858static void
27859host_ipmi_proxy_g_signal (GDBusProxy *proxy,
27860 const gchar *sender_name G_GNUC_UNUSED,
27861 const gchar *signal_name,
27862 GVariant *parameters)
27863{
27864 _ExtendedGDBusSignalInfo *info;
27865 GVariantIter iter;
27866 GVariant *child;
27867 GValue *paramv;
27868 guint num_params;
27869 guint n;
27870 guint signal_id;
27871 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
27872 if (info == NULL)
27873 return;
27874 num_params = g_variant_n_children (parameters);
27875 paramv = g_new0 (GValue, num_params + 1);
27876 g_value_init (&paramv[0], TYPE_HOST_IPMI);
27877 g_value_set_object (&paramv[0], proxy);
27878 g_variant_iter_init (&iter, parameters);
27879 n = 1;
27880 while ((child = g_variant_iter_next_value (&iter)) != NULL)
27881 {
27882 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
27883 if (arg_info->use_gvariant)
27884 {
27885 g_value_init (&paramv[n], G_TYPE_VARIANT);
27886 g_value_set_variant (&paramv[n], child);
27887 n++;
27888 }
27889 else
27890 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
27891 g_variant_unref (child);
27892 }
27893 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
27894 g_signal_emitv (paramv, signal_id, 0, NULL);
27895 for (n = 0; n < num_params + 1; n++)
27896 g_value_unset (&paramv[n]);
27897 g_free (paramv);
27898}
27899
27900static void
27901host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
27902 GVariant *changed_properties,
27903 const gchar *const *invalidated_properties)
27904{
27905 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
27906 guint n;
27907 const gchar *key;
27908 GVariantIter *iter;
27909 _ExtendedGDBusPropertyInfo *info;
27910 g_variant_get (changed_properties, "a{sv}", &iter);
27911 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
27912 {
27913 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
27914 g_datalist_remove_data (&proxy->priv->qdata, key);
27915 if (info != NULL)
27916 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
27917 }
27918 g_variant_iter_free (iter);
27919 for (n = 0; invalidated_properties[n] != NULL; n++)
27920 {
27921 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
27922 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
27923 if (info != NULL)
27924 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
27925 }
27926}
27927
27928static void
27929host_ipmi_proxy_init (HostIpmiProxy *proxy)
27930{
27931#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27932 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
27933#else
27934 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
27935#endif
27936
27937 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
27938}
27939
27940static void
27941host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
27942{
27943 GObjectClass *gobject_class;
27944 GDBusProxyClass *proxy_class;
27945
27946 gobject_class = G_OBJECT_CLASS (klass);
27947 gobject_class->finalize = host_ipmi_proxy_finalize;
27948 gobject_class->get_property = host_ipmi_proxy_get_property;
27949 gobject_class->set_property = host_ipmi_proxy_set_property;
27950
27951 proxy_class = G_DBUS_PROXY_CLASS (klass);
27952 proxy_class->g_signal = host_ipmi_proxy_g_signal;
27953 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
27954
27955#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27956 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
27957#endif
27958}
27959
27960static void
27961host_ipmi_proxy_iface_init (HostIpmiIface *iface)
27962{
27963}
27964
27965/**
27966 * host_ipmi_proxy_new:
27967 * @connection: A #GDBusConnection.
27968 * @flags: Flags from the #GDBusProxyFlags enumeration.
27969 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
27970 * @object_path: An object path.
27971 * @cancellable: (allow-none): A #GCancellable or %NULL.
27972 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
27973 * @user_data: User data to pass to @callback.
27974 *
27975 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new() for more details.
27976 *
27977 * 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.
27978 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
27979 *
27980 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
27981 */
27982void
27983host_ipmi_proxy_new (
27984 GDBusConnection *connection,
27985 GDBusProxyFlags flags,
27986 const gchar *name,
27987 const gchar *object_path,
27988 GCancellable *cancellable,
27989 GAsyncReadyCallback callback,
27990 gpointer user_data)
27991{
27992 g_async_initable_new_async (TYPE_HOST_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.HostIpmi", NULL);
27993}
27994
27995/**
27996 * host_ipmi_proxy_new_finish:
27997 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
27998 * @error: Return location for error or %NULL
27999 *
28000 * Finishes an operation started with host_ipmi_proxy_new().
28001 *
28002 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28003 */
28004HostIpmi *
28005host_ipmi_proxy_new_finish (
28006 GAsyncResult *res,
28007 GError **error)
28008{
28009 GObject *ret;
28010 GObject *source_object;
28011 source_object = g_async_result_get_source_object (res);
28012 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28013 g_object_unref (source_object);
28014 if (ret != NULL)
28015 return HOST_IPMI (ret);
28016 else
28017 return NULL;
28018}
28019
28020/**
28021 * host_ipmi_proxy_new_sync:
28022 * @connection: A #GDBusConnection.
28023 * @flags: Flags from the #GDBusProxyFlags enumeration.
28024 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28025 * @object_path: An object path.
28026 * @cancellable: (allow-none): A #GCancellable or %NULL.
28027 * @error: Return location for error or %NULL
28028 *
28029 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new_sync() for more details.
28030 *
28031 * The calling thread is blocked until a reply is received.
28032 *
28033 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
28034 *
28035 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28036 */
28037HostIpmi *
28038host_ipmi_proxy_new_sync (
28039 GDBusConnection *connection,
28040 GDBusProxyFlags flags,
28041 const gchar *name,
28042 const gchar *object_path,
28043 GCancellable *cancellable,
28044 GError **error)
28045{
28046 GInitable *ret;
28047 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
28048 if (ret != NULL)
28049 return HOST_IPMI (ret);
28050 else
28051 return NULL;
28052}
28053
28054
28055/**
28056 * host_ipmi_proxy_new_for_bus:
28057 * @bus_type: A #GBusType.
28058 * @flags: Flags from the #GDBusProxyFlags enumeration.
28059 * @name: A bus name (well-known or unique).
28060 * @object_path: An object path.
28061 * @cancellable: (allow-none): A #GCancellable or %NULL.
28062 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28063 * @user_data: User data to pass to @callback.
28064 *
28065 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
28066 *
28067 * 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.
28068 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
28069 *
28070 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
28071 */
28072void
28073host_ipmi_proxy_new_for_bus (
28074 GBusType bus_type,
28075 GDBusProxyFlags flags,
28076 const gchar *name,
28077 const gchar *object_path,
28078 GCancellable *cancellable,
28079 GAsyncReadyCallback callback,
28080 gpointer user_data)
28081{
28082 g_async_initable_new_async (TYPE_HOST_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.HostIpmi", NULL);
28083}
28084
28085/**
28086 * host_ipmi_proxy_new_for_bus_finish:
28087 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
28088 * @error: Return location for error or %NULL
28089 *
28090 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
28091 *
28092 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28093 */
28094HostIpmi *
28095host_ipmi_proxy_new_for_bus_finish (
28096 GAsyncResult *res,
28097 GError **error)
28098{
28099 GObject *ret;
28100 GObject *source_object;
28101 source_object = g_async_result_get_source_object (res);
28102 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28103 g_object_unref (source_object);
28104 if (ret != NULL)
28105 return HOST_IPMI (ret);
28106 else
28107 return NULL;
28108}
28109
28110/**
28111 * host_ipmi_proxy_new_for_bus_sync:
28112 * @bus_type: A #GBusType.
28113 * @flags: Flags from the #GDBusProxyFlags enumeration.
28114 * @name: A bus name (well-known or unique).
28115 * @object_path: An object path.
28116 * @cancellable: (allow-none): A #GCancellable or %NULL.
28117 * @error: Return location for error or %NULL
28118 *
28119 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
28120 *
28121 * The calling thread is blocked until a reply is received.
28122 *
28123 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
28124 *
28125 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28126 */
28127HostIpmi *
28128host_ipmi_proxy_new_for_bus_sync (
28129 GBusType bus_type,
28130 GDBusProxyFlags flags,
28131 const gchar *name,
28132 const gchar *object_path,
28133 GCancellable *cancellable,
28134 GError **error)
28135{
28136 GInitable *ret;
28137 ret = g_initable_new (TYPE_HOST_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.HostIpmi", NULL);
28138 if (ret != NULL)
28139 return HOST_IPMI (ret);
28140 else
28141 return NULL;
28142}
28143
28144
28145/* ------------------------------------------------------------------------ */
28146
28147/**
28148 * HostIpmiSkeleton:
28149 *
28150 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
28151 */
28152
28153/**
28154 * HostIpmiSkeletonClass:
28155 * @parent_class: The parent class.
28156 *
28157 * Class structure for #HostIpmiSkeleton.
28158 */
28159
28160struct _HostIpmiSkeletonPrivate
28161{
28162 GValue *properties;
28163 GList *changed_properties;
28164 GSource *changed_properties_idle_source;
28165 GMainContext *context;
28166 GMutex lock;
28167};
28168
28169static void
28170_host_ipmi_skeleton_handle_method_call (
28171 GDBusConnection *connection G_GNUC_UNUSED,
28172 const gchar *sender G_GNUC_UNUSED,
28173 const gchar *object_path G_GNUC_UNUSED,
28174 const gchar *interface_name,
28175 const gchar *method_name,
28176 GVariant *parameters,
28177 GDBusMethodInvocation *invocation,
28178 gpointer user_data)
28179{
28180 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28181 _ExtendedGDBusMethodInfo *info;
28182 GVariantIter iter;
28183 GVariant *child;
28184 GValue *paramv;
28185 guint num_params;
28186 guint num_extra;
28187 guint n;
28188 guint signal_id;
28189 GValue return_value = G_VALUE_INIT;
28190 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
28191 g_assert (info != NULL);
28192 num_params = g_variant_n_children (parameters);
28193 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
28194 n = 0;
28195 g_value_init (&paramv[n], TYPE_HOST_IPMI);
28196 g_value_set_object (&paramv[n++], skeleton);
28197 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
28198 g_value_set_object (&paramv[n++], invocation);
28199 if (info->pass_fdlist)
28200 {
28201#ifdef G_OS_UNIX
28202 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
28203 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
28204#else
28205 g_assert_not_reached ();
28206#endif
28207 }
28208 g_variant_iter_init (&iter, parameters);
28209 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28210 {
28211 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
28212 if (arg_info->use_gvariant)
28213 {
28214 g_value_init (&paramv[n], G_TYPE_VARIANT);
28215 g_value_set_variant (&paramv[n], child);
28216 n++;
28217 }
28218 else
28219 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28220 g_variant_unref (child);
28221 }
28222 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
28223 g_value_init (&return_value, G_TYPE_BOOLEAN);
28224 g_signal_emitv (paramv, signal_id, 0, &return_value);
28225 if (!g_value_get_boolean (&return_value))
28226 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);
28227 g_value_unset (&return_value);
28228 for (n = 0; n < num_params + num_extra; n++)
28229 g_value_unset (&paramv[n]);
28230 g_free (paramv);
28231}
28232
28233static GVariant *
28234_host_ipmi_skeleton_handle_get_property (
28235 GDBusConnection *connection G_GNUC_UNUSED,
28236 const gchar *sender G_GNUC_UNUSED,
28237 const gchar *object_path G_GNUC_UNUSED,
28238 const gchar *interface_name G_GNUC_UNUSED,
28239 const gchar *property_name,
28240 GError **error,
28241 gpointer user_data)
28242{
28243 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28244 GValue value = G_VALUE_INIT;
28245 GParamSpec *pspec;
28246 _ExtendedGDBusPropertyInfo *info;
28247 GVariant *ret;
28248 ret = NULL;
28249 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
28250 g_assert (info != NULL);
28251 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28252 if (pspec == NULL)
28253 {
28254 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28255 }
28256 else
28257 {
28258 g_value_init (&value, pspec->value_type);
28259 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28260 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
28261 g_value_unset (&value);
28262 }
28263 return ret;
28264}
28265
28266static gboolean
28267_host_ipmi_skeleton_handle_set_property (
28268 GDBusConnection *connection G_GNUC_UNUSED,
28269 const gchar *sender G_GNUC_UNUSED,
28270 const gchar *object_path G_GNUC_UNUSED,
28271 const gchar *interface_name G_GNUC_UNUSED,
28272 const gchar *property_name,
28273 GVariant *variant,
28274 GError **error,
28275 gpointer user_data)
28276{
28277 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28278 GValue value = G_VALUE_INIT;
28279 GParamSpec *pspec;
28280 _ExtendedGDBusPropertyInfo *info;
28281 gboolean ret;
28282 ret = FALSE;
28283 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
28284 g_assert (info != NULL);
28285 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28286 if (pspec == NULL)
28287 {
28288 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28289 }
28290 else
28291 {
28292 if (info->use_gvariant)
28293 g_value_set_variant (&value, variant);
28294 else
28295 g_dbus_gvariant_to_gvalue (variant, &value);
28296 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28297 g_value_unset (&value);
28298 ret = TRUE;
28299 }
28300 return ret;
28301}
28302
28303static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
28304{
28305 _host_ipmi_skeleton_handle_method_call,
28306 _host_ipmi_skeleton_handle_get_property,
28307 _host_ipmi_skeleton_handle_set_property,
28308 {NULL}
28309};
28310
28311static GDBusInterfaceInfo *
28312host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28313{
28314 return host_ipmi_interface_info ();
28315}
28316
28317static GDBusInterfaceVTable *
28318host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28319{
28320 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
28321}
28322
28323static GVariant *
28324host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
28325{
28326 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
28327
28328 GVariantBuilder builder;
28329 guint n;
28330 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28331 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
28332 goto out;
28333 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
28334 {
28335 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
28336 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
28337 {
28338 GVariant *value;
28339 value = _host_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.HostIpmi", info->name, NULL, skeleton);
28340 if (value != NULL)
28341 {
28342 g_variant_take_ref (value);
28343 g_variant_builder_add (&builder, "{sv}", info->name, value);
28344 g_variant_unref (value);
28345 }
28346 }
28347 }
28348out:
28349 return g_variant_builder_end (&builder);
28350}
28351
28352static void
28353host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
28354{
28355}
28356
28357static void
28358_host_ipmi_on_signal_received_message (
28359 HostIpmi *object,
28360 guchar arg_seq,
28361 guchar arg_netfn,
28362 guchar arg_cmd,
28363 const gchar *arg_data)
28364{
28365 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
28366
28367 GList *connections, *l;
28368 GVariant *signal_variant;
28369 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28370
28371 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
28372 arg_seq,
28373 arg_netfn,
28374 arg_cmd,
28375 arg_data));
28376 for (l = connections; l != NULL; l = l->next)
28377 {
28378 GDBusConnection *connection = l->data;
28379 g_dbus_connection_emit_signal (connection,
28380 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
28381 signal_variant, NULL);
28382 }
28383 g_variant_unref (signal_variant);
28384 g_list_free_full (connections, g_object_unref);
28385}
28386
28387static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
28388#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28389G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28390 G_ADD_PRIVATE (HostIpmiSkeleton)
28391 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
28392
28393#else
28394G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28395 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
28396
28397#endif
28398static void
28399host_ipmi_skeleton_finalize (GObject *object)
28400{
28401 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
28402 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28403 if (skeleton->priv->changed_properties_idle_source != NULL)
28404 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28405 g_main_context_unref (skeleton->priv->context);
28406 g_mutex_clear (&skeleton->priv->lock);
28407 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
28408}
28409
28410static void
28411host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
28412{
28413#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28414 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
28415#else
28416 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
28417#endif
28418
28419 g_mutex_init (&skeleton->priv->lock);
28420 skeleton->priv->context = g_main_context_ref_thread_default ();
28421}
28422
28423static void
28424host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
28425{
28426 GObjectClass *gobject_class;
28427 GDBusInterfaceSkeletonClass *skeleton_class;
28428
28429 gobject_class = G_OBJECT_CLASS (klass);
28430 gobject_class->finalize = host_ipmi_skeleton_finalize;
28431
28432 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
28433 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
28434 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
28435 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
28436 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
28437
28438#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28439 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
28440#endif
28441}
28442
28443static void
28444host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
28445{
28446 iface->received_message = _host_ipmi_on_signal_received_message;
28447}
28448
28449/**
28450 * host_ipmi_skeleton_new:
28451 *
28452 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
28453 *
28454 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
28455 */
28456HostIpmi *
28457host_ipmi_skeleton_new (void)
28458{
28459 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
28460}
28461
28462/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050028463 * Code for Object, ObjectProxy and ObjectSkeleton
28464 * ------------------------------------------------------------------------
28465 */
28466
28467/**
28468 * SECTION:Object
28469 * @title: Object
28470 * @short_description: Specialized GDBusObject types
28471 *
28472 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
28473 */
28474
28475/**
28476 * Object:
28477 *
28478 * The #Object type is a specialized container of interfaces.
28479 */
28480
28481/**
28482 * ObjectIface:
28483 * @parent_iface: The parent interface.
28484 *
28485 * Virtual table for the #Object interface.
28486 */
28487
28488typedef ObjectIface ObjectInterface;
28489G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
28490
28491static void
28492object_default_init (ObjectIface *iface)
28493{
28494 /**
28495 * Object:occ:
28496 *
28497 * 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.
28498 *
28499 * Connect to the #GObject::notify signal to get informed of property changes.
28500 */
28501 g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28502
28503 /**
28504 * Object:fan:
28505 *
28506 * 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.
28507 *
28508 * Connect to the #GObject::notify signal to get informed of property changes.
28509 */
28510 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28511
28512 /**
28513 * Object:sensor-value:
28514 *
28515 * 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.
28516 *
28517 * Connect to the #GObject::notify signal to get informed of property changes.
28518 */
28519 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));
28520
28521 /**
28522 * Object:sensor-threshold:
28523 *
28524 * 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.
28525 *
28526 * Connect to the #GObject::notify signal to get informed of property changes.
28527 */
28528 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));
28529
28530 /**
28531 * Object:sensor-i2c:
28532 *
28533 * 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.
28534 *
28535 * Connect to the #GObject::notify signal to get informed of property changes.
28536 */
28537 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));
28538
28539 /**
28540 * Object:sensor-match:
28541 *
28542 * 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.
28543 *
28544 * Connect to the #GObject::notify signal to get informed of property changes.
28545 */
28546 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));
28547
28548 /**
28549 * Object:process:
28550 *
28551 * 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.
28552 *
28553 * Connect to the #GObject::notify signal to get informed of property changes.
28554 */
28555 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28556
28557 /**
Norman James18998182015-10-11 21:54:53 -050028558 * Object:shared-resource:
28559 *
28560 * The #SharedResource instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>, if any.
28561 *
28562 * Connect to the #GObject::notify signal to get informed of property changes.
28563 */
28564 g_object_interface_install_property (iface, g_param_spec_object ("shared-resource", "shared-resource", "shared-resource", TYPE_SHARED_RESOURCE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28565
28566 /**
Norman James362a80f2015-09-14 14:04:39 -050028567 * Object:control:
28568 *
28569 * 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.
28570 *
28571 * Connect to the #GObject::notify signal to get informed of property changes.
28572 */
28573 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28574
28575 /**
28576 * Object:control-bmc:
28577 *
28578 * 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.
28579 *
28580 * Connect to the #GObject::notify signal to get informed of property changes.
28581 */
28582 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));
28583
28584 /**
28585 * Object:control-host:
28586 *
28587 * 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.
28588 *
28589 * Connect to the #GObject::notify signal to get informed of property changes.
28590 */
28591 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));
28592
28593 /**
28594 * Object:control-power:
28595 *
28596 * 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.
28597 *
28598 * Connect to the #GObject::notify signal to get informed of property changes.
28599 */
28600 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));
28601
28602 /**
28603 * Object:watchdog:
28604 *
28605 * 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.
28606 *
28607 * Connect to the #GObject::notify signal to get informed of property changes.
28608 */
28609 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28610
28611 /**
28612 * Object:event-log:
28613 *
28614 * 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.
28615 *
28616 * Connect to the #GObject::notify signal to get informed of property changes.
28617 */
28618 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));
28619
28620 /**
28621 * Object:flash:
28622 *
28623 * 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.
28624 *
28625 * Connect to the #GObject::notify signal to get informed of property changes.
28626 */
28627 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28628
28629 /**
Norman James18998182015-10-11 21:54:53 -050028630 * Object:flash-control:
28631 *
28632 * The #FlashControl instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>, if any.
28633 *
28634 * Connect to the #GObject::notify signal to get informed of property changes.
28635 */
28636 g_object_interface_install_property (iface, g_param_spec_object ("flash-control", "flash-control", "flash-control", TYPE_FLASH_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28637
28638 /**
Norman James362a80f2015-09-14 14:04:39 -050028639 * Object:button:
28640 *
28641 * 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.
28642 *
28643 * Connect to the #GObject::notify signal to get informed of property changes.
28644 */
28645 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28646
28647 /**
28648 * Object:led:
28649 *
28650 * 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.
28651 *
28652 * Connect to the #GObject::notify signal to get informed of property changes.
28653 */
28654 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28655
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028656 /**
28657 * Object:host-ipmi:
28658 *
28659 * The #HostIpmi instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>, if any.
28660 *
28661 * Connect to the #GObject::notify signal to get informed of property changes.
28662 */
28663 g_object_interface_install_property (iface, g_param_spec_object ("host-ipmi", "host-ipmi", "host-ipmi", TYPE_HOST_IPMI, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28664
Norman James362a80f2015-09-14 14:04:39 -050028665}
28666
28667/**
28668 * object_get_occ:
28669 * @object: A #Object.
28670 *
28671 * 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.
28672 *
28673 * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28674 */
28675Occ *object_get_occ (Object *object)
28676{
28677 GDBusInterface *ret;
28678 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
28679 if (ret == NULL)
28680 return NULL;
28681 return OCC (ret);
28682}
28683
28684/**
28685 * object_get_fan:
28686 * @object: A #Object.
28687 *
28688 * 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.
28689 *
28690 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28691 */
28692Fan *object_get_fan (Object *object)
28693{
28694 GDBusInterface *ret;
28695 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
28696 if (ret == NULL)
28697 return NULL;
28698 return FAN (ret);
28699}
28700
28701/**
28702 * object_get_sensor_value:
28703 * @object: A #Object.
28704 *
28705 * 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.
28706 *
28707 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28708 */
28709SensorValue *object_get_sensor_value (Object *object)
28710{
28711 GDBusInterface *ret;
28712 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
28713 if (ret == NULL)
28714 return NULL;
28715 return SENSOR_VALUE (ret);
28716}
28717
28718/**
28719 * object_get_sensor_threshold:
28720 * @object: A #Object.
28721 *
28722 * 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.
28723 *
28724 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28725 */
28726SensorThreshold *object_get_sensor_threshold (Object *object)
28727{
28728 GDBusInterface *ret;
28729 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
28730 if (ret == NULL)
28731 return NULL;
28732 return SENSOR_THRESHOLD (ret);
28733}
28734
28735/**
28736 * object_get_sensor_i2c:
28737 * @object: A #Object.
28738 *
28739 * 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.
28740 *
28741 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28742 */
28743SensorI2c *object_get_sensor_i2c (Object *object)
28744{
28745 GDBusInterface *ret;
28746 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
28747 if (ret == NULL)
28748 return NULL;
28749 return SENSOR_I2C (ret);
28750}
28751
28752/**
28753 * object_get_sensor_match:
28754 * @object: A #Object.
28755 *
28756 * 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.
28757 *
28758 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28759 */
28760SensorMatch *object_get_sensor_match (Object *object)
28761{
28762 GDBusInterface *ret;
28763 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
28764 if (ret == NULL)
28765 return NULL;
28766 return SENSOR_MATCH (ret);
28767}
28768
28769/**
28770 * object_get_process:
28771 * @object: A #Object.
28772 *
28773 * 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.
28774 *
28775 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28776 */
28777Process *object_get_process (Object *object)
28778{
28779 GDBusInterface *ret;
28780 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
28781 if (ret == NULL)
28782 return NULL;
28783 return PROCESS (ret);
28784}
28785
28786/**
Norman James18998182015-10-11 21:54:53 -050028787 * object_get_shared_resource:
28788 * @object: A #Object.
28789 *
28790 * Gets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object, if any.
28791 *
28792 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28793 */
28794SharedResource *object_get_shared_resource (Object *object)
28795{
28796 GDBusInterface *ret;
28797 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
28798 if (ret == NULL)
28799 return NULL;
28800 return SHARED_RESOURCE (ret);
28801}
28802
28803/**
Norman James362a80f2015-09-14 14:04:39 -050028804 * object_get_control:
28805 * @object: A #Object.
28806 *
28807 * 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.
28808 *
28809 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28810 */
28811Control *object_get_control (Object *object)
28812{
28813 GDBusInterface *ret;
28814 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
28815 if (ret == NULL)
28816 return NULL;
28817 return CONTROL (ret);
28818}
28819
28820/**
28821 * object_get_control_bmc:
28822 * @object: A #Object.
28823 *
28824 * 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.
28825 *
28826 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28827 */
28828ControlBmc *object_get_control_bmc (Object *object)
28829{
28830 GDBusInterface *ret;
28831 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
28832 if (ret == NULL)
28833 return NULL;
28834 return CONTROL_BMC (ret);
28835}
28836
28837/**
28838 * object_get_control_host:
28839 * @object: A #Object.
28840 *
28841 * 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.
28842 *
28843 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28844 */
28845ControlHost *object_get_control_host (Object *object)
28846{
28847 GDBusInterface *ret;
28848 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
28849 if (ret == NULL)
28850 return NULL;
28851 return CONTROL_HOST (ret);
28852}
28853
28854/**
28855 * object_get_control_power:
28856 * @object: A #Object.
28857 *
28858 * 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.
28859 *
28860 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28861 */
28862ControlPower *object_get_control_power (Object *object)
28863{
28864 GDBusInterface *ret;
28865 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
28866 if (ret == NULL)
28867 return NULL;
28868 return CONTROL_POWER (ret);
28869}
28870
28871/**
28872 * object_get_watchdog:
28873 * @object: A #Object.
28874 *
28875 * 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.
28876 *
28877 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28878 */
28879Watchdog *object_get_watchdog (Object *object)
28880{
28881 GDBusInterface *ret;
28882 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
28883 if (ret == NULL)
28884 return NULL;
28885 return WATCHDOG (ret);
28886}
28887
28888/**
28889 * object_get_event_log:
28890 * @object: A #Object.
28891 *
28892 * 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.
28893 *
28894 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28895 */
28896EventLog *object_get_event_log (Object *object)
28897{
28898 GDBusInterface *ret;
28899 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
28900 if (ret == NULL)
28901 return NULL;
28902 return EVENT_LOG (ret);
28903}
28904
28905/**
28906 * object_get_flash:
28907 * @object: A #Object.
28908 *
28909 * 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.
28910 *
28911 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28912 */
28913Flash *object_get_flash (Object *object)
28914{
28915 GDBusInterface *ret;
28916 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
28917 if (ret == NULL)
28918 return NULL;
28919 return FLASH (ret);
28920}
28921
28922/**
Norman James18998182015-10-11 21:54:53 -050028923 * object_get_flash_control:
28924 * @object: A #Object.
28925 *
28926 * Gets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object, if any.
28927 *
28928 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28929 */
28930FlashControl *object_get_flash_control (Object *object)
28931{
28932 GDBusInterface *ret;
28933 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
28934 if (ret == NULL)
28935 return NULL;
28936 return FLASH_CONTROL (ret);
28937}
28938
28939/**
Norman James362a80f2015-09-14 14:04:39 -050028940 * object_get_button:
28941 * @object: A #Object.
28942 *
28943 * 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.
28944 *
28945 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28946 */
28947Button *object_get_button (Object *object)
28948{
28949 GDBusInterface *ret;
28950 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
28951 if (ret == NULL)
28952 return NULL;
28953 return BUTTON (ret);
28954}
28955
28956/**
28957 * object_get_led:
28958 * @object: A #Object.
28959 *
28960 * 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.
28961 *
28962 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28963 */
28964Led *object_get_led (Object *object)
28965{
28966 GDBusInterface *ret;
28967 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
28968 if (ret == NULL)
28969 return NULL;
28970 return LED (ret);
28971}
28972
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028973/**
28974 * object_get_host_ipmi:
28975 * @object: A #Object.
28976 *
28977 * Gets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object, if any.
28978 *
28979 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28980 */
28981HostIpmi *object_get_host_ipmi (Object *object)
28982{
28983 GDBusInterface *ret;
28984 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
28985 if (ret == NULL)
28986 return NULL;
28987 return HOST_IPMI (ret);
28988}
28989
Norman James362a80f2015-09-14 14:04:39 -050028990
28991/**
28992 * object_peek_occ: (skip)
28993 * @object: A #Object.
28994 *
28995 * Like object_get_occ() but doesn't increase the reference count on the returned object.
28996 *
28997 * <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>
28998 *
28999 * 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.
29000 */
29001Occ *object_peek_occ (Object *object)
29002{
29003 GDBusInterface *ret;
29004 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
29005 if (ret == NULL)
29006 return NULL;
29007 g_object_unref (ret);
29008 return OCC (ret);
29009}
29010
29011/**
29012 * object_peek_fan: (skip)
29013 * @object: A #Object.
29014 *
29015 * Like object_get_fan() but doesn't increase the reference count on the returned object.
29016 *
29017 * <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>
29018 *
29019 * 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.
29020 */
29021Fan *object_peek_fan (Object *object)
29022{
29023 GDBusInterface *ret;
29024 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
29025 if (ret == NULL)
29026 return NULL;
29027 g_object_unref (ret);
29028 return FAN (ret);
29029}
29030
29031/**
29032 * object_peek_sensor_value: (skip)
29033 * @object: A #Object.
29034 *
29035 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
29036 *
29037 * <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>
29038 *
29039 * 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.
29040 */
29041SensorValue *object_peek_sensor_value (Object *object)
29042{
29043 GDBusInterface *ret;
29044 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
29045 if (ret == NULL)
29046 return NULL;
29047 g_object_unref (ret);
29048 return SENSOR_VALUE (ret);
29049}
29050
29051/**
29052 * object_peek_sensor_threshold: (skip)
29053 * @object: A #Object.
29054 *
29055 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
29056 *
29057 * <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>
29058 *
29059 * 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.
29060 */
29061SensorThreshold *object_peek_sensor_threshold (Object *object)
29062{
29063 GDBusInterface *ret;
29064 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
29065 if (ret == NULL)
29066 return NULL;
29067 g_object_unref (ret);
29068 return SENSOR_THRESHOLD (ret);
29069}
29070
29071/**
29072 * object_peek_sensor_i2c: (skip)
29073 * @object: A #Object.
29074 *
29075 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
29076 *
29077 * <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>
29078 *
29079 * 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.
29080 */
29081SensorI2c *object_peek_sensor_i2c (Object *object)
29082{
29083 GDBusInterface *ret;
29084 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
29085 if (ret == NULL)
29086 return NULL;
29087 g_object_unref (ret);
29088 return SENSOR_I2C (ret);
29089}
29090
29091/**
29092 * object_peek_sensor_match: (skip)
29093 * @object: A #Object.
29094 *
29095 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
29096 *
29097 * <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>
29098 *
29099 * 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.
29100 */
29101SensorMatch *object_peek_sensor_match (Object *object)
29102{
29103 GDBusInterface *ret;
29104 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
29105 if (ret == NULL)
29106 return NULL;
29107 g_object_unref (ret);
29108 return SENSOR_MATCH (ret);
29109}
29110
29111/**
29112 * object_peek_process: (skip)
29113 * @object: A #Object.
29114 *
29115 * Like object_get_process() but doesn't increase the reference count on the returned object.
29116 *
29117 * <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>
29118 *
29119 * 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.
29120 */
29121Process *object_peek_process (Object *object)
29122{
29123 GDBusInterface *ret;
29124 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
29125 if (ret == NULL)
29126 return NULL;
29127 g_object_unref (ret);
29128 return PROCESS (ret);
29129}
29130
29131/**
Norman James18998182015-10-11 21:54:53 -050029132 * object_peek_shared_resource: (skip)
29133 * @object: A #Object.
29134 *
29135 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
29136 *
29137 * <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>
29138 *
29139 * Returns: (transfer none): A #SharedResource or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
29140 */
29141SharedResource *object_peek_shared_resource (Object *object)
29142{
29143 GDBusInterface *ret;
29144 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
29145 if (ret == NULL)
29146 return NULL;
29147 g_object_unref (ret);
29148 return SHARED_RESOURCE (ret);
29149}
29150
29151/**
Norman James362a80f2015-09-14 14:04:39 -050029152 * object_peek_control: (skip)
29153 * @object: A #Object.
29154 *
29155 * Like object_get_control() but doesn't increase the reference count on the returned object.
29156 *
29157 * <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>
29158 *
29159 * 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.
29160 */
29161Control *object_peek_control (Object *object)
29162{
29163 GDBusInterface *ret;
29164 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
29165 if (ret == NULL)
29166 return NULL;
29167 g_object_unref (ret);
29168 return CONTROL (ret);
29169}
29170
29171/**
29172 * object_peek_control_bmc: (skip)
29173 * @object: A #Object.
29174 *
29175 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
29176 *
29177 * <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>
29178 *
29179 * 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.
29180 */
29181ControlBmc *object_peek_control_bmc (Object *object)
29182{
29183 GDBusInterface *ret;
29184 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
29185 if (ret == NULL)
29186 return NULL;
29187 g_object_unref (ret);
29188 return CONTROL_BMC (ret);
29189}
29190
29191/**
29192 * object_peek_control_host: (skip)
29193 * @object: A #Object.
29194 *
29195 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
29196 *
29197 * <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>
29198 *
29199 * 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.
29200 */
29201ControlHost *object_peek_control_host (Object *object)
29202{
29203 GDBusInterface *ret;
29204 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
29205 if (ret == NULL)
29206 return NULL;
29207 g_object_unref (ret);
29208 return CONTROL_HOST (ret);
29209}
29210
29211/**
29212 * object_peek_control_power: (skip)
29213 * @object: A #Object.
29214 *
29215 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
29216 *
29217 * <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>
29218 *
29219 * 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.
29220 */
29221ControlPower *object_peek_control_power (Object *object)
29222{
29223 GDBusInterface *ret;
29224 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
29225 if (ret == NULL)
29226 return NULL;
29227 g_object_unref (ret);
29228 return CONTROL_POWER (ret);
29229}
29230
29231/**
29232 * object_peek_watchdog: (skip)
29233 * @object: A #Object.
29234 *
29235 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
29236 *
29237 * <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>
29238 *
29239 * 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.
29240 */
29241Watchdog *object_peek_watchdog (Object *object)
29242{
29243 GDBusInterface *ret;
29244 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
29245 if (ret == NULL)
29246 return NULL;
29247 g_object_unref (ret);
29248 return WATCHDOG (ret);
29249}
29250
29251/**
29252 * object_peek_event_log: (skip)
29253 * @object: A #Object.
29254 *
29255 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
29256 *
29257 * <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>
29258 *
29259 * 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.
29260 */
29261EventLog *object_peek_event_log (Object *object)
29262{
29263 GDBusInterface *ret;
29264 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
29265 if (ret == NULL)
29266 return NULL;
29267 g_object_unref (ret);
29268 return EVENT_LOG (ret);
29269}
29270
29271/**
29272 * object_peek_flash: (skip)
29273 * @object: A #Object.
29274 *
29275 * Like object_get_flash() but doesn't increase the reference count on the returned object.
29276 *
29277 * <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>
29278 *
29279 * 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.
29280 */
29281Flash *object_peek_flash (Object *object)
29282{
29283 GDBusInterface *ret;
29284 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
29285 if (ret == NULL)
29286 return NULL;
29287 g_object_unref (ret);
29288 return FLASH (ret);
29289}
29290
29291/**
Norman James18998182015-10-11 21:54:53 -050029292 * object_peek_flash_control: (skip)
29293 * @object: A #Object.
29294 *
29295 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
29296 *
29297 * <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>
29298 *
29299 * Returns: (transfer none): A #FlashControl or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
29300 */
29301FlashControl *object_peek_flash_control (Object *object)
29302{
29303 GDBusInterface *ret;
29304 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
29305 if (ret == NULL)
29306 return NULL;
29307 g_object_unref (ret);
29308 return FLASH_CONTROL (ret);
29309}
29310
29311/**
Norman James362a80f2015-09-14 14:04:39 -050029312 * object_peek_button: (skip)
29313 * @object: A #Object.
29314 *
29315 * Like object_get_button() but doesn't increase the reference count on the returned object.
29316 *
29317 * <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>
29318 *
29319 * 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.
29320 */
29321Button *object_peek_button (Object *object)
29322{
29323 GDBusInterface *ret;
29324 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29325 if (ret == NULL)
29326 return NULL;
29327 g_object_unref (ret);
29328 return BUTTON (ret);
29329}
29330
29331/**
29332 * object_peek_led: (skip)
29333 * @object: A #Object.
29334 *
29335 * Like object_get_led() but doesn't increase the reference count on the returned object.
29336 *
29337 * <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>
29338 *
29339 * 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.
29340 */
29341Led *object_peek_led (Object *object)
29342{
29343 GDBusInterface *ret;
29344 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29345 if (ret == NULL)
29346 return NULL;
29347 g_object_unref (ret);
29348 return LED (ret);
29349}
29350
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029351/**
29352 * object_peek_host_ipmi: (skip)
29353 * @object: A #Object.
29354 *
29355 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
29356 *
29357 * <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>
29358 *
29359 * Returns: (transfer none): A #HostIpmi or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
29360 */
29361HostIpmi *object_peek_host_ipmi (Object *object)
29362{
29363 GDBusInterface *ret;
29364 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29365 if (ret == NULL)
29366 return NULL;
29367 g_object_unref (ret);
29368 return HOST_IPMI (ret);
29369}
29370
Norman James362a80f2015-09-14 14:04:39 -050029371
29372static void
29373object_notify (GDBusObject *object, GDBusInterface *interface)
29374{
29375 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
29376 /* info can be NULL if the other end is using a D-Bus interface we don't know
29377 * anything about, for example old generated code in this process talking to
29378 * newer generated code in the other process. */
29379 if (info != NULL)
29380 g_object_notify (G_OBJECT (object), info->hyphen_name);
29381}
29382
29383/**
29384 * ObjectProxy:
29385 *
29386 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
29387 */
29388
29389/**
29390 * ObjectProxyClass:
29391 * @parent_class: The parent class.
29392 *
29393 * Class structure for #ObjectProxy.
29394 */
29395
29396static void
29397object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
29398{
29399}
29400
29401static void
29402object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
29403{
29404 iface->interface_added = object_notify;
29405 iface->interface_removed = object_notify;
29406}
29407
29408
29409G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
29410 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
29411 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
29412
29413static void
29414object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
29415{
29416}
29417
29418static void
29419object_proxy_set_property (GObject *gobject,
29420 guint prop_id,
29421 const GValue *value G_GNUC_UNUSED,
29422 GParamSpec *pspec)
29423{
29424 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29425}
29426
29427static void
29428object_proxy_get_property (GObject *gobject,
29429 guint prop_id,
29430 GValue *value,
29431 GParamSpec *pspec)
29432{
29433 ObjectProxy *object = OBJECT_PROXY (gobject);
29434 GDBusInterface *interface;
29435
29436 switch (prop_id)
29437 {
29438 case 1:
29439 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
29440 g_value_take_object (value, interface);
29441 break;
29442
29443 case 2:
29444 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
29445 g_value_take_object (value, interface);
29446 break;
29447
29448 case 3:
29449 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
29450 g_value_take_object (value, interface);
29451 break;
29452
29453 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029454 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050029455 g_value_take_object (value, interface);
29456 break;
29457
Norman James19e45912015-10-04 20:19:41 -050029458 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029459 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050029460 g_value_take_object (value, interface);
29461 break;
29462
Norman James19e45912015-10-04 20:19:41 -050029463 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029464 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050029465 g_value_take_object (value, interface);
29466 break;
29467
Norman James19e45912015-10-04 20:19:41 -050029468 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029469 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050029470 g_value_take_object (value, interface);
29471 break;
29472
Norman James19e45912015-10-04 20:19:41 -050029473 case 8:
Norman James18998182015-10-11 21:54:53 -050029474 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050029475 g_value_take_object (value, interface);
29476 break;
29477
Norman James19e45912015-10-04 20:19:41 -050029478 case 9:
Norman James18998182015-10-11 21:54:53 -050029479 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050029480 g_value_take_object (value, interface);
29481 break;
29482
Norman James19e45912015-10-04 20:19:41 -050029483 case 10:
Norman James18998182015-10-11 21:54:53 -050029484 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050029485 g_value_take_object (value, interface);
29486 break;
29487
Norman James19e45912015-10-04 20:19:41 -050029488 case 11:
Norman James18998182015-10-11 21:54:53 -050029489 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050029490 g_value_take_object (value, interface);
29491 break;
29492
Norman James19e45912015-10-04 20:19:41 -050029493 case 12:
Norman James18998182015-10-11 21:54:53 -050029494 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050029495 g_value_take_object (value, interface);
29496 break;
29497
Norman James19e45912015-10-04 20:19:41 -050029498 case 13:
Norman James18998182015-10-11 21:54:53 -050029499 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050029500 g_value_take_object (value, interface);
29501 break;
29502
Norman James19e45912015-10-04 20:19:41 -050029503 case 14:
Norman James18998182015-10-11 21:54:53 -050029504 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050029505 g_value_take_object (value, interface);
29506 break;
29507
Norman James19e45912015-10-04 20:19:41 -050029508 case 15:
Norman James18998182015-10-11 21:54:53 -050029509 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050029510 g_value_take_object (value, interface);
29511 break;
29512
Norman James19e45912015-10-04 20:19:41 -050029513 case 16:
Norman James18998182015-10-11 21:54:53 -050029514 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050029515 g_value_take_object (value, interface);
29516 break;
29517
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029518 case 17:
Norman James18998182015-10-11 21:54:53 -050029519 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29520 g_value_take_object (value, interface);
29521 break;
29522
29523 case 18:
29524 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29525 g_value_take_object (value, interface);
29526 break;
29527
29528 case 19:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029529 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29530 g_value_take_object (value, interface);
29531 break;
29532
Norman James362a80f2015-09-14 14:04:39 -050029533 default:
29534 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29535 break;
29536 }
29537}
29538
29539static void
29540object_proxy_class_init (ObjectProxyClass *klass)
29541{
29542 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
29543
29544 gobject_class->set_property = object_proxy_set_property;
29545 gobject_class->get_property = object_proxy_get_property;
29546
29547 g_object_class_override_property (gobject_class, 1, "occ");
29548 g_object_class_override_property (gobject_class, 2, "fan");
29549 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050029550 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
29551 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
29552 g_object_class_override_property (gobject_class, 6, "sensor-match");
29553 g_object_class_override_property (gobject_class, 7, "process");
Norman James18998182015-10-11 21:54:53 -050029554 g_object_class_override_property (gobject_class, 8, "shared-resource");
29555 g_object_class_override_property (gobject_class, 9, "control");
29556 g_object_class_override_property (gobject_class, 10, "control-bmc");
29557 g_object_class_override_property (gobject_class, 11, "control-host");
29558 g_object_class_override_property (gobject_class, 12, "control-power");
29559 g_object_class_override_property (gobject_class, 13, "watchdog");
29560 g_object_class_override_property (gobject_class, 14, "event-log");
29561 g_object_class_override_property (gobject_class, 15, "flash");
29562 g_object_class_override_property (gobject_class, 16, "flash-control");
29563 g_object_class_override_property (gobject_class, 17, "button");
29564 g_object_class_override_property (gobject_class, 18, "led");
29565 g_object_class_override_property (gobject_class, 19, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050029566}
29567
29568/**
29569 * object_proxy_new:
29570 * @connection: A #GDBusConnection.
29571 * @object_path: An object path.
29572 *
29573 * Creates a new proxy object.
29574 *
29575 * Returns: (transfer full): The proxy object.
29576 */
29577ObjectProxy *
29578object_proxy_new (GDBusConnection *connection,
29579 const gchar *object_path)
29580{
29581 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
29582 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
29583 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
29584}
29585
29586/**
29587 * ObjectSkeleton:
29588 *
29589 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
29590 */
29591
29592/**
29593 * ObjectSkeletonClass:
29594 * @parent_class: The parent class.
29595 *
29596 * Class structure for #ObjectSkeleton.
29597 */
29598
29599static void
29600object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
29601{
29602}
29603
29604
29605static void
29606object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
29607{
29608 iface->interface_added = object_notify;
29609 iface->interface_removed = object_notify;
29610}
29611
29612G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
29613 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
29614 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
29615
29616static void
29617object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
29618{
29619}
29620
29621static void
29622object_skeleton_set_property (GObject *gobject,
29623 guint prop_id,
29624 const GValue *value,
29625 GParamSpec *pspec)
29626{
29627 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
29628 GDBusInterfaceSkeleton *interface;
29629
29630 switch (prop_id)
29631 {
29632 case 1:
29633 interface = g_value_get_object (value);
29634 if (interface != NULL)
29635 {
29636 g_warn_if_fail (IS_OCC (interface));
29637 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29638 }
29639 else
29640 {
29641 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
29642 }
29643 break;
29644
29645 case 2:
29646 interface = g_value_get_object (value);
29647 if (interface != NULL)
29648 {
29649 g_warn_if_fail (IS_FAN (interface));
29650 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29651 }
29652 else
29653 {
29654 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
29655 }
29656 break;
29657
29658 case 3:
29659 interface = g_value_get_object (value);
29660 if (interface != NULL)
29661 {
29662 g_warn_if_fail (IS_SENSOR_VALUE (interface));
29663 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29664 }
29665 else
29666 {
29667 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
29668 }
29669 break;
29670
29671 case 4:
29672 interface = g_value_get_object (value);
29673 if (interface != NULL)
29674 {
29675 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
29676 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29677 }
29678 else
29679 {
29680 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
29681 }
29682 break;
29683
Norman James19e45912015-10-04 20:19:41 -050029684 case 5:
Norman James362a80f2015-09-14 14:04:39 -050029685 interface = g_value_get_object (value);
29686 if (interface != NULL)
29687 {
29688 g_warn_if_fail (IS_SENSOR_I2C (interface));
29689 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29690 }
29691 else
29692 {
29693 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
29694 }
29695 break;
29696
Norman James19e45912015-10-04 20:19:41 -050029697 case 6:
Norman James362a80f2015-09-14 14:04:39 -050029698 interface = g_value_get_object (value);
29699 if (interface != NULL)
29700 {
29701 g_warn_if_fail (IS_SENSOR_MATCH (interface));
29702 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29703 }
29704 else
29705 {
29706 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
29707 }
29708 break;
29709
Norman James19e45912015-10-04 20:19:41 -050029710 case 7:
Norman James362a80f2015-09-14 14:04:39 -050029711 interface = g_value_get_object (value);
29712 if (interface != NULL)
29713 {
29714 g_warn_if_fail (IS_PROCESS (interface));
29715 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29716 }
29717 else
29718 {
29719 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
29720 }
29721 break;
29722
Norman James19e45912015-10-04 20:19:41 -050029723 case 8:
Norman James362a80f2015-09-14 14:04:39 -050029724 interface = g_value_get_object (value);
29725 if (interface != NULL)
29726 {
Norman James18998182015-10-11 21:54:53 -050029727 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
29728 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29729 }
29730 else
29731 {
29732 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
29733 }
29734 break;
29735
29736 case 9:
29737 interface = g_value_get_object (value);
29738 if (interface != NULL)
29739 {
Norman James362a80f2015-09-14 14:04:39 -050029740 g_warn_if_fail (IS_CONTROL (interface));
29741 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29742 }
29743 else
29744 {
29745 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
29746 }
29747 break;
29748
Norman James18998182015-10-11 21:54:53 -050029749 case 10:
Norman James362a80f2015-09-14 14:04:39 -050029750 interface = g_value_get_object (value);
29751 if (interface != NULL)
29752 {
29753 g_warn_if_fail (IS_CONTROL_BMC (interface));
29754 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29755 }
29756 else
29757 {
29758 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
29759 }
29760 break;
29761
Norman James18998182015-10-11 21:54:53 -050029762 case 11:
Norman James362a80f2015-09-14 14:04:39 -050029763 interface = g_value_get_object (value);
29764 if (interface != NULL)
29765 {
29766 g_warn_if_fail (IS_CONTROL_HOST (interface));
29767 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29768 }
29769 else
29770 {
29771 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
29772 }
29773 break;
29774
Norman James18998182015-10-11 21:54:53 -050029775 case 12:
Norman James362a80f2015-09-14 14:04:39 -050029776 interface = g_value_get_object (value);
29777 if (interface != NULL)
29778 {
29779 g_warn_if_fail (IS_CONTROL_POWER (interface));
29780 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29781 }
29782 else
29783 {
29784 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
29785 }
29786 break;
29787
Norman James18998182015-10-11 21:54:53 -050029788 case 13:
Norman James362a80f2015-09-14 14:04:39 -050029789 interface = g_value_get_object (value);
29790 if (interface != NULL)
29791 {
29792 g_warn_if_fail (IS_WATCHDOG (interface));
29793 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29794 }
29795 else
29796 {
29797 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
29798 }
29799 break;
29800
Norman James18998182015-10-11 21:54:53 -050029801 case 14:
Norman James362a80f2015-09-14 14:04:39 -050029802 interface = g_value_get_object (value);
29803 if (interface != NULL)
29804 {
29805 g_warn_if_fail (IS_EVENT_LOG (interface));
29806 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29807 }
29808 else
29809 {
29810 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
29811 }
29812 break;
29813
Norman James18998182015-10-11 21:54:53 -050029814 case 15:
Norman James362a80f2015-09-14 14:04:39 -050029815 interface = g_value_get_object (value);
29816 if (interface != NULL)
29817 {
29818 g_warn_if_fail (IS_FLASH (interface));
29819 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29820 }
29821 else
29822 {
29823 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
29824 }
29825 break;
29826
Norman James18998182015-10-11 21:54:53 -050029827 case 16:
29828 interface = g_value_get_object (value);
29829 if (interface != NULL)
29830 {
29831 g_warn_if_fail (IS_FLASH_CONTROL (interface));
29832 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29833 }
29834 else
29835 {
29836 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
29837 }
29838 break;
29839
29840 case 17:
Norman James362a80f2015-09-14 14:04:39 -050029841 interface = g_value_get_object (value);
29842 if (interface != NULL)
29843 {
29844 g_warn_if_fail (IS_BUTTON (interface));
29845 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29846 }
29847 else
29848 {
29849 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
29850 }
29851 break;
29852
Norman James18998182015-10-11 21:54:53 -050029853 case 18:
Norman James362a80f2015-09-14 14:04:39 -050029854 interface = g_value_get_object (value);
29855 if (interface != NULL)
29856 {
29857 g_warn_if_fail (IS_LED (interface));
29858 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29859 }
29860 else
29861 {
29862 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
29863 }
29864 break;
29865
Norman James18998182015-10-11 21:54:53 -050029866 case 19:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029867 interface = g_value_get_object (value);
29868 if (interface != NULL)
29869 {
29870 g_warn_if_fail (IS_HOST_IPMI (interface));
29871 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29872 }
29873 else
29874 {
29875 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
29876 }
29877 break;
29878
Norman James362a80f2015-09-14 14:04:39 -050029879 default:
29880 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29881 break;
29882 }
29883}
29884
29885static void
29886object_skeleton_get_property (GObject *gobject,
29887 guint prop_id,
29888 GValue *value,
29889 GParamSpec *pspec)
29890{
29891 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
29892 GDBusInterface *interface;
29893
29894 switch (prop_id)
29895 {
29896 case 1:
29897 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
29898 g_value_take_object (value, interface);
29899 break;
29900
29901 case 2:
29902 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
29903 g_value_take_object (value, interface);
29904 break;
29905
29906 case 3:
29907 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
29908 g_value_take_object (value, interface);
29909 break;
29910
29911 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029912 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050029913 g_value_take_object (value, interface);
29914 break;
29915
Norman James19e45912015-10-04 20:19:41 -050029916 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029917 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050029918 g_value_take_object (value, interface);
29919 break;
29920
Norman James19e45912015-10-04 20:19:41 -050029921 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029922 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050029923 g_value_take_object (value, interface);
29924 break;
29925
Norman James19e45912015-10-04 20:19:41 -050029926 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029927 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050029928 g_value_take_object (value, interface);
29929 break;
29930
Norman James19e45912015-10-04 20:19:41 -050029931 case 8:
Norman James18998182015-10-11 21:54:53 -050029932 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050029933 g_value_take_object (value, interface);
29934 break;
29935
Norman James19e45912015-10-04 20:19:41 -050029936 case 9:
Norman James18998182015-10-11 21:54:53 -050029937 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050029938 g_value_take_object (value, interface);
29939 break;
29940
Norman James19e45912015-10-04 20:19:41 -050029941 case 10:
Norman James18998182015-10-11 21:54:53 -050029942 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050029943 g_value_take_object (value, interface);
29944 break;
29945
Norman James19e45912015-10-04 20:19:41 -050029946 case 11:
Norman James18998182015-10-11 21:54:53 -050029947 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050029948 g_value_take_object (value, interface);
29949 break;
29950
Norman James19e45912015-10-04 20:19:41 -050029951 case 12:
Norman James18998182015-10-11 21:54:53 -050029952 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050029953 g_value_take_object (value, interface);
29954 break;
29955
Norman James19e45912015-10-04 20:19:41 -050029956 case 13:
Norman James18998182015-10-11 21:54:53 -050029957 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050029958 g_value_take_object (value, interface);
29959 break;
29960
Norman James19e45912015-10-04 20:19:41 -050029961 case 14:
Norman James18998182015-10-11 21:54:53 -050029962 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050029963 g_value_take_object (value, interface);
29964 break;
29965
Norman James19e45912015-10-04 20:19:41 -050029966 case 15:
Norman James18998182015-10-11 21:54:53 -050029967 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050029968 g_value_take_object (value, interface);
29969 break;
29970
Norman James19e45912015-10-04 20:19:41 -050029971 case 16:
Norman James18998182015-10-11 21:54:53 -050029972 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050029973 g_value_take_object (value, interface);
29974 break;
29975
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029976 case 17:
Norman James18998182015-10-11 21:54:53 -050029977 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29978 g_value_take_object (value, interface);
29979 break;
29980
29981 case 18:
29982 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29983 g_value_take_object (value, interface);
29984 break;
29985
29986 case 19:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029987 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29988 g_value_take_object (value, interface);
29989 break;
29990
Norman James362a80f2015-09-14 14:04:39 -050029991 default:
29992 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29993 break;
29994 }
29995}
29996
29997static void
29998object_skeleton_class_init (ObjectSkeletonClass *klass)
29999{
30000 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
30001
30002 gobject_class->set_property = object_skeleton_set_property;
30003 gobject_class->get_property = object_skeleton_get_property;
30004
30005 g_object_class_override_property (gobject_class, 1, "occ");
30006 g_object_class_override_property (gobject_class, 2, "fan");
30007 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050030008 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
30009 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
30010 g_object_class_override_property (gobject_class, 6, "sensor-match");
30011 g_object_class_override_property (gobject_class, 7, "process");
Norman James18998182015-10-11 21:54:53 -050030012 g_object_class_override_property (gobject_class, 8, "shared-resource");
30013 g_object_class_override_property (gobject_class, 9, "control");
30014 g_object_class_override_property (gobject_class, 10, "control-bmc");
30015 g_object_class_override_property (gobject_class, 11, "control-host");
30016 g_object_class_override_property (gobject_class, 12, "control-power");
30017 g_object_class_override_property (gobject_class, 13, "watchdog");
30018 g_object_class_override_property (gobject_class, 14, "event-log");
30019 g_object_class_override_property (gobject_class, 15, "flash");
30020 g_object_class_override_property (gobject_class, 16, "flash-control");
30021 g_object_class_override_property (gobject_class, 17, "button");
30022 g_object_class_override_property (gobject_class, 18, "led");
30023 g_object_class_override_property (gobject_class, 19, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050030024}
30025
30026/**
30027 * object_skeleton_new:
30028 * @object_path: An object path.
30029 *
30030 * Creates a new skeleton object.
30031 *
30032 * Returns: (transfer full): The skeleton object.
30033 */
30034ObjectSkeleton *
30035object_skeleton_new (const gchar *object_path)
30036{
30037 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
30038 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
30039}
30040
30041/**
30042 * object_skeleton_set_occ:
30043 * @object: A #ObjectSkeleton.
30044 * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
30045 *
30046 * 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.
30047 */
30048void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
30049{
30050 g_object_set (G_OBJECT (object), "occ", interface_, NULL);
30051}
30052
30053/**
30054 * object_skeleton_set_fan:
30055 * @object: A #ObjectSkeleton.
30056 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
30057 *
30058 * 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.
30059 */
30060void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
30061{
30062 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
30063}
30064
30065/**
30066 * object_skeleton_set_sensor_value:
30067 * @object: A #ObjectSkeleton.
30068 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
30069 *
30070 * 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.
30071 */
30072void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
30073{
30074 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
30075}
30076
30077/**
30078 * object_skeleton_set_sensor_threshold:
30079 * @object: A #ObjectSkeleton.
30080 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
30081 *
30082 * 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.
30083 */
30084void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
30085{
30086 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
30087}
30088
30089/**
30090 * object_skeleton_set_sensor_i2c:
30091 * @object: A #ObjectSkeleton.
30092 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
30093 *
30094 * 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.
30095 */
30096void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
30097{
30098 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
30099}
30100
30101/**
30102 * object_skeleton_set_sensor_match:
30103 * @object: A #ObjectSkeleton.
30104 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
30105 *
30106 * 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.
30107 */
30108void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
30109{
30110 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
30111}
30112
30113/**
30114 * object_skeleton_set_process:
30115 * @object: A #ObjectSkeleton.
30116 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
30117 *
30118 * 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.
30119 */
30120void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
30121{
30122 g_object_set (G_OBJECT (object), "process", interface_, NULL);
30123}
30124
30125/**
Norman James18998182015-10-11 21:54:53 -050030126 * object_skeleton_set_shared_resource:
30127 * @object: A #ObjectSkeleton.
30128 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
30129 *
30130 * Sets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object.
30131 */
30132void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
30133{
30134 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
30135}
30136
30137/**
Norman James362a80f2015-09-14 14:04:39 -050030138 * object_skeleton_set_control:
30139 * @object: A #ObjectSkeleton.
30140 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
30141 *
30142 * 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.
30143 */
30144void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
30145{
30146 g_object_set (G_OBJECT (object), "control", interface_, NULL);
30147}
30148
30149/**
30150 * object_skeleton_set_control_bmc:
30151 * @object: A #ObjectSkeleton.
30152 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
30153 *
30154 * 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.
30155 */
30156void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
30157{
30158 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
30159}
30160
30161/**
30162 * object_skeleton_set_control_host:
30163 * @object: A #ObjectSkeleton.
30164 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
30165 *
30166 * 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.
30167 */
30168void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
30169{
30170 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
30171}
30172
30173/**
30174 * object_skeleton_set_control_power:
30175 * @object: A #ObjectSkeleton.
30176 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
30177 *
30178 * 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.
30179 */
30180void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
30181{
30182 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
30183}
30184
30185/**
30186 * object_skeleton_set_watchdog:
30187 * @object: A #ObjectSkeleton.
30188 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
30189 *
30190 * 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.
30191 */
30192void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
30193{
30194 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
30195}
30196
30197/**
30198 * object_skeleton_set_event_log:
30199 * @object: A #ObjectSkeleton.
30200 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
30201 *
30202 * 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.
30203 */
30204void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
30205{
30206 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
30207}
30208
30209/**
30210 * object_skeleton_set_flash:
30211 * @object: A #ObjectSkeleton.
30212 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
30213 *
30214 * 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.
30215 */
30216void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
30217{
30218 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
30219}
30220
30221/**
Norman James18998182015-10-11 21:54:53 -050030222 * object_skeleton_set_flash_control:
30223 * @object: A #ObjectSkeleton.
30224 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
30225 *
30226 * Sets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object.
30227 */
30228void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
30229{
30230 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
30231}
30232
30233/**
Norman James362a80f2015-09-14 14:04:39 -050030234 * object_skeleton_set_button:
30235 * @object: A #ObjectSkeleton.
30236 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
30237 *
30238 * 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.
30239 */
30240void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
30241{
30242 g_object_set (G_OBJECT (object), "button", interface_, NULL);
30243}
30244
30245/**
30246 * object_skeleton_set_led:
30247 * @object: A #ObjectSkeleton.
30248 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
30249 *
30250 * 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.
30251 */
30252void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
30253{
30254 g_object_set (G_OBJECT (object), "led", interface_, NULL);
30255}
30256
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030257/**
30258 * object_skeleton_set_host_ipmi:
30259 * @object: A #ObjectSkeleton.
30260 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
30261 *
30262 * Sets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object.
30263 */
30264void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
30265{
30266 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
30267}
30268
Norman James362a80f2015-09-14 14:04:39 -050030269
30270/* ------------------------------------------------------------------------
30271 * Code for ObjectManager client
30272 * ------------------------------------------------------------------------
30273 */
30274
30275/**
30276 * SECTION:ObjectManagerClient
30277 * @title: ObjectManagerClient
30278 * @short_description: Generated GDBusObjectManagerClient type
30279 *
30280 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
30281 */
30282
30283/**
30284 * ObjectManagerClient:
30285 *
30286 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
30287 */
30288
30289/**
30290 * ObjectManagerClientClass:
30291 * @parent_class: The parent class.
30292 *
30293 * Class structure for #ObjectManagerClient.
30294 */
30295
30296G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
30297
30298static void
30299object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
30300{
30301}
30302
30303static void
30304object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
30305{
30306}
30307
30308/**
30309 * object_manager_client_get_proxy_type:
30310 * @manager: A #GDBusObjectManagerClient.
30311 * @object_path: The object path of the remote object (unused).
30312 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
30313 * @user_data: User data (unused).
30314 *
30315 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
30316 *
30317 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
30318 */
30319GType
30320object_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)
30321{
30322 static gsize once_init_value = 0;
30323 static GHashTable *lookup_hash;
30324 GType ret;
30325
30326 if (interface_name == NULL)
30327 return TYPE_OBJECT_PROXY;
30328 if (g_once_init_enter (&once_init_value))
30329 {
30330 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
30331 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
30332 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
30333 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030334 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
30335 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
30336 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
30337 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050030338 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030339 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
30340 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
30341 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
30342 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
30343 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
30344 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
30345 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050030346 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030347 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
30348 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030349 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030350 g_once_init_leave (&once_init_value, 1);
30351 }
30352 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
30353 if (ret == (GType) 0)
30354 ret = G_TYPE_DBUS_PROXY;
30355 return ret;
30356}
30357
30358/**
30359 * object_manager_client_new:
30360 * @connection: A #GDBusConnection.
30361 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30362 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30363 * @object_path: An object path.
30364 * @cancellable: (allow-none): A #GCancellable or %NULL.
30365 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30366 * @user_data: User data to pass to @callback.
30367 *
30368 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
30369 *
30370 * 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.
30371 * You can then call object_manager_client_new_finish() to get the result of the operation.
30372 *
30373 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
30374 */
30375void
30376object_manager_client_new (
30377 GDBusConnection *connection,
30378 GDBusObjectManagerClientFlags flags,
30379 const gchar *name,
30380 const gchar *object_path,
30381 GCancellable *cancellable,
30382 GAsyncReadyCallback callback,
30383 gpointer user_data)
30384{
30385 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);
30386}
30387
30388/**
30389 * object_manager_client_new_finish:
30390 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
30391 * @error: Return location for error or %NULL
30392 *
30393 * Finishes an operation started with object_manager_client_new().
30394 *
30395 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30396 */
30397GDBusObjectManager *
30398object_manager_client_new_finish (
30399 GAsyncResult *res,
30400 GError **error)
30401{
30402 GObject *ret;
30403 GObject *source_object;
30404 source_object = g_async_result_get_source_object (res);
30405 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30406 g_object_unref (source_object);
30407 if (ret != NULL)
30408 return G_DBUS_OBJECT_MANAGER (ret);
30409 else
30410 return NULL;
30411}
30412
30413/**
30414 * object_manager_client_new_sync:
30415 * @connection: A #GDBusConnection.
30416 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30417 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30418 * @object_path: An object path.
30419 * @cancellable: (allow-none): A #GCancellable or %NULL.
30420 * @error: Return location for error or %NULL
30421 *
30422 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
30423 *
30424 * The calling thread is blocked until a reply is received.
30425 *
30426 * See object_manager_client_new() for the asynchronous version of this constructor.
30427 *
30428 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30429 */
30430GDBusObjectManager *
30431object_manager_client_new_sync (
30432 GDBusConnection *connection,
30433 GDBusObjectManagerClientFlags flags,
30434 const gchar *name,
30435 const gchar *object_path,
30436 GCancellable *cancellable,
30437 GError **error)
30438{
30439 GInitable *ret;
30440 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);
30441 if (ret != NULL)
30442 return G_DBUS_OBJECT_MANAGER (ret);
30443 else
30444 return NULL;
30445}
30446
30447
30448/**
30449 * object_manager_client_new_for_bus:
30450 * @bus_type: A #GBusType.
30451 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30452 * @name: A bus name (well-known or unique).
30453 * @object_path: An object path.
30454 * @cancellable: (allow-none): A #GCancellable or %NULL.
30455 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30456 * @user_data: User data to pass to @callback.
30457 *
30458 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
30459 *
30460 * 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.
30461 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
30462 *
30463 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
30464 */
30465void
30466object_manager_client_new_for_bus (
30467 GBusType bus_type,
30468 GDBusObjectManagerClientFlags flags,
30469 const gchar *name,
30470 const gchar *object_path,
30471 GCancellable *cancellable,
30472 GAsyncReadyCallback callback,
30473 gpointer user_data)
30474{
30475 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);
30476}
30477
30478/**
30479 * object_manager_client_new_for_bus_finish:
30480 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
30481 * @error: Return location for error or %NULL
30482 *
30483 * Finishes an operation started with object_manager_client_new_for_bus().
30484 *
30485 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30486 */
30487GDBusObjectManager *
30488object_manager_client_new_for_bus_finish (
30489 GAsyncResult *res,
30490 GError **error)
30491{
30492 GObject *ret;
30493 GObject *source_object;
30494 source_object = g_async_result_get_source_object (res);
30495 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30496 g_object_unref (source_object);
30497 if (ret != NULL)
30498 return G_DBUS_OBJECT_MANAGER (ret);
30499 else
30500 return NULL;
30501}
30502
30503/**
30504 * object_manager_client_new_for_bus_sync:
30505 * @bus_type: A #GBusType.
30506 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30507 * @name: A bus name (well-known or unique).
30508 * @object_path: An object path.
30509 * @cancellable: (allow-none): A #GCancellable or %NULL.
30510 * @error: Return location for error or %NULL
30511 *
30512 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
30513 *
30514 * The calling thread is blocked until a reply is received.
30515 *
30516 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
30517 *
30518 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30519 */
30520GDBusObjectManager *
30521object_manager_client_new_for_bus_sync (
30522 GBusType bus_type,
30523 GDBusObjectManagerClientFlags flags,
30524 const gchar *name,
30525 const gchar *object_path,
30526 GCancellable *cancellable,
30527 GError **error)
30528{
30529 GInitable *ret;
30530 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);
30531 if (ret != NULL)
30532 return G_DBUS_OBJECT_MANAGER (ret);
30533 else
30534 return NULL;
30535}
30536
30537