Norman James | e276510 | 2015-08-19 22:00:55 -0500 | [diff] [blame] | 1 | /*
|
| 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/led.h"
|
| 12 |
|
| 13 | #include <string.h>
|
| 14 | #ifdef G_OS_UNIX
|
| 15 | # include <gio/gunixfdlist.h>
|
| 16 | #endif
|
| 17 |
|
| 18 | typedef struct
|
| 19 | {
|
| 20 | GDBusArgInfo parent_struct;
|
| 21 | gboolean use_gvariant;
|
| 22 | } _ExtendedGDBusArgInfo;
|
| 23 |
|
| 24 | typedef struct
|
| 25 | {
|
| 26 | GDBusMethodInfo parent_struct;
|
| 27 | const gchar *signal_name;
|
| 28 | gboolean pass_fdlist;
|
| 29 | } _ExtendedGDBusMethodInfo;
|
| 30 |
|
| 31 | typedef struct
|
| 32 | {
|
| 33 | GDBusSignalInfo parent_struct;
|
| 34 | const gchar *signal_name;
|
| 35 | } _ExtendedGDBusSignalInfo;
|
| 36 |
|
| 37 | typedef struct
|
| 38 | {
|
| 39 | GDBusPropertyInfo parent_struct;
|
| 40 | const gchar *hyphen_name;
|
| 41 | gboolean use_gvariant;
|
| 42 | } _ExtendedGDBusPropertyInfo;
|
| 43 |
|
| 44 | typedef struct
|
| 45 | {
|
| 46 | GDBusInterfaceInfo parent_struct;
|
| 47 | const gchar *hyphen_name;
|
| 48 | } _ExtendedGDBusInterfaceInfo;
|
| 49 |
|
| 50 | typedef struct
|
| 51 | {
|
| 52 | const _ExtendedGDBusPropertyInfo *info;
|
| 53 | guint prop_id;
|
| 54 | GValue orig_value; /* the value before the change */
|
| 55 | } ChangedProperty;
|
| 56 |
|
| 57 | static void
|
| 58 | _changed_property_free (ChangedProperty *data)
|
| 59 | {
|
| 60 | g_value_unset (&data->orig_value);
|
| 61 | g_free (data);
|
| 62 | }
|
| 63 |
|
| 64 | static 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;
|
| 82 | out:
|
| 83 | return ret;
|
| 84 | }
|
| 85 |
|
| 86 | static 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);
|
| 98 | out:
|
| 99 | return ret;
|
| 100 | }
|
| 101 |
|
| 102 | G_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.Led
|
| 153 | * ------------------------------------------------------------------------
|
| 154 | */
|
| 155 |
|
| 156 | /**
|
| 157 | * SECTION:Led
|
| 158 | * @title: Led
|
| 159 | * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
|
| 160 | *
|
| 161 | * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface in C.
|
| 162 | */
|
| 163 |
|
| 164 | /* ---- Introspection data for org.openbmc.Led ---- */
|
| 165 |
|
| 166 | static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
|
| 167 | {
|
| 168 | {
|
| 169 | -1,
|
| 170 | (gchar *) "setOn",
|
| 171 | NULL,
|
| 172 | NULL,
|
| 173 | NULL
|
| 174 | },
|
| 175 | "handle-set-on",
|
| 176 | FALSE
|
| 177 | };
|
| 178 |
|
| 179 | static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
|
| 180 | {
|
| 181 | {
|
| 182 | -1,
|
| 183 | (gchar *) "setOff",
|
| 184 | NULL,
|
| 185 | NULL,
|
| 186 | NULL
|
| 187 | },
|
| 188 | "handle-set-off",
|
| 189 | FALSE
|
| 190 | };
|
| 191 |
|
| 192 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
|
| 193 | {
|
| 194 | {
|
| 195 | -1,
|
| 196 | (gchar *) "setBlinkSlow",
|
| 197 | NULL,
|
| 198 | NULL,
|
| 199 | NULL
|
| 200 | },
|
| 201 | "handle-set-blink-slow",
|
| 202 | FALSE
|
| 203 | };
|
| 204 |
|
| 205 | static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
|
| 206 | {
|
| 207 | {
|
| 208 | -1,
|
| 209 | (gchar *) "setBlinkFast",
|
| 210 | NULL,
|
| 211 | NULL,
|
| 212 | NULL
|
| 213 | },
|
| 214 | "handle-set-blink-fast",
|
| 215 | FALSE
|
| 216 | };
|
| 217 |
|
| 218 | static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
|
| 219 | {
|
| 220 | &_led_method_info_set_on,
|
| 221 | &_led_method_info_set_off,
|
| 222 | &_led_method_info_set_blink_slow,
|
| 223 | &_led_method_info_set_blink_fast,
|
| 224 | NULL
|
| 225 | };
|
| 226 |
|
| 227 | static const _ExtendedGDBusPropertyInfo _led_property_info_color =
|
| 228 | {
|
| 229 | {
|
| 230 | -1,
|
| 231 | (gchar *) "color",
|
| 232 | (gchar *) "i",
|
| 233 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
|
| 234 | NULL
|
| 235 | },
|
| 236 | "color",
|
| 237 | FALSE
|
| 238 | };
|
| 239 |
|
| 240 | static const _ExtendedGDBusPropertyInfo _led_property_info_function =
|
| 241 | {
|
| 242 | {
|
| 243 | -1,
|
| 244 | (gchar *) "function",
|
| 245 | (gchar *) "s",
|
| 246 | G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
|
| 247 | NULL
|
| 248 | },
|
| 249 | "function",
|
| 250 | FALSE
|
| 251 | };
|
| 252 |
|
| 253 | static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
|
| 254 | {
|
| 255 | &_led_property_info_color,
|
| 256 | &_led_property_info_function,
|
| 257 | NULL
|
| 258 | };
|
| 259 |
|
| 260 | static const _ExtendedGDBusInterfaceInfo _led_interface_info =
|
| 261 | {
|
| 262 | {
|
| 263 | -1,
|
| 264 | (gchar *) "org.openbmc.Led",
|
| 265 | (GDBusMethodInfo **) &_led_method_info_pointers,
|
| 266 | NULL,
|
| 267 | (GDBusPropertyInfo **) &_led_property_info_pointers,
|
| 268 | NULL
|
| 269 | },
|
| 270 | "led",
|
| 271 | };
|
| 272 |
|
| 273 |
|
| 274 | /**
|
| 275 | * led_interface_info:
|
| 276 | *
|
| 277 | * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
|
| 278 | *
|
| 279 | * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
|
| 280 | */
|
| 281 | GDBusInterfaceInfo *
|
| 282 | led_interface_info (void)
|
| 283 | {
|
| 284 | return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
|
| 285 | }
|
| 286 |
|
| 287 | /**
|
| 288 | * led_override_properties:
|
| 289 | * @klass: The class structure for a #GObject<!-- -->-derived class.
|
| 290 | * @property_id_begin: The property id to assign to the first overridden property.
|
| 291 | *
|
| 292 | * Overrides all #GObject properties in the #Led interface for a concrete class.
|
| 293 | * The properties are overridden in the order they are defined.
|
| 294 | *
|
| 295 | * Returns: The last property id.
|
| 296 | */
|
| 297 | guint
|
| 298 | led_override_properties (GObjectClass *klass, guint property_id_begin)
|
| 299 | {
|
| 300 | g_object_class_override_property (klass, property_id_begin++, "color");
|
| 301 | g_object_class_override_property (klass, property_id_begin++, "function");
|
| 302 | return property_id_begin - 1;
|
| 303 | }
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 | /**
|
| 308 | * Led:
|
| 309 | *
|
| 310 | * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
|
| 311 | */
|
| 312 |
|
| 313 | /**
|
| 314 | * LedIface:
|
| 315 | * @parent_iface: The parent interface.
|
| 316 | * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
|
| 317 | * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
|
| 318 | * @handle_set_off: Handler for the #Led::handle-set-off signal.
|
| 319 | * @handle_set_on: Handler for the #Led::handle-set-on signal.
|
| 320 | * @get_color: Getter for the #Led:color property.
|
| 321 | * @get_function: Getter for the #Led:function property.
|
| 322 | *
|
| 323 | * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
|
| 324 | */
|
| 325 |
|
| 326 | typedef LedIface LedInterface;
|
| 327 | G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
|
| 328 |
|
| 329 | static void
|
| 330 | led_default_init (LedIface *iface)
|
| 331 | {
|
| 332 | /* GObject signals for incoming D-Bus method calls: */
|
| 333 | /**
|
| 334 | * Led::handle-set-on:
|
| 335 | * @object: A #Led.
|
| 336 | * @invocation: A #GDBusMethodInvocation.
|
| 337 | *
|
| 338 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
|
| 339 | *
|
| 340 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call led_complete_set_on() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
|
| 341 | *
|
| 342 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
|
| 343 | */
|
| 344 | g_signal_new ("handle-set-on",
|
| 345 | G_TYPE_FROM_INTERFACE (iface),
|
| 346 | G_SIGNAL_RUN_LAST,
|
| 347 | G_STRUCT_OFFSET (LedIface, handle_set_on),
|
| 348 | g_signal_accumulator_true_handled,
|
| 349 | NULL,
|
| 350 | g_cclosure_marshal_generic,
|
| 351 | G_TYPE_BOOLEAN,
|
| 352 | 1,
|
| 353 | G_TYPE_DBUS_METHOD_INVOCATION);
|
| 354 |
|
| 355 | /**
|
| 356 | * Led::handle-set-off:
|
| 357 | * @object: A #Led.
|
| 358 | * @invocation: A #GDBusMethodInvocation.
|
| 359 | *
|
| 360 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
|
| 361 | *
|
| 362 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call led_complete_set_off() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
|
| 363 | *
|
| 364 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
|
| 365 | */
|
| 366 | g_signal_new ("handle-set-off",
|
| 367 | G_TYPE_FROM_INTERFACE (iface),
|
| 368 | G_SIGNAL_RUN_LAST,
|
| 369 | G_STRUCT_OFFSET (LedIface, handle_set_off),
|
| 370 | g_signal_accumulator_true_handled,
|
| 371 | NULL,
|
| 372 | g_cclosure_marshal_generic,
|
| 373 | G_TYPE_BOOLEAN,
|
| 374 | 1,
|
| 375 | G_TYPE_DBUS_METHOD_INVOCATION);
|
| 376 |
|
| 377 | /**
|
| 378 | * Led::handle-set-blink-slow:
|
| 379 | * @object: A #Led.
|
| 380 | * @invocation: A #GDBusMethodInvocation.
|
| 381 | *
|
| 382 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
|
| 383 | *
|
| 384 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call led_complete_set_blink_slow() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
|
| 385 | *
|
| 386 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
|
| 387 | */
|
| 388 | g_signal_new ("handle-set-blink-slow",
|
| 389 | G_TYPE_FROM_INTERFACE (iface),
|
| 390 | G_SIGNAL_RUN_LAST,
|
| 391 | G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
|
| 392 | g_signal_accumulator_true_handled,
|
| 393 | NULL,
|
| 394 | g_cclosure_marshal_generic,
|
| 395 | G_TYPE_BOOLEAN,
|
| 396 | 1,
|
| 397 | G_TYPE_DBUS_METHOD_INVOCATION);
|
| 398 |
|
| 399 | /**
|
| 400 | * Led::handle-set-blink-fast:
|
| 401 | * @object: A #Led.
|
| 402 | * @invocation: A #GDBusMethodInvocation.
|
| 403 | *
|
| 404 | * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
|
| 405 | *
|
| 406 | * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call led_complete_set_blink_fast() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
|
| 407 | *
|
| 408 | * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
|
| 409 | */
|
| 410 | g_signal_new ("handle-set-blink-fast",
|
| 411 | G_TYPE_FROM_INTERFACE (iface),
|
| 412 | G_SIGNAL_RUN_LAST,
|
| 413 | G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
|
| 414 | g_signal_accumulator_true_handled,
|
| 415 | NULL,
|
| 416 | g_cclosure_marshal_generic,
|
| 417 | G_TYPE_BOOLEAN,
|
| 418 | 1,
|
| 419 | G_TYPE_DBUS_METHOD_INVOCATION);
|
| 420 |
|
| 421 | /* GObject properties for D-Bus properties: */
|
| 422 | /**
|
| 423 | * Led:color:
|
| 424 | *
|
| 425 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
|
| 426 | *
|
| 427 | * 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.
|
| 428 | */
|
| 429 | g_object_interface_install_property (iface,
|
| 430 | g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
| 431 | /**
|
| 432 | * Led:function:
|
| 433 | *
|
| 434 | * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
|
| 435 | *
|
| 436 | * 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.
|
| 437 | */
|
| 438 | g_object_interface_install_property (iface,
|
| 439 | g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
| 440 | }
|
| 441 |
|
| 442 | /**
|
| 443 | * led_get_color: (skip)
|
| 444 | * @object: A #Led.
|
| 445 | *
|
| 446 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
|
| 447 | *
|
| 448 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
|
| 449 | *
|
| 450 | * Returns: The property value.
|
| 451 | */
|
| 452 | gint
|
| 453 | led_get_color (Led *object)
|
| 454 | {
|
| 455 | return LED_GET_IFACE (object)->get_color (object);
|
| 456 | }
|
| 457 |
|
| 458 | /**
|
| 459 | * led_set_color: (skip)
|
| 460 | * @object: A #Led.
|
| 461 | * @value: The value to set.
|
| 462 | *
|
| 463 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
|
| 464 | *
|
| 465 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
|
| 466 | */
|
| 467 | void
|
| 468 | led_set_color (Led *object, gint value)
|
| 469 | {
|
| 470 | g_object_set (G_OBJECT (object), "color", value, NULL);
|
| 471 | }
|
| 472 |
|
| 473 | /**
|
| 474 | * led_get_function: (skip)
|
| 475 | * @object: A #Led.
|
| 476 | *
|
| 477 | * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
|
| 478 | *
|
| 479 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
|
| 480 | *
|
| 481 | * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use led_dup_function() if on another thread.</warning>
|
| 482 | *
|
| 483 | * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
|
| 484 | */
|
| 485 | const gchar *
|
| 486 | led_get_function (Led *object)
|
| 487 | {
|
| 488 | return LED_GET_IFACE (object)->get_function (object);
|
| 489 | }
|
| 490 |
|
| 491 | /**
|
| 492 | * led_dup_function: (skip)
|
| 493 | * @object: A #Led.
|
| 494 | *
|
| 495 | * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
|
| 496 | *
|
| 497 | * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
|
| 498 | *
|
| 499 | * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
|
| 500 | */
|
| 501 | gchar *
|
| 502 | led_dup_function (Led *object)
|
| 503 | {
|
| 504 | gchar *value;
|
| 505 | g_object_get (G_OBJECT (object), "function", &value, NULL);
|
| 506 | return value;
|
| 507 | }
|
| 508 |
|
| 509 | /**
|
| 510 | * led_set_function: (skip)
|
| 511 | * @object: A #Led.
|
| 512 | * @value: The value to set.
|
| 513 | *
|
| 514 | * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
|
| 515 | *
|
| 516 | * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
|
| 517 | */
|
| 518 | void
|
| 519 | led_set_function (Led *object, const gchar *value)
|
| 520 | {
|
| 521 | g_object_set (G_OBJECT (object), "function", value, NULL);
|
| 522 | }
|
| 523 |
|
| 524 | /**
|
| 525 | * led_call_set_on:
|
| 526 | * @proxy: A #LedProxy.
|
| 527 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 528 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
|
| 529 | * @user_data: User data to pass to @callback.
|
| 530 | *
|
| 531 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
|
| 532 | * 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.
|
| 533 | * You can then call led_call_set_on_finish() to get the result of the operation.
|
| 534 | *
|
| 535 | * See led_call_set_on_sync() for the synchronous, blocking version of this method.
|
| 536 | */
|
| 537 | void
|
| 538 | led_call_set_on (
|
| 539 | Led *proxy,
|
| 540 | GCancellable *cancellable,
|
| 541 | GAsyncReadyCallback callback,
|
| 542 | gpointer user_data)
|
| 543 | {
|
| 544 | g_dbus_proxy_call (G_DBUS_PROXY (proxy),
|
| 545 | "setOn",
|
| 546 | g_variant_new ("()"),
|
| 547 | G_DBUS_CALL_FLAGS_NONE,
|
| 548 | -1,
|
| 549 | cancellable,
|
| 550 | callback,
|
| 551 | user_data);
|
| 552 | }
|
| 553 |
|
| 554 | /**
|
| 555 | * led_call_set_on_finish:
|
| 556 | * @proxy: A #LedProxy.
|
| 557 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
|
| 558 | * @error: Return location for error or %NULL.
|
| 559 | *
|
| 560 | * Finishes an operation started with led_call_set_on().
|
| 561 | *
|
| 562 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
|
| 563 | */
|
| 564 | gboolean
|
| 565 | led_call_set_on_finish (
|
| 566 | Led *proxy,
|
| 567 | GAsyncResult *res,
|
| 568 | GError **error)
|
| 569 | {
|
| 570 | GVariant *_ret;
|
| 571 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
|
| 572 | if (_ret == NULL)
|
| 573 | goto _out;
|
| 574 | g_variant_get (_ret,
|
| 575 | "()");
|
| 576 | g_variant_unref (_ret);
|
| 577 | _out:
|
| 578 | return _ret != NULL;
|
| 579 | }
|
| 580 |
|
| 581 | /**
|
| 582 | * led_call_set_on_sync:
|
| 583 | * @proxy: A #LedProxy.
|
| 584 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 585 | * @error: Return location for error or %NULL.
|
| 586 | *
|
| 587 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
|
| 588 | *
|
| 589 | * See led_call_set_on() for the asynchronous version of this method.
|
| 590 | *
|
| 591 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
|
| 592 | */
|
| 593 | gboolean
|
| 594 | led_call_set_on_sync (
|
| 595 | Led *proxy,
|
| 596 | GCancellable *cancellable,
|
| 597 | GError **error)
|
| 598 | {
|
| 599 | GVariant *_ret;
|
| 600 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
|
| 601 | "setOn",
|
| 602 | g_variant_new ("()"),
|
| 603 | G_DBUS_CALL_FLAGS_NONE,
|
| 604 | -1,
|
| 605 | cancellable,
|
| 606 | error);
|
| 607 | if (_ret == NULL)
|
| 608 | goto _out;
|
| 609 | g_variant_get (_ret,
|
| 610 | "()");
|
| 611 | g_variant_unref (_ret);
|
| 612 | _out:
|
| 613 | return _ret != NULL;
|
| 614 | }
|
| 615 |
|
| 616 | /**
|
| 617 | * led_call_set_off:
|
| 618 | * @proxy: A #LedProxy.
|
| 619 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 620 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
|
| 621 | * @user_data: User data to pass to @callback.
|
| 622 | *
|
| 623 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
|
| 624 | * 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.
|
| 625 | * You can then call led_call_set_off_finish() to get the result of the operation.
|
| 626 | *
|
| 627 | * See led_call_set_off_sync() for the synchronous, blocking version of this method.
|
| 628 | */
|
| 629 | void
|
| 630 | led_call_set_off (
|
| 631 | Led *proxy,
|
| 632 | GCancellable *cancellable,
|
| 633 | GAsyncReadyCallback callback,
|
| 634 | gpointer user_data)
|
| 635 | {
|
| 636 | g_dbus_proxy_call (G_DBUS_PROXY (proxy),
|
| 637 | "setOff",
|
| 638 | g_variant_new ("()"),
|
| 639 | G_DBUS_CALL_FLAGS_NONE,
|
| 640 | -1,
|
| 641 | cancellable,
|
| 642 | callback,
|
| 643 | user_data);
|
| 644 | }
|
| 645 |
|
| 646 | /**
|
| 647 | * led_call_set_off_finish:
|
| 648 | * @proxy: A #LedProxy.
|
| 649 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
|
| 650 | * @error: Return location for error or %NULL.
|
| 651 | *
|
| 652 | * Finishes an operation started with led_call_set_off().
|
| 653 | *
|
| 654 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
|
| 655 | */
|
| 656 | gboolean
|
| 657 | led_call_set_off_finish (
|
| 658 | Led *proxy,
|
| 659 | GAsyncResult *res,
|
| 660 | GError **error)
|
| 661 | {
|
| 662 | GVariant *_ret;
|
| 663 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
|
| 664 | if (_ret == NULL)
|
| 665 | goto _out;
|
| 666 | g_variant_get (_ret,
|
| 667 | "()");
|
| 668 | g_variant_unref (_ret);
|
| 669 | _out:
|
| 670 | return _ret != NULL;
|
| 671 | }
|
| 672 |
|
| 673 | /**
|
| 674 | * led_call_set_off_sync:
|
| 675 | * @proxy: A #LedProxy.
|
| 676 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 677 | * @error: Return location for error or %NULL.
|
| 678 | *
|
| 679 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
|
| 680 | *
|
| 681 | * See led_call_set_off() for the asynchronous version of this method.
|
| 682 | *
|
| 683 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
|
| 684 | */
|
| 685 | gboolean
|
| 686 | led_call_set_off_sync (
|
| 687 | Led *proxy,
|
| 688 | GCancellable *cancellable,
|
| 689 | GError **error)
|
| 690 | {
|
| 691 | GVariant *_ret;
|
| 692 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
|
| 693 | "setOff",
|
| 694 | g_variant_new ("()"),
|
| 695 | G_DBUS_CALL_FLAGS_NONE,
|
| 696 | -1,
|
| 697 | cancellable,
|
| 698 | error);
|
| 699 | if (_ret == NULL)
|
| 700 | goto _out;
|
| 701 | g_variant_get (_ret,
|
| 702 | "()");
|
| 703 | g_variant_unref (_ret);
|
| 704 | _out:
|
| 705 | return _ret != NULL;
|
| 706 | }
|
| 707 |
|
| 708 | /**
|
| 709 | * led_call_set_blink_slow:
|
| 710 | * @proxy: A #LedProxy.
|
| 711 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 712 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
|
| 713 | * @user_data: User data to pass to @callback.
|
| 714 | *
|
| 715 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
|
| 716 | * 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.
|
| 717 | * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
|
| 718 | *
|
| 719 | * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
|
| 720 | */
|
| 721 | void
|
| 722 | led_call_set_blink_slow (
|
| 723 | Led *proxy,
|
| 724 | GCancellable *cancellable,
|
| 725 | GAsyncReadyCallback callback,
|
| 726 | gpointer user_data)
|
| 727 | {
|
| 728 | g_dbus_proxy_call (G_DBUS_PROXY (proxy),
|
| 729 | "setBlinkSlow",
|
| 730 | g_variant_new ("()"),
|
| 731 | G_DBUS_CALL_FLAGS_NONE,
|
| 732 | -1,
|
| 733 | cancellable,
|
| 734 | callback,
|
| 735 | user_data);
|
| 736 | }
|
| 737 |
|
| 738 | /**
|
| 739 | * led_call_set_blink_slow_finish:
|
| 740 | * @proxy: A #LedProxy.
|
| 741 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
|
| 742 | * @error: Return location for error or %NULL.
|
| 743 | *
|
| 744 | * Finishes an operation started with led_call_set_blink_slow().
|
| 745 | *
|
| 746 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
|
| 747 | */
|
| 748 | gboolean
|
| 749 | led_call_set_blink_slow_finish (
|
| 750 | Led *proxy,
|
| 751 | GAsyncResult *res,
|
| 752 | GError **error)
|
| 753 | {
|
| 754 | GVariant *_ret;
|
| 755 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
|
| 756 | if (_ret == NULL)
|
| 757 | goto _out;
|
| 758 | g_variant_get (_ret,
|
| 759 | "()");
|
| 760 | g_variant_unref (_ret);
|
| 761 | _out:
|
| 762 | return _ret != NULL;
|
| 763 | }
|
| 764 |
|
| 765 | /**
|
| 766 | * led_call_set_blink_slow_sync:
|
| 767 | * @proxy: A #LedProxy.
|
| 768 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 769 | * @error: Return location for error or %NULL.
|
| 770 | *
|
| 771 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
|
| 772 | *
|
| 773 | * See led_call_set_blink_slow() for the asynchronous version of this method.
|
| 774 | *
|
| 775 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
|
| 776 | */
|
| 777 | gboolean
|
| 778 | led_call_set_blink_slow_sync (
|
| 779 | Led *proxy,
|
| 780 | GCancellable *cancellable,
|
| 781 | GError **error)
|
| 782 | {
|
| 783 | GVariant *_ret;
|
| 784 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
|
| 785 | "setBlinkSlow",
|
| 786 | g_variant_new ("()"),
|
| 787 | G_DBUS_CALL_FLAGS_NONE,
|
| 788 | -1,
|
| 789 | cancellable,
|
| 790 | error);
|
| 791 | if (_ret == NULL)
|
| 792 | goto _out;
|
| 793 | g_variant_get (_ret,
|
| 794 | "()");
|
| 795 | g_variant_unref (_ret);
|
| 796 | _out:
|
| 797 | return _ret != NULL;
|
| 798 | }
|
| 799 |
|
| 800 | /**
|
| 801 | * led_call_set_blink_fast:
|
| 802 | * @proxy: A #LedProxy.
|
| 803 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 804 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
|
| 805 | * @user_data: User data to pass to @callback.
|
| 806 | *
|
| 807 | * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
|
| 808 | * 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.
|
| 809 | * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
|
| 810 | *
|
| 811 | * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
|
| 812 | */
|
| 813 | void
|
| 814 | led_call_set_blink_fast (
|
| 815 | Led *proxy,
|
| 816 | GCancellable *cancellable,
|
| 817 | GAsyncReadyCallback callback,
|
| 818 | gpointer user_data)
|
| 819 | {
|
| 820 | g_dbus_proxy_call (G_DBUS_PROXY (proxy),
|
| 821 | "setBlinkFast",
|
| 822 | g_variant_new ("()"),
|
| 823 | G_DBUS_CALL_FLAGS_NONE,
|
| 824 | -1,
|
| 825 | cancellable,
|
| 826 | callback,
|
| 827 | user_data);
|
| 828 | }
|
| 829 |
|
| 830 | /**
|
| 831 | * led_call_set_blink_fast_finish:
|
| 832 | * @proxy: A #LedProxy.
|
| 833 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
|
| 834 | * @error: Return location for error or %NULL.
|
| 835 | *
|
| 836 | * Finishes an operation started with led_call_set_blink_fast().
|
| 837 | *
|
| 838 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
|
| 839 | */
|
| 840 | gboolean
|
| 841 | led_call_set_blink_fast_finish (
|
| 842 | Led *proxy,
|
| 843 | GAsyncResult *res,
|
| 844 | GError **error)
|
| 845 | {
|
| 846 | GVariant *_ret;
|
| 847 | _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
|
| 848 | if (_ret == NULL)
|
| 849 | goto _out;
|
| 850 | g_variant_get (_ret,
|
| 851 | "()");
|
| 852 | g_variant_unref (_ret);
|
| 853 | _out:
|
| 854 | return _ret != NULL;
|
| 855 | }
|
| 856 |
|
| 857 | /**
|
| 858 | * led_call_set_blink_fast_sync:
|
| 859 | * @proxy: A #LedProxy.
|
| 860 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 861 | * @error: Return location for error or %NULL.
|
| 862 | *
|
| 863 | * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
|
| 864 | *
|
| 865 | * See led_call_set_blink_fast() for the asynchronous version of this method.
|
| 866 | *
|
| 867 | * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
|
| 868 | */
|
| 869 | gboolean
|
| 870 | led_call_set_blink_fast_sync (
|
| 871 | Led *proxy,
|
| 872 | GCancellable *cancellable,
|
| 873 | GError **error)
|
| 874 | {
|
| 875 | GVariant *_ret;
|
| 876 | _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
|
| 877 | "setBlinkFast",
|
| 878 | g_variant_new ("()"),
|
| 879 | G_DBUS_CALL_FLAGS_NONE,
|
| 880 | -1,
|
| 881 | cancellable,
|
| 882 | error);
|
| 883 | if (_ret == NULL)
|
| 884 | goto _out;
|
| 885 | g_variant_get (_ret,
|
| 886 | "()");
|
| 887 | g_variant_unref (_ret);
|
| 888 | _out:
|
| 889 | return _ret != NULL;
|
| 890 | }
|
| 891 |
|
| 892 | /**
|
| 893 | * led_complete_set_on:
|
| 894 | * @object: A #Led.
|
| 895 | * @invocation: (transfer full): A #GDBusMethodInvocation.
|
| 896 | *
|
| 897 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
|
| 898 | *
|
| 899 | * This method will free @invocation, you cannot use it afterwards.
|
| 900 | */
|
| 901 | void
|
| 902 | led_complete_set_on (
|
| 903 | Led *object,
|
| 904 | GDBusMethodInvocation *invocation)
|
| 905 | {
|
| 906 | g_dbus_method_invocation_return_value (invocation,
|
| 907 | g_variant_new ("()"));
|
| 908 | }
|
| 909 |
|
| 910 | /**
|
| 911 | * led_complete_set_off:
|
| 912 | * @object: A #Led.
|
| 913 | * @invocation: (transfer full): A #GDBusMethodInvocation.
|
| 914 | *
|
| 915 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
|
| 916 | *
|
| 917 | * This method will free @invocation, you cannot use it afterwards.
|
| 918 | */
|
| 919 | void
|
| 920 | led_complete_set_off (
|
| 921 | Led *object,
|
| 922 | GDBusMethodInvocation *invocation)
|
| 923 | {
|
| 924 | g_dbus_method_invocation_return_value (invocation,
|
| 925 | g_variant_new ("()"));
|
| 926 | }
|
| 927 |
|
| 928 | /**
|
| 929 | * led_complete_set_blink_slow:
|
| 930 | * @object: A #Led.
|
| 931 | * @invocation: (transfer full): A #GDBusMethodInvocation.
|
| 932 | *
|
| 933 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
|
| 934 | *
|
| 935 | * This method will free @invocation, you cannot use it afterwards.
|
| 936 | */
|
| 937 | void
|
| 938 | led_complete_set_blink_slow (
|
| 939 | Led *object,
|
| 940 | GDBusMethodInvocation *invocation)
|
| 941 | {
|
| 942 | g_dbus_method_invocation_return_value (invocation,
|
| 943 | g_variant_new ("()"));
|
| 944 | }
|
| 945 |
|
| 946 | /**
|
| 947 | * led_complete_set_blink_fast:
|
| 948 | * @object: A #Led.
|
| 949 | * @invocation: (transfer full): A #GDBusMethodInvocation.
|
| 950 | *
|
| 951 | * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
|
| 952 | *
|
| 953 | * This method will free @invocation, you cannot use it afterwards.
|
| 954 | */
|
| 955 | void
|
| 956 | led_complete_set_blink_fast (
|
| 957 | Led *object,
|
| 958 | GDBusMethodInvocation *invocation)
|
| 959 | {
|
| 960 | g_dbus_method_invocation_return_value (invocation,
|
| 961 | g_variant_new ("()"));
|
| 962 | }
|
| 963 |
|
| 964 | /* ------------------------------------------------------------------------ */
|
| 965 |
|
| 966 | /**
|
| 967 | * LedProxy:
|
| 968 | *
|
| 969 | * The #LedProxy structure contains only private data and should only be accessed using the provided API.
|
| 970 | */
|
| 971 |
|
| 972 | /**
|
| 973 | * LedProxyClass:
|
| 974 | * @parent_class: The parent class.
|
| 975 | *
|
| 976 | * Class structure for #LedProxy.
|
| 977 | */
|
| 978 |
|
| 979 | struct _LedProxyPrivate
|
| 980 | {
|
| 981 | GData *qdata;
|
| 982 | };
|
| 983 |
|
| 984 | static void led_proxy_iface_init (LedIface *iface);
|
| 985 |
|
| 986 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
|
| 987 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
|
| 988 | G_ADD_PRIVATE (LedProxy)
|
| 989 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
|
| 990 |
|
| 991 | #else
|
| 992 | G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
|
| 993 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
|
| 994 |
|
| 995 | #endif
|
| 996 | static void
|
| 997 | led_proxy_finalize (GObject *object)
|
| 998 | {
|
| 999 | LedProxy *proxy = LED_PROXY (object);
|
| 1000 | g_datalist_clear (&proxy->priv->qdata);
|
| 1001 | G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
|
| 1002 | }
|
| 1003 |
|
| 1004 | static void
|
| 1005 | led_proxy_get_property (GObject *object,
|
| 1006 | guint prop_id,
|
| 1007 | GValue *value,
|
| 1008 | GParamSpec *pspec G_GNUC_UNUSED)
|
| 1009 | {
|
| 1010 | const _ExtendedGDBusPropertyInfo *info;
|
| 1011 | GVariant *variant;
|
| 1012 | g_assert (prop_id != 0 && prop_id - 1 < 2);
|
| 1013 | info = _led_property_info_pointers[prop_id - 1];
|
| 1014 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
|
| 1015 | if (info->use_gvariant)
|
| 1016 | {
|
| 1017 | g_value_set_variant (value, variant);
|
| 1018 | }
|
| 1019 | else
|
| 1020 | {
|
| 1021 | if (variant != NULL)
|
| 1022 | g_dbus_gvariant_to_gvalue (variant, value);
|
| 1023 | }
|
| 1024 | if (variant != NULL)
|
| 1025 | g_variant_unref (variant);
|
| 1026 | }
|
| 1027 |
|
| 1028 | static void
|
| 1029 | led_proxy_set_property_cb (GDBusProxy *proxy,
|
| 1030 | GAsyncResult *res,
|
| 1031 | gpointer user_data)
|
| 1032 | {
|
| 1033 | const _ExtendedGDBusPropertyInfo *info = user_data;
|
| 1034 | GError *error;
|
| 1035 | GVariant *_ret;
|
| 1036 | error = NULL;
|
| 1037 | _ret = g_dbus_proxy_call_finish (proxy, res, &error);
|
| 1038 | if (!_ret)
|
| 1039 | {
|
| 1040 | g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
|
| 1041 | info->parent_struct.name,
|
| 1042 | error->message, g_quark_to_string (error->domain), error->code);
|
| 1043 | g_error_free (error);
|
| 1044 | }
|
| 1045 | else
|
| 1046 | {
|
| 1047 | g_variant_unref (_ret);
|
| 1048 | }
|
| 1049 | }
|
| 1050 |
|
| 1051 | static void
|
| 1052 | led_proxy_set_property (GObject *object,
|
| 1053 | guint prop_id,
|
| 1054 | const GValue *value,
|
| 1055 | GParamSpec *pspec G_GNUC_UNUSED)
|
| 1056 | {
|
| 1057 | const _ExtendedGDBusPropertyInfo *info;
|
| 1058 | GVariant *variant;
|
| 1059 | g_assert (prop_id != 0 && prop_id - 1 < 2);
|
| 1060 | info = _led_property_info_pointers[prop_id - 1];
|
| 1061 | variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
|
| 1062 | g_dbus_proxy_call (G_DBUS_PROXY (object),
|
| 1063 | "org.freedesktop.DBus.Properties.Set",
|
| 1064 | g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
|
| 1065 | G_DBUS_CALL_FLAGS_NONE,
|
| 1066 | -1,
|
| 1067 | NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
|
| 1068 | g_variant_unref (variant);
|
| 1069 | }
|
| 1070 |
|
| 1071 | static void
|
| 1072 | led_proxy_g_signal (GDBusProxy *proxy,
|
| 1073 | const gchar *sender_name G_GNUC_UNUSED,
|
| 1074 | const gchar *signal_name,
|
| 1075 | GVariant *parameters)
|
| 1076 | {
|
| 1077 | _ExtendedGDBusSignalInfo *info;
|
| 1078 | GVariantIter iter;
|
| 1079 | GVariant *child;
|
| 1080 | GValue *paramv;
|
| 1081 | guint num_params;
|
| 1082 | guint n;
|
| 1083 | guint signal_id;
|
| 1084 | info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
|
| 1085 | if (info == NULL)
|
| 1086 | return;
|
| 1087 | num_params = g_variant_n_children (parameters);
|
| 1088 | paramv = g_new0 (GValue, num_params + 1);
|
| 1089 | g_value_init (¶mv[0], TYPE_LED);
|
| 1090 | g_value_set_object (¶mv[0], proxy);
|
| 1091 | g_variant_iter_init (&iter, parameters);
|
| 1092 | n = 1;
|
| 1093 | while ((child = g_variant_iter_next_value (&iter)) != NULL)
|
| 1094 | {
|
| 1095 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
|
| 1096 | if (arg_info->use_gvariant)
|
| 1097 | {
|
| 1098 | g_value_init (¶mv[n], G_TYPE_VARIANT);
|
| 1099 | g_value_set_variant (¶mv[n], child);
|
| 1100 | n++;
|
| 1101 | }
|
| 1102 | else
|
| 1103 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
|
| 1104 | g_variant_unref (child);
|
| 1105 | }
|
| 1106 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
|
| 1107 | g_signal_emitv (paramv, signal_id, 0, NULL);
|
| 1108 | for (n = 0; n < num_params + 1; n++)
|
| 1109 | g_value_unset (¶mv[n]);
|
| 1110 | g_free (paramv);
|
| 1111 | }
|
| 1112 |
|
| 1113 | static void
|
| 1114 | led_proxy_g_properties_changed (GDBusProxy *_proxy,
|
| 1115 | GVariant *changed_properties,
|
| 1116 | const gchar *const *invalidated_properties)
|
| 1117 | {
|
| 1118 | LedProxy *proxy = LED_PROXY (_proxy);
|
| 1119 | guint n;
|
| 1120 | const gchar *key;
|
| 1121 | GVariantIter *iter;
|
| 1122 | _ExtendedGDBusPropertyInfo *info;
|
| 1123 | g_variant_get (changed_properties, "a{sv}", &iter);
|
| 1124 | while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
|
| 1125 | {
|
| 1126 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
|
| 1127 | g_datalist_remove_data (&proxy->priv->qdata, key);
|
| 1128 | if (info != NULL)
|
| 1129 | g_object_notify (G_OBJECT (proxy), info->hyphen_name);
|
| 1130 | }
|
| 1131 | g_variant_iter_free (iter);
|
| 1132 | for (n = 0; invalidated_properties[n] != NULL; n++)
|
| 1133 | {
|
| 1134 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
|
| 1135 | g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
|
| 1136 | if (info != NULL)
|
| 1137 | g_object_notify (G_OBJECT (proxy), info->hyphen_name);
|
| 1138 | }
|
| 1139 | }
|
| 1140 |
|
| 1141 | static gint
|
| 1142 | led_proxy_get_color (Led *object)
|
| 1143 | {
|
| 1144 | LedProxy *proxy = LED_PROXY (object);
|
| 1145 | GVariant *variant;
|
| 1146 | gint value = 0;
|
| 1147 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
|
| 1148 | if (variant != NULL)
|
| 1149 | {
|
| 1150 | value = g_variant_get_int32 (variant);
|
| 1151 | g_variant_unref (variant);
|
| 1152 | }
|
| 1153 | return value;
|
| 1154 | }
|
| 1155 |
|
| 1156 | static const gchar *
|
| 1157 | led_proxy_get_function (Led *object)
|
| 1158 | {
|
| 1159 | LedProxy *proxy = LED_PROXY (object);
|
| 1160 | GVariant *variant;
|
| 1161 | const gchar *value = NULL;
|
| 1162 | variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
|
| 1163 | if (variant != NULL)
|
| 1164 | {
|
| 1165 | value = g_variant_get_string (variant, NULL);
|
| 1166 | g_variant_unref (variant);
|
| 1167 | }
|
| 1168 | return value;
|
| 1169 | }
|
| 1170 |
|
| 1171 | static void
|
| 1172 | led_proxy_init (LedProxy *proxy)
|
| 1173 | {
|
| 1174 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
|
| 1175 | proxy->priv = led_proxy_get_instance_private (proxy);
|
| 1176 | #else
|
| 1177 | proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
|
| 1178 | #endif
|
| 1179 |
|
| 1180 | g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
|
| 1181 | }
|
| 1182 |
|
| 1183 | static void
|
| 1184 | led_proxy_class_init (LedProxyClass *klass)
|
| 1185 | {
|
| 1186 | GObjectClass *gobject_class;
|
| 1187 | GDBusProxyClass *proxy_class;
|
| 1188 |
|
| 1189 | gobject_class = G_OBJECT_CLASS (klass);
|
| 1190 | gobject_class->finalize = led_proxy_finalize;
|
| 1191 | gobject_class->get_property = led_proxy_get_property;
|
| 1192 | gobject_class->set_property = led_proxy_set_property;
|
| 1193 |
|
| 1194 | proxy_class = G_DBUS_PROXY_CLASS (klass);
|
| 1195 | proxy_class->g_signal = led_proxy_g_signal;
|
| 1196 | proxy_class->g_properties_changed = led_proxy_g_properties_changed;
|
| 1197 |
|
| 1198 | led_override_properties (gobject_class, 1);
|
| 1199 |
|
| 1200 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
|
| 1201 | g_type_class_add_private (klass, sizeof (LedProxyPrivate));
|
| 1202 | #endif
|
| 1203 | }
|
| 1204 |
|
| 1205 | static void
|
| 1206 | led_proxy_iface_init (LedIface *iface)
|
| 1207 | {
|
| 1208 | iface->get_color = led_proxy_get_color;
|
| 1209 | iface->get_function = led_proxy_get_function;
|
| 1210 | }
|
| 1211 |
|
| 1212 | /**
|
| 1213 | * led_proxy_new:
|
| 1214 | * @connection: A #GDBusConnection.
|
| 1215 | * @flags: Flags from the #GDBusProxyFlags enumeration.
|
| 1216 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
|
| 1217 | * @object_path: An object path.
|
| 1218 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 1219 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
| 1220 | * @user_data: User data to pass to @callback.
|
| 1221 | *
|
| 1222 | * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new() for more details.
|
| 1223 | *
|
| 1224 | * 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.
|
| 1225 | * You can then call led_proxy_new_finish() to get the result of the operation.
|
| 1226 | *
|
| 1227 | * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
|
| 1228 | */
|
| 1229 | void
|
| 1230 | led_proxy_new (
|
| 1231 | GDBusConnection *connection,
|
| 1232 | GDBusProxyFlags flags,
|
| 1233 | const gchar *name,
|
| 1234 | const gchar *object_path,
|
| 1235 | GCancellable *cancellable,
|
| 1236 | GAsyncReadyCallback callback,
|
| 1237 | gpointer user_data)
|
| 1238 | {
|
| 1239 | g_async_initable_new_async (TYPE_LED_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
|
| 1240 | }
|
| 1241 |
|
| 1242 | /**
|
| 1243 | * led_proxy_new_finish:
|
| 1244 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
|
| 1245 | * @error: Return location for error or %NULL
|
| 1246 | *
|
| 1247 | * Finishes an operation started with led_proxy_new().
|
| 1248 | *
|
| 1249 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
|
| 1250 | */
|
| 1251 | Led *
|
| 1252 | led_proxy_new_finish (
|
| 1253 | GAsyncResult *res,
|
| 1254 | GError **error)
|
| 1255 | {
|
| 1256 | GObject *ret;
|
| 1257 | GObject *source_object;
|
| 1258 | source_object = g_async_result_get_source_object (res);
|
| 1259 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
|
| 1260 | g_object_unref (source_object);
|
| 1261 | if (ret != NULL)
|
| 1262 | return LED (ret);
|
| 1263 | else
|
| 1264 | return NULL;
|
| 1265 | }
|
| 1266 |
|
| 1267 | /**
|
| 1268 | * led_proxy_new_sync:
|
| 1269 | * @connection: A #GDBusConnection.
|
| 1270 | * @flags: Flags from the #GDBusProxyFlags enumeration.
|
| 1271 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
|
| 1272 | * @object_path: An object path.
|
| 1273 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 1274 | * @error: Return location for error or %NULL
|
| 1275 | *
|
| 1276 | * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new_sync() for more details.
|
| 1277 | *
|
| 1278 | * The calling thread is blocked until a reply is received.
|
| 1279 | *
|
| 1280 | * See led_proxy_new() for the asynchronous version of this constructor.
|
| 1281 | *
|
| 1282 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
|
| 1283 | */
|
| 1284 | Led *
|
| 1285 | led_proxy_new_sync (
|
| 1286 | GDBusConnection *connection,
|
| 1287 | GDBusProxyFlags flags,
|
| 1288 | const gchar *name,
|
| 1289 | const gchar *object_path,
|
| 1290 | GCancellable *cancellable,
|
| 1291 | GError **error)
|
| 1292 | {
|
| 1293 | GInitable *ret;
|
| 1294 | ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
|
| 1295 | if (ret != NULL)
|
| 1296 | return LED (ret);
|
| 1297 | else
|
| 1298 | return NULL;
|
| 1299 | }
|
| 1300 |
|
| 1301 |
|
| 1302 | /**
|
| 1303 | * led_proxy_new_for_bus:
|
| 1304 | * @bus_type: A #GBusType.
|
| 1305 | * @flags: Flags from the #GDBusProxyFlags enumeration.
|
| 1306 | * @name: A bus name (well-known or unique).
|
| 1307 | * @object_path: An object path.
|
| 1308 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 1309 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
| 1310 | * @user_data: User data to pass to @callback.
|
| 1311 | *
|
| 1312 | * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
|
| 1313 | *
|
| 1314 | * 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.
|
| 1315 | * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
|
| 1316 | *
|
| 1317 | * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
|
| 1318 | */
|
| 1319 | void
|
| 1320 | led_proxy_new_for_bus (
|
| 1321 | GBusType bus_type,
|
| 1322 | GDBusProxyFlags flags,
|
| 1323 | const gchar *name,
|
| 1324 | const gchar *object_path,
|
| 1325 | GCancellable *cancellable,
|
| 1326 | GAsyncReadyCallback callback,
|
| 1327 | gpointer user_data)
|
| 1328 | {
|
| 1329 | g_async_initable_new_async (TYPE_LED_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
|
| 1330 | }
|
| 1331 |
|
| 1332 | /**
|
| 1333 | * led_proxy_new_for_bus_finish:
|
| 1334 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
|
| 1335 | * @error: Return location for error or %NULL
|
| 1336 | *
|
| 1337 | * Finishes an operation started with led_proxy_new_for_bus().
|
| 1338 | *
|
| 1339 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
|
| 1340 | */
|
| 1341 | Led *
|
| 1342 | led_proxy_new_for_bus_finish (
|
| 1343 | GAsyncResult *res,
|
| 1344 | GError **error)
|
| 1345 | {
|
| 1346 | GObject *ret;
|
| 1347 | GObject *source_object;
|
| 1348 | source_object = g_async_result_get_source_object (res);
|
| 1349 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
|
| 1350 | g_object_unref (source_object);
|
| 1351 | if (ret != NULL)
|
| 1352 | return LED (ret);
|
| 1353 | else
|
| 1354 | return NULL;
|
| 1355 | }
|
| 1356 |
|
| 1357 | /**
|
| 1358 | * led_proxy_new_for_bus_sync:
|
| 1359 | * @bus_type: A #GBusType.
|
| 1360 | * @flags: Flags from the #GDBusProxyFlags enumeration.
|
| 1361 | * @name: A bus name (well-known or unique).
|
| 1362 | * @object_path: An object path.
|
| 1363 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 1364 | * @error: Return location for error or %NULL
|
| 1365 | *
|
| 1366 | * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
|
| 1367 | *
|
| 1368 | * The calling thread is blocked until a reply is received.
|
| 1369 | *
|
| 1370 | * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
|
| 1371 | *
|
| 1372 | * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
|
| 1373 | */
|
| 1374 | Led *
|
| 1375 | led_proxy_new_for_bus_sync (
|
| 1376 | GBusType bus_type,
|
| 1377 | GDBusProxyFlags flags,
|
| 1378 | const gchar *name,
|
| 1379 | const gchar *object_path,
|
| 1380 | GCancellable *cancellable,
|
| 1381 | GError **error)
|
| 1382 | {
|
| 1383 | GInitable *ret;
|
| 1384 | ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
|
| 1385 | if (ret != NULL)
|
| 1386 | return LED (ret);
|
| 1387 | else
|
| 1388 | return NULL;
|
| 1389 | }
|
| 1390 |
|
| 1391 |
|
| 1392 | /* ------------------------------------------------------------------------ */
|
| 1393 |
|
| 1394 | /**
|
| 1395 | * LedSkeleton:
|
| 1396 | *
|
| 1397 | * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
|
| 1398 | */
|
| 1399 |
|
| 1400 | /**
|
| 1401 | * LedSkeletonClass:
|
| 1402 | * @parent_class: The parent class.
|
| 1403 | *
|
| 1404 | * Class structure for #LedSkeleton.
|
| 1405 | */
|
| 1406 |
|
| 1407 | struct _LedSkeletonPrivate
|
| 1408 | {
|
| 1409 | GValue *properties;
|
| 1410 | GList *changed_properties;
|
| 1411 | GSource *changed_properties_idle_source;
|
| 1412 | GMainContext *context;
|
| 1413 | GMutex lock;
|
| 1414 | };
|
| 1415 |
|
| 1416 | static void
|
| 1417 | _led_skeleton_handle_method_call (
|
| 1418 | GDBusConnection *connection G_GNUC_UNUSED,
|
| 1419 | const gchar *sender G_GNUC_UNUSED,
|
| 1420 | const gchar *object_path G_GNUC_UNUSED,
|
| 1421 | const gchar *interface_name,
|
| 1422 | const gchar *method_name,
|
| 1423 | GVariant *parameters,
|
| 1424 | GDBusMethodInvocation *invocation,
|
| 1425 | gpointer user_data)
|
| 1426 | {
|
| 1427 | LedSkeleton *skeleton = LED_SKELETON (user_data);
|
| 1428 | _ExtendedGDBusMethodInfo *info;
|
| 1429 | GVariantIter iter;
|
| 1430 | GVariant *child;
|
| 1431 | GValue *paramv;
|
| 1432 | guint num_params;
|
| 1433 | guint num_extra;
|
| 1434 | guint n;
|
| 1435 | guint signal_id;
|
| 1436 | GValue return_value = G_VALUE_INIT;
|
| 1437 | info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
|
| 1438 | g_assert (info != NULL);
|
| 1439 | num_params = g_variant_n_children (parameters);
|
| 1440 | num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
|
| 1441 | n = 0;
|
| 1442 | g_value_init (¶mv[n], TYPE_LED);
|
| 1443 | g_value_set_object (¶mv[n++], skeleton);
|
| 1444 | g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
|
| 1445 | g_value_set_object (¶mv[n++], invocation);
|
| 1446 | if (info->pass_fdlist)
|
| 1447 | {
|
| 1448 | #ifdef G_OS_UNIX
|
| 1449 | g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
|
| 1450 | g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
|
| 1451 | #else
|
| 1452 | g_assert_not_reached ();
|
| 1453 | #endif
|
| 1454 | }
|
| 1455 | g_variant_iter_init (&iter, parameters);
|
| 1456 | while ((child = g_variant_iter_next_value (&iter)) != NULL)
|
| 1457 | {
|
| 1458 | _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
|
| 1459 | if (arg_info->use_gvariant)
|
| 1460 | {
|
| 1461 | g_value_init (¶mv[n], G_TYPE_VARIANT);
|
| 1462 | g_value_set_variant (¶mv[n], child);
|
| 1463 | n++;
|
| 1464 | }
|
| 1465 | else
|
| 1466 | g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
|
| 1467 | g_variant_unref (child);
|
| 1468 | }
|
| 1469 | signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
|
| 1470 | g_value_init (&return_value, G_TYPE_BOOLEAN);
|
| 1471 | g_signal_emitv (paramv, signal_id, 0, &return_value);
|
| 1472 | if (!g_value_get_boolean (&return_value))
|
| 1473 | 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);
|
| 1474 | g_value_unset (&return_value);
|
| 1475 | for (n = 0; n < num_params + num_extra; n++)
|
| 1476 | g_value_unset (¶mv[n]);
|
| 1477 | g_free (paramv);
|
| 1478 | }
|
| 1479 |
|
| 1480 | static GVariant *
|
| 1481 | _led_skeleton_handle_get_property (
|
| 1482 | GDBusConnection *connection G_GNUC_UNUSED,
|
| 1483 | const gchar *sender G_GNUC_UNUSED,
|
| 1484 | const gchar *object_path G_GNUC_UNUSED,
|
| 1485 | const gchar *interface_name G_GNUC_UNUSED,
|
| 1486 | const gchar *property_name,
|
| 1487 | GError **error,
|
| 1488 | gpointer user_data)
|
| 1489 | {
|
| 1490 | LedSkeleton *skeleton = LED_SKELETON (user_data);
|
| 1491 | GValue value = G_VALUE_INIT;
|
| 1492 | GParamSpec *pspec;
|
| 1493 | _ExtendedGDBusPropertyInfo *info;
|
| 1494 | GVariant *ret;
|
| 1495 | ret = NULL;
|
| 1496 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
|
| 1497 | g_assert (info != NULL);
|
| 1498 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
|
| 1499 | if (pspec == NULL)
|
| 1500 | {
|
| 1501 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
|
| 1502 | }
|
| 1503 | else
|
| 1504 | {
|
| 1505 | g_value_init (&value, pspec->value_type);
|
| 1506 | g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
|
| 1507 | ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
|
| 1508 | g_value_unset (&value);
|
| 1509 | }
|
| 1510 | return ret;
|
| 1511 | }
|
| 1512 |
|
| 1513 | static gboolean
|
| 1514 | _led_skeleton_handle_set_property (
|
| 1515 | GDBusConnection *connection G_GNUC_UNUSED,
|
| 1516 | const gchar *sender G_GNUC_UNUSED,
|
| 1517 | const gchar *object_path G_GNUC_UNUSED,
|
| 1518 | const gchar *interface_name G_GNUC_UNUSED,
|
| 1519 | const gchar *property_name,
|
| 1520 | GVariant *variant,
|
| 1521 | GError **error,
|
| 1522 | gpointer user_data)
|
| 1523 | {
|
| 1524 | LedSkeleton *skeleton = LED_SKELETON (user_data);
|
| 1525 | GValue value = G_VALUE_INIT;
|
| 1526 | GParamSpec *pspec;
|
| 1527 | _ExtendedGDBusPropertyInfo *info;
|
| 1528 | gboolean ret;
|
| 1529 | ret = FALSE;
|
| 1530 | info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
|
| 1531 | g_assert (info != NULL);
|
| 1532 | pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
|
| 1533 | if (pspec == NULL)
|
| 1534 | {
|
| 1535 | g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
|
| 1536 | }
|
| 1537 | else
|
| 1538 | {
|
| 1539 | if (info->use_gvariant)
|
| 1540 | g_value_set_variant (&value, variant);
|
| 1541 | else
|
| 1542 | g_dbus_gvariant_to_gvalue (variant, &value);
|
| 1543 | g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
|
| 1544 | g_value_unset (&value);
|
| 1545 | ret = TRUE;
|
| 1546 | }
|
| 1547 | return ret;
|
| 1548 | }
|
| 1549 |
|
| 1550 | static const GDBusInterfaceVTable _led_skeleton_vtable =
|
| 1551 | {
|
| 1552 | _led_skeleton_handle_method_call,
|
| 1553 | _led_skeleton_handle_get_property,
|
| 1554 | _led_skeleton_handle_set_property,
|
| 1555 | {NULL}
|
| 1556 | };
|
| 1557 |
|
| 1558 | static GDBusInterfaceInfo *
|
| 1559 | led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
|
| 1560 | {
|
| 1561 | return led_interface_info ();
|
| 1562 | }
|
| 1563 |
|
| 1564 | static GDBusInterfaceVTable *
|
| 1565 | led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
|
| 1566 | {
|
| 1567 | return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
|
| 1568 | }
|
| 1569 |
|
| 1570 | static GVariant *
|
| 1571 | led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
|
| 1572 | {
|
| 1573 | LedSkeleton *skeleton = LED_SKELETON (_skeleton);
|
| 1574 |
|
| 1575 | GVariantBuilder builder;
|
| 1576 | guint n;
|
| 1577 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
| 1578 | if (_led_interface_info.parent_struct.properties == NULL)
|
| 1579 | goto out;
|
| 1580 | for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
|
| 1581 | {
|
| 1582 | GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
|
| 1583 | if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
|
| 1584 | {
|
| 1585 | GVariant *value;
|
| 1586 | value = _led_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Led", info->name, NULL, skeleton);
|
| 1587 | if (value != NULL)
|
| 1588 | {
|
| 1589 | g_variant_take_ref (value);
|
| 1590 | g_variant_builder_add (&builder, "{sv}", info->name, value);
|
| 1591 | g_variant_unref (value);
|
| 1592 | }
|
| 1593 | }
|
| 1594 | }
|
| 1595 | out:
|
| 1596 | return g_variant_builder_end (&builder);
|
| 1597 | }
|
| 1598 |
|
| 1599 | static gboolean _led_emit_changed (gpointer user_data);
|
| 1600 |
|
| 1601 | static void
|
| 1602 | led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
|
| 1603 | {
|
| 1604 | LedSkeleton *skeleton = LED_SKELETON (_skeleton);
|
| 1605 | gboolean emit_changed = FALSE;
|
| 1606 |
|
| 1607 | g_mutex_lock (&skeleton->priv->lock);
|
| 1608 | if (skeleton->priv->changed_properties_idle_source != NULL)
|
| 1609 | {
|
| 1610 | g_source_destroy (skeleton->priv->changed_properties_idle_source);
|
| 1611 | skeleton->priv->changed_properties_idle_source = NULL;
|
| 1612 | emit_changed = TRUE;
|
| 1613 | }
|
| 1614 | g_mutex_unlock (&skeleton->priv->lock);
|
| 1615 |
|
| 1616 | if (emit_changed)
|
| 1617 | _led_emit_changed (skeleton);
|
| 1618 | }
|
| 1619 |
|
| 1620 | static void led_skeleton_iface_init (LedIface *iface);
|
| 1621 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
|
| 1622 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
|
| 1623 | G_ADD_PRIVATE (LedSkeleton)
|
| 1624 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
|
| 1625 |
|
| 1626 | #else
|
| 1627 | G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
|
| 1628 | G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
|
| 1629 |
|
| 1630 | #endif
|
| 1631 | static void
|
| 1632 | led_skeleton_finalize (GObject *object)
|
| 1633 | {
|
| 1634 | LedSkeleton *skeleton = LED_SKELETON (object);
|
| 1635 | guint n;
|
| 1636 | for (n = 0; n < 2; n++)
|
| 1637 | g_value_unset (&skeleton->priv->properties[n]);
|
| 1638 | g_free (skeleton->priv->properties);
|
| 1639 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
|
| 1640 | if (skeleton->priv->changed_properties_idle_source != NULL)
|
| 1641 | g_source_destroy (skeleton->priv->changed_properties_idle_source);
|
| 1642 | g_main_context_unref (skeleton->priv->context);
|
| 1643 | g_mutex_clear (&skeleton->priv->lock);
|
| 1644 | G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
|
| 1645 | }
|
| 1646 |
|
| 1647 | static void
|
| 1648 | led_skeleton_get_property (GObject *object,
|
| 1649 | guint prop_id,
|
| 1650 | GValue *value,
|
| 1651 | GParamSpec *pspec G_GNUC_UNUSED)
|
| 1652 | {
|
| 1653 | LedSkeleton *skeleton = LED_SKELETON (object);
|
| 1654 | g_assert (prop_id != 0 && prop_id - 1 < 2);
|
| 1655 | g_mutex_lock (&skeleton->priv->lock);
|
| 1656 | g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
|
| 1657 | g_mutex_unlock (&skeleton->priv->lock);
|
| 1658 | }
|
| 1659 |
|
| 1660 | static gboolean
|
| 1661 | _led_emit_changed (gpointer user_data)
|
| 1662 | {
|
| 1663 | LedSkeleton *skeleton = LED_SKELETON (user_data);
|
| 1664 | GList *l;
|
| 1665 | GVariantBuilder builder;
|
| 1666 | GVariantBuilder invalidated_builder;
|
| 1667 | guint num_changes;
|
| 1668 |
|
| 1669 | g_mutex_lock (&skeleton->priv->lock);
|
| 1670 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
| 1671 | g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
|
| 1672 | for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
|
| 1673 | {
|
| 1674 | ChangedProperty *cp = l->data;
|
| 1675 | GVariant *variant;
|
| 1676 | const GValue *cur_value;
|
| 1677 |
|
| 1678 | cur_value = &skeleton->priv->properties[cp->prop_id - 1];
|
| 1679 | if (!_g_value_equal (cur_value, &cp->orig_value))
|
| 1680 | {
|
| 1681 | variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
|
| 1682 | g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
|
| 1683 | g_variant_unref (variant);
|
| 1684 | num_changes++;
|
| 1685 | }
|
| 1686 | }
|
| 1687 | if (num_changes > 0)
|
| 1688 | {
|
| 1689 | GList *connections, *ll;
|
| 1690 | GVariant *signal_variant;
|
| 1691 | signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
|
| 1692 | &builder, &invalidated_builder));
|
| 1693 | connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
|
| 1694 | for (ll = connections; ll != NULL; ll = ll->next)
|
| 1695 | {
|
| 1696 | GDBusConnection *connection = ll->data;
|
| 1697 |
|
| 1698 | g_dbus_connection_emit_signal (connection,
|
| 1699 | NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
|
| 1700 | "org.freedesktop.DBus.Properties",
|
| 1701 | "PropertiesChanged",
|
| 1702 | signal_variant,
|
| 1703 | NULL);
|
| 1704 | }
|
| 1705 | g_variant_unref (signal_variant);
|
| 1706 | g_list_free_full (connections, g_object_unref);
|
| 1707 | }
|
| 1708 | else
|
| 1709 | {
|
| 1710 | g_variant_builder_clear (&builder);
|
| 1711 | g_variant_builder_clear (&invalidated_builder);
|
| 1712 | }
|
| 1713 | g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
|
| 1714 | skeleton->priv->changed_properties = NULL;
|
| 1715 | skeleton->priv->changed_properties_idle_source = NULL;
|
| 1716 | g_mutex_unlock (&skeleton->priv->lock);
|
| 1717 | return FALSE;
|
| 1718 | }
|
| 1719 |
|
| 1720 | static void
|
| 1721 | _led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
|
| 1722 | {
|
| 1723 | ChangedProperty *cp;
|
| 1724 | GList *l;
|
| 1725 | cp = NULL;
|
| 1726 | for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
|
| 1727 | {
|
| 1728 | ChangedProperty *i_cp = l->data;
|
| 1729 | if (i_cp->info == info)
|
| 1730 | {
|
| 1731 | cp = i_cp;
|
| 1732 | break;
|
| 1733 | }
|
| 1734 | }
|
| 1735 | if (cp == NULL)
|
| 1736 | {
|
| 1737 | cp = g_new0 (ChangedProperty, 1);
|
| 1738 | cp->prop_id = prop_id;
|
| 1739 | cp->info = info;
|
| 1740 | skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
|
| 1741 | g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
|
| 1742 | g_value_copy (orig_value, &cp->orig_value);
|
| 1743 | }
|
| 1744 | }
|
| 1745 |
|
| 1746 | static void
|
| 1747 | led_skeleton_notify (GObject *object,
|
| 1748 | GParamSpec *pspec G_GNUC_UNUSED)
|
| 1749 | {
|
| 1750 | LedSkeleton *skeleton = LED_SKELETON (object);
|
| 1751 | g_mutex_lock (&skeleton->priv->lock);
|
| 1752 | if (skeleton->priv->changed_properties != NULL &&
|
| 1753 | skeleton->priv->changed_properties_idle_source == NULL)
|
| 1754 | {
|
| 1755 | skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
|
| 1756 | g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
|
| 1757 | g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
|
| 1758 | g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
|
| 1759 | g_source_unref (skeleton->priv->changed_properties_idle_source);
|
| 1760 | }
|
| 1761 | g_mutex_unlock (&skeleton->priv->lock);
|
| 1762 | }
|
| 1763 |
|
| 1764 | static void
|
| 1765 | led_skeleton_set_property (GObject *object,
|
| 1766 | guint prop_id,
|
| 1767 | const GValue *value,
|
| 1768 | GParamSpec *pspec)
|
| 1769 | {
|
| 1770 | LedSkeleton *skeleton = LED_SKELETON (object);
|
| 1771 | g_assert (prop_id != 0 && prop_id - 1 < 2);
|
| 1772 | g_mutex_lock (&skeleton->priv->lock);
|
| 1773 | g_object_freeze_notify (object);
|
| 1774 | if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
|
| 1775 | {
|
| 1776 | if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
|
| 1777 | _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
|
| 1778 | g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
|
| 1779 | g_object_notify_by_pspec (object, pspec);
|
| 1780 | }
|
| 1781 | g_mutex_unlock (&skeleton->priv->lock);
|
| 1782 | g_object_thaw_notify (object);
|
| 1783 | }
|
| 1784 |
|
| 1785 | static void
|
| 1786 | led_skeleton_init (LedSkeleton *skeleton)
|
| 1787 | {
|
| 1788 | #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
|
| 1789 | skeleton->priv = led_skeleton_get_instance_private (skeleton);
|
| 1790 | #else
|
| 1791 | skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
|
| 1792 | #endif
|
| 1793 |
|
| 1794 | g_mutex_init (&skeleton->priv->lock);
|
| 1795 | skeleton->priv->context = g_main_context_ref_thread_default ();
|
| 1796 | skeleton->priv->properties = g_new0 (GValue, 2);
|
| 1797 | g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
|
| 1798 | g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
|
| 1799 | }
|
| 1800 |
|
| 1801 | static gint
|
| 1802 | led_skeleton_get_color (Led *object)
|
| 1803 | {
|
| 1804 | LedSkeleton *skeleton = LED_SKELETON (object);
|
| 1805 | gint value;
|
| 1806 | g_mutex_lock (&skeleton->priv->lock);
|
| 1807 | value = g_value_get_int (&(skeleton->priv->properties[0]));
|
| 1808 | g_mutex_unlock (&skeleton->priv->lock);
|
| 1809 | return value;
|
| 1810 | }
|
| 1811 |
|
| 1812 | static const gchar *
|
| 1813 | led_skeleton_get_function (Led *object)
|
| 1814 | {
|
| 1815 | LedSkeleton *skeleton = LED_SKELETON (object);
|
| 1816 | const gchar *value;
|
| 1817 | g_mutex_lock (&skeleton->priv->lock);
|
| 1818 | value = g_value_get_string (&(skeleton->priv->properties[1]));
|
| 1819 | g_mutex_unlock (&skeleton->priv->lock);
|
| 1820 | return value;
|
| 1821 | }
|
| 1822 |
|
| 1823 | static void
|
| 1824 | led_skeleton_class_init (LedSkeletonClass *klass)
|
| 1825 | {
|
| 1826 | GObjectClass *gobject_class;
|
| 1827 | GDBusInterfaceSkeletonClass *skeleton_class;
|
| 1828 |
|
| 1829 | gobject_class = G_OBJECT_CLASS (klass);
|
| 1830 | gobject_class->finalize = led_skeleton_finalize;
|
| 1831 | gobject_class->get_property = led_skeleton_get_property;
|
| 1832 | gobject_class->set_property = led_skeleton_set_property;
|
| 1833 | gobject_class->notify = led_skeleton_notify;
|
| 1834 |
|
| 1835 |
|
| 1836 | led_override_properties (gobject_class, 1);
|
| 1837 |
|
| 1838 | skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
|
| 1839 | skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
|
| 1840 | skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
|
| 1841 | skeleton_class->flush = led_skeleton_dbus_interface_flush;
|
| 1842 | skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
|
| 1843 |
|
| 1844 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
|
| 1845 | g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
|
| 1846 | #endif
|
| 1847 | }
|
| 1848 |
|
| 1849 | static void
|
| 1850 | led_skeleton_iface_init (LedIface *iface)
|
| 1851 | {
|
| 1852 | iface->get_color = led_skeleton_get_color;
|
| 1853 | iface->get_function = led_skeleton_get_function;
|
| 1854 | }
|
| 1855 |
|
| 1856 | /**
|
| 1857 | * led_skeleton_new:
|
| 1858 | *
|
| 1859 | * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
|
| 1860 | *
|
| 1861 | * Returns: (transfer full) (type LedSkeleton): The skeleton object.
|
| 1862 | */
|
| 1863 | Led *
|
| 1864 | led_skeleton_new (void)
|
| 1865 | {
|
| 1866 | return LED (g_object_new (TYPE_LED_SKELETON, NULL));
|
| 1867 | }
|
| 1868 |
|
| 1869 | /* ------------------------------------------------------------------------
|
| 1870 | * Code for Object, ObjectProxy and ObjectSkeleton
|
| 1871 | * ------------------------------------------------------------------------
|
| 1872 | */
|
| 1873 |
|
| 1874 | /**
|
| 1875 | * SECTION:Object
|
| 1876 | * @title: Object
|
| 1877 | * @short_description: Specialized GDBusObject types
|
| 1878 | *
|
| 1879 | * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
|
| 1880 | */
|
| 1881 |
|
| 1882 | /**
|
| 1883 | * Object:
|
| 1884 | *
|
| 1885 | * The #Object type is a specialized container of interfaces.
|
| 1886 | */
|
| 1887 |
|
| 1888 | /**
|
| 1889 | * ObjectIface:
|
| 1890 | * @parent_iface: The parent interface.
|
| 1891 | *
|
| 1892 | * Virtual table for the #Object interface.
|
| 1893 | */
|
| 1894 |
|
| 1895 | typedef ObjectIface ObjectInterface;
|
| 1896 | G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
|
| 1897 |
|
| 1898 | static void
|
| 1899 | object_default_init (ObjectIface *iface)
|
| 1900 | {
|
| 1901 | /**
|
| 1902 | * Object:led:
|
| 1903 | *
|
| 1904 | * The #Led instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>, if any.
|
| 1905 | *
|
| 1906 | * Connect to the #GObject::notify signal to get informed of property changes.
|
| 1907 | */
|
| 1908 | g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
|
| 1909 |
|
| 1910 | }
|
| 1911 |
|
| 1912 | /**
|
| 1913 | * object_get_led:
|
| 1914 | * @object: A #Object.
|
| 1915 | *
|
| 1916 | * Gets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object, if any.
|
| 1917 | *
|
| 1918 | * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
|
| 1919 | */
|
| 1920 | Led *object_get_led (Object *object)
|
| 1921 | {
|
| 1922 | GDBusInterface *ret;
|
| 1923 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
|
| 1924 | if (ret == NULL)
|
| 1925 | return NULL;
|
| 1926 | return LED (ret);
|
| 1927 | }
|
| 1928 |
|
| 1929 |
|
| 1930 | /**
|
| 1931 | * object_peek_led: (skip)
|
| 1932 | * @object: A #Object.
|
| 1933 | *
|
| 1934 | * Like object_get_led() but doesn't increase the reference count on the returned object.
|
| 1935 | *
|
| 1936 | * <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>
|
| 1937 | *
|
| 1938 | * Returns: (transfer none): A #Led or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
|
| 1939 | */
|
| 1940 | Led *object_peek_led (Object *object)
|
| 1941 | {
|
| 1942 | GDBusInterface *ret;
|
| 1943 | ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
|
| 1944 | if (ret == NULL)
|
| 1945 | return NULL;
|
| 1946 | g_object_unref (ret);
|
| 1947 | return LED (ret);
|
| 1948 | }
|
| 1949 |
|
| 1950 |
|
| 1951 | static void
|
| 1952 | object_notify (GDBusObject *object, GDBusInterface *interface)
|
| 1953 | {
|
| 1954 | _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
|
| 1955 | /* info can be NULL if the other end is using a D-Bus interface we don't know
|
| 1956 | * anything about, for example old generated code in this process talking to
|
| 1957 | * newer generated code in the other process. */
|
| 1958 | if (info != NULL)
|
| 1959 | g_object_notify (G_OBJECT (object), info->hyphen_name);
|
| 1960 | }
|
| 1961 |
|
| 1962 | /**
|
| 1963 | * ObjectProxy:
|
| 1964 | *
|
| 1965 | * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
|
| 1966 | */
|
| 1967 |
|
| 1968 | /**
|
| 1969 | * ObjectProxyClass:
|
| 1970 | * @parent_class: The parent class.
|
| 1971 | *
|
| 1972 | * Class structure for #ObjectProxy.
|
| 1973 | */
|
| 1974 |
|
| 1975 | static void
|
| 1976 | object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
|
| 1977 | {
|
| 1978 | }
|
| 1979 |
|
| 1980 | static void
|
| 1981 | object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
|
| 1982 | {
|
| 1983 | iface->interface_added = object_notify;
|
| 1984 | iface->interface_removed = object_notify;
|
| 1985 | }
|
| 1986 |
|
| 1987 |
|
| 1988 | G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
|
| 1989 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
|
| 1990 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
|
| 1991 |
|
| 1992 | static void
|
| 1993 | object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
|
| 1994 | {
|
| 1995 | }
|
| 1996 |
|
| 1997 | static void
|
| 1998 | object_proxy_set_property (GObject *gobject,
|
| 1999 | guint prop_id,
|
| 2000 | const GValue *value G_GNUC_UNUSED,
|
| 2001 | GParamSpec *pspec)
|
| 2002 | {
|
| 2003 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
| 2004 | }
|
| 2005 |
|
| 2006 | static void
|
| 2007 | object_proxy_get_property (GObject *gobject,
|
| 2008 | guint prop_id,
|
| 2009 | GValue *value,
|
| 2010 | GParamSpec *pspec)
|
| 2011 | {
|
| 2012 | ObjectProxy *object = OBJECT_PROXY (gobject);
|
| 2013 | GDBusInterface *interface;
|
| 2014 |
|
| 2015 | switch (prop_id)
|
| 2016 | {
|
| 2017 | case 1:
|
| 2018 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
|
| 2019 | g_value_take_object (value, interface);
|
| 2020 | break;
|
| 2021 |
|
| 2022 | default:
|
| 2023 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
| 2024 | break;
|
| 2025 | }
|
| 2026 | }
|
| 2027 |
|
| 2028 | static void
|
| 2029 | object_proxy_class_init (ObjectProxyClass *klass)
|
| 2030 | {
|
| 2031 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
| 2032 |
|
| 2033 | gobject_class->set_property = object_proxy_set_property;
|
| 2034 | gobject_class->get_property = object_proxy_get_property;
|
| 2035 |
|
| 2036 | g_object_class_override_property (gobject_class, 1, "led");
|
| 2037 | }
|
| 2038 |
|
| 2039 | /**
|
| 2040 | * object_proxy_new:
|
| 2041 | * @connection: A #GDBusConnection.
|
| 2042 | * @object_path: An object path.
|
| 2043 | *
|
| 2044 | * Creates a new proxy object.
|
| 2045 | *
|
| 2046 | * Returns: (transfer full): The proxy object.
|
| 2047 | */
|
| 2048 | ObjectProxy *
|
| 2049 | object_proxy_new (GDBusConnection *connection,
|
| 2050 | const gchar *object_path)
|
| 2051 | {
|
| 2052 | g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
|
| 2053 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
|
| 2054 | return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
|
| 2055 | }
|
| 2056 |
|
| 2057 | /**
|
| 2058 | * ObjectSkeleton:
|
| 2059 | *
|
| 2060 | * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
|
| 2061 | */
|
| 2062 |
|
| 2063 | /**
|
| 2064 | * ObjectSkeletonClass:
|
| 2065 | * @parent_class: The parent class.
|
| 2066 | *
|
| 2067 | * Class structure for #ObjectSkeleton.
|
| 2068 | */
|
| 2069 |
|
| 2070 | static void
|
| 2071 | object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
|
| 2072 | {
|
| 2073 | }
|
| 2074 |
|
| 2075 |
|
| 2076 | static void
|
| 2077 | object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
|
| 2078 | {
|
| 2079 | iface->interface_added = object_notify;
|
| 2080 | iface->interface_removed = object_notify;
|
| 2081 | }
|
| 2082 |
|
| 2083 | G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
|
| 2084 | G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
|
| 2085 | G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
|
| 2086 |
|
| 2087 | static void
|
| 2088 | object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
|
| 2089 | {
|
| 2090 | }
|
| 2091 |
|
| 2092 | static void
|
| 2093 | object_skeleton_set_property (GObject *gobject,
|
| 2094 | guint prop_id,
|
| 2095 | const GValue *value,
|
| 2096 | GParamSpec *pspec)
|
| 2097 | {
|
| 2098 | ObjectSkeleton *object = OBJECT_SKELETON (gobject);
|
| 2099 | GDBusInterfaceSkeleton *interface;
|
| 2100 |
|
| 2101 | switch (prop_id)
|
| 2102 | {
|
| 2103 | case 1:
|
| 2104 | interface = g_value_get_object (value);
|
| 2105 | if (interface != NULL)
|
| 2106 | {
|
| 2107 | g_warn_if_fail (IS_LED (interface));
|
| 2108 | g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
|
| 2109 | }
|
| 2110 | else
|
| 2111 | {
|
| 2112 | g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
|
| 2113 | }
|
| 2114 | break;
|
| 2115 |
|
| 2116 | default:
|
| 2117 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
| 2118 | break;
|
| 2119 | }
|
| 2120 | }
|
| 2121 |
|
| 2122 | static void
|
| 2123 | object_skeleton_get_property (GObject *gobject,
|
| 2124 | guint prop_id,
|
| 2125 | GValue *value,
|
| 2126 | GParamSpec *pspec)
|
| 2127 | {
|
| 2128 | ObjectSkeleton *object = OBJECT_SKELETON (gobject);
|
| 2129 | GDBusInterface *interface;
|
| 2130 |
|
| 2131 | switch (prop_id)
|
| 2132 | {
|
| 2133 | case 1:
|
| 2134 | interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
|
| 2135 | g_value_take_object (value, interface);
|
| 2136 | break;
|
| 2137 |
|
| 2138 | default:
|
| 2139 | G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
| 2140 | break;
|
| 2141 | }
|
| 2142 | }
|
| 2143 |
|
| 2144 | static void
|
| 2145 | object_skeleton_class_init (ObjectSkeletonClass *klass)
|
| 2146 | {
|
| 2147 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
| 2148 |
|
| 2149 | gobject_class->set_property = object_skeleton_set_property;
|
| 2150 | gobject_class->get_property = object_skeleton_get_property;
|
| 2151 |
|
| 2152 | g_object_class_override_property (gobject_class, 1, "led");
|
| 2153 | }
|
| 2154 |
|
| 2155 | /**
|
| 2156 | * object_skeleton_new:
|
| 2157 | * @object_path: An object path.
|
| 2158 | *
|
| 2159 | * Creates a new skeleton object.
|
| 2160 | *
|
| 2161 | * Returns: (transfer full): The skeleton object.
|
| 2162 | */
|
| 2163 | ObjectSkeleton *
|
| 2164 | object_skeleton_new (const gchar *object_path)
|
| 2165 | {
|
| 2166 | g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
|
| 2167 | return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
|
| 2168 | }
|
| 2169 |
|
| 2170 | /**
|
| 2171 | * object_skeleton_set_led:
|
| 2172 | * @object: A #ObjectSkeleton.
|
| 2173 | * @interface_: (allow-none): A #Led or %NULL to clear the interface.
|
| 2174 | *
|
| 2175 | * Sets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object.
|
| 2176 | */
|
| 2177 | void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
|
| 2178 | {
|
| 2179 | g_object_set (G_OBJECT (object), "led", interface_, NULL);
|
| 2180 | }
|
| 2181 |
|
| 2182 |
|
| 2183 | /* ------------------------------------------------------------------------
|
| 2184 | * Code for ObjectManager client
|
| 2185 | * ------------------------------------------------------------------------
|
| 2186 | */
|
| 2187 |
|
| 2188 | /**
|
| 2189 | * SECTION:ObjectManagerClient
|
| 2190 | * @title: ObjectManagerClient
|
| 2191 | * @short_description: Generated GDBusObjectManagerClient type
|
| 2192 | *
|
| 2193 | * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
|
| 2194 | */
|
| 2195 |
|
| 2196 | /**
|
| 2197 | * ObjectManagerClient:
|
| 2198 | *
|
| 2199 | * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
|
| 2200 | */
|
| 2201 |
|
| 2202 | /**
|
| 2203 | * ObjectManagerClientClass:
|
| 2204 | * @parent_class: The parent class.
|
| 2205 | *
|
| 2206 | * Class structure for #ObjectManagerClient.
|
| 2207 | */
|
| 2208 |
|
| 2209 | G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
|
| 2210 |
|
| 2211 | static void
|
| 2212 | object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
|
| 2213 | {
|
| 2214 | }
|
| 2215 |
|
| 2216 | static void
|
| 2217 | object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
|
| 2218 | {
|
| 2219 | }
|
| 2220 |
|
| 2221 | /**
|
| 2222 | * object_manager_client_get_proxy_type:
|
| 2223 | * @manager: A #GDBusObjectManagerClient.
|
| 2224 | * @object_path: The object path of the remote object (unused).
|
| 2225 | * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
|
| 2226 | * @user_data: User data (unused).
|
| 2227 | *
|
| 2228 | * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
|
| 2229 | *
|
| 2230 | * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
|
| 2231 | */
|
| 2232 | GType
|
| 2233 | object_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)
|
| 2234 | {
|
| 2235 | static gsize once_init_value = 0;
|
| 2236 | static GHashTable *lookup_hash;
|
| 2237 | GType ret;
|
| 2238 |
|
| 2239 | if (interface_name == NULL)
|
| 2240 | return TYPE_OBJECT_PROXY;
|
| 2241 | if (g_once_init_enter (&once_init_value))
|
| 2242 | {
|
| 2243 | lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
| 2244 | g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
|
| 2245 | g_once_init_leave (&once_init_value, 1);
|
| 2246 | }
|
| 2247 | ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
|
| 2248 | if (ret == (GType) 0)
|
| 2249 | ret = G_TYPE_DBUS_PROXY;
|
| 2250 | return ret;
|
| 2251 | }
|
| 2252 |
|
| 2253 | /**
|
| 2254 | * object_manager_client_new:
|
| 2255 | * @connection: A #GDBusConnection.
|
| 2256 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
|
| 2257 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
|
| 2258 | * @object_path: An object path.
|
| 2259 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 2260 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
| 2261 | * @user_data: User data to pass to @callback.
|
| 2262 | *
|
| 2263 | * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
|
| 2264 | *
|
| 2265 | * 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.
|
| 2266 | * You can then call object_manager_client_new_finish() to get the result of the operation.
|
| 2267 | *
|
| 2268 | * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
|
| 2269 | */
|
| 2270 | void
|
| 2271 | object_manager_client_new (
|
| 2272 | GDBusConnection *connection,
|
| 2273 | GDBusObjectManagerClientFlags flags,
|
| 2274 | const gchar *name,
|
| 2275 | const gchar *object_path,
|
| 2276 | GCancellable *cancellable,
|
| 2277 | GAsyncReadyCallback callback,
|
| 2278 | gpointer user_data)
|
| 2279 | {
|
| 2280 | 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);
|
| 2281 | }
|
| 2282 |
|
| 2283 | /**
|
| 2284 | * object_manager_client_new_finish:
|
| 2285 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
|
| 2286 | * @error: Return location for error or %NULL
|
| 2287 | *
|
| 2288 | * Finishes an operation started with object_manager_client_new().
|
| 2289 | *
|
| 2290 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
|
| 2291 | */
|
| 2292 | GDBusObjectManager *
|
| 2293 | object_manager_client_new_finish (
|
| 2294 | GAsyncResult *res,
|
| 2295 | GError **error)
|
| 2296 | {
|
| 2297 | GObject *ret;
|
| 2298 | GObject *source_object;
|
| 2299 | source_object = g_async_result_get_source_object (res);
|
| 2300 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
|
| 2301 | g_object_unref (source_object);
|
| 2302 | if (ret != NULL)
|
| 2303 | return G_DBUS_OBJECT_MANAGER (ret);
|
| 2304 | else
|
| 2305 | return NULL;
|
| 2306 | }
|
| 2307 |
|
| 2308 | /**
|
| 2309 | * object_manager_client_new_sync:
|
| 2310 | * @connection: A #GDBusConnection.
|
| 2311 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
|
| 2312 | * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
|
| 2313 | * @object_path: An object path.
|
| 2314 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 2315 | * @error: Return location for error or %NULL
|
| 2316 | *
|
| 2317 | * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
|
| 2318 | *
|
| 2319 | * The calling thread is blocked until a reply is received.
|
| 2320 | *
|
| 2321 | * See object_manager_client_new() for the asynchronous version of this constructor.
|
| 2322 | *
|
| 2323 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
|
| 2324 | */
|
| 2325 | GDBusObjectManager *
|
| 2326 | object_manager_client_new_sync (
|
| 2327 | GDBusConnection *connection,
|
| 2328 | GDBusObjectManagerClientFlags flags,
|
| 2329 | const gchar *name,
|
| 2330 | const gchar *object_path,
|
| 2331 | GCancellable *cancellable,
|
| 2332 | GError **error)
|
| 2333 | {
|
| 2334 | GInitable *ret;
|
| 2335 | 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);
|
| 2336 | if (ret != NULL)
|
| 2337 | return G_DBUS_OBJECT_MANAGER (ret);
|
| 2338 | else
|
| 2339 | return NULL;
|
| 2340 | }
|
| 2341 |
|
| 2342 |
|
| 2343 | /**
|
| 2344 | * object_manager_client_new_for_bus:
|
| 2345 | * @bus_type: A #GBusType.
|
| 2346 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
|
| 2347 | * @name: A bus name (well-known or unique).
|
| 2348 | * @object_path: An object path.
|
| 2349 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 2350 | * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
| 2351 | * @user_data: User data to pass to @callback.
|
| 2352 | *
|
| 2353 | * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
|
| 2354 | *
|
| 2355 | * 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.
|
| 2356 | * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
|
| 2357 | *
|
| 2358 | * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
|
| 2359 | */
|
| 2360 | void
|
| 2361 | object_manager_client_new_for_bus (
|
| 2362 | GBusType bus_type,
|
| 2363 | GDBusObjectManagerClientFlags flags,
|
| 2364 | const gchar *name,
|
| 2365 | const gchar *object_path,
|
| 2366 | GCancellable *cancellable,
|
| 2367 | GAsyncReadyCallback callback,
|
| 2368 | gpointer user_data)
|
| 2369 | {
|
| 2370 | 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);
|
| 2371 | }
|
| 2372 |
|
| 2373 | /**
|
| 2374 | * object_manager_client_new_for_bus_finish:
|
| 2375 | * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
|
| 2376 | * @error: Return location for error or %NULL
|
| 2377 | *
|
| 2378 | * Finishes an operation started with object_manager_client_new_for_bus().
|
| 2379 | *
|
| 2380 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
|
| 2381 | */
|
| 2382 | GDBusObjectManager *
|
| 2383 | object_manager_client_new_for_bus_finish (
|
| 2384 | GAsyncResult *res,
|
| 2385 | GError **error)
|
| 2386 | {
|
| 2387 | GObject *ret;
|
| 2388 | GObject *source_object;
|
| 2389 | source_object = g_async_result_get_source_object (res);
|
| 2390 | ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
|
| 2391 | g_object_unref (source_object);
|
| 2392 | if (ret != NULL)
|
| 2393 | return G_DBUS_OBJECT_MANAGER (ret);
|
| 2394 | else
|
| 2395 | return NULL;
|
| 2396 | }
|
| 2397 |
|
| 2398 | /**
|
| 2399 | * object_manager_client_new_for_bus_sync:
|
| 2400 | * @bus_type: A #GBusType.
|
| 2401 | * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
|
| 2402 | * @name: A bus name (well-known or unique).
|
| 2403 | * @object_path: An object path.
|
| 2404 | * @cancellable: (allow-none): A #GCancellable or %NULL.
|
| 2405 | * @error: Return location for error or %NULL
|
| 2406 | *
|
| 2407 | * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
|
| 2408 | *
|
| 2409 | * The calling thread is blocked until a reply is received.
|
| 2410 | *
|
| 2411 | * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
|
| 2412 | *
|
| 2413 | * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
|
| 2414 | */
|
| 2415 | GDBusObjectManager *
|
| 2416 | object_manager_client_new_for_bus_sync (
|
| 2417 | GBusType bus_type,
|
| 2418 | GDBusObjectManagerClientFlags flags,
|
| 2419 | const gchar *name,
|
| 2420 | const gchar *object_path,
|
| 2421 | GCancellable *cancellable,
|
| 2422 | GError **error)
|
| 2423 | {
|
| 2424 | GInitable *ret;
|
| 2425 | 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);
|
| 2426 | if (ret != NULL)
|
| 2427 | return G_DBUS_OBJECT_MANAGER (ret);
|
| 2428 | else
|
| 2429 | return NULL;
|
| 2430 | }
|
| 2431 |
|
| 2432 |
|