blob: b7eba40e682de6d56cf04dfadd0db2727593ffed [file] [log] [blame]
Norman Jamesce46e3e2015-08-30 22:25:55 -05001/*
2 * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
3 *
4 * The license of this code is the same as for the source it was derived from.
5 */
6
7#ifdef HAVE_CONFIG_H
8# include "config.h"
9#endif
10
11#include "interfaces/control.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.Control
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:Control
158 * @title: Control
159 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
160 *
161 * 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.
162 */
163
164/* ---- Introspection data for org.openbmc.Control ---- */
165
Norman James9e6acf92015-09-08 07:00:04 -0500166static const _ExtendedGDBusMethodInfo _control_method_info_init =
Norman Jamesce46e3e2015-08-30 22:25:55 -0500167{
168 {
169 -1,
Norman James9e6acf92015-09-08 07:00:04 -0500170 (gchar *) "init",
171 NULL,
Norman Jamesce46e3e2015-08-30 22:25:55 -0500172 NULL,
173 NULL
174 },
Norman James9e6acf92015-09-08 07:00:04 -0500175 "handle-init",
Norman Jamesce46e3e2015-08-30 22:25:55 -0500176 FALSE
177};
178
179static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
180{
Norman James9e6acf92015-09-08 07:00:04 -0500181 &_control_method_info_init,
Norman Jamesce46e3e2015-08-30 22:25:55 -0500182 NULL
183};
184
185static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
186{
187 {
188 -1,
189 (gchar *) "bus_name",
190 (gchar *) "s",
191 NULL
192 },
193 FALSE
194};
195
196static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
197{
198 &_control_signal_info_heartbeat_ARG_bus_name,
199 NULL
200};
201
202static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
203{
204 {
205 -1,
206 (gchar *) "Heartbeat",
207 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
208 NULL
209 },
210 "heartbeat"
211};
212
213static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
214{
215 &_control_signal_info_heartbeat,
216 NULL
217};
218
219static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
220{
221 {
222 -1,
223 (gchar *) "poll_interval",
224 (gchar *) "i",
Norman James9e6acf92015-09-08 07:00:04 -0500225 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
Norman Jamesce46e3e2015-08-30 22:25:55 -0500226 NULL
227 },
228 "poll-interval",
229 FALSE
230};
231
232static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
233{
234 {
235 -1,
236 (gchar *) "heatbeat",
237 (gchar *) "i",
238 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
239 NULL
240 },
241 "heatbeat",
242 FALSE
243};
244
245static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
246{
247 &_control_property_info_poll_interval,
248 &_control_property_info_heatbeat,
249 NULL
250};
251
252static const _ExtendedGDBusInterfaceInfo _control_interface_info =
253{
254 {
255 -1,
256 (gchar *) "org.openbmc.Control",
257 (GDBusMethodInfo **) &_control_method_info_pointers,
258 (GDBusSignalInfo **) &_control_signal_info_pointers,
259 (GDBusPropertyInfo **) &_control_property_info_pointers,
260 NULL
261 },
262 "control",
263};
264
265
266/**
267 * control_interface_info:
268 *
269 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
270 *
271 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
272 */
273GDBusInterfaceInfo *
274control_interface_info (void)
275{
276 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
277}
278
279/**
280 * control_override_properties:
281 * @klass: The class structure for a #GObject<!-- -->-derived class.
282 * @property_id_begin: The property id to assign to the first overridden property.
283 *
284 * Overrides all #GObject properties in the #Control interface for a concrete class.
285 * The properties are overridden in the order they are defined.
286 *
287 * Returns: The last property id.
288 */
289guint
290control_override_properties (GObjectClass *klass, guint property_id_begin)
291{
292 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
293 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
294 return property_id_begin - 1;
295}
296
297
298
299/**
300 * Control:
301 *
302 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
303 */
304
305/**
306 * ControlIface:
307 * @parent_iface: The parent interface.
Norman James9e6acf92015-09-08 07:00:04 -0500308 * @handle_init: Handler for the #Control::handle-init signal.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500309 * @get_heatbeat: Getter for the #Control:heatbeat property.
310 * @get_poll_interval: Getter for the #Control:poll-interval property.
311 * @heartbeat: Handler for the #Control::heartbeat signal.
312 *
313 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
314 */
315
316typedef ControlIface ControlInterface;
317G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
318
319static void
320control_default_init (ControlIface *iface)
321{
322 /* GObject signals for incoming D-Bus method calls: */
323 /**
Norman James9e6acf92015-09-08 07:00:04 -0500324 * Control::handle-init:
Norman Jamesce46e3e2015-08-30 22:25:55 -0500325 * @object: A #Control.
326 * @invocation: A #GDBusMethodInvocation.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500327 *
Norman James9e6acf92015-09-08 07:00:04 -0500328 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500329 *
Norman James9e6acf92015-09-08 07:00:04 -0500330 * 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.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500331 *
332 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
333 */
Norman James9e6acf92015-09-08 07:00:04 -0500334 g_signal_new ("handle-init",
Norman Jamesce46e3e2015-08-30 22:25:55 -0500335 G_TYPE_FROM_INTERFACE (iface),
336 G_SIGNAL_RUN_LAST,
Norman James9e6acf92015-09-08 07:00:04 -0500337 G_STRUCT_OFFSET (ControlIface, handle_init),
Norman Jamesce46e3e2015-08-30 22:25:55 -0500338 g_signal_accumulator_true_handled,
339 NULL,
340 g_cclosure_marshal_generic,
341 G_TYPE_BOOLEAN,
Norman James9e6acf92015-09-08 07:00:04 -0500342 1,
343 G_TYPE_DBUS_METHOD_INVOCATION);
Norman Jamesce46e3e2015-08-30 22:25:55 -0500344
345 /* GObject signals for received D-Bus signals: */
346 /**
347 * Control::heartbeat:
348 * @object: A #Control.
349 * @arg_bus_name: Argument.
350 *
351 * 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.
352 *
353 * 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.
354 */
355 g_signal_new ("heartbeat",
356 G_TYPE_FROM_INTERFACE (iface),
357 G_SIGNAL_RUN_LAST,
358 G_STRUCT_OFFSET (ControlIface, heartbeat),
359 NULL,
360 NULL,
361 g_cclosure_marshal_generic,
362 G_TYPE_NONE,
363 1, G_TYPE_STRING);
364
365 /* GObject properties for D-Bus properties: */
366 /**
367 * Control:poll-interval:
368 *
369 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
370 *
Norman James9e6acf92015-09-08 07:00:04 -0500371 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500372 */
373 g_object_interface_install_property (iface,
374 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
375 /**
376 * Control:heatbeat:
377 *
378 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
379 *
380 * 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.
381 */
382 g_object_interface_install_property (iface,
383 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
384}
385
386/**
387 * control_get_poll_interval: (skip)
388 * @object: A #Control.
389 *
390 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
391 *
Norman James9e6acf92015-09-08 07:00:04 -0500392 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500393 *
394 * Returns: The property value.
395 */
396gint
397control_get_poll_interval (Control *object)
398{
399 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
400}
401
402/**
403 * control_set_poll_interval: (skip)
404 * @object: A #Control.
405 * @value: The value to set.
406 *
407 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
408 *
Norman James9e6acf92015-09-08 07:00:04 -0500409 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500410 */
411void
412control_set_poll_interval (Control *object, gint value)
413{
414 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
415}
416
417/**
418 * control_get_heatbeat: (skip)
419 * @object: A #Control.
420 *
421 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
422 *
423 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
424 *
425 * Returns: The property value.
426 */
427gint
428control_get_heatbeat (Control *object)
429{
430 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
431}
432
433/**
434 * control_set_heatbeat: (skip)
435 * @object: A #Control.
436 * @value: The value to set.
437 *
438 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
439 *
440 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
441 */
442void
443control_set_heatbeat (Control *object, gint value)
444{
445 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
446}
447
448/**
449 * control_emit_heartbeat:
450 * @object: A #Control.
451 * @arg_bus_name: Argument to pass with the signal.
452 *
453 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
454 */
455void
456control_emit_heartbeat (
457 Control *object,
458 const gchar *arg_bus_name)
459{
460 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
461}
462
463/**
Norman James9e6acf92015-09-08 07:00:04 -0500464 * control_call_init:
Norman Jamesce46e3e2015-08-30 22:25:55 -0500465 * @proxy: A #ControlProxy.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500466 * @cancellable: (allow-none): A #GCancellable or %NULL.
467 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
468 * @user_data: User data to pass to @callback.
469 *
Norman James9e6acf92015-09-08 07:00:04 -0500470 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500471 * 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 James9e6acf92015-09-08 07:00:04 -0500472 * You can then call control_call_init_finish() to get the result of the operation.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500473 *
Norman James9e6acf92015-09-08 07:00:04 -0500474 * See control_call_init_sync() for the synchronous, blocking version of this method.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500475 */
476void
Norman James9e6acf92015-09-08 07:00:04 -0500477control_call_init (
Norman Jamesce46e3e2015-08-30 22:25:55 -0500478 Control *proxy,
Norman Jamesce46e3e2015-08-30 22:25:55 -0500479 GCancellable *cancellable,
480 GAsyncReadyCallback callback,
481 gpointer user_data)
482{
483 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James9e6acf92015-09-08 07:00:04 -0500484 "init",
485 g_variant_new ("()"),
Norman Jamesce46e3e2015-08-30 22:25:55 -0500486 G_DBUS_CALL_FLAGS_NONE,
487 -1,
488 cancellable,
489 callback,
490 user_data);
491}
492
493/**
Norman James9e6acf92015-09-08 07:00:04 -0500494 * control_call_init_finish:
Norman Jamesce46e3e2015-08-30 22:25:55 -0500495 * @proxy: A #ControlProxy.
Norman James9e6acf92015-09-08 07:00:04 -0500496 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
Norman Jamesce46e3e2015-08-30 22:25:55 -0500497 * @error: Return location for error or %NULL.
498 *
Norman James9e6acf92015-09-08 07:00:04 -0500499 * Finishes an operation started with control_call_init().
Norman Jamesce46e3e2015-08-30 22:25:55 -0500500 *
501 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
502 */
503gboolean
Norman James9e6acf92015-09-08 07:00:04 -0500504control_call_init_finish (
Norman Jamesce46e3e2015-08-30 22:25:55 -0500505 Control *proxy,
506 GAsyncResult *res,
507 GError **error)
508{
509 GVariant *_ret;
510 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
511 if (_ret == NULL)
512 goto _out;
513 g_variant_get (_ret,
514 "()");
515 g_variant_unref (_ret);
516_out:
517 return _ret != NULL;
518}
519
520/**
Norman James9e6acf92015-09-08 07:00:04 -0500521 * control_call_init_sync:
Norman Jamesce46e3e2015-08-30 22:25:55 -0500522 * @proxy: A #ControlProxy.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500523 * @cancellable: (allow-none): A #GCancellable or %NULL.
524 * @error: Return location for error or %NULL.
525 *
Norman James9e6acf92015-09-08 07:00:04 -0500526 * 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.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500527 *
Norman James9e6acf92015-09-08 07:00:04 -0500528 * See control_call_init() for the asynchronous version of this method.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500529 *
530 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
531 */
532gboolean
Norman James9e6acf92015-09-08 07:00:04 -0500533control_call_init_sync (
Norman Jamesce46e3e2015-08-30 22:25:55 -0500534 Control *proxy,
Norman Jamesce46e3e2015-08-30 22:25:55 -0500535 GCancellable *cancellable,
536 GError **error)
537{
538 GVariant *_ret;
539 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James9e6acf92015-09-08 07:00:04 -0500540 "init",
541 g_variant_new ("()"),
Norman Jamesce46e3e2015-08-30 22:25:55 -0500542 G_DBUS_CALL_FLAGS_NONE,
543 -1,
544 cancellable,
545 error);
546 if (_ret == NULL)
547 goto _out;
548 g_variant_get (_ret,
549 "()");
550 g_variant_unref (_ret);
551_out:
552 return _ret != NULL;
553}
554
555/**
Norman James9e6acf92015-09-08 07:00:04 -0500556 * control_complete_init:
Norman Jamesce46e3e2015-08-30 22:25:55 -0500557 * @object: A #Control.
558 * @invocation: (transfer full): A #GDBusMethodInvocation.
559 *
Norman James9e6acf92015-09-08 07:00:04 -0500560 * 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.
Norman Jamesce46e3e2015-08-30 22:25:55 -0500561 *
562 * This method will free @invocation, you cannot use it afterwards.
563 */
564void
Norman James9e6acf92015-09-08 07:00:04 -0500565control_complete_init (
Norman Jamesce46e3e2015-08-30 22:25:55 -0500566 Control *object,
567 GDBusMethodInvocation *invocation)
568{
569 g_dbus_method_invocation_return_value (invocation,
570 g_variant_new ("()"));
571}
572
573/* ------------------------------------------------------------------------ */
574
575/**
576 * ControlProxy:
577 *
578 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
579 */
580
581/**
582 * ControlProxyClass:
583 * @parent_class: The parent class.
584 *
585 * Class structure for #ControlProxy.
586 */
587
588struct _ControlProxyPrivate
589{
590 GData *qdata;
591};
592
593static void control_proxy_iface_init (ControlIface *iface);
594
595#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
596G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
597 G_ADD_PRIVATE (ControlProxy)
598 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
599
600#else
601G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
602 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
603
604#endif
605static void
606control_proxy_finalize (GObject *object)
607{
608 ControlProxy *proxy = CONTROL_PROXY (object);
609 g_datalist_clear (&proxy->priv->qdata);
610 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
611}
612
613static void
614control_proxy_get_property (GObject *object,
615 guint prop_id,
616 GValue *value,
617 GParamSpec *pspec G_GNUC_UNUSED)
618{
619 const _ExtendedGDBusPropertyInfo *info;
620 GVariant *variant;
621 g_assert (prop_id != 0 && prop_id - 1 < 2);
622 info = _control_property_info_pointers[prop_id - 1];
623 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
624 if (info->use_gvariant)
625 {
626 g_value_set_variant (value, variant);
627 }
628 else
629 {
630 if (variant != NULL)
631 g_dbus_gvariant_to_gvalue (variant, value);
632 }
633 if (variant != NULL)
634 g_variant_unref (variant);
635}
636
637static void
638control_proxy_set_property_cb (GDBusProxy *proxy,
639 GAsyncResult *res,
640 gpointer user_data)
641{
642 const _ExtendedGDBusPropertyInfo *info = user_data;
643 GError *error;
644 GVariant *_ret;
645 error = NULL;
646 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
647 if (!_ret)
648 {
649 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
650 info->parent_struct.name,
651 error->message, g_quark_to_string (error->domain), error->code);
652 g_error_free (error);
653 }
654 else
655 {
656 g_variant_unref (_ret);
657 }
658}
659
660static void
661control_proxy_set_property (GObject *object,
662 guint prop_id,
663 const GValue *value,
664 GParamSpec *pspec G_GNUC_UNUSED)
665{
666 const _ExtendedGDBusPropertyInfo *info;
667 GVariant *variant;
668 g_assert (prop_id != 0 && prop_id - 1 < 2);
669 info = _control_property_info_pointers[prop_id - 1];
670 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
671 g_dbus_proxy_call (G_DBUS_PROXY (object),
672 "org.freedesktop.DBus.Properties.Set",
673 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
674 G_DBUS_CALL_FLAGS_NONE,
675 -1,
676 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
677 g_variant_unref (variant);
678}
679
680static void
681control_proxy_g_signal (GDBusProxy *proxy,
682 const gchar *sender_name G_GNUC_UNUSED,
683 const gchar *signal_name,
684 GVariant *parameters)
685{
686 _ExtendedGDBusSignalInfo *info;
687 GVariantIter iter;
688 GVariant *child;
689 GValue *paramv;
690 guint num_params;
691 guint n;
692 guint signal_id;
693 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
694 if (info == NULL)
695 return;
696 num_params = g_variant_n_children (parameters);
697 paramv = g_new0 (GValue, num_params + 1);
698 g_value_init (&paramv[0], TYPE_CONTROL);
699 g_value_set_object (&paramv[0], proxy);
700 g_variant_iter_init (&iter, parameters);
701 n = 1;
702 while ((child = g_variant_iter_next_value (&iter)) != NULL)
703 {
704 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
705 if (arg_info->use_gvariant)
706 {
707 g_value_init (&paramv[n], G_TYPE_VARIANT);
708 g_value_set_variant (&paramv[n], child);
709 n++;
710 }
711 else
712 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
713 g_variant_unref (child);
714 }
715 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
716 g_signal_emitv (paramv, signal_id, 0, NULL);
717 for (n = 0; n < num_params + 1; n++)
718 g_value_unset (&paramv[n]);
719 g_free (paramv);
720}
721
722static void
723control_proxy_g_properties_changed (GDBusProxy *_proxy,
724 GVariant *changed_properties,
725 const gchar *const *invalidated_properties)
726{
727 ControlProxy *proxy = CONTROL_PROXY (_proxy);
728 guint n;
729 const gchar *key;
730 GVariantIter *iter;
731 _ExtendedGDBusPropertyInfo *info;
732 g_variant_get (changed_properties, "a{sv}", &iter);
733 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
734 {
735 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
736 g_datalist_remove_data (&proxy->priv->qdata, key);
737 if (info != NULL)
738 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
739 }
740 g_variant_iter_free (iter);
741 for (n = 0; invalidated_properties[n] != NULL; n++)
742 {
743 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
744 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
745 if (info != NULL)
746 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
747 }
748}
749
750static gint
751control_proxy_get_poll_interval (Control *object)
752{
753 ControlProxy *proxy = CONTROL_PROXY (object);
754 GVariant *variant;
755 gint value = 0;
756 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
757 if (variant != NULL)
758 {
759 value = g_variant_get_int32 (variant);
760 g_variant_unref (variant);
761 }
762 return value;
763}
764
765static gint
766control_proxy_get_heatbeat (Control *object)
767{
768 ControlProxy *proxy = CONTROL_PROXY (object);
769 GVariant *variant;
770 gint value = 0;
771 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
772 if (variant != NULL)
773 {
774 value = g_variant_get_int32 (variant);
775 g_variant_unref (variant);
776 }
777 return value;
778}
779
780static void
781control_proxy_init (ControlProxy *proxy)
782{
783#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
784 proxy->priv = control_proxy_get_instance_private (proxy);
785#else
786 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
787#endif
788
789 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
790}
791
792static void
793control_proxy_class_init (ControlProxyClass *klass)
794{
795 GObjectClass *gobject_class;
796 GDBusProxyClass *proxy_class;
797
798 gobject_class = G_OBJECT_CLASS (klass);
799 gobject_class->finalize = control_proxy_finalize;
800 gobject_class->get_property = control_proxy_get_property;
801 gobject_class->set_property = control_proxy_set_property;
802
803 proxy_class = G_DBUS_PROXY_CLASS (klass);
804 proxy_class->g_signal = control_proxy_g_signal;
805 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
806
807 control_override_properties (gobject_class, 1);
808
809#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
810 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
811#endif
812}
813
814static void
815control_proxy_iface_init (ControlIface *iface)
816{
817 iface->get_poll_interval = control_proxy_get_poll_interval;
818 iface->get_heatbeat = control_proxy_get_heatbeat;
819}
820
821/**
822 * control_proxy_new:
823 * @connection: A #GDBusConnection.
824 * @flags: Flags from the #GDBusProxyFlags enumeration.
825 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
826 * @object_path: An object path.
827 * @cancellable: (allow-none): A #GCancellable or %NULL.
828 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
829 * @user_data: User data to pass to @callback.
830 *
831 * 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.
832 *
833 * 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.
834 * You can then call control_proxy_new_finish() to get the result of the operation.
835 *
836 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
837 */
838void
839control_proxy_new (
840 GDBusConnection *connection,
841 GDBusProxyFlags flags,
842 const gchar *name,
843 const gchar *object_path,
844 GCancellable *cancellable,
845 GAsyncReadyCallback callback,
846 gpointer user_data)
847{
848 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);
849}
850
851/**
852 * control_proxy_new_finish:
853 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
854 * @error: Return location for error or %NULL
855 *
856 * Finishes an operation started with control_proxy_new().
857 *
858 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
859 */
860Control *
861control_proxy_new_finish (
862 GAsyncResult *res,
863 GError **error)
864{
865 GObject *ret;
866 GObject *source_object;
867 source_object = g_async_result_get_source_object (res);
868 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
869 g_object_unref (source_object);
870 if (ret != NULL)
871 return CONTROL (ret);
872 else
873 return NULL;
874}
875
876/**
877 * control_proxy_new_sync:
878 * @connection: A #GDBusConnection.
879 * @flags: Flags from the #GDBusProxyFlags enumeration.
880 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
881 * @object_path: An object path.
882 * @cancellable: (allow-none): A #GCancellable or %NULL.
883 * @error: Return location for error or %NULL
884 *
885 * 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.
886 *
887 * The calling thread is blocked until a reply is received.
888 *
889 * See control_proxy_new() for the asynchronous version of this constructor.
890 *
891 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
892 */
893Control *
894control_proxy_new_sync (
895 GDBusConnection *connection,
896 GDBusProxyFlags flags,
897 const gchar *name,
898 const gchar *object_path,
899 GCancellable *cancellable,
900 GError **error)
901{
902 GInitable *ret;
903 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);
904 if (ret != NULL)
905 return CONTROL (ret);
906 else
907 return NULL;
908}
909
910
911/**
912 * control_proxy_new_for_bus:
913 * @bus_type: A #GBusType.
914 * @flags: Flags from the #GDBusProxyFlags enumeration.
915 * @name: A bus name (well-known or unique).
916 * @object_path: An object path.
917 * @cancellable: (allow-none): A #GCancellable or %NULL.
918 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
919 * @user_data: User data to pass to @callback.
920 *
921 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
922 *
923 * 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.
924 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
925 *
926 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
927 */
928void
929control_proxy_new_for_bus (
930 GBusType bus_type,
931 GDBusProxyFlags flags,
932 const gchar *name,
933 const gchar *object_path,
934 GCancellable *cancellable,
935 GAsyncReadyCallback callback,
936 gpointer user_data)
937{
938 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);
939}
940
941/**
942 * control_proxy_new_for_bus_finish:
943 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
944 * @error: Return location for error or %NULL
945 *
946 * Finishes an operation started with control_proxy_new_for_bus().
947 *
948 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
949 */
950Control *
951control_proxy_new_for_bus_finish (
952 GAsyncResult *res,
953 GError **error)
954{
955 GObject *ret;
956 GObject *source_object;
957 source_object = g_async_result_get_source_object (res);
958 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
959 g_object_unref (source_object);
960 if (ret != NULL)
961 return CONTROL (ret);
962 else
963 return NULL;
964}
965
966/**
967 * control_proxy_new_for_bus_sync:
968 * @bus_type: A #GBusType.
969 * @flags: Flags from the #GDBusProxyFlags enumeration.
970 * @name: A bus name (well-known or unique).
971 * @object_path: An object path.
972 * @cancellable: (allow-none): A #GCancellable or %NULL.
973 * @error: Return location for error or %NULL
974 *
975 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
976 *
977 * The calling thread is blocked until a reply is received.
978 *
979 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
980 *
981 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
982 */
983Control *
984control_proxy_new_for_bus_sync (
985 GBusType bus_type,
986 GDBusProxyFlags flags,
987 const gchar *name,
988 const gchar *object_path,
989 GCancellable *cancellable,
990 GError **error)
991{
992 GInitable *ret;
993 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);
994 if (ret != NULL)
995 return CONTROL (ret);
996 else
997 return NULL;
998}
999
1000
1001/* ------------------------------------------------------------------------ */
1002
1003/**
1004 * ControlSkeleton:
1005 *
1006 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
1007 */
1008
1009/**
1010 * ControlSkeletonClass:
1011 * @parent_class: The parent class.
1012 *
1013 * Class structure for #ControlSkeleton.
1014 */
1015
1016struct _ControlSkeletonPrivate
1017{
1018 GValue *properties;
1019 GList *changed_properties;
1020 GSource *changed_properties_idle_source;
1021 GMainContext *context;
1022 GMutex lock;
1023};
1024
1025static void
1026_control_skeleton_handle_method_call (
1027 GDBusConnection *connection G_GNUC_UNUSED,
1028 const gchar *sender G_GNUC_UNUSED,
1029 const gchar *object_path G_GNUC_UNUSED,
1030 const gchar *interface_name,
1031 const gchar *method_name,
1032 GVariant *parameters,
1033 GDBusMethodInvocation *invocation,
1034 gpointer user_data)
1035{
1036 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
1037 _ExtendedGDBusMethodInfo *info;
1038 GVariantIter iter;
1039 GVariant *child;
1040 GValue *paramv;
1041 guint num_params;
1042 guint num_extra;
1043 guint n;
1044 guint signal_id;
1045 GValue return_value = G_VALUE_INIT;
1046 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1047 g_assert (info != NULL);
1048 num_params = g_variant_n_children (parameters);
1049 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1050 n = 0;
1051 g_value_init (&paramv[n], TYPE_CONTROL);
1052 g_value_set_object (&paramv[n++], skeleton);
1053 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1054 g_value_set_object (&paramv[n++], invocation);
1055 if (info->pass_fdlist)
1056 {
1057#ifdef G_OS_UNIX
1058 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1059 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1060#else
1061 g_assert_not_reached ();
1062#endif
1063 }
1064 g_variant_iter_init (&iter, parameters);
1065 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1066 {
1067 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1068 if (arg_info->use_gvariant)
1069 {
1070 g_value_init (&paramv[n], G_TYPE_VARIANT);
1071 g_value_set_variant (&paramv[n], child);
1072 n++;
1073 }
1074 else
1075 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1076 g_variant_unref (child);
1077 }
1078 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
1079 g_value_init (&return_value, G_TYPE_BOOLEAN);
1080 g_signal_emitv (paramv, signal_id, 0, &return_value);
1081 if (!g_value_get_boolean (&return_value))
1082 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);
1083 g_value_unset (&return_value);
1084 for (n = 0; n < num_params + num_extra; n++)
1085 g_value_unset (&paramv[n]);
1086 g_free (paramv);
1087}
1088
1089static GVariant *
1090_control_skeleton_handle_get_property (
1091 GDBusConnection *connection G_GNUC_UNUSED,
1092 const gchar *sender G_GNUC_UNUSED,
1093 const gchar *object_path G_GNUC_UNUSED,
1094 const gchar *interface_name G_GNUC_UNUSED,
1095 const gchar *property_name,
1096 GError **error,
1097 gpointer user_data)
1098{
1099 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
1100 GValue value = G_VALUE_INIT;
1101 GParamSpec *pspec;
1102 _ExtendedGDBusPropertyInfo *info;
1103 GVariant *ret;
1104 ret = NULL;
1105 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
1106 g_assert (info != NULL);
1107 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1108 if (pspec == NULL)
1109 {
1110 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1111 }
1112 else
1113 {
1114 g_value_init (&value, pspec->value_type);
1115 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1116 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1117 g_value_unset (&value);
1118 }
1119 return ret;
1120}
1121
1122static gboolean
1123_control_skeleton_handle_set_property (
1124 GDBusConnection *connection G_GNUC_UNUSED,
1125 const gchar *sender G_GNUC_UNUSED,
1126 const gchar *object_path G_GNUC_UNUSED,
1127 const gchar *interface_name G_GNUC_UNUSED,
1128 const gchar *property_name,
1129 GVariant *variant,
1130 GError **error,
1131 gpointer user_data)
1132{
1133 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
1134 GValue value = G_VALUE_INIT;
1135 GParamSpec *pspec;
1136 _ExtendedGDBusPropertyInfo *info;
1137 gboolean ret;
1138 ret = FALSE;
1139 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
1140 g_assert (info != NULL);
1141 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1142 if (pspec == NULL)
1143 {
1144 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1145 }
1146 else
1147 {
1148 if (info->use_gvariant)
1149 g_value_set_variant (&value, variant);
1150 else
1151 g_dbus_gvariant_to_gvalue (variant, &value);
1152 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1153 g_value_unset (&value);
1154 ret = TRUE;
1155 }
1156 return ret;
1157}
1158
1159static const GDBusInterfaceVTable _control_skeleton_vtable =
1160{
1161 _control_skeleton_handle_method_call,
1162 _control_skeleton_handle_get_property,
1163 _control_skeleton_handle_set_property,
1164 {NULL}
1165};
1166
1167static GDBusInterfaceInfo *
1168control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1169{
1170 return control_interface_info ();
1171}
1172
1173static GDBusInterfaceVTable *
1174control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1175{
1176 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
1177}
1178
1179static GVariant *
1180control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1181{
1182 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
1183
1184 GVariantBuilder builder;
1185 guint n;
1186 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1187 if (_control_interface_info.parent_struct.properties == NULL)
1188 goto out;
1189 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
1190 {
1191 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
1192 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1193 {
1194 GVariant *value;
1195 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);
1196 if (value != NULL)
1197 {
1198 g_variant_take_ref (value);
1199 g_variant_builder_add (&builder, "{sv}", info->name, value);
1200 g_variant_unref (value);
1201 }
1202 }
1203 }
1204out:
1205 return g_variant_builder_end (&builder);
1206}
1207
1208static gboolean _control_emit_changed (gpointer user_data);
1209
1210static void
1211control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1212{
1213 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
1214 gboolean emit_changed = FALSE;
1215
1216 g_mutex_lock (&skeleton->priv->lock);
1217 if (skeleton->priv->changed_properties_idle_source != NULL)
1218 {
1219 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1220 skeleton->priv->changed_properties_idle_source = NULL;
1221 emit_changed = TRUE;
1222 }
1223 g_mutex_unlock (&skeleton->priv->lock);
1224
1225 if (emit_changed)
1226 _control_emit_changed (skeleton);
1227}
1228
1229static void
1230_control_on_signal_heartbeat (
1231 Control *object,
1232 const gchar *arg_bus_name)
1233{
1234 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
1235
1236 GList *connections, *l;
1237 GVariant *signal_variant;
1238 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1239
1240 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
1241 arg_bus_name));
1242 for (l = connections; l != NULL; l = l->next)
1243 {
1244 GDBusConnection *connection = l->data;
1245 g_dbus_connection_emit_signal (connection,
1246 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
1247 signal_variant, NULL);
1248 }
1249 g_variant_unref (signal_variant);
1250 g_list_free_full (connections, g_object_unref);
1251}
1252
1253static void control_skeleton_iface_init (ControlIface *iface);
1254#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1255G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1256 G_ADD_PRIVATE (ControlSkeleton)
1257 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
1258
1259#else
1260G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1261 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
1262
1263#endif
1264static void
1265control_skeleton_finalize (GObject *object)
1266{
1267 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
1268 guint n;
1269 for (n = 0; n < 2; n++)
1270 g_value_unset (&skeleton->priv->properties[n]);
1271 g_free (skeleton->priv->properties);
1272 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1273 if (skeleton->priv->changed_properties_idle_source != NULL)
1274 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1275 g_main_context_unref (skeleton->priv->context);
1276 g_mutex_clear (&skeleton->priv->lock);
1277 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
1278}
1279
1280static void
1281control_skeleton_get_property (GObject *object,
1282 guint prop_id,
1283 GValue *value,
1284 GParamSpec *pspec G_GNUC_UNUSED)
1285{
1286 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
1287 g_assert (prop_id != 0 && prop_id - 1 < 2);
1288 g_mutex_lock (&skeleton->priv->lock);
1289 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1290 g_mutex_unlock (&skeleton->priv->lock);
1291}
1292
1293static gboolean
1294_control_emit_changed (gpointer user_data)
1295{
1296 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
1297 GList *l;
1298 GVariantBuilder builder;
1299 GVariantBuilder invalidated_builder;
1300 guint num_changes;
1301
1302 g_mutex_lock (&skeleton->priv->lock);
1303 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1304 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1305 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1306 {
1307 ChangedProperty *cp = l->data;
1308 GVariant *variant;
1309 const GValue *cur_value;
1310
1311 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1312 if (!_g_value_equal (cur_value, &cp->orig_value))
1313 {
1314 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1315 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1316 g_variant_unref (variant);
1317 num_changes++;
1318 }
1319 }
1320 if (num_changes > 0)
1321 {
1322 GList *connections, *ll;
1323 GVariant *signal_variant;
1324 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
1325 &builder, &invalidated_builder));
1326 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1327 for (ll = connections; ll != NULL; ll = ll->next)
1328 {
1329 GDBusConnection *connection = ll->data;
1330
1331 g_dbus_connection_emit_signal (connection,
1332 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1333 "org.freedesktop.DBus.Properties",
1334 "PropertiesChanged",
1335 signal_variant,
1336 NULL);
1337 }
1338 g_variant_unref (signal_variant);
1339 g_list_free_full (connections, g_object_unref);
1340 }
1341 else
1342 {
1343 g_variant_builder_clear (&builder);
1344 g_variant_builder_clear (&invalidated_builder);
1345 }
1346 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1347 skeleton->priv->changed_properties = NULL;
1348 skeleton->priv->changed_properties_idle_source = NULL;
1349 g_mutex_unlock (&skeleton->priv->lock);
1350 return FALSE;
1351}
1352
1353static void
1354_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1355{
1356 ChangedProperty *cp;
1357 GList *l;
1358 cp = NULL;
1359 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1360 {
1361 ChangedProperty *i_cp = l->data;
1362 if (i_cp->info == info)
1363 {
1364 cp = i_cp;
1365 break;
1366 }
1367 }
1368 if (cp == NULL)
1369 {
1370 cp = g_new0 (ChangedProperty, 1);
1371 cp->prop_id = prop_id;
1372 cp->info = info;
1373 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1374 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1375 g_value_copy (orig_value, &cp->orig_value);
1376 }
1377}
1378
1379static void
1380control_skeleton_notify (GObject *object,
1381 GParamSpec *pspec G_GNUC_UNUSED)
1382{
1383 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
1384 g_mutex_lock (&skeleton->priv->lock);
1385 if (skeleton->priv->changed_properties != NULL &&
1386 skeleton->priv->changed_properties_idle_source == NULL)
1387 {
1388 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1389 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1390 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
1391 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1392 g_source_unref (skeleton->priv->changed_properties_idle_source);
1393 }
1394 g_mutex_unlock (&skeleton->priv->lock);
1395}
1396
1397static void
1398control_skeleton_set_property (GObject *object,
1399 guint prop_id,
1400 const GValue *value,
1401 GParamSpec *pspec)
1402{
1403 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
1404 g_assert (prop_id != 0 && prop_id - 1 < 2);
1405 g_mutex_lock (&skeleton->priv->lock);
1406 g_object_freeze_notify (object);
1407 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1408 {
1409 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1410 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1411 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1412 g_object_notify_by_pspec (object, pspec);
1413 }
1414 g_mutex_unlock (&skeleton->priv->lock);
1415 g_object_thaw_notify (object);
1416}
1417
1418static void
1419control_skeleton_init (ControlSkeleton *skeleton)
1420{
1421#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1422 skeleton->priv = control_skeleton_get_instance_private (skeleton);
1423#else
1424 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
1425#endif
1426
1427 g_mutex_init (&skeleton->priv->lock);
1428 skeleton->priv->context = g_main_context_ref_thread_default ();
1429 skeleton->priv->properties = g_new0 (GValue, 2);
1430 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
1431 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
1432}
1433
1434static gint
1435control_skeleton_get_poll_interval (Control *object)
1436{
1437 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
1438 gint value;
1439 g_mutex_lock (&skeleton->priv->lock);
1440 value = g_value_get_int (&(skeleton->priv->properties[0]));
1441 g_mutex_unlock (&skeleton->priv->lock);
1442 return value;
1443}
1444
1445static gint
1446control_skeleton_get_heatbeat (Control *object)
1447{
1448 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
1449 gint value;
1450 g_mutex_lock (&skeleton->priv->lock);
1451 value = g_value_get_int (&(skeleton->priv->properties[1]));
1452 g_mutex_unlock (&skeleton->priv->lock);
1453 return value;
1454}
1455
1456static void
1457control_skeleton_class_init (ControlSkeletonClass *klass)
1458{
1459 GObjectClass *gobject_class;
1460 GDBusInterfaceSkeletonClass *skeleton_class;
1461
1462 gobject_class = G_OBJECT_CLASS (klass);
1463 gobject_class->finalize = control_skeleton_finalize;
1464 gobject_class->get_property = control_skeleton_get_property;
1465 gobject_class->set_property = control_skeleton_set_property;
1466 gobject_class->notify = control_skeleton_notify;
1467
1468
1469 control_override_properties (gobject_class, 1);
1470
1471 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1472 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
1473 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
1474 skeleton_class->flush = control_skeleton_dbus_interface_flush;
1475 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
1476
1477#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1478 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
1479#endif
1480}
1481
1482static void
1483control_skeleton_iface_init (ControlIface *iface)
1484{
1485 iface->heartbeat = _control_on_signal_heartbeat;
1486 iface->get_poll_interval = control_skeleton_get_poll_interval;
1487 iface->get_heatbeat = control_skeleton_get_heatbeat;
1488}
1489
1490/**
1491 * control_skeleton_new:
1492 *
1493 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
1494 *
1495 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
1496 */
1497Control *
1498control_skeleton_new (void)
1499{
1500 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
1501}
1502
1503/* ------------------------------------------------------------------------
1504 * Code for interface org.openbmc.control.Host
1505 * ------------------------------------------------------------------------
1506 */
1507
1508/**
1509 * SECTION:ControlHost
1510 * @title: ControlHost
1511 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
1512 *
1513 * 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.
1514 */
1515
1516/* ---- Introspection data for org.openbmc.control.Host ---- */
1517
1518static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
1519{
1520 {
1521 -1,
1522 (gchar *) "boot",
1523 NULL,
1524 NULL,
1525 NULL
1526 },
1527 "handle-boot",
1528 FALSE
1529};
1530
1531static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
1532{
1533 {
1534 -1,
1535 (gchar *) "shutdown",
1536 NULL,
1537 NULL,
1538 NULL
1539 },
1540 "handle-shutdown",
1541 FALSE
1542};
1543
1544static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
1545{
1546 {
1547 -1,
1548 (gchar *) "reboot",
1549 NULL,
1550 NULL,
1551 NULL
1552 },
1553 "handle-reboot",
1554 FALSE
1555};
1556
1557static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
1558{
1559 &_control_host_method_info_boot,
1560 &_control_host_method_info_shutdown,
1561 &_control_host_method_info_reboot,
1562 NULL
1563};
1564
1565static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
1566{
1567 {
1568 -1,
1569 (gchar *) "Booted",
1570 NULL,
1571 NULL
1572 },
1573 "booted"
1574};
1575
1576static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
1577{
1578 &_control_host_signal_info_booted,
1579 NULL
1580};
1581
1582static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
1583{
1584 {
1585 -1,
1586 (gchar *) "org.openbmc.control.Host",
1587 (GDBusMethodInfo **) &_control_host_method_info_pointers,
1588 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
1589 NULL,
1590 NULL
1591 },
1592 "control-host",
1593};
1594
1595
1596/**
1597 * control_host_interface_info:
1598 *
1599 * 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.
1600 *
1601 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1602 */
1603GDBusInterfaceInfo *
1604control_host_interface_info (void)
1605{
1606 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
1607}
1608
1609/**
1610 * control_host_override_properties:
1611 * @klass: The class structure for a #GObject<!-- -->-derived class.
1612 * @property_id_begin: The property id to assign to the first overridden property.
1613 *
1614 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
1615 * The properties are overridden in the order they are defined.
1616 *
1617 * Returns: The last property id.
1618 */
1619guint
1620control_host_override_properties (GObjectClass *klass, guint property_id_begin)
1621{
1622 return property_id_begin - 1;
1623}
1624
1625
1626
1627/**
1628 * ControlHost:
1629 *
1630 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
1631 */
1632
1633/**
1634 * ControlHostIface:
1635 * @parent_iface: The parent interface.
1636 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
1637 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
1638 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
1639 * @booted: Handler for the #ControlHost::booted signal.
1640 *
1641 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
1642 */
1643
1644typedef ControlHostIface ControlHostInterface;
1645G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
1646
1647static void
1648control_host_default_init (ControlHostIface *iface)
1649{
1650 /* GObject signals for incoming D-Bus method calls: */
1651 /**
1652 * ControlHost::handle-boot:
1653 * @object: A #ControlHost.
1654 * @invocation: A #GDBusMethodInvocation.
1655 *
1656 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
1657 *
1658 * 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.
1659 *
1660 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1661 */
1662 g_signal_new ("handle-boot",
1663 G_TYPE_FROM_INTERFACE (iface),
1664 G_SIGNAL_RUN_LAST,
1665 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
1666 g_signal_accumulator_true_handled,
1667 NULL,
1668 g_cclosure_marshal_generic,
1669 G_TYPE_BOOLEAN,
1670 1,
1671 G_TYPE_DBUS_METHOD_INVOCATION);
1672
1673 /**
1674 * ControlHost::handle-shutdown:
1675 * @object: A #ControlHost.
1676 * @invocation: A #GDBusMethodInvocation.
1677 *
1678 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
1679 *
1680 * 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.
1681 *
1682 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1683 */
1684 g_signal_new ("handle-shutdown",
1685 G_TYPE_FROM_INTERFACE (iface),
1686 G_SIGNAL_RUN_LAST,
1687 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
1688 g_signal_accumulator_true_handled,
1689 NULL,
1690 g_cclosure_marshal_generic,
1691 G_TYPE_BOOLEAN,
1692 1,
1693 G_TYPE_DBUS_METHOD_INVOCATION);
1694
1695 /**
1696 * ControlHost::handle-reboot:
1697 * @object: A #ControlHost.
1698 * @invocation: A #GDBusMethodInvocation.
1699 *
1700 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
1701 *
1702 * 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.
1703 *
1704 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1705 */
1706 g_signal_new ("handle-reboot",
1707 G_TYPE_FROM_INTERFACE (iface),
1708 G_SIGNAL_RUN_LAST,
1709 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
1710 g_signal_accumulator_true_handled,
1711 NULL,
1712 g_cclosure_marshal_generic,
1713 G_TYPE_BOOLEAN,
1714 1,
1715 G_TYPE_DBUS_METHOD_INVOCATION);
1716
1717 /* GObject signals for received D-Bus signals: */
1718 /**
1719 * ControlHost::booted:
1720 * @object: A #ControlHost.
1721 *
1722 * 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.
1723 *
1724 * 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.
1725 */
1726 g_signal_new ("booted",
1727 G_TYPE_FROM_INTERFACE (iface),
1728 G_SIGNAL_RUN_LAST,
1729 G_STRUCT_OFFSET (ControlHostIface, booted),
1730 NULL,
1731 NULL,
1732 g_cclosure_marshal_generic,
1733 G_TYPE_NONE,
1734 0);
1735
1736}
1737
1738/**
1739 * control_host_emit_booted:
1740 * @object: A #ControlHost.
1741 *
1742 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
1743 */
1744void
1745control_host_emit_booted (
1746 ControlHost *object)
1747{
1748 g_signal_emit_by_name (object, "booted");
1749}
1750
1751/**
1752 * control_host_call_boot:
1753 * @proxy: A #ControlHostProxy.
1754 * @cancellable: (allow-none): A #GCancellable or %NULL.
1755 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1756 * @user_data: User data to pass to @callback.
1757 *
1758 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
1759 * 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.
1760 * You can then call control_host_call_boot_finish() to get the result of the operation.
1761 *
1762 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
1763 */
1764void
1765control_host_call_boot (
1766 ControlHost *proxy,
1767 GCancellable *cancellable,
1768 GAsyncReadyCallback callback,
1769 gpointer user_data)
1770{
1771 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1772 "boot",
1773 g_variant_new ("()"),
1774 G_DBUS_CALL_FLAGS_NONE,
1775 -1,
1776 cancellable,
1777 callback,
1778 user_data);
1779}
1780
1781/**
1782 * control_host_call_boot_finish:
1783 * @proxy: A #ControlHostProxy.
1784 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
1785 * @error: Return location for error or %NULL.
1786 *
1787 * Finishes an operation started with control_host_call_boot().
1788 *
1789 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1790 */
1791gboolean
1792control_host_call_boot_finish (
1793 ControlHost *proxy,
1794 GAsyncResult *res,
1795 GError **error)
1796{
1797 GVariant *_ret;
1798 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1799 if (_ret == NULL)
1800 goto _out;
1801 g_variant_get (_ret,
1802 "()");
1803 g_variant_unref (_ret);
1804_out:
1805 return _ret != NULL;
1806}
1807
1808/**
1809 * control_host_call_boot_sync:
1810 * @proxy: A #ControlHostProxy.
1811 * @cancellable: (allow-none): A #GCancellable or %NULL.
1812 * @error: Return location for error or %NULL.
1813 *
1814 * 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.
1815 *
1816 * See control_host_call_boot() for the asynchronous version of this method.
1817 *
1818 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1819 */
1820gboolean
1821control_host_call_boot_sync (
1822 ControlHost *proxy,
1823 GCancellable *cancellable,
1824 GError **error)
1825{
1826 GVariant *_ret;
1827 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1828 "boot",
1829 g_variant_new ("()"),
1830 G_DBUS_CALL_FLAGS_NONE,
1831 -1,
1832 cancellable,
1833 error);
1834 if (_ret == NULL)
1835 goto _out;
1836 g_variant_get (_ret,
1837 "()");
1838 g_variant_unref (_ret);
1839_out:
1840 return _ret != NULL;
1841}
1842
1843/**
1844 * control_host_call_shutdown:
1845 * @proxy: A #ControlHostProxy.
1846 * @cancellable: (allow-none): A #GCancellable or %NULL.
1847 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1848 * @user_data: User data to pass to @callback.
1849 *
1850 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
1851 * 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.
1852 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
1853 *
1854 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
1855 */
1856void
1857control_host_call_shutdown (
1858 ControlHost *proxy,
1859 GCancellable *cancellable,
1860 GAsyncReadyCallback callback,
1861 gpointer user_data)
1862{
1863 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1864 "shutdown",
1865 g_variant_new ("()"),
1866 G_DBUS_CALL_FLAGS_NONE,
1867 -1,
1868 cancellable,
1869 callback,
1870 user_data);
1871}
1872
1873/**
1874 * control_host_call_shutdown_finish:
1875 * @proxy: A #ControlHostProxy.
1876 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
1877 * @error: Return location for error or %NULL.
1878 *
1879 * Finishes an operation started with control_host_call_shutdown().
1880 *
1881 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1882 */
1883gboolean
1884control_host_call_shutdown_finish (
1885 ControlHost *proxy,
1886 GAsyncResult *res,
1887 GError **error)
1888{
1889 GVariant *_ret;
1890 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1891 if (_ret == NULL)
1892 goto _out;
1893 g_variant_get (_ret,
1894 "()");
1895 g_variant_unref (_ret);
1896_out:
1897 return _ret != NULL;
1898}
1899
1900/**
1901 * control_host_call_shutdown_sync:
1902 * @proxy: A #ControlHostProxy.
1903 * @cancellable: (allow-none): A #GCancellable or %NULL.
1904 * @error: Return location for error or %NULL.
1905 *
1906 * 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.
1907 *
1908 * See control_host_call_shutdown() for the asynchronous version of this method.
1909 *
1910 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1911 */
1912gboolean
1913control_host_call_shutdown_sync (
1914 ControlHost *proxy,
1915 GCancellable *cancellable,
1916 GError **error)
1917{
1918 GVariant *_ret;
1919 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1920 "shutdown",
1921 g_variant_new ("()"),
1922 G_DBUS_CALL_FLAGS_NONE,
1923 -1,
1924 cancellable,
1925 error);
1926 if (_ret == NULL)
1927 goto _out;
1928 g_variant_get (_ret,
1929 "()");
1930 g_variant_unref (_ret);
1931_out:
1932 return _ret != NULL;
1933}
1934
1935/**
1936 * control_host_call_reboot:
1937 * @proxy: A #ControlHostProxy.
1938 * @cancellable: (allow-none): A #GCancellable or %NULL.
1939 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1940 * @user_data: User data to pass to @callback.
1941 *
1942 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
1943 * 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.
1944 * You can then call control_host_call_reboot_finish() to get the result of the operation.
1945 *
1946 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
1947 */
1948void
1949control_host_call_reboot (
1950 ControlHost *proxy,
1951 GCancellable *cancellable,
1952 GAsyncReadyCallback callback,
1953 gpointer user_data)
1954{
1955 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1956 "reboot",
1957 g_variant_new ("()"),
1958 G_DBUS_CALL_FLAGS_NONE,
1959 -1,
1960 cancellable,
1961 callback,
1962 user_data);
1963}
1964
1965/**
1966 * control_host_call_reboot_finish:
1967 * @proxy: A #ControlHostProxy.
1968 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
1969 * @error: Return location for error or %NULL.
1970 *
1971 * Finishes an operation started with control_host_call_reboot().
1972 *
1973 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1974 */
1975gboolean
1976control_host_call_reboot_finish (
1977 ControlHost *proxy,
1978 GAsyncResult *res,
1979 GError **error)
1980{
1981 GVariant *_ret;
1982 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1983 if (_ret == NULL)
1984 goto _out;
1985 g_variant_get (_ret,
1986 "()");
1987 g_variant_unref (_ret);
1988_out:
1989 return _ret != NULL;
1990}
1991
1992/**
1993 * control_host_call_reboot_sync:
1994 * @proxy: A #ControlHostProxy.
1995 * @cancellable: (allow-none): A #GCancellable or %NULL.
1996 * @error: Return location for error or %NULL.
1997 *
1998 * 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.
1999 *
2000 * See control_host_call_reboot() for the asynchronous version of this method.
2001 *
2002 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2003 */
2004gboolean
2005control_host_call_reboot_sync (
2006 ControlHost *proxy,
2007 GCancellable *cancellable,
2008 GError **error)
2009{
2010 GVariant *_ret;
2011 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2012 "reboot",
2013 g_variant_new ("()"),
2014 G_DBUS_CALL_FLAGS_NONE,
2015 -1,
2016 cancellable,
2017 error);
2018 if (_ret == NULL)
2019 goto _out;
2020 g_variant_get (_ret,
2021 "()");
2022 g_variant_unref (_ret);
2023_out:
2024 return _ret != NULL;
2025}
2026
2027/**
2028 * control_host_complete_boot:
2029 * @object: A #ControlHost.
2030 * @invocation: (transfer full): A #GDBusMethodInvocation.
2031 *
2032 * 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.
2033 *
2034 * This method will free @invocation, you cannot use it afterwards.
2035 */
2036void
2037control_host_complete_boot (
2038 ControlHost *object,
2039 GDBusMethodInvocation *invocation)
2040{
2041 g_dbus_method_invocation_return_value (invocation,
2042 g_variant_new ("()"));
2043}
2044
2045/**
2046 * control_host_complete_shutdown:
2047 * @object: A #ControlHost.
2048 * @invocation: (transfer full): A #GDBusMethodInvocation.
2049 *
2050 * 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.
2051 *
2052 * This method will free @invocation, you cannot use it afterwards.
2053 */
2054void
2055control_host_complete_shutdown (
2056 ControlHost *object,
2057 GDBusMethodInvocation *invocation)
2058{
2059 g_dbus_method_invocation_return_value (invocation,
2060 g_variant_new ("()"));
2061}
2062
2063/**
2064 * control_host_complete_reboot:
2065 * @object: A #ControlHost.
2066 * @invocation: (transfer full): A #GDBusMethodInvocation.
2067 *
2068 * 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.
2069 *
2070 * This method will free @invocation, you cannot use it afterwards.
2071 */
2072void
2073control_host_complete_reboot (
2074 ControlHost *object,
2075 GDBusMethodInvocation *invocation)
2076{
2077 g_dbus_method_invocation_return_value (invocation,
2078 g_variant_new ("()"));
2079}
2080
2081/* ------------------------------------------------------------------------ */
2082
2083/**
2084 * ControlHostProxy:
2085 *
2086 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
2087 */
2088
2089/**
2090 * ControlHostProxyClass:
2091 * @parent_class: The parent class.
2092 *
2093 * Class structure for #ControlHostProxy.
2094 */
2095
2096struct _ControlHostProxyPrivate
2097{
2098 GData *qdata;
2099};
2100
2101static void control_host_proxy_iface_init (ControlHostIface *iface);
2102
2103#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2104G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
2105 G_ADD_PRIVATE (ControlHostProxy)
2106 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
2107
2108#else
2109G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
2110 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
2111
2112#endif
2113static void
2114control_host_proxy_finalize (GObject *object)
2115{
2116 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
2117 g_datalist_clear (&proxy->priv->qdata);
2118 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
2119}
2120
2121static void
2122control_host_proxy_get_property (GObject *object,
2123 guint prop_id,
2124 GValue *value,
2125 GParamSpec *pspec G_GNUC_UNUSED)
2126{
2127}
2128
2129static void
2130control_host_proxy_set_property (GObject *object,
2131 guint prop_id,
2132 const GValue *value,
2133 GParamSpec *pspec G_GNUC_UNUSED)
2134{
2135}
2136
2137static void
2138control_host_proxy_g_signal (GDBusProxy *proxy,
2139 const gchar *sender_name G_GNUC_UNUSED,
2140 const gchar *signal_name,
2141 GVariant *parameters)
2142{
2143 _ExtendedGDBusSignalInfo *info;
2144 GVariantIter iter;
2145 GVariant *child;
2146 GValue *paramv;
2147 guint num_params;
2148 guint n;
2149 guint signal_id;
2150 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
2151 if (info == NULL)
2152 return;
2153 num_params = g_variant_n_children (parameters);
2154 paramv = g_new0 (GValue, num_params + 1);
2155 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
2156 g_value_set_object (&paramv[0], proxy);
2157 g_variant_iter_init (&iter, parameters);
2158 n = 1;
2159 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2160 {
2161 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2162 if (arg_info->use_gvariant)
2163 {
2164 g_value_init (&paramv[n], G_TYPE_VARIANT);
2165 g_value_set_variant (&paramv[n], child);
2166 n++;
2167 }
2168 else
2169 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2170 g_variant_unref (child);
2171 }
2172 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
2173 g_signal_emitv (paramv, signal_id, 0, NULL);
2174 for (n = 0; n < num_params + 1; n++)
2175 g_value_unset (&paramv[n]);
2176 g_free (paramv);
2177}
2178
2179static void
2180control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
2181 GVariant *changed_properties,
2182 const gchar *const *invalidated_properties)
2183{
2184 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
2185 guint n;
2186 const gchar *key;
2187 GVariantIter *iter;
2188 _ExtendedGDBusPropertyInfo *info;
2189 g_variant_get (changed_properties, "a{sv}", &iter);
2190 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2191 {
2192 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
2193 g_datalist_remove_data (&proxy->priv->qdata, key);
2194 if (info != NULL)
2195 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2196 }
2197 g_variant_iter_free (iter);
2198 for (n = 0; invalidated_properties[n] != NULL; n++)
2199 {
2200 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
2201 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2202 if (info != NULL)
2203 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2204 }
2205}
2206
2207static void
2208control_host_proxy_init (ControlHostProxy *proxy)
2209{
2210#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2211 proxy->priv = control_host_proxy_get_instance_private (proxy);
2212#else
2213 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
2214#endif
2215
2216 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
2217}
2218
2219static void
2220control_host_proxy_class_init (ControlHostProxyClass *klass)
2221{
2222 GObjectClass *gobject_class;
2223 GDBusProxyClass *proxy_class;
2224
2225 gobject_class = G_OBJECT_CLASS (klass);
2226 gobject_class->finalize = control_host_proxy_finalize;
2227 gobject_class->get_property = control_host_proxy_get_property;
2228 gobject_class->set_property = control_host_proxy_set_property;
2229
2230 proxy_class = G_DBUS_PROXY_CLASS (klass);
2231 proxy_class->g_signal = control_host_proxy_g_signal;
2232 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
2233
2234#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2235 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
2236#endif
2237}
2238
2239static void
2240control_host_proxy_iface_init (ControlHostIface *iface)
2241{
2242}
2243
2244/**
2245 * control_host_proxy_new:
2246 * @connection: A #GDBusConnection.
2247 * @flags: Flags from the #GDBusProxyFlags enumeration.
2248 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2249 * @object_path: An object path.
2250 * @cancellable: (allow-none): A #GCancellable or %NULL.
2251 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2252 * @user_data: User data to pass to @callback.
2253 *
2254 * 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.
2255 *
2256 * 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.
2257 * You can then call control_host_proxy_new_finish() to get the result of the operation.
2258 *
2259 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
2260 */
2261void
2262control_host_proxy_new (
2263 GDBusConnection *connection,
2264 GDBusProxyFlags flags,
2265 const gchar *name,
2266 const gchar *object_path,
2267 GCancellable *cancellable,
2268 GAsyncReadyCallback callback,
2269 gpointer user_data)
2270{
2271 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);
2272}
2273
2274/**
2275 * control_host_proxy_new_finish:
2276 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
2277 * @error: Return location for error or %NULL
2278 *
2279 * Finishes an operation started with control_host_proxy_new().
2280 *
2281 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
2282 */
2283ControlHost *
2284control_host_proxy_new_finish (
2285 GAsyncResult *res,
2286 GError **error)
2287{
2288 GObject *ret;
2289 GObject *source_object;
2290 source_object = g_async_result_get_source_object (res);
2291 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2292 g_object_unref (source_object);
2293 if (ret != NULL)
2294 return CONTROL_HOST (ret);
2295 else
2296 return NULL;
2297}
2298
2299/**
2300 * control_host_proxy_new_sync:
2301 * @connection: A #GDBusConnection.
2302 * @flags: Flags from the #GDBusProxyFlags enumeration.
2303 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2304 * @object_path: An object path.
2305 * @cancellable: (allow-none): A #GCancellable or %NULL.
2306 * @error: Return location for error or %NULL
2307 *
2308 * 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.
2309 *
2310 * The calling thread is blocked until a reply is received.
2311 *
2312 * See control_host_proxy_new() for the asynchronous version of this constructor.
2313 *
2314 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
2315 */
2316ControlHost *
2317control_host_proxy_new_sync (
2318 GDBusConnection *connection,
2319 GDBusProxyFlags flags,
2320 const gchar *name,
2321 const gchar *object_path,
2322 GCancellable *cancellable,
2323 GError **error)
2324{
2325 GInitable *ret;
2326 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);
2327 if (ret != NULL)
2328 return CONTROL_HOST (ret);
2329 else
2330 return NULL;
2331}
2332
2333
2334/**
2335 * control_host_proxy_new_for_bus:
2336 * @bus_type: A #GBusType.
2337 * @flags: Flags from the #GDBusProxyFlags enumeration.
2338 * @name: A bus name (well-known or unique).
2339 * @object_path: An object path.
2340 * @cancellable: (allow-none): A #GCancellable or %NULL.
2341 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2342 * @user_data: User data to pass to @callback.
2343 *
2344 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2345 *
2346 * 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.
2347 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
2348 *
2349 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2350 */
2351void
2352control_host_proxy_new_for_bus (
2353 GBusType bus_type,
2354 GDBusProxyFlags flags,
2355 const gchar *name,
2356 const gchar *object_path,
2357 GCancellable *cancellable,
2358 GAsyncReadyCallback callback,
2359 gpointer user_data)
2360{
2361 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);
2362}
2363
2364/**
2365 * control_host_proxy_new_for_bus_finish:
2366 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
2367 * @error: Return location for error or %NULL
2368 *
2369 * Finishes an operation started with control_host_proxy_new_for_bus().
2370 *
2371 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
2372 */
2373ControlHost *
2374control_host_proxy_new_for_bus_finish (
2375 GAsyncResult *res,
2376 GError **error)
2377{
2378 GObject *ret;
2379 GObject *source_object;
2380 source_object = g_async_result_get_source_object (res);
2381 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2382 g_object_unref (source_object);
2383 if (ret != NULL)
2384 return CONTROL_HOST (ret);
2385 else
2386 return NULL;
2387}
2388
2389/**
2390 * control_host_proxy_new_for_bus_sync:
2391 * @bus_type: A #GBusType.
2392 * @flags: Flags from the #GDBusProxyFlags enumeration.
2393 * @name: A bus name (well-known or unique).
2394 * @object_path: An object path.
2395 * @cancellable: (allow-none): A #GCancellable or %NULL.
2396 * @error: Return location for error or %NULL
2397 *
2398 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2399 *
2400 * The calling thread is blocked until a reply is received.
2401 *
2402 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
2403 *
2404 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
2405 */
2406ControlHost *
2407control_host_proxy_new_for_bus_sync (
2408 GBusType bus_type,
2409 GDBusProxyFlags flags,
2410 const gchar *name,
2411 const gchar *object_path,
2412 GCancellable *cancellable,
2413 GError **error)
2414{
2415 GInitable *ret;
2416 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);
2417 if (ret != NULL)
2418 return CONTROL_HOST (ret);
2419 else
2420 return NULL;
2421}
2422
2423
2424/* ------------------------------------------------------------------------ */
2425
2426/**
2427 * ControlHostSkeleton:
2428 *
2429 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
2430 */
2431
2432/**
2433 * ControlHostSkeletonClass:
2434 * @parent_class: The parent class.
2435 *
2436 * Class structure for #ControlHostSkeleton.
2437 */
2438
2439struct _ControlHostSkeletonPrivate
2440{
2441 GValue *properties;
2442 GList *changed_properties;
2443 GSource *changed_properties_idle_source;
2444 GMainContext *context;
2445 GMutex lock;
2446};
2447
2448static void
2449_control_host_skeleton_handle_method_call (
2450 GDBusConnection *connection G_GNUC_UNUSED,
2451 const gchar *sender G_GNUC_UNUSED,
2452 const gchar *object_path G_GNUC_UNUSED,
2453 const gchar *interface_name,
2454 const gchar *method_name,
2455 GVariant *parameters,
2456 GDBusMethodInvocation *invocation,
2457 gpointer user_data)
2458{
2459 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
2460 _ExtendedGDBusMethodInfo *info;
2461 GVariantIter iter;
2462 GVariant *child;
2463 GValue *paramv;
2464 guint num_params;
2465 guint num_extra;
2466 guint n;
2467 guint signal_id;
2468 GValue return_value = G_VALUE_INIT;
2469 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2470 g_assert (info != NULL);
2471 num_params = g_variant_n_children (parameters);
2472 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
2473 n = 0;
2474 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
2475 g_value_set_object (&paramv[n++], skeleton);
2476 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
2477 g_value_set_object (&paramv[n++], invocation);
2478 if (info->pass_fdlist)
2479 {
2480#ifdef G_OS_UNIX
2481 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
2482 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
2483#else
2484 g_assert_not_reached ();
2485#endif
2486 }
2487 g_variant_iter_init (&iter, parameters);
2488 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2489 {
2490 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
2491 if (arg_info->use_gvariant)
2492 {
2493 g_value_init (&paramv[n], G_TYPE_VARIANT);
2494 g_value_set_variant (&paramv[n], child);
2495 n++;
2496 }
2497 else
2498 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2499 g_variant_unref (child);
2500 }
2501 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
2502 g_value_init (&return_value, G_TYPE_BOOLEAN);
2503 g_signal_emitv (paramv, signal_id, 0, &return_value);
2504 if (!g_value_get_boolean (&return_value))
2505 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);
2506 g_value_unset (&return_value);
2507 for (n = 0; n < num_params + num_extra; n++)
2508 g_value_unset (&paramv[n]);
2509 g_free (paramv);
2510}
2511
2512static GVariant *
2513_control_host_skeleton_handle_get_property (
2514 GDBusConnection *connection G_GNUC_UNUSED,
2515 const gchar *sender G_GNUC_UNUSED,
2516 const gchar *object_path G_GNUC_UNUSED,
2517 const gchar *interface_name G_GNUC_UNUSED,
2518 const gchar *property_name,
2519 GError **error,
2520 gpointer user_data)
2521{
2522 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
2523 GValue value = G_VALUE_INIT;
2524 GParamSpec *pspec;
2525 _ExtendedGDBusPropertyInfo *info;
2526 GVariant *ret;
2527 ret = NULL;
2528 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
2529 g_assert (info != NULL);
2530 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2531 if (pspec == NULL)
2532 {
2533 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2534 }
2535 else
2536 {
2537 g_value_init (&value, pspec->value_type);
2538 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2539 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2540 g_value_unset (&value);
2541 }
2542 return ret;
2543}
2544
2545static gboolean
2546_control_host_skeleton_handle_set_property (
2547 GDBusConnection *connection G_GNUC_UNUSED,
2548 const gchar *sender G_GNUC_UNUSED,
2549 const gchar *object_path G_GNUC_UNUSED,
2550 const gchar *interface_name G_GNUC_UNUSED,
2551 const gchar *property_name,
2552 GVariant *variant,
2553 GError **error,
2554 gpointer user_data)
2555{
2556 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
2557 GValue value = G_VALUE_INIT;
2558 GParamSpec *pspec;
2559 _ExtendedGDBusPropertyInfo *info;
2560 gboolean ret;
2561 ret = FALSE;
2562 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
2563 g_assert (info != NULL);
2564 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2565 if (pspec == NULL)
2566 {
2567 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2568 }
2569 else
2570 {
2571 if (info->use_gvariant)
2572 g_value_set_variant (&value, variant);
2573 else
2574 g_dbus_gvariant_to_gvalue (variant, &value);
2575 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2576 g_value_unset (&value);
2577 ret = TRUE;
2578 }
2579 return ret;
2580}
2581
2582static const GDBusInterfaceVTable _control_host_skeleton_vtable =
2583{
2584 _control_host_skeleton_handle_method_call,
2585 _control_host_skeleton_handle_get_property,
2586 _control_host_skeleton_handle_set_property,
2587 {NULL}
2588};
2589
2590static GDBusInterfaceInfo *
2591control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2592{
2593 return control_host_interface_info ();
2594}
2595
2596static GDBusInterfaceVTable *
2597control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2598{
2599 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
2600}
2601
2602static GVariant *
2603control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2604{
2605 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
2606
2607 GVariantBuilder builder;
2608 guint n;
2609 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2610 if (_control_host_interface_info.parent_struct.properties == NULL)
2611 goto out;
2612 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
2613 {
2614 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
2615 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2616 {
2617 GVariant *value;
2618 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);
2619 if (value != NULL)
2620 {
2621 g_variant_take_ref (value);
2622 g_variant_builder_add (&builder, "{sv}", info->name, value);
2623 g_variant_unref (value);
2624 }
2625 }
2626 }
2627out:
2628 return g_variant_builder_end (&builder);
2629}
2630
2631static void
2632control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2633{
2634}
2635
2636static void
2637_control_host_on_signal_booted (
2638 ControlHost *object)
2639{
2640 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
2641
2642 GList *connections, *l;
2643 GVariant *signal_variant;
2644 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2645
2646 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
2647 for (l = connections; l != NULL; l = l->next)
2648 {
2649 GDBusConnection *connection = l->data;
2650 g_dbus_connection_emit_signal (connection,
2651 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
2652 signal_variant, NULL);
2653 }
2654 g_variant_unref (signal_variant);
2655 g_list_free_full (connections, g_object_unref);
2656}
2657
2658static void control_host_skeleton_iface_init (ControlHostIface *iface);
2659#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2660G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2661 G_ADD_PRIVATE (ControlHostSkeleton)
2662 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
2663
2664#else
2665G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2666 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
2667
2668#endif
2669static void
2670control_host_skeleton_finalize (GObject *object)
2671{
2672 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
2673 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2674 if (skeleton->priv->changed_properties_idle_source != NULL)
2675 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2676 g_main_context_unref (skeleton->priv->context);
2677 g_mutex_clear (&skeleton->priv->lock);
2678 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
2679}
2680
2681static void
2682control_host_skeleton_init (ControlHostSkeleton *skeleton)
2683{
2684#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2685 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
2686#else
2687 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
2688#endif
2689
2690 g_mutex_init (&skeleton->priv->lock);
2691 skeleton->priv->context = g_main_context_ref_thread_default ();
2692}
2693
2694static void
2695control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
2696{
2697 GObjectClass *gobject_class;
2698 GDBusInterfaceSkeletonClass *skeleton_class;
2699
2700 gobject_class = G_OBJECT_CLASS (klass);
2701 gobject_class->finalize = control_host_skeleton_finalize;
2702
2703 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2704 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
2705 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
2706 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
2707 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
2708
2709#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2710 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
2711#endif
2712}
2713
2714static void
2715control_host_skeleton_iface_init (ControlHostIface *iface)
2716{
2717 iface->booted = _control_host_on_signal_booted;
2718}
2719
2720/**
2721 * control_host_skeleton_new:
2722 *
2723 * 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>.
2724 *
2725 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
2726 */
2727ControlHost *
2728control_host_skeleton_new (void)
2729{
2730 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
2731}
2732
2733/* ------------------------------------------------------------------------
2734 * Code for interface org.openbmc.control.Power
2735 * ------------------------------------------------------------------------
2736 */
2737
2738/**
2739 * SECTION:ControlPower
2740 * @title: ControlPower
2741 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
2742 *
2743 * 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.
2744 */
2745
2746/* ---- Introspection data for org.openbmc.control.Power ---- */
2747
2748static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
2749{
2750 {
2751 -1,
2752 (gchar *) "state",
2753 (gchar *) "i",
2754 NULL
2755 },
2756 FALSE
2757};
2758
2759static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
2760{
2761 &_control_power_method_info_set_power_state_IN_ARG_state,
2762 NULL
2763};
2764
2765static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
2766{
2767 {
2768 -1,
2769 (gchar *) "setPowerState",
2770 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
2771 NULL,
2772 NULL
2773 },
2774 "handle-set-power-state",
2775 FALSE
2776};
2777
2778static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
2779{
2780 {
2781 -1,
2782 (gchar *) "state",
2783 (gchar *) "i",
2784 NULL
2785 },
2786 FALSE
2787};
2788
2789static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
2790{
2791 &_control_power_method_info_get_power_state_OUT_ARG_state,
2792 NULL
2793};
2794
2795static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
2796{
2797 {
2798 -1,
2799 (gchar *) "getPowerState",
2800 NULL,
2801 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
2802 NULL
2803 },
2804 "handle-get-power-state",
2805 FALSE
2806};
2807
2808static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
2809{
2810 &_control_power_method_info_set_power_state,
2811 &_control_power_method_info_get_power_state,
2812 NULL
2813};
2814
2815static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
2816{
2817 {
2818 -1,
2819 (gchar *) "PowerGood",
2820 NULL,
2821 NULL
2822 },
2823 "power-good"
2824};
2825
2826static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
2827{
2828 {
2829 -1,
2830 (gchar *) "PowerLost",
2831 NULL,
2832 NULL
2833 },
2834 "power-lost"
2835};
2836
2837static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
2838{
2839 &_control_power_signal_info_power_good,
2840 &_control_power_signal_info_power_lost,
2841 NULL
2842};
2843
2844static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
2845{
2846 {
2847 -1,
2848 (gchar *) "pgood",
2849 (gchar *) "i",
2850 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2851 NULL
2852 },
2853 "pgood",
2854 FALSE
2855};
2856
2857static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
2858{
2859 {
2860 -1,
2861 (gchar *) "state",
2862 (gchar *) "i",
2863 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
2864 NULL
2865 },
2866 "state",
2867 FALSE
2868};
2869
2870static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
2871{
2872 &_control_power_property_info_pgood,
2873 &_control_power_property_info_state,
2874 NULL
2875};
2876
2877static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
2878{
2879 {
2880 -1,
2881 (gchar *) "org.openbmc.control.Power",
2882 (GDBusMethodInfo **) &_control_power_method_info_pointers,
2883 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
2884 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
2885 NULL
2886 },
2887 "control-power",
2888};
2889
2890
2891/**
2892 * control_power_interface_info:
2893 *
2894 * 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.
2895 *
2896 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2897 */
2898GDBusInterfaceInfo *
2899control_power_interface_info (void)
2900{
2901 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
2902}
2903
2904/**
2905 * control_power_override_properties:
2906 * @klass: The class structure for a #GObject<!-- -->-derived class.
2907 * @property_id_begin: The property id to assign to the first overridden property.
2908 *
2909 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
2910 * The properties are overridden in the order they are defined.
2911 *
2912 * Returns: The last property id.
2913 */
2914guint
2915control_power_override_properties (GObjectClass *klass, guint property_id_begin)
2916{
2917 g_object_class_override_property (klass, property_id_begin++, "pgood");
2918 g_object_class_override_property (klass, property_id_begin++, "state");
2919 return property_id_begin - 1;
2920}
2921
2922
2923
2924/**
2925 * ControlPower:
2926 *
2927 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
2928 */
2929
2930/**
2931 * ControlPowerIface:
2932 * @parent_iface: The parent interface.
2933 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
2934 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
2935 * @get_pgood: Getter for the #ControlPower:pgood property.
2936 * @get_state: Getter for the #ControlPower:state property.
2937 * @power_good: Handler for the #ControlPower::power-good signal.
2938 * @power_lost: Handler for the #ControlPower::power-lost signal.
2939 *
2940 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
2941 */
2942
2943typedef ControlPowerIface ControlPowerInterface;
2944G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
2945
2946static void
2947control_power_default_init (ControlPowerIface *iface)
2948{
2949 /* GObject signals for incoming D-Bus method calls: */
2950 /**
2951 * ControlPower::handle-set-power-state:
2952 * @object: A #ControlPower.
2953 * @invocation: A #GDBusMethodInvocation.
2954 * @arg_state: Argument passed by remote caller.
2955 *
2956 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
2957 *
2958 * 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.
2959 *
2960 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2961 */
2962 g_signal_new ("handle-set-power-state",
2963 G_TYPE_FROM_INTERFACE (iface),
2964 G_SIGNAL_RUN_LAST,
2965 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
2966 g_signal_accumulator_true_handled,
2967 NULL,
2968 g_cclosure_marshal_generic,
2969 G_TYPE_BOOLEAN,
2970 2,
2971 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2972
2973 /**
2974 * ControlPower::handle-get-power-state:
2975 * @object: A #ControlPower.
2976 * @invocation: A #GDBusMethodInvocation.
2977 *
2978 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
2979 *
2980 * 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.
2981 *
2982 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2983 */
2984 g_signal_new ("handle-get-power-state",
2985 G_TYPE_FROM_INTERFACE (iface),
2986 G_SIGNAL_RUN_LAST,
2987 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
2988 g_signal_accumulator_true_handled,
2989 NULL,
2990 g_cclosure_marshal_generic,
2991 G_TYPE_BOOLEAN,
2992 1,
2993 G_TYPE_DBUS_METHOD_INVOCATION);
2994
2995 /* GObject signals for received D-Bus signals: */
2996 /**
2997 * ControlPower::power-good:
2998 * @object: A #ControlPower.
2999 *
3000 * 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.
3001 *
3002 * 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.
3003 */
3004 g_signal_new ("power-good",
3005 G_TYPE_FROM_INTERFACE (iface),
3006 G_SIGNAL_RUN_LAST,
3007 G_STRUCT_OFFSET (ControlPowerIface, power_good),
3008 NULL,
3009 NULL,
3010 g_cclosure_marshal_generic,
3011 G_TYPE_NONE,
3012 0);
3013
3014 /**
3015 * ControlPower::power-lost:
3016 * @object: A #ControlPower.
3017 *
3018 * 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.
3019 *
3020 * 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.
3021 */
3022 g_signal_new ("power-lost",
3023 G_TYPE_FROM_INTERFACE (iface),
3024 G_SIGNAL_RUN_LAST,
3025 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
3026 NULL,
3027 NULL,
3028 g_cclosure_marshal_generic,
3029 G_TYPE_NONE,
3030 0);
3031
3032 /* GObject properties for D-Bus properties: */
3033 /**
3034 * ControlPower:pgood:
3035 *
3036 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
3037 *
3038 * 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.
3039 */
3040 g_object_interface_install_property (iface,
3041 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3042 /**
3043 * ControlPower:state:
3044 *
3045 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
3046 *
3047 * 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.
3048 */
3049 g_object_interface_install_property (iface,
3050 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3051}
3052
3053/**
3054 * control_power_get_pgood: (skip)
3055 * @object: A #ControlPower.
3056 *
3057 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
3058 *
3059 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3060 *
3061 * Returns: The property value.
3062 */
3063gint
3064control_power_get_pgood (ControlPower *object)
3065{
3066 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
3067}
3068
3069/**
3070 * control_power_set_pgood: (skip)
3071 * @object: A #ControlPower.
3072 * @value: The value to set.
3073 *
3074 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
3075 *
3076 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3077 */
3078void
3079control_power_set_pgood (ControlPower *object, gint value)
3080{
3081 g_object_set (G_OBJECT (object), "pgood", value, NULL);
3082}
3083
3084/**
3085 * control_power_get_state: (skip)
3086 * @object: A #ControlPower.
3087 *
3088 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
3089 *
3090 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3091 *
3092 * Returns: The property value.
3093 */
3094gint
3095control_power_get_state (ControlPower *object)
3096{
3097 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
3098}
3099
3100/**
3101 * control_power_set_state: (skip)
3102 * @object: A #ControlPower.
3103 * @value: The value to set.
3104 *
3105 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
3106 *
3107 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3108 */
3109void
3110control_power_set_state (ControlPower *object, gint value)
3111{
3112 g_object_set (G_OBJECT (object), "state", value, NULL);
3113}
3114
3115/**
3116 * control_power_emit_power_good:
3117 * @object: A #ControlPower.
3118 *
3119 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
3120 */
3121void
3122control_power_emit_power_good (
3123 ControlPower *object)
3124{
3125 g_signal_emit_by_name (object, "power-good");
3126}
3127
3128/**
3129 * control_power_emit_power_lost:
3130 * @object: A #ControlPower.
3131 *
3132 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
3133 */
3134void
3135control_power_emit_power_lost (
3136 ControlPower *object)
3137{
3138 g_signal_emit_by_name (object, "power-lost");
3139}
3140
3141/**
3142 * control_power_call_set_power_state:
3143 * @proxy: A #ControlPowerProxy.
3144 * @arg_state: Argument to pass with the method invocation.
3145 * @cancellable: (allow-none): A #GCancellable or %NULL.
3146 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3147 * @user_data: User data to pass to @callback.
3148 *
3149 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
3150 * 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.
3151 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
3152 *
3153 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
3154 */
3155void
3156control_power_call_set_power_state (
3157 ControlPower *proxy,
3158 gint arg_state,
3159 GCancellable *cancellable,
3160 GAsyncReadyCallback callback,
3161 gpointer user_data)
3162{
3163 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3164 "setPowerState",
3165 g_variant_new ("(i)",
3166 arg_state),
3167 G_DBUS_CALL_FLAGS_NONE,
3168 -1,
3169 cancellable,
3170 callback,
3171 user_data);
3172}
3173
3174/**
3175 * control_power_call_set_power_state_finish:
3176 * @proxy: A #ControlPowerProxy.
3177 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
3178 * @error: Return location for error or %NULL.
3179 *
3180 * Finishes an operation started with control_power_call_set_power_state().
3181 *
3182 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3183 */
3184gboolean
3185control_power_call_set_power_state_finish (
3186 ControlPower *proxy,
3187 GAsyncResult *res,
3188 GError **error)
3189{
3190 GVariant *_ret;
3191 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3192 if (_ret == NULL)
3193 goto _out;
3194 g_variant_get (_ret,
3195 "()");
3196 g_variant_unref (_ret);
3197_out:
3198 return _ret != NULL;
3199}
3200
3201/**
3202 * control_power_call_set_power_state_sync:
3203 * @proxy: A #ControlPowerProxy.
3204 * @arg_state: Argument to pass with the method invocation.
3205 * @cancellable: (allow-none): A #GCancellable or %NULL.
3206 * @error: Return location for error or %NULL.
3207 *
3208 * 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.
3209 *
3210 * See control_power_call_set_power_state() for the asynchronous version of this method.
3211 *
3212 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3213 */
3214gboolean
3215control_power_call_set_power_state_sync (
3216 ControlPower *proxy,
3217 gint arg_state,
3218 GCancellable *cancellable,
3219 GError **error)
3220{
3221 GVariant *_ret;
3222 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3223 "setPowerState",
3224 g_variant_new ("(i)",
3225 arg_state),
3226 G_DBUS_CALL_FLAGS_NONE,
3227 -1,
3228 cancellable,
3229 error);
3230 if (_ret == NULL)
3231 goto _out;
3232 g_variant_get (_ret,
3233 "()");
3234 g_variant_unref (_ret);
3235_out:
3236 return _ret != NULL;
3237}
3238
3239/**
3240 * control_power_call_get_power_state:
3241 * @proxy: A #ControlPowerProxy.
3242 * @cancellable: (allow-none): A #GCancellable or %NULL.
3243 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3244 * @user_data: User data to pass to @callback.
3245 *
3246 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
3247 * 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.
3248 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
3249 *
3250 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
3251 */
3252void
3253control_power_call_get_power_state (
3254 ControlPower *proxy,
3255 GCancellable *cancellable,
3256 GAsyncReadyCallback callback,
3257 gpointer user_data)
3258{
3259 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
3260 "getPowerState",
3261 g_variant_new ("()"),
3262 G_DBUS_CALL_FLAGS_NONE,
3263 -1,
3264 cancellable,
3265 callback,
3266 user_data);
3267}
3268
3269/**
3270 * control_power_call_get_power_state_finish:
3271 * @proxy: A #ControlPowerProxy.
3272 * @out_state: (out): Return location for return parameter or %NULL to ignore.
3273 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
3274 * @error: Return location for error or %NULL.
3275 *
3276 * Finishes an operation started with control_power_call_get_power_state().
3277 *
3278 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3279 */
3280gboolean
3281control_power_call_get_power_state_finish (
3282 ControlPower *proxy,
3283 gint *out_state,
3284 GAsyncResult *res,
3285 GError **error)
3286{
3287 GVariant *_ret;
3288 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
3289 if (_ret == NULL)
3290 goto _out;
3291 g_variant_get (_ret,
3292 "(i)",
3293 out_state);
3294 g_variant_unref (_ret);
3295_out:
3296 return _ret != NULL;
3297}
3298
3299/**
3300 * control_power_call_get_power_state_sync:
3301 * @proxy: A #ControlPowerProxy.
3302 * @out_state: (out): Return location for return parameter or %NULL to ignore.
3303 * @cancellable: (allow-none): A #GCancellable or %NULL.
3304 * @error: Return location for error or %NULL.
3305 *
3306 * 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.
3307 *
3308 * See control_power_call_get_power_state() for the asynchronous version of this method.
3309 *
3310 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3311 */
3312gboolean
3313control_power_call_get_power_state_sync (
3314 ControlPower *proxy,
3315 gint *out_state,
3316 GCancellable *cancellable,
3317 GError **error)
3318{
3319 GVariant *_ret;
3320 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3321 "getPowerState",
3322 g_variant_new ("()"),
3323 G_DBUS_CALL_FLAGS_NONE,
3324 -1,
3325 cancellable,
3326 error);
3327 if (_ret == NULL)
3328 goto _out;
3329 g_variant_get (_ret,
3330 "(i)",
3331 out_state);
3332 g_variant_unref (_ret);
3333_out:
3334 return _ret != NULL;
3335}
3336
3337/**
3338 * control_power_complete_set_power_state:
3339 * @object: A #ControlPower.
3340 * @invocation: (transfer full): A #GDBusMethodInvocation.
3341 *
3342 * 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.
3343 *
3344 * This method will free @invocation, you cannot use it afterwards.
3345 */
3346void
3347control_power_complete_set_power_state (
3348 ControlPower *object,
3349 GDBusMethodInvocation *invocation)
3350{
3351 g_dbus_method_invocation_return_value (invocation,
3352 g_variant_new ("()"));
3353}
3354
3355/**
3356 * control_power_complete_get_power_state:
3357 * @object: A #ControlPower.
3358 * @invocation: (transfer full): A #GDBusMethodInvocation.
3359 * @state: Parameter to return.
3360 *
3361 * 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.
3362 *
3363 * This method will free @invocation, you cannot use it afterwards.
3364 */
3365void
3366control_power_complete_get_power_state (
3367 ControlPower *object,
3368 GDBusMethodInvocation *invocation,
3369 gint state)
3370{
3371 g_dbus_method_invocation_return_value (invocation,
3372 g_variant_new ("(i)",
3373 state));
3374}
3375
3376/* ------------------------------------------------------------------------ */
3377
3378/**
3379 * ControlPowerProxy:
3380 *
3381 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
3382 */
3383
3384/**
3385 * ControlPowerProxyClass:
3386 * @parent_class: The parent class.
3387 *
3388 * Class structure for #ControlPowerProxy.
3389 */
3390
3391struct _ControlPowerProxyPrivate
3392{
3393 GData *qdata;
3394};
3395
3396static void control_power_proxy_iface_init (ControlPowerIface *iface);
3397
3398#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3399G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
3400 G_ADD_PRIVATE (ControlPowerProxy)
3401 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
3402
3403#else
3404G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
3405 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
3406
3407#endif
3408static void
3409control_power_proxy_finalize (GObject *object)
3410{
3411 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
3412 g_datalist_clear (&proxy->priv->qdata);
3413 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
3414}
3415
3416static void
3417control_power_proxy_get_property (GObject *object,
3418 guint prop_id,
3419 GValue *value,
3420 GParamSpec *pspec G_GNUC_UNUSED)
3421{
3422 const _ExtendedGDBusPropertyInfo *info;
3423 GVariant *variant;
3424 g_assert (prop_id != 0 && prop_id - 1 < 2);
3425 info = _control_power_property_info_pointers[prop_id - 1];
3426 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3427 if (info->use_gvariant)
3428 {
3429 g_value_set_variant (value, variant);
3430 }
3431 else
3432 {
3433 if (variant != NULL)
3434 g_dbus_gvariant_to_gvalue (variant, value);
3435 }
3436 if (variant != NULL)
3437 g_variant_unref (variant);
3438}
3439
3440static void
3441control_power_proxy_set_property_cb (GDBusProxy *proxy,
3442 GAsyncResult *res,
3443 gpointer user_data)
3444{
3445 const _ExtendedGDBusPropertyInfo *info = user_data;
3446 GError *error;
3447 GVariant *_ret;
3448 error = NULL;
3449 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3450 if (!_ret)
3451 {
3452 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
3453 info->parent_struct.name,
3454 error->message, g_quark_to_string (error->domain), error->code);
3455 g_error_free (error);
3456 }
3457 else
3458 {
3459 g_variant_unref (_ret);
3460 }
3461}
3462
3463static void
3464control_power_proxy_set_property (GObject *object,
3465 guint prop_id,
3466 const GValue *value,
3467 GParamSpec *pspec G_GNUC_UNUSED)
3468{
3469 const _ExtendedGDBusPropertyInfo *info;
3470 GVariant *variant;
3471 g_assert (prop_id != 0 && prop_id - 1 < 2);
3472 info = _control_power_property_info_pointers[prop_id - 1];
3473 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3474 g_dbus_proxy_call (G_DBUS_PROXY (object),
3475 "org.freedesktop.DBus.Properties.Set",
3476 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
3477 G_DBUS_CALL_FLAGS_NONE,
3478 -1,
3479 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3480 g_variant_unref (variant);
3481}
3482
3483static void
3484control_power_proxy_g_signal (GDBusProxy *proxy,
3485 const gchar *sender_name G_GNUC_UNUSED,
3486 const gchar *signal_name,
3487 GVariant *parameters)
3488{
3489 _ExtendedGDBusSignalInfo *info;
3490 GVariantIter iter;
3491 GVariant *child;
3492 GValue *paramv;
3493 guint num_params;
3494 guint n;
3495 guint signal_id;
3496 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
3497 if (info == NULL)
3498 return;
3499 num_params = g_variant_n_children (parameters);
3500 paramv = g_new0 (GValue, num_params + 1);
3501 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
3502 g_value_set_object (&paramv[0], proxy);
3503 g_variant_iter_init (&iter, parameters);
3504 n = 1;
3505 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3506 {
3507 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3508 if (arg_info->use_gvariant)
3509 {
3510 g_value_init (&paramv[n], G_TYPE_VARIANT);
3511 g_value_set_variant (&paramv[n], child);
3512 n++;
3513 }
3514 else
3515 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3516 g_variant_unref (child);
3517 }
3518 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
3519 g_signal_emitv (paramv, signal_id, 0, NULL);
3520 for (n = 0; n < num_params + 1; n++)
3521 g_value_unset (&paramv[n]);
3522 g_free (paramv);
3523}
3524
3525static void
3526control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
3527 GVariant *changed_properties,
3528 const gchar *const *invalidated_properties)
3529{
3530 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
3531 guint n;
3532 const gchar *key;
3533 GVariantIter *iter;
3534 _ExtendedGDBusPropertyInfo *info;
3535 g_variant_get (changed_properties, "a{sv}", &iter);
3536 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3537 {
3538 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
3539 g_datalist_remove_data (&proxy->priv->qdata, key);
3540 if (info != NULL)
3541 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3542 }
3543 g_variant_iter_free (iter);
3544 for (n = 0; invalidated_properties[n] != NULL; n++)
3545 {
3546 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
3547 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3548 if (info != NULL)
3549 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3550 }
3551}
3552
3553static gint
3554control_power_proxy_get_pgood (ControlPower *object)
3555{
3556 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
3557 GVariant *variant;
3558 gint value = 0;
3559 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
3560 if (variant != NULL)
3561 {
3562 value = g_variant_get_int32 (variant);
3563 g_variant_unref (variant);
3564 }
3565 return value;
3566}
3567
3568static gint
3569control_power_proxy_get_state (ControlPower *object)
3570{
3571 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
3572 GVariant *variant;
3573 gint value = 0;
3574 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
3575 if (variant != NULL)
3576 {
3577 value = g_variant_get_int32 (variant);
3578 g_variant_unref (variant);
3579 }
3580 return value;
3581}
3582
3583static void
3584control_power_proxy_init (ControlPowerProxy *proxy)
3585{
3586#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3587 proxy->priv = control_power_proxy_get_instance_private (proxy);
3588#else
3589 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
3590#endif
3591
3592 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
3593}
3594
3595static void
3596control_power_proxy_class_init (ControlPowerProxyClass *klass)
3597{
3598 GObjectClass *gobject_class;
3599 GDBusProxyClass *proxy_class;
3600
3601 gobject_class = G_OBJECT_CLASS (klass);
3602 gobject_class->finalize = control_power_proxy_finalize;
3603 gobject_class->get_property = control_power_proxy_get_property;
3604 gobject_class->set_property = control_power_proxy_set_property;
3605
3606 proxy_class = G_DBUS_PROXY_CLASS (klass);
3607 proxy_class->g_signal = control_power_proxy_g_signal;
3608 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
3609
3610 control_power_override_properties (gobject_class, 1);
3611
3612#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3613 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
3614#endif
3615}
3616
3617static void
3618control_power_proxy_iface_init (ControlPowerIface *iface)
3619{
3620 iface->get_pgood = control_power_proxy_get_pgood;
3621 iface->get_state = control_power_proxy_get_state;
3622}
3623
3624/**
3625 * control_power_proxy_new:
3626 * @connection: A #GDBusConnection.
3627 * @flags: Flags from the #GDBusProxyFlags enumeration.
3628 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3629 * @object_path: An object path.
3630 * @cancellable: (allow-none): A #GCancellable or %NULL.
3631 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3632 * @user_data: User data to pass to @callback.
3633 *
3634 * 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.
3635 *
3636 * 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.
3637 * You can then call control_power_proxy_new_finish() to get the result of the operation.
3638 *
3639 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
3640 */
3641void
3642control_power_proxy_new (
3643 GDBusConnection *connection,
3644 GDBusProxyFlags flags,
3645 const gchar *name,
3646 const gchar *object_path,
3647 GCancellable *cancellable,
3648 GAsyncReadyCallback callback,
3649 gpointer user_data)
3650{
3651 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);
3652}
3653
3654/**
3655 * control_power_proxy_new_finish:
3656 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
3657 * @error: Return location for error or %NULL
3658 *
3659 * Finishes an operation started with control_power_proxy_new().
3660 *
3661 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
3662 */
3663ControlPower *
3664control_power_proxy_new_finish (
3665 GAsyncResult *res,
3666 GError **error)
3667{
3668 GObject *ret;
3669 GObject *source_object;
3670 source_object = g_async_result_get_source_object (res);
3671 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3672 g_object_unref (source_object);
3673 if (ret != NULL)
3674 return CONTROL_POWER (ret);
3675 else
3676 return NULL;
3677}
3678
3679/**
3680 * control_power_proxy_new_sync:
3681 * @connection: A #GDBusConnection.
3682 * @flags: Flags from the #GDBusProxyFlags enumeration.
3683 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3684 * @object_path: An object path.
3685 * @cancellable: (allow-none): A #GCancellable or %NULL.
3686 * @error: Return location for error or %NULL
3687 *
3688 * 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.
3689 *
3690 * The calling thread is blocked until a reply is received.
3691 *
3692 * See control_power_proxy_new() for the asynchronous version of this constructor.
3693 *
3694 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
3695 */
3696ControlPower *
3697control_power_proxy_new_sync (
3698 GDBusConnection *connection,
3699 GDBusProxyFlags flags,
3700 const gchar *name,
3701 const gchar *object_path,
3702 GCancellable *cancellable,
3703 GError **error)
3704{
3705 GInitable *ret;
3706 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);
3707 if (ret != NULL)
3708 return CONTROL_POWER (ret);
3709 else
3710 return NULL;
3711}
3712
3713
3714/**
3715 * control_power_proxy_new_for_bus:
3716 * @bus_type: A #GBusType.
3717 * @flags: Flags from the #GDBusProxyFlags enumeration.
3718 * @name: A bus name (well-known or unique).
3719 * @object_path: An object path.
3720 * @cancellable: (allow-none): A #GCancellable or %NULL.
3721 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3722 * @user_data: User data to pass to @callback.
3723 *
3724 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3725 *
3726 * 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.
3727 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
3728 *
3729 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3730 */
3731void
3732control_power_proxy_new_for_bus (
3733 GBusType bus_type,
3734 GDBusProxyFlags flags,
3735 const gchar *name,
3736 const gchar *object_path,
3737 GCancellable *cancellable,
3738 GAsyncReadyCallback callback,
3739 gpointer user_data)
3740{
3741 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);
3742}
3743
3744/**
3745 * control_power_proxy_new_for_bus_finish:
3746 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
3747 * @error: Return location for error or %NULL
3748 *
3749 * Finishes an operation started with control_power_proxy_new_for_bus().
3750 *
3751 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
3752 */
3753ControlPower *
3754control_power_proxy_new_for_bus_finish (
3755 GAsyncResult *res,
3756 GError **error)
3757{
3758 GObject *ret;
3759 GObject *source_object;
3760 source_object = g_async_result_get_source_object (res);
3761 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3762 g_object_unref (source_object);
3763 if (ret != NULL)
3764 return CONTROL_POWER (ret);
3765 else
3766 return NULL;
3767}
3768
3769/**
3770 * control_power_proxy_new_for_bus_sync:
3771 * @bus_type: A #GBusType.
3772 * @flags: Flags from the #GDBusProxyFlags enumeration.
3773 * @name: A bus name (well-known or unique).
3774 * @object_path: An object path.
3775 * @cancellable: (allow-none): A #GCancellable or %NULL.
3776 * @error: Return location for error or %NULL
3777 *
3778 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3779 *
3780 * The calling thread is blocked until a reply is received.
3781 *
3782 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
3783 *
3784 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
3785 */
3786ControlPower *
3787control_power_proxy_new_for_bus_sync (
3788 GBusType bus_type,
3789 GDBusProxyFlags flags,
3790 const gchar *name,
3791 const gchar *object_path,
3792 GCancellable *cancellable,
3793 GError **error)
3794{
3795 GInitable *ret;
3796 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);
3797 if (ret != NULL)
3798 return CONTROL_POWER (ret);
3799 else
3800 return NULL;
3801}
3802
3803
3804/* ------------------------------------------------------------------------ */
3805
3806/**
3807 * ControlPowerSkeleton:
3808 *
3809 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
3810 */
3811
3812/**
3813 * ControlPowerSkeletonClass:
3814 * @parent_class: The parent class.
3815 *
3816 * Class structure for #ControlPowerSkeleton.
3817 */
3818
3819struct _ControlPowerSkeletonPrivate
3820{
3821 GValue *properties;
3822 GList *changed_properties;
3823 GSource *changed_properties_idle_source;
3824 GMainContext *context;
3825 GMutex lock;
3826};
3827
3828static void
3829_control_power_skeleton_handle_method_call (
3830 GDBusConnection *connection G_GNUC_UNUSED,
3831 const gchar *sender G_GNUC_UNUSED,
3832 const gchar *object_path G_GNUC_UNUSED,
3833 const gchar *interface_name,
3834 const gchar *method_name,
3835 GVariant *parameters,
3836 GDBusMethodInvocation *invocation,
3837 gpointer user_data)
3838{
3839 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
3840 _ExtendedGDBusMethodInfo *info;
3841 GVariantIter iter;
3842 GVariant *child;
3843 GValue *paramv;
3844 guint num_params;
3845 guint num_extra;
3846 guint n;
3847 guint signal_id;
3848 GValue return_value = G_VALUE_INIT;
3849 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3850 g_assert (info != NULL);
3851 num_params = g_variant_n_children (parameters);
3852 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3853 n = 0;
3854 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
3855 g_value_set_object (&paramv[n++], skeleton);
3856 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3857 g_value_set_object (&paramv[n++], invocation);
3858 if (info->pass_fdlist)
3859 {
3860#ifdef G_OS_UNIX
3861 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3862 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3863#else
3864 g_assert_not_reached ();
3865#endif
3866 }
3867 g_variant_iter_init (&iter, parameters);
3868 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3869 {
3870 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3871 if (arg_info->use_gvariant)
3872 {
3873 g_value_init (&paramv[n], G_TYPE_VARIANT);
3874 g_value_set_variant (&paramv[n], child);
3875 n++;
3876 }
3877 else
3878 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3879 g_variant_unref (child);
3880 }
3881 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
3882 g_value_init (&return_value, G_TYPE_BOOLEAN);
3883 g_signal_emitv (paramv, signal_id, 0, &return_value);
3884 if (!g_value_get_boolean (&return_value))
3885 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);
3886 g_value_unset (&return_value);
3887 for (n = 0; n < num_params + num_extra; n++)
3888 g_value_unset (&paramv[n]);
3889 g_free (paramv);
3890}
3891
3892static GVariant *
3893_control_power_skeleton_handle_get_property (
3894 GDBusConnection *connection G_GNUC_UNUSED,
3895 const gchar *sender G_GNUC_UNUSED,
3896 const gchar *object_path G_GNUC_UNUSED,
3897 const gchar *interface_name G_GNUC_UNUSED,
3898 const gchar *property_name,
3899 GError **error,
3900 gpointer user_data)
3901{
3902 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
3903 GValue value = G_VALUE_INIT;
3904 GParamSpec *pspec;
3905 _ExtendedGDBusPropertyInfo *info;
3906 GVariant *ret;
3907 ret = NULL;
3908 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
3909 g_assert (info != NULL);
3910 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3911 if (pspec == NULL)
3912 {
3913 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3914 }
3915 else
3916 {
3917 g_value_init (&value, pspec->value_type);
3918 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3919 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3920 g_value_unset (&value);
3921 }
3922 return ret;
3923}
3924
3925static gboolean
3926_control_power_skeleton_handle_set_property (
3927 GDBusConnection *connection G_GNUC_UNUSED,
3928 const gchar *sender G_GNUC_UNUSED,
3929 const gchar *object_path G_GNUC_UNUSED,
3930 const gchar *interface_name G_GNUC_UNUSED,
3931 const gchar *property_name,
3932 GVariant *variant,
3933 GError **error,
3934 gpointer user_data)
3935{
3936 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
3937 GValue value = G_VALUE_INIT;
3938 GParamSpec *pspec;
3939 _ExtendedGDBusPropertyInfo *info;
3940 gboolean ret;
3941 ret = FALSE;
3942 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
3943 g_assert (info != NULL);
3944 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3945 if (pspec == NULL)
3946 {
3947 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3948 }
3949 else
3950 {
3951 if (info->use_gvariant)
3952 g_value_set_variant (&value, variant);
3953 else
3954 g_dbus_gvariant_to_gvalue (variant, &value);
3955 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3956 g_value_unset (&value);
3957 ret = TRUE;
3958 }
3959 return ret;
3960}
3961
3962static const GDBusInterfaceVTable _control_power_skeleton_vtable =
3963{
3964 _control_power_skeleton_handle_method_call,
3965 _control_power_skeleton_handle_get_property,
3966 _control_power_skeleton_handle_set_property,
3967 {NULL}
3968};
3969
3970static GDBusInterfaceInfo *
3971control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3972{
3973 return control_power_interface_info ();
3974}
3975
3976static GDBusInterfaceVTable *
3977control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3978{
3979 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
3980}
3981
3982static GVariant *
3983control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3984{
3985 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
3986
3987 GVariantBuilder builder;
3988 guint n;
3989 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3990 if (_control_power_interface_info.parent_struct.properties == NULL)
3991 goto out;
3992 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
3993 {
3994 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
3995 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3996 {
3997 GVariant *value;
3998 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);
3999 if (value != NULL)
4000 {
4001 g_variant_take_ref (value);
4002 g_variant_builder_add (&builder, "{sv}", info->name, value);
4003 g_variant_unref (value);
4004 }
4005 }
4006 }
4007out:
4008 return g_variant_builder_end (&builder);
4009}
4010
4011static gboolean _control_power_emit_changed (gpointer user_data);
4012
4013static void
4014control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
4015{
4016 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
4017 gboolean emit_changed = FALSE;
4018
4019 g_mutex_lock (&skeleton->priv->lock);
4020 if (skeleton->priv->changed_properties_idle_source != NULL)
4021 {
4022 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4023 skeleton->priv->changed_properties_idle_source = NULL;
4024 emit_changed = TRUE;
4025 }
4026 g_mutex_unlock (&skeleton->priv->lock);
4027
4028 if (emit_changed)
4029 _control_power_emit_changed (skeleton);
4030}
4031
4032static void
4033_control_power_on_signal_power_good (
4034 ControlPower *object)
4035{
4036 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
4037
4038 GList *connections, *l;
4039 GVariant *signal_variant;
4040 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4041
4042 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
4043 for (l = connections; l != NULL; l = l->next)
4044 {
4045 GDBusConnection *connection = l->data;
4046 g_dbus_connection_emit_signal (connection,
4047 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
4048 signal_variant, NULL);
4049 }
4050 g_variant_unref (signal_variant);
4051 g_list_free_full (connections, g_object_unref);
4052}
4053
4054static void
4055_control_power_on_signal_power_lost (
4056 ControlPower *object)
4057{
4058 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
4059
4060 GList *connections, *l;
4061 GVariant *signal_variant;
4062 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4063
4064 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
4065 for (l = connections; l != NULL; l = l->next)
4066 {
4067 GDBusConnection *connection = l->data;
4068 g_dbus_connection_emit_signal (connection,
4069 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
4070 signal_variant, NULL);
4071 }
4072 g_variant_unref (signal_variant);
4073 g_list_free_full (connections, g_object_unref);
4074}
4075
4076static void control_power_skeleton_iface_init (ControlPowerIface *iface);
4077#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4078G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4079 G_ADD_PRIVATE (ControlPowerSkeleton)
4080 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
4081
4082#else
4083G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
4084 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
4085
4086#endif
4087static void
4088control_power_skeleton_finalize (GObject *object)
4089{
4090 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
4091 guint n;
4092 for (n = 0; n < 2; n++)
4093 g_value_unset (&skeleton->priv->properties[n]);
4094 g_free (skeleton->priv->properties);
4095 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4096 if (skeleton->priv->changed_properties_idle_source != NULL)
4097 g_source_destroy (skeleton->priv->changed_properties_idle_source);
4098 g_main_context_unref (skeleton->priv->context);
4099 g_mutex_clear (&skeleton->priv->lock);
4100 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
4101}
4102
4103static void
4104control_power_skeleton_get_property (GObject *object,
4105 guint prop_id,
4106 GValue *value,
4107 GParamSpec *pspec G_GNUC_UNUSED)
4108{
4109 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
4110 g_assert (prop_id != 0 && prop_id - 1 < 2);
4111 g_mutex_lock (&skeleton->priv->lock);
4112 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
4113 g_mutex_unlock (&skeleton->priv->lock);
4114}
4115
4116static gboolean
4117_control_power_emit_changed (gpointer user_data)
4118{
4119 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
4120 GList *l;
4121 GVariantBuilder builder;
4122 GVariantBuilder invalidated_builder;
4123 guint num_changes;
4124
4125 g_mutex_lock (&skeleton->priv->lock);
4126 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4127 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
4128 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
4129 {
4130 ChangedProperty *cp = l->data;
4131 GVariant *variant;
4132 const GValue *cur_value;
4133
4134 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
4135 if (!_g_value_equal (cur_value, &cp->orig_value))
4136 {
4137 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
4138 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
4139 g_variant_unref (variant);
4140 num_changes++;
4141 }
4142 }
4143 if (num_changes > 0)
4144 {
4145 GList *connections, *ll;
4146 GVariant *signal_variant;
4147 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
4148 &builder, &invalidated_builder));
4149 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
4150 for (ll = connections; ll != NULL; ll = ll->next)
4151 {
4152 GDBusConnection *connection = ll->data;
4153
4154 g_dbus_connection_emit_signal (connection,
4155 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
4156 "org.freedesktop.DBus.Properties",
4157 "PropertiesChanged",
4158 signal_variant,
4159 NULL);
4160 }
4161 g_variant_unref (signal_variant);
4162 g_list_free_full (connections, g_object_unref);
4163 }
4164 else
4165 {
4166 g_variant_builder_clear (&builder);
4167 g_variant_builder_clear (&invalidated_builder);
4168 }
4169 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
4170 skeleton->priv->changed_properties = NULL;
4171 skeleton->priv->changed_properties_idle_source = NULL;
4172 g_mutex_unlock (&skeleton->priv->lock);
4173 return FALSE;
4174}
4175
4176static void
4177_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
4178{
4179 ChangedProperty *cp;
4180 GList *l;
4181 cp = NULL;
4182 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
4183 {
4184 ChangedProperty *i_cp = l->data;
4185 if (i_cp->info == info)
4186 {
4187 cp = i_cp;
4188 break;
4189 }
4190 }
4191 if (cp == NULL)
4192 {
4193 cp = g_new0 (ChangedProperty, 1);
4194 cp->prop_id = prop_id;
4195 cp->info = info;
4196 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
4197 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
4198 g_value_copy (orig_value, &cp->orig_value);
4199 }
4200}
4201
4202static void
4203control_power_skeleton_notify (GObject *object,
4204 GParamSpec *pspec G_GNUC_UNUSED)
4205{
4206 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
4207 g_mutex_lock (&skeleton->priv->lock);
4208 if (skeleton->priv->changed_properties != NULL &&
4209 skeleton->priv->changed_properties_idle_source == NULL)
4210 {
4211 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
4212 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
4213 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
4214 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
4215 g_source_unref (skeleton->priv->changed_properties_idle_source);
4216 }
4217 g_mutex_unlock (&skeleton->priv->lock);
4218}
4219
4220static void
4221control_power_skeleton_set_property (GObject *object,
4222 guint prop_id,
4223 const GValue *value,
4224 GParamSpec *pspec)
4225{
4226 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
4227 g_assert (prop_id != 0 && prop_id - 1 < 2);
4228 g_mutex_lock (&skeleton->priv->lock);
4229 g_object_freeze_notify (object);
4230 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
4231 {
4232 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
4233 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
4234 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
4235 g_object_notify_by_pspec (object, pspec);
4236 }
4237 g_mutex_unlock (&skeleton->priv->lock);
4238 g_object_thaw_notify (object);
4239}
4240
4241static void
4242control_power_skeleton_init (ControlPowerSkeleton *skeleton)
4243{
4244#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4245 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
4246#else
4247 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
4248#endif
4249
4250 g_mutex_init (&skeleton->priv->lock);
4251 skeleton->priv->context = g_main_context_ref_thread_default ();
4252 skeleton->priv->properties = g_new0 (GValue, 2);
4253 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
4254 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
4255}
4256
4257static gint
4258control_power_skeleton_get_pgood (ControlPower *object)
4259{
4260 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
4261 gint value;
4262 g_mutex_lock (&skeleton->priv->lock);
4263 value = g_value_get_int (&(skeleton->priv->properties[0]));
4264 g_mutex_unlock (&skeleton->priv->lock);
4265 return value;
4266}
4267
4268static gint
4269control_power_skeleton_get_state (ControlPower *object)
4270{
4271 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
4272 gint value;
4273 g_mutex_lock (&skeleton->priv->lock);
4274 value = g_value_get_int (&(skeleton->priv->properties[1]));
4275 g_mutex_unlock (&skeleton->priv->lock);
4276 return value;
4277}
4278
4279static void
4280control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
4281{
4282 GObjectClass *gobject_class;
4283 GDBusInterfaceSkeletonClass *skeleton_class;
4284
4285 gobject_class = G_OBJECT_CLASS (klass);
4286 gobject_class->finalize = control_power_skeleton_finalize;
4287 gobject_class->get_property = control_power_skeleton_get_property;
4288 gobject_class->set_property = control_power_skeleton_set_property;
4289 gobject_class->notify = control_power_skeleton_notify;
4290
4291
4292 control_power_override_properties (gobject_class, 1);
4293
4294 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4295 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
4296 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
4297 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
4298 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
4299
4300#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4301 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
4302#endif
4303}
4304
4305static void
4306control_power_skeleton_iface_init (ControlPowerIface *iface)
4307{
4308 iface->power_good = _control_power_on_signal_power_good;
4309 iface->power_lost = _control_power_on_signal_power_lost;
4310 iface->get_pgood = control_power_skeleton_get_pgood;
4311 iface->get_state = control_power_skeleton_get_state;
4312}
4313
4314/**
4315 * control_power_skeleton_new:
4316 *
4317 * 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>.
4318 *
4319 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
4320 */
4321ControlPower *
4322control_power_skeleton_new (void)
4323{
4324 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
4325}
4326
4327/* ------------------------------------------------------------------------
4328 * Code for interface org.openbmc.EventLog
4329 * ------------------------------------------------------------------------
4330 */
4331
4332/**
4333 * SECTION:EventLog
4334 * @title: EventLog
4335 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
4336 *
4337 * 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.
4338 */
4339
4340/* ---- Introspection data for org.openbmc.EventLog ---- */
4341
4342static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
4343{
4344 {
4345 -1,
4346 (gchar *) "message",
4347 (gchar *) "a{ss}",
4348 NULL
4349 },
4350 FALSE
4351};
4352
4353static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
4354{
4355 &_event_log_signal_info_event_log_ARG_message,
4356 NULL
4357};
4358
4359static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
4360{
4361 {
4362 -1,
4363 (gchar *) "EventLog",
4364 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
4365 NULL
4366 },
4367 "event-log"
4368};
4369
4370static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
4371{
4372 &_event_log_signal_info_event_log,
4373 NULL
4374};
4375
4376static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
4377{
4378 {
4379 -1,
4380 (gchar *) "org.openbmc.EventLog",
4381 NULL,
4382 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
4383 NULL,
4384 NULL
4385 },
4386 "event-log",
4387};
4388
4389
4390/**
4391 * event_log_interface_info:
4392 *
4393 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
4394 *
4395 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4396 */
4397GDBusInterfaceInfo *
4398event_log_interface_info (void)
4399{
4400 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
4401}
4402
4403/**
4404 * event_log_override_properties:
4405 * @klass: The class structure for a #GObject<!-- -->-derived class.
4406 * @property_id_begin: The property id to assign to the first overridden property.
4407 *
4408 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
4409 * The properties are overridden in the order they are defined.
4410 *
4411 * Returns: The last property id.
4412 */
4413guint
4414event_log_override_properties (GObjectClass *klass, guint property_id_begin)
4415{
4416 return property_id_begin - 1;
4417}
4418
4419
4420
4421/**
4422 * EventLog:
4423 *
4424 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
4425 */
4426
4427/**
4428 * EventLogIface:
4429 * @parent_iface: The parent interface.
4430 * @event_log: Handler for the #EventLog::event-log signal.
4431 *
4432 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
4433 */
4434
4435typedef EventLogIface EventLogInterface;
4436G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
4437
4438static void
4439event_log_default_init (EventLogIface *iface)
4440{
4441 /* GObject signals for received D-Bus signals: */
4442 /**
4443 * EventLog::event-log:
4444 * @object: A #EventLog.
4445 * @arg_message: Argument.
4446 *
4447 * 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.
4448 *
4449 * 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.
4450 */
4451 g_signal_new ("event-log",
4452 G_TYPE_FROM_INTERFACE (iface),
4453 G_SIGNAL_RUN_LAST,
4454 G_STRUCT_OFFSET (EventLogIface, event_log),
4455 NULL,
4456 NULL,
4457 g_cclosure_marshal_generic,
4458 G_TYPE_NONE,
4459 1, G_TYPE_VARIANT);
4460
4461}
4462
4463/**
4464 * event_log_emit_event_log:
4465 * @object: A #EventLog.
4466 * @arg_message: Argument to pass with the signal.
4467 *
4468 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
4469 */
4470void
4471event_log_emit_event_log (
4472 EventLog *object,
4473 GVariant *arg_message)
4474{
4475 g_signal_emit_by_name (object, "event-log", arg_message);
4476}
4477
4478/* ------------------------------------------------------------------------ */
4479
4480/**
4481 * EventLogProxy:
4482 *
4483 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
4484 */
4485
4486/**
4487 * EventLogProxyClass:
4488 * @parent_class: The parent class.
4489 *
4490 * Class structure for #EventLogProxy.
4491 */
4492
4493struct _EventLogProxyPrivate
4494{
4495 GData *qdata;
4496};
4497
4498static void event_log_proxy_iface_init (EventLogIface *iface);
4499
4500#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4501G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
4502 G_ADD_PRIVATE (EventLogProxy)
4503 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
4504
4505#else
4506G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
4507 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
4508
4509#endif
4510static void
4511event_log_proxy_finalize (GObject *object)
4512{
4513 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
4514 g_datalist_clear (&proxy->priv->qdata);
4515 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
4516}
4517
4518static void
4519event_log_proxy_get_property (GObject *object,
4520 guint prop_id,
4521 GValue *value,
4522 GParamSpec *pspec G_GNUC_UNUSED)
4523{
4524}
4525
4526static void
4527event_log_proxy_set_property (GObject *object,
4528 guint prop_id,
4529 const GValue *value,
4530 GParamSpec *pspec G_GNUC_UNUSED)
4531{
4532}
4533
4534static void
4535event_log_proxy_g_signal (GDBusProxy *proxy,
4536 const gchar *sender_name G_GNUC_UNUSED,
4537 const gchar *signal_name,
4538 GVariant *parameters)
4539{
4540 _ExtendedGDBusSignalInfo *info;
4541 GVariantIter iter;
4542 GVariant *child;
4543 GValue *paramv;
4544 guint num_params;
4545 guint n;
4546 guint signal_id;
4547 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
4548 if (info == NULL)
4549 return;
4550 num_params = g_variant_n_children (parameters);
4551 paramv = g_new0 (GValue, num_params + 1);
4552 g_value_init (&paramv[0], TYPE_EVENT_LOG);
4553 g_value_set_object (&paramv[0], proxy);
4554 g_variant_iter_init (&iter, parameters);
4555 n = 1;
4556 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4557 {
4558 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4559 if (arg_info->use_gvariant)
4560 {
4561 g_value_init (&paramv[n], G_TYPE_VARIANT);
4562 g_value_set_variant (&paramv[n], child);
4563 n++;
4564 }
4565 else
4566 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4567 g_variant_unref (child);
4568 }
4569 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
4570 g_signal_emitv (paramv, signal_id, 0, NULL);
4571 for (n = 0; n < num_params + 1; n++)
4572 g_value_unset (&paramv[n]);
4573 g_free (paramv);
4574}
4575
4576static void
4577event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
4578 GVariant *changed_properties,
4579 const gchar *const *invalidated_properties)
4580{
4581 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
4582 guint n;
4583 const gchar *key;
4584 GVariantIter *iter;
4585 _ExtendedGDBusPropertyInfo *info;
4586 g_variant_get (changed_properties, "a{sv}", &iter);
4587 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4588 {
4589 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
4590 g_datalist_remove_data (&proxy->priv->qdata, key);
4591 if (info != NULL)
4592 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4593 }
4594 g_variant_iter_free (iter);
4595 for (n = 0; invalidated_properties[n] != NULL; n++)
4596 {
4597 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
4598 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4599 if (info != NULL)
4600 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4601 }
4602}
4603
4604static void
4605event_log_proxy_init (EventLogProxy *proxy)
4606{
4607#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4608 proxy->priv = event_log_proxy_get_instance_private (proxy);
4609#else
4610 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
4611#endif
4612
4613 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
4614}
4615
4616static void
4617event_log_proxy_class_init (EventLogProxyClass *klass)
4618{
4619 GObjectClass *gobject_class;
4620 GDBusProxyClass *proxy_class;
4621
4622 gobject_class = G_OBJECT_CLASS (klass);
4623 gobject_class->finalize = event_log_proxy_finalize;
4624 gobject_class->get_property = event_log_proxy_get_property;
4625 gobject_class->set_property = event_log_proxy_set_property;
4626
4627 proxy_class = G_DBUS_PROXY_CLASS (klass);
4628 proxy_class->g_signal = event_log_proxy_g_signal;
4629 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
4630
4631#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4632 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
4633#endif
4634}
4635
4636static void
4637event_log_proxy_iface_init (EventLogIface *iface)
4638{
4639}
4640
4641/**
4642 * event_log_proxy_new:
4643 * @connection: A #GDBusConnection.
4644 * @flags: Flags from the #GDBusProxyFlags enumeration.
4645 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4646 * @object_path: An object path.
4647 * @cancellable: (allow-none): A #GCancellable or %NULL.
4648 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4649 * @user_data: User data to pass to @callback.
4650 *
4651 * 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.
4652 *
4653 * 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.
4654 * You can then call event_log_proxy_new_finish() to get the result of the operation.
4655 *
4656 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
4657 */
4658void
4659event_log_proxy_new (
4660 GDBusConnection *connection,
4661 GDBusProxyFlags flags,
4662 const gchar *name,
4663 const gchar *object_path,
4664 GCancellable *cancellable,
4665 GAsyncReadyCallback callback,
4666 gpointer user_data)
4667{
4668 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);
4669}
4670
4671/**
4672 * event_log_proxy_new_finish:
4673 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
4674 * @error: Return location for error or %NULL
4675 *
4676 * Finishes an operation started with event_log_proxy_new().
4677 *
4678 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
4679 */
4680EventLog *
4681event_log_proxy_new_finish (
4682 GAsyncResult *res,
4683 GError **error)
4684{
4685 GObject *ret;
4686 GObject *source_object;
4687 source_object = g_async_result_get_source_object (res);
4688 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4689 g_object_unref (source_object);
4690 if (ret != NULL)
4691 return EVENT_LOG (ret);
4692 else
4693 return NULL;
4694}
4695
4696/**
4697 * event_log_proxy_new_sync:
4698 * @connection: A #GDBusConnection.
4699 * @flags: Flags from the #GDBusProxyFlags enumeration.
4700 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4701 * @object_path: An object path.
4702 * @cancellable: (allow-none): A #GCancellable or %NULL.
4703 * @error: Return location for error or %NULL
4704 *
4705 * 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.
4706 *
4707 * The calling thread is blocked until a reply is received.
4708 *
4709 * See event_log_proxy_new() for the asynchronous version of this constructor.
4710 *
4711 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
4712 */
4713EventLog *
4714event_log_proxy_new_sync (
4715 GDBusConnection *connection,
4716 GDBusProxyFlags flags,
4717 const gchar *name,
4718 const gchar *object_path,
4719 GCancellable *cancellable,
4720 GError **error)
4721{
4722 GInitable *ret;
4723 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);
4724 if (ret != NULL)
4725 return EVENT_LOG (ret);
4726 else
4727 return NULL;
4728}
4729
4730
4731/**
4732 * event_log_proxy_new_for_bus:
4733 * @bus_type: A #GBusType.
4734 * @flags: Flags from the #GDBusProxyFlags enumeration.
4735 * @name: A bus name (well-known or unique).
4736 * @object_path: An object path.
4737 * @cancellable: (allow-none): A #GCancellable or %NULL.
4738 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4739 * @user_data: User data to pass to @callback.
4740 *
4741 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
4742 *
4743 * 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.
4744 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
4745 *
4746 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4747 */
4748void
4749event_log_proxy_new_for_bus (
4750 GBusType bus_type,
4751 GDBusProxyFlags flags,
4752 const gchar *name,
4753 const gchar *object_path,
4754 GCancellable *cancellable,
4755 GAsyncReadyCallback callback,
4756 gpointer user_data)
4757{
4758 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);
4759}
4760
4761/**
4762 * event_log_proxy_new_for_bus_finish:
4763 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
4764 * @error: Return location for error or %NULL
4765 *
4766 * Finishes an operation started with event_log_proxy_new_for_bus().
4767 *
4768 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
4769 */
4770EventLog *
4771event_log_proxy_new_for_bus_finish (
4772 GAsyncResult *res,
4773 GError **error)
4774{
4775 GObject *ret;
4776 GObject *source_object;
4777 source_object = g_async_result_get_source_object (res);
4778 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4779 g_object_unref (source_object);
4780 if (ret != NULL)
4781 return EVENT_LOG (ret);
4782 else
4783 return NULL;
4784}
4785
4786/**
4787 * event_log_proxy_new_for_bus_sync:
4788 * @bus_type: A #GBusType.
4789 * @flags: Flags from the #GDBusProxyFlags enumeration.
4790 * @name: A bus name (well-known or unique).
4791 * @object_path: An object path.
4792 * @cancellable: (allow-none): A #GCancellable or %NULL.
4793 * @error: Return location for error or %NULL
4794 *
4795 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4796 *
4797 * The calling thread is blocked until a reply is received.
4798 *
4799 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
4800 *
4801 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
4802 */
4803EventLog *
4804event_log_proxy_new_for_bus_sync (
4805 GBusType bus_type,
4806 GDBusProxyFlags flags,
4807 const gchar *name,
4808 const gchar *object_path,
4809 GCancellable *cancellable,
4810 GError **error)
4811{
4812 GInitable *ret;
4813 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);
4814 if (ret != NULL)
4815 return EVENT_LOG (ret);
4816 else
4817 return NULL;
4818}
4819
4820
4821/* ------------------------------------------------------------------------ */
4822
4823/**
4824 * EventLogSkeleton:
4825 *
4826 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
4827 */
4828
4829/**
4830 * EventLogSkeletonClass:
4831 * @parent_class: The parent class.
4832 *
4833 * Class structure for #EventLogSkeleton.
4834 */
4835
4836struct _EventLogSkeletonPrivate
4837{
4838 GValue *properties;
4839 GList *changed_properties;
4840 GSource *changed_properties_idle_source;
4841 GMainContext *context;
4842 GMutex lock;
4843};
4844
4845static void
4846_event_log_skeleton_handle_method_call (
4847 GDBusConnection *connection G_GNUC_UNUSED,
4848 const gchar *sender G_GNUC_UNUSED,
4849 const gchar *object_path G_GNUC_UNUSED,
4850 const gchar *interface_name,
4851 const gchar *method_name,
4852 GVariant *parameters,
4853 GDBusMethodInvocation *invocation,
4854 gpointer user_data)
4855{
4856 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
4857 _ExtendedGDBusMethodInfo *info;
4858 GVariantIter iter;
4859 GVariant *child;
4860 GValue *paramv;
4861 guint num_params;
4862 guint num_extra;
4863 guint n;
4864 guint signal_id;
4865 GValue return_value = G_VALUE_INIT;
4866 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
4867 g_assert (info != NULL);
4868 num_params = g_variant_n_children (parameters);
4869 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
4870 n = 0;
4871 g_value_init (&paramv[n], TYPE_EVENT_LOG);
4872 g_value_set_object (&paramv[n++], skeleton);
4873 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
4874 g_value_set_object (&paramv[n++], invocation);
4875 if (info->pass_fdlist)
4876 {
4877#ifdef G_OS_UNIX
4878 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
4879 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
4880#else
4881 g_assert_not_reached ();
4882#endif
4883 }
4884 g_variant_iter_init (&iter, parameters);
4885 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4886 {
4887 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
4888 if (arg_info->use_gvariant)
4889 {
4890 g_value_init (&paramv[n], G_TYPE_VARIANT);
4891 g_value_set_variant (&paramv[n], child);
4892 n++;
4893 }
4894 else
4895 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4896 g_variant_unref (child);
4897 }
4898 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
4899 g_value_init (&return_value, G_TYPE_BOOLEAN);
4900 g_signal_emitv (paramv, signal_id, 0, &return_value);
4901 if (!g_value_get_boolean (&return_value))
4902 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);
4903 g_value_unset (&return_value);
4904 for (n = 0; n < num_params + num_extra; n++)
4905 g_value_unset (&paramv[n]);
4906 g_free (paramv);
4907}
4908
4909static GVariant *
4910_event_log_skeleton_handle_get_property (
4911 GDBusConnection *connection G_GNUC_UNUSED,
4912 const gchar *sender G_GNUC_UNUSED,
4913 const gchar *object_path G_GNUC_UNUSED,
4914 const gchar *interface_name G_GNUC_UNUSED,
4915 const gchar *property_name,
4916 GError **error,
4917 gpointer user_data)
4918{
4919 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
4920 GValue value = G_VALUE_INIT;
4921 GParamSpec *pspec;
4922 _ExtendedGDBusPropertyInfo *info;
4923 GVariant *ret;
4924 ret = NULL;
4925 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
4926 g_assert (info != NULL);
4927 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4928 if (pspec == NULL)
4929 {
4930 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4931 }
4932 else
4933 {
4934 g_value_init (&value, pspec->value_type);
4935 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4936 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
4937 g_value_unset (&value);
4938 }
4939 return ret;
4940}
4941
4942static gboolean
4943_event_log_skeleton_handle_set_property (
4944 GDBusConnection *connection G_GNUC_UNUSED,
4945 const gchar *sender G_GNUC_UNUSED,
4946 const gchar *object_path G_GNUC_UNUSED,
4947 const gchar *interface_name G_GNUC_UNUSED,
4948 const gchar *property_name,
4949 GVariant *variant,
4950 GError **error,
4951 gpointer user_data)
4952{
4953 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
4954 GValue value = G_VALUE_INIT;
4955 GParamSpec *pspec;
4956 _ExtendedGDBusPropertyInfo *info;
4957 gboolean ret;
4958 ret = FALSE;
4959 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
4960 g_assert (info != NULL);
4961 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4962 if (pspec == NULL)
4963 {
4964 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4965 }
4966 else
4967 {
4968 if (info->use_gvariant)
4969 g_value_set_variant (&value, variant);
4970 else
4971 g_dbus_gvariant_to_gvalue (variant, &value);
4972 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4973 g_value_unset (&value);
4974 ret = TRUE;
4975 }
4976 return ret;
4977}
4978
4979static const GDBusInterfaceVTable _event_log_skeleton_vtable =
4980{
4981 _event_log_skeleton_handle_method_call,
4982 _event_log_skeleton_handle_get_property,
4983 _event_log_skeleton_handle_set_property,
4984 {NULL}
4985};
4986
4987static GDBusInterfaceInfo *
4988event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4989{
4990 return event_log_interface_info ();
4991}
4992
4993static GDBusInterfaceVTable *
4994event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4995{
4996 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
4997}
4998
4999static GVariant *
5000event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5001{
5002 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
5003
5004 GVariantBuilder builder;
5005 guint n;
5006 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5007 if (_event_log_interface_info.parent_struct.properties == NULL)
5008 goto out;
5009 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
5010 {
5011 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
5012 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5013 {
5014 GVariant *value;
5015 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);
5016 if (value != NULL)
5017 {
5018 g_variant_take_ref (value);
5019 g_variant_builder_add (&builder, "{sv}", info->name, value);
5020 g_variant_unref (value);
5021 }
5022 }
5023 }
5024out:
5025 return g_variant_builder_end (&builder);
5026}
5027
5028static void
5029event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5030{
5031}
5032
5033static void
5034_event_log_on_signal_event_log (
5035 EventLog *object,
5036 GVariant *arg_message)
5037{
5038 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
5039
5040 GList *connections, *l;
5041 GVariant *signal_variant;
5042 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5043
5044 signal_variant = g_variant_ref_sink (g_variant_new ("(@a{ss})",
5045 arg_message));
5046 for (l = connections; l != NULL; l = l->next)
5047 {
5048 GDBusConnection *connection = l->data;
5049 g_dbus_connection_emit_signal (connection,
5050 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
5051 signal_variant, NULL);
5052 }
5053 g_variant_unref (signal_variant);
5054 g_list_free_full (connections, g_object_unref);
5055}
5056
5057static void event_log_skeleton_iface_init (EventLogIface *iface);
5058#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5059G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5060 G_ADD_PRIVATE (EventLogSkeleton)
5061 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
5062
5063#else
5064G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5065 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
5066
5067#endif
5068static void
5069event_log_skeleton_finalize (GObject *object)
5070{
5071 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
5072 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5073 if (skeleton->priv->changed_properties_idle_source != NULL)
5074 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5075 g_main_context_unref (skeleton->priv->context);
5076 g_mutex_clear (&skeleton->priv->lock);
5077 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
5078}
5079
5080static void
5081event_log_skeleton_init (EventLogSkeleton *skeleton)
5082{
5083#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5084 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
5085#else
5086 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
5087#endif
5088
5089 g_mutex_init (&skeleton->priv->lock);
5090 skeleton->priv->context = g_main_context_ref_thread_default ();
5091}
5092
5093static void
5094event_log_skeleton_class_init (EventLogSkeletonClass *klass)
5095{
5096 GObjectClass *gobject_class;
5097 GDBusInterfaceSkeletonClass *skeleton_class;
5098
5099 gobject_class = G_OBJECT_CLASS (klass);
5100 gobject_class->finalize = event_log_skeleton_finalize;
5101
5102 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5103 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
5104 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
5105 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
5106 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
5107
5108#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5109 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
5110#endif
5111}
5112
5113static void
5114event_log_skeleton_iface_init (EventLogIface *iface)
5115{
5116 iface->event_log = _event_log_on_signal_event_log;
5117}
5118
5119/**
5120 * event_log_skeleton_new:
5121 *
5122 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
5123 *
5124 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
5125 */
5126EventLog *
5127event_log_skeleton_new (void)
5128{
5129 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
5130}
5131
5132/* ------------------------------------------------------------------------
5133 * Code for Object, ObjectProxy and ObjectSkeleton
5134 * ------------------------------------------------------------------------
5135 */
5136
5137/**
5138 * SECTION:Object
5139 * @title: Object
5140 * @short_description: Specialized GDBusObject types
5141 *
5142 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
5143 */
5144
5145/**
5146 * Object:
5147 *
5148 * The #Object type is a specialized container of interfaces.
5149 */
5150
5151/**
5152 * ObjectIface:
5153 * @parent_iface: The parent interface.
5154 *
5155 * Virtual table for the #Object interface.
5156 */
5157
5158typedef ObjectIface ObjectInterface;
5159G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
5160
5161static void
5162object_default_init (ObjectIface *iface)
5163{
5164 /**
5165 * Object:control:
5166 *
5167 * 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.
5168 *
5169 * Connect to the #GObject::notify signal to get informed of property changes.
5170 */
5171 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
5172
5173 /**
5174 * Object:control-host:
5175 *
5176 * 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.
5177 *
5178 * Connect to the #GObject::notify signal to get informed of property changes.
5179 */
5180 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));
5181
5182 /**
5183 * Object:control-power:
5184 *
5185 * 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.
5186 *
5187 * Connect to the #GObject::notify signal to get informed of property changes.
5188 */
5189 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));
5190
5191 /**
5192 * Object:event-log:
5193 *
5194 * 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.
5195 *
5196 * Connect to the #GObject::notify signal to get informed of property changes.
5197 */
5198 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));
5199
5200}
5201
5202/**
5203 * object_get_control:
5204 * @object: A #Object.
5205 *
5206 * 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.
5207 *
5208 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
5209 */
5210Control *object_get_control (Object *object)
5211{
5212 GDBusInterface *ret;
5213 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
5214 if (ret == NULL)
5215 return NULL;
5216 return CONTROL (ret);
5217}
5218
5219/**
5220 * object_get_control_host:
5221 * @object: A #Object.
5222 *
5223 * 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.
5224 *
5225 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
5226 */
5227ControlHost *object_get_control_host (Object *object)
5228{
5229 GDBusInterface *ret;
5230 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
5231 if (ret == NULL)
5232 return NULL;
5233 return CONTROL_HOST (ret);
5234}
5235
5236/**
5237 * object_get_control_power:
5238 * @object: A #Object.
5239 *
5240 * 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.
5241 *
5242 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
5243 */
5244ControlPower *object_get_control_power (Object *object)
5245{
5246 GDBusInterface *ret;
5247 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
5248 if (ret == NULL)
5249 return NULL;
5250 return CONTROL_POWER (ret);
5251}
5252
5253/**
5254 * object_get_event_log:
5255 * @object: A #Object.
5256 *
5257 * 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.
5258 *
5259 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
5260 */
5261EventLog *object_get_event_log (Object *object)
5262{
5263 GDBusInterface *ret;
5264 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
5265 if (ret == NULL)
5266 return NULL;
5267 return EVENT_LOG (ret);
5268}
5269
5270
5271/**
5272 * object_peek_control: (skip)
5273 * @object: A #Object.
5274 *
5275 * Like object_get_control() but doesn't increase the reference count on the returned object.
5276 *
5277 * <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>
5278 *
5279 * 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.
5280 */
5281Control *object_peek_control (Object *object)
5282{
5283 GDBusInterface *ret;
5284 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
5285 if (ret == NULL)
5286 return NULL;
5287 g_object_unref (ret);
5288 return CONTROL (ret);
5289}
5290
5291/**
5292 * object_peek_control_host: (skip)
5293 * @object: A #Object.
5294 *
5295 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
5296 *
5297 * <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>
5298 *
5299 * 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.
5300 */
5301ControlHost *object_peek_control_host (Object *object)
5302{
5303 GDBusInterface *ret;
5304 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
5305 if (ret == NULL)
5306 return NULL;
5307 g_object_unref (ret);
5308 return CONTROL_HOST (ret);
5309}
5310
5311/**
5312 * object_peek_control_power: (skip)
5313 * @object: A #Object.
5314 *
5315 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
5316 *
5317 * <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>
5318 *
5319 * 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.
5320 */
5321ControlPower *object_peek_control_power (Object *object)
5322{
5323 GDBusInterface *ret;
5324 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
5325 if (ret == NULL)
5326 return NULL;
5327 g_object_unref (ret);
5328 return CONTROL_POWER (ret);
5329}
5330
5331/**
5332 * object_peek_event_log: (skip)
5333 * @object: A #Object.
5334 *
5335 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
5336 *
5337 * <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>
5338 *
5339 * 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.
5340 */
5341EventLog *object_peek_event_log (Object *object)
5342{
5343 GDBusInterface *ret;
5344 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
5345 if (ret == NULL)
5346 return NULL;
5347 g_object_unref (ret);
5348 return EVENT_LOG (ret);
5349}
5350
5351
5352static void
5353object_notify (GDBusObject *object, GDBusInterface *interface)
5354{
5355 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
5356 /* info can be NULL if the other end is using a D-Bus interface we don't know
5357 * anything about, for example old generated code in this process talking to
5358 * newer generated code in the other process. */
5359 if (info != NULL)
5360 g_object_notify (G_OBJECT (object), info->hyphen_name);
5361}
5362
5363/**
5364 * ObjectProxy:
5365 *
5366 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
5367 */
5368
5369/**
5370 * ObjectProxyClass:
5371 * @parent_class: The parent class.
5372 *
5373 * Class structure for #ObjectProxy.
5374 */
5375
5376static void
5377object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
5378{
5379}
5380
5381static void
5382object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
5383{
5384 iface->interface_added = object_notify;
5385 iface->interface_removed = object_notify;
5386}
5387
5388
5389G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
5390 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
5391 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
5392
5393static void
5394object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
5395{
5396}
5397
5398static void
5399object_proxy_set_property (GObject *gobject,
5400 guint prop_id,
5401 const GValue *value G_GNUC_UNUSED,
5402 GParamSpec *pspec)
5403{
5404 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5405}
5406
5407static void
5408object_proxy_get_property (GObject *gobject,
5409 guint prop_id,
5410 GValue *value,
5411 GParamSpec *pspec)
5412{
5413 ObjectProxy *object = OBJECT_PROXY (gobject);
5414 GDBusInterface *interface;
5415
5416 switch (prop_id)
5417 {
5418 case 1:
5419 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
5420 g_value_take_object (value, interface);
5421 break;
5422
5423 case 2:
5424 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
5425 g_value_take_object (value, interface);
5426 break;
5427
5428 case 3:
5429 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
5430 g_value_take_object (value, interface);
5431 break;
5432
5433 case 4:
5434 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
5435 g_value_take_object (value, interface);
5436 break;
5437
5438 default:
5439 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5440 break;
5441 }
5442}
5443
5444static void
5445object_proxy_class_init (ObjectProxyClass *klass)
5446{
5447 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
5448
5449 gobject_class->set_property = object_proxy_set_property;
5450 gobject_class->get_property = object_proxy_get_property;
5451
5452 g_object_class_override_property (gobject_class, 1, "control");
5453 g_object_class_override_property (gobject_class, 2, "control-host");
5454 g_object_class_override_property (gobject_class, 3, "control-power");
5455 g_object_class_override_property (gobject_class, 4, "event-log");
5456}
5457
5458/**
5459 * object_proxy_new:
5460 * @connection: A #GDBusConnection.
5461 * @object_path: An object path.
5462 *
5463 * Creates a new proxy object.
5464 *
5465 * Returns: (transfer full): The proxy object.
5466 */
5467ObjectProxy *
5468object_proxy_new (GDBusConnection *connection,
5469 const gchar *object_path)
5470{
5471 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
5472 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
5473 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
5474}
5475
5476/**
5477 * ObjectSkeleton:
5478 *
5479 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
5480 */
5481
5482/**
5483 * ObjectSkeletonClass:
5484 * @parent_class: The parent class.
5485 *
5486 * Class structure for #ObjectSkeleton.
5487 */
5488
5489static void
5490object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
5491{
5492}
5493
5494
5495static void
5496object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
5497{
5498 iface->interface_added = object_notify;
5499 iface->interface_removed = object_notify;
5500}
5501
5502G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
5503 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
5504 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
5505
5506static void
5507object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
5508{
5509}
5510
5511static void
5512object_skeleton_set_property (GObject *gobject,
5513 guint prop_id,
5514 const GValue *value,
5515 GParamSpec *pspec)
5516{
5517 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
5518 GDBusInterfaceSkeleton *interface;
5519
5520 switch (prop_id)
5521 {
5522 case 1:
5523 interface = g_value_get_object (value);
5524 if (interface != NULL)
5525 {
5526 g_warn_if_fail (IS_CONTROL (interface));
5527 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
5528 }
5529 else
5530 {
5531 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
5532 }
5533 break;
5534
5535 case 2:
5536 interface = g_value_get_object (value);
5537 if (interface != NULL)
5538 {
5539 g_warn_if_fail (IS_CONTROL_HOST (interface));
5540 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
5541 }
5542 else
5543 {
5544 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
5545 }
5546 break;
5547
5548 case 3:
5549 interface = g_value_get_object (value);
5550 if (interface != NULL)
5551 {
5552 g_warn_if_fail (IS_CONTROL_POWER (interface));
5553 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
5554 }
5555 else
5556 {
5557 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
5558 }
5559 break;
5560
5561 case 4:
5562 interface = g_value_get_object (value);
5563 if (interface != NULL)
5564 {
5565 g_warn_if_fail (IS_EVENT_LOG (interface));
5566 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
5567 }
5568 else
5569 {
5570 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
5571 }
5572 break;
5573
5574 default:
5575 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5576 break;
5577 }
5578}
5579
5580static void
5581object_skeleton_get_property (GObject *gobject,
5582 guint prop_id,
5583 GValue *value,
5584 GParamSpec *pspec)
5585{
5586 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
5587 GDBusInterface *interface;
5588
5589 switch (prop_id)
5590 {
5591 case 1:
5592 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
5593 g_value_take_object (value, interface);
5594 break;
5595
5596 case 2:
5597 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
5598 g_value_take_object (value, interface);
5599 break;
5600
5601 case 3:
5602 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
5603 g_value_take_object (value, interface);
5604 break;
5605
5606 case 4:
5607 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
5608 g_value_take_object (value, interface);
5609 break;
5610
5611 default:
5612 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
5613 break;
5614 }
5615}
5616
5617static void
5618object_skeleton_class_init (ObjectSkeletonClass *klass)
5619{
5620 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
5621
5622 gobject_class->set_property = object_skeleton_set_property;
5623 gobject_class->get_property = object_skeleton_get_property;
5624
5625 g_object_class_override_property (gobject_class, 1, "control");
5626 g_object_class_override_property (gobject_class, 2, "control-host");
5627 g_object_class_override_property (gobject_class, 3, "control-power");
5628 g_object_class_override_property (gobject_class, 4, "event-log");
5629}
5630
5631/**
5632 * object_skeleton_new:
5633 * @object_path: An object path.
5634 *
5635 * Creates a new skeleton object.
5636 *
5637 * Returns: (transfer full): The skeleton object.
5638 */
5639ObjectSkeleton *
5640object_skeleton_new (const gchar *object_path)
5641{
5642 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
5643 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
5644}
5645
5646/**
5647 * object_skeleton_set_control:
5648 * @object: A #ObjectSkeleton.
5649 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
5650 *
5651 * 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.
5652 */
5653void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
5654{
5655 g_object_set (G_OBJECT (object), "control", interface_, NULL);
5656}
5657
5658/**
5659 * object_skeleton_set_control_host:
5660 * @object: A #ObjectSkeleton.
5661 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
5662 *
5663 * 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.
5664 */
5665void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
5666{
5667 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
5668}
5669
5670/**
5671 * object_skeleton_set_control_power:
5672 * @object: A #ObjectSkeleton.
5673 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
5674 *
5675 * 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.
5676 */
5677void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
5678{
5679 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
5680}
5681
5682/**
5683 * object_skeleton_set_event_log:
5684 * @object: A #ObjectSkeleton.
5685 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
5686 *
5687 * 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.
5688 */
5689void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
5690{
5691 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
5692}
5693
5694
5695/* ------------------------------------------------------------------------
5696 * Code for ObjectManager client
5697 * ------------------------------------------------------------------------
5698 */
5699
5700/**
5701 * SECTION:ObjectManagerClient
5702 * @title: ObjectManagerClient
5703 * @short_description: Generated GDBusObjectManagerClient type
5704 *
5705 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
5706 */
5707
5708/**
5709 * ObjectManagerClient:
5710 *
5711 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
5712 */
5713
5714/**
5715 * ObjectManagerClientClass:
5716 * @parent_class: The parent class.
5717 *
5718 * Class structure for #ObjectManagerClient.
5719 */
5720
5721G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
5722
5723static void
5724object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
5725{
5726}
5727
5728static void
5729object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
5730{
5731}
5732
5733/**
5734 * object_manager_client_get_proxy_type:
5735 * @manager: A #GDBusObjectManagerClient.
5736 * @object_path: The object path of the remote object (unused).
5737 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
5738 * @user_data: User data (unused).
5739 *
5740 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
5741 *
5742 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
5743 */
5744GType
5745object_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)
5746{
5747 static gsize once_init_value = 0;
5748 static GHashTable *lookup_hash;
5749 GType ret;
5750
5751 if (interface_name == NULL)
5752 return TYPE_OBJECT_PROXY;
5753 if (g_once_init_enter (&once_init_value))
5754 {
5755 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
5756 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
5757 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
5758 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
5759 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
5760 g_once_init_leave (&once_init_value, 1);
5761 }
5762 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
5763 if (ret == (GType) 0)
5764 ret = G_TYPE_DBUS_PROXY;
5765 return ret;
5766}
5767
5768/**
5769 * object_manager_client_new:
5770 * @connection: A #GDBusConnection.
5771 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
5772 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5773 * @object_path: An object path.
5774 * @cancellable: (allow-none): A #GCancellable or %NULL.
5775 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5776 * @user_data: User data to pass to @callback.
5777 *
5778 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
5779 *
5780 * 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.
5781 * You can then call object_manager_client_new_finish() to get the result of the operation.
5782 *
5783 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
5784 */
5785void
5786object_manager_client_new (
5787 GDBusConnection *connection,
5788 GDBusObjectManagerClientFlags flags,
5789 const gchar *name,
5790 const gchar *object_path,
5791 GCancellable *cancellable,
5792 GAsyncReadyCallback callback,
5793 gpointer user_data)
5794{
5795 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);
5796}
5797
5798/**
5799 * object_manager_client_new_finish:
5800 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
5801 * @error: Return location for error or %NULL
5802 *
5803 * Finishes an operation started with object_manager_client_new().
5804 *
5805 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
5806 */
5807GDBusObjectManager *
5808object_manager_client_new_finish (
5809 GAsyncResult *res,
5810 GError **error)
5811{
5812 GObject *ret;
5813 GObject *source_object;
5814 source_object = g_async_result_get_source_object (res);
5815 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5816 g_object_unref (source_object);
5817 if (ret != NULL)
5818 return G_DBUS_OBJECT_MANAGER (ret);
5819 else
5820 return NULL;
5821}
5822
5823/**
5824 * object_manager_client_new_sync:
5825 * @connection: A #GDBusConnection.
5826 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
5827 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5828 * @object_path: An object path.
5829 * @cancellable: (allow-none): A #GCancellable or %NULL.
5830 * @error: Return location for error or %NULL
5831 *
5832 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
5833 *
5834 * The calling thread is blocked until a reply is received.
5835 *
5836 * See object_manager_client_new() for the asynchronous version of this constructor.
5837 *
5838 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
5839 */
5840GDBusObjectManager *
5841object_manager_client_new_sync (
5842 GDBusConnection *connection,
5843 GDBusObjectManagerClientFlags flags,
5844 const gchar *name,
5845 const gchar *object_path,
5846 GCancellable *cancellable,
5847 GError **error)
5848{
5849 GInitable *ret;
5850 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);
5851 if (ret != NULL)
5852 return G_DBUS_OBJECT_MANAGER (ret);
5853 else
5854 return NULL;
5855}
5856
5857
5858/**
5859 * object_manager_client_new_for_bus:
5860 * @bus_type: A #GBusType.
5861 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
5862 * @name: A bus name (well-known or unique).
5863 * @object_path: An object path.
5864 * @cancellable: (allow-none): A #GCancellable or %NULL.
5865 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5866 * @user_data: User data to pass to @callback.
5867 *
5868 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
5869 *
5870 * 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.
5871 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
5872 *
5873 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5874 */
5875void
5876object_manager_client_new_for_bus (
5877 GBusType bus_type,
5878 GDBusObjectManagerClientFlags flags,
5879 const gchar *name,
5880 const gchar *object_path,
5881 GCancellable *cancellable,
5882 GAsyncReadyCallback callback,
5883 gpointer user_data)
5884{
5885 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);
5886}
5887
5888/**
5889 * object_manager_client_new_for_bus_finish:
5890 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
5891 * @error: Return location for error or %NULL
5892 *
5893 * Finishes an operation started with object_manager_client_new_for_bus().
5894 *
5895 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
5896 */
5897GDBusObjectManager *
5898object_manager_client_new_for_bus_finish (
5899 GAsyncResult *res,
5900 GError **error)
5901{
5902 GObject *ret;
5903 GObject *source_object;
5904 source_object = g_async_result_get_source_object (res);
5905 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5906 g_object_unref (source_object);
5907 if (ret != NULL)
5908 return G_DBUS_OBJECT_MANAGER (ret);
5909 else
5910 return NULL;
5911}
5912
5913/**
5914 * object_manager_client_new_for_bus_sync:
5915 * @bus_type: A #GBusType.
5916 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
5917 * @name: A bus name (well-known or unique).
5918 * @object_path: An object path.
5919 * @cancellable: (allow-none): A #GCancellable or %NULL.
5920 * @error: Return location for error or %NULL
5921 *
5922 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5923 *
5924 * The calling thread is blocked until a reply is received.
5925 *
5926 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
5927 *
5928 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
5929 */
5930GDBusObjectManager *
5931object_manager_client_new_for_bus_sync (
5932 GBusType bus_type,
5933 GDBusObjectManagerClientFlags flags,
5934 const gchar *name,
5935 const gchar *object_path,
5936 GCancellable *cancellable,
5937 GError **error)
5938{
5939 GInitable *ret;
5940 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);
5941 if (ret != NULL)
5942 return G_DBUS_OBJECT_MANAGER (ret);
5943 else
5944 return NULL;
5945}
5946
5947