1 /* 2 * Generated by gdbus-codegen 2.48.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 "openbmc_intf.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.Hwmon 153 * ------------------------------------------------------------------------ 154 */ 155 156 /** 157 * SECTION:Hwmon 158 * @title: Hwmon 159 * @short_description: Generated C code for the org.openbmc.Hwmon D-Bus interface 160 * 161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface in C. 162 */ 163 164 /* ---- Introspection data for org.openbmc.Hwmon ---- */ 165 166 static const _ExtendedGDBusPropertyInfo _hwmon_property_info_poll_interval = 167 { 168 { 169 -1, 170 (gchar *) "poll_interval", 171 (gchar *) "i", 172 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 173 NULL 174 }, 175 "poll-interval", 176 FALSE 177 }; 178 179 static const _ExtendedGDBusPropertyInfo _hwmon_property_info_sysfs_path = 180 { 181 { 182 -1, 183 (gchar *) "sysfs_path", 184 (gchar *) "s", 185 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 186 NULL 187 }, 188 "sysfs-path", 189 FALSE 190 }; 191 192 static const _ExtendedGDBusPropertyInfo _hwmon_property_info_scale = 193 { 194 { 195 -1, 196 (gchar *) "scale", 197 (gchar *) "i", 198 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 199 NULL 200 }, 201 "scale", 202 FALSE 203 }; 204 205 static const _ExtendedGDBusPropertyInfo * const _hwmon_property_info_pointers[] = 206 { 207 &_hwmon_property_info_poll_interval, 208 &_hwmon_property_info_sysfs_path, 209 &_hwmon_property_info_scale, 210 NULL 211 }; 212 213 static const _ExtendedGDBusInterfaceInfo _hwmon_interface_info = 214 { 215 { 216 -1, 217 (gchar *) "org.openbmc.Hwmon", 218 NULL, 219 NULL, 220 (GDBusPropertyInfo **) &_hwmon_property_info_pointers, 221 NULL 222 }, 223 "hwmon", 224 }; 225 226 227 /** 228 * hwmon_interface_info: 229 * 230 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface. 231 * 232 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 233 */ 234 GDBusInterfaceInfo * 235 hwmon_interface_info (void) 236 { 237 return (GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct; 238 } 239 240 /** 241 * hwmon_override_properties: 242 * @klass: The class structure for a #GObject<!-- -->-derived class. 243 * @property_id_begin: The property id to assign to the first overridden property. 244 * 245 * Overrides all #GObject properties in the #Hwmon interface for a concrete class. 246 * The properties are overridden in the order they are defined. 247 * 248 * Returns: The last property id. 249 */ 250 guint 251 hwmon_override_properties (GObjectClass *klass, guint property_id_begin) 252 { 253 g_object_class_override_property (klass, property_id_begin++, "poll-interval"); 254 g_object_class_override_property (klass, property_id_begin++, "sysfs-path"); 255 g_object_class_override_property (klass, property_id_begin++, "scale"); 256 return property_id_begin - 1; 257 } 258 259 260 261 /** 262 * Hwmon: 263 * 264 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. 265 */ 266 267 /** 268 * HwmonIface: 269 * @parent_iface: The parent interface. 270 * @get_poll_interval: Getter for the #Hwmon:poll-interval property. 271 * @get_scale: Getter for the #Hwmon:scale property. 272 * @get_sysfs_path: Getter for the #Hwmon:sysfs-path property. 273 * 274 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. 275 */ 276 277 typedef HwmonIface HwmonInterface; 278 G_DEFINE_INTERFACE (Hwmon, hwmon, G_TYPE_OBJECT); 279 280 static void 281 hwmon_default_init (HwmonIface *iface) 282 { 283 /* GObject properties for D-Bus properties: */ 284 /** 285 * Hwmon:poll-interval: 286 * 287 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link>. 288 * 289 * 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. 290 */ 291 g_object_interface_install_property (iface, 292 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 293 /** 294 * Hwmon:sysfs-path: 295 * 296 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link>. 297 * 298 * 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. 299 */ 300 g_object_interface_install_property (iface, 301 g_param_spec_string ("sysfs-path", "sysfs_path", "sysfs_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 302 /** 303 * Hwmon:scale: 304 * 305 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link>. 306 * 307 * 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. 308 */ 309 g_object_interface_install_property (iface, 310 g_param_spec_int ("scale", "scale", "scale", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 311 } 312 313 /** 314 * hwmon_get_poll_interval: (skip) 315 * @object: A #Hwmon. 316 * 317 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property. 318 * 319 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 320 * 321 * Returns: The property value. 322 */ 323 gint 324 hwmon_get_poll_interval (Hwmon *object) 325 { 326 return HWMON_GET_IFACE (object)->get_poll_interval (object); 327 } 328 329 /** 330 * hwmon_set_poll_interval: (skip) 331 * @object: A #Hwmon. 332 * @value: The value to set. 333 * 334 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property to @value. 335 * 336 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 337 */ 338 void 339 hwmon_set_poll_interval (Hwmon *object, gint value) 340 { 341 g_object_set (G_OBJECT (object), "poll-interval", value, NULL); 342 } 343 344 /** 345 * hwmon_get_sysfs_path: (skip) 346 * @object: A #Hwmon. 347 * 348 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property. 349 * 350 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 351 * 352 * <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 hwmon_dup_sysfs_path() if on another thread.</warning> 353 * 354 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 355 */ 356 const gchar * 357 hwmon_get_sysfs_path (Hwmon *object) 358 { 359 return HWMON_GET_IFACE (object)->get_sysfs_path (object); 360 } 361 362 /** 363 * hwmon_dup_sysfs_path: (skip) 364 * @object: A #Hwmon. 365 * 366 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property. 367 * 368 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 369 * 370 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 371 */ 372 gchar * 373 hwmon_dup_sysfs_path (Hwmon *object) 374 { 375 gchar *value; 376 g_object_get (G_OBJECT (object), "sysfs-path", &value, NULL); 377 return value; 378 } 379 380 /** 381 * hwmon_set_sysfs_path: (skip) 382 * @object: A #Hwmon. 383 * @value: The value to set. 384 * 385 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property to @value. 386 * 387 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 388 */ 389 void 390 hwmon_set_sysfs_path (Hwmon *object, const gchar *value) 391 { 392 g_object_set (G_OBJECT (object), "sysfs-path", value, NULL); 393 } 394 395 /** 396 * hwmon_get_scale: (skip) 397 * @object: A #Hwmon. 398 * 399 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property. 400 * 401 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 402 * 403 * Returns: The property value. 404 */ 405 gint 406 hwmon_get_scale (Hwmon *object) 407 { 408 return HWMON_GET_IFACE (object)->get_scale (object); 409 } 410 411 /** 412 * hwmon_set_scale: (skip) 413 * @object: A #Hwmon. 414 * @value: The value to set. 415 * 416 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property to @value. 417 * 418 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 419 */ 420 void 421 hwmon_set_scale (Hwmon *object, gint value) 422 { 423 g_object_set (G_OBJECT (object), "scale", value, NULL); 424 } 425 426 /* ------------------------------------------------------------------------ */ 427 428 /** 429 * HwmonProxy: 430 * 431 * The #HwmonProxy structure contains only private data and should only be accessed using the provided API. 432 */ 433 434 /** 435 * HwmonProxyClass: 436 * @parent_class: The parent class. 437 * 438 * Class structure for #HwmonProxy. 439 */ 440 441 struct _HwmonProxyPrivate 442 { 443 GData *qdata; 444 }; 445 446 static void hwmon_proxy_iface_init (HwmonIface *iface); 447 448 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 449 G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY, 450 G_ADD_PRIVATE (HwmonProxy) 451 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init)); 452 453 #else 454 G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY, 455 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init)); 456 457 #endif 458 static void 459 hwmon_proxy_finalize (GObject *object) 460 { 461 HwmonProxy *proxy = HWMON_PROXY (object); 462 g_datalist_clear (&proxy->priv->qdata); 463 G_OBJECT_CLASS (hwmon_proxy_parent_class)->finalize (object); 464 } 465 466 static void 467 hwmon_proxy_get_property (GObject *object, 468 guint prop_id, 469 GValue *value, 470 GParamSpec *pspec G_GNUC_UNUSED) 471 { 472 const _ExtendedGDBusPropertyInfo *info; 473 GVariant *variant; 474 g_assert (prop_id != 0 && prop_id - 1 < 3); 475 info = _hwmon_property_info_pointers[prop_id - 1]; 476 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 477 if (info->use_gvariant) 478 { 479 g_value_set_variant (value, variant); 480 } 481 else 482 { 483 if (variant != NULL) 484 g_dbus_gvariant_to_gvalue (variant, value); 485 } 486 if (variant != NULL) 487 g_variant_unref (variant); 488 } 489 490 static void 491 hwmon_proxy_set_property_cb (GDBusProxy *proxy, 492 GAsyncResult *res, 493 gpointer user_data) 494 { 495 const _ExtendedGDBusPropertyInfo *info = user_data; 496 GError *error; 497 GVariant *_ret; 498 error = NULL; 499 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 500 if (!_ret) 501 { 502 g_warning ("Error setting property '%s' on interface org.openbmc.Hwmon: %s (%s, %d)", 503 info->parent_struct.name, 504 error->message, g_quark_to_string (error->domain), error->code); 505 g_error_free (error); 506 } 507 else 508 { 509 g_variant_unref (_ret); 510 } 511 } 512 513 static void 514 hwmon_proxy_set_property (GObject *object, 515 guint prop_id, 516 const GValue *value, 517 GParamSpec *pspec G_GNUC_UNUSED) 518 { 519 const _ExtendedGDBusPropertyInfo *info; 520 GVariant *variant; 521 g_assert (prop_id != 0 && prop_id - 1 < 3); 522 info = _hwmon_property_info_pointers[prop_id - 1]; 523 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 524 g_dbus_proxy_call (G_DBUS_PROXY (object), 525 "org.freedesktop.DBus.Properties.Set", 526 g_variant_new ("(ssv)", "org.openbmc.Hwmon", info->parent_struct.name, variant), 527 G_DBUS_CALL_FLAGS_NONE, 528 -1, 529 NULL, (GAsyncReadyCallback) hwmon_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 530 g_variant_unref (variant); 531 } 532 533 static void 534 hwmon_proxy_g_signal (GDBusProxy *proxy, 535 const gchar *sender_name G_GNUC_UNUSED, 536 const gchar *signal_name, 537 GVariant *parameters) 538 { 539 _ExtendedGDBusSignalInfo *info; 540 GVariantIter iter; 541 GVariant *child; 542 GValue *paramv; 543 guint num_params; 544 guint n; 545 guint signal_id; 546 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, signal_name); 547 if (info == NULL) 548 return; 549 num_params = g_variant_n_children (parameters); 550 paramv = g_new0 (GValue, num_params + 1); 551 g_value_init (¶mv[0], TYPE_HWMON); 552 g_value_set_object (¶mv[0], proxy); 553 g_variant_iter_init (&iter, parameters); 554 n = 1; 555 while ((child = g_variant_iter_next_value (&iter)) != NULL) 556 { 557 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 558 if (arg_info->use_gvariant) 559 { 560 g_value_init (¶mv[n], G_TYPE_VARIANT); 561 g_value_set_variant (¶mv[n], child); 562 n++; 563 } 564 else 565 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 566 g_variant_unref (child); 567 } 568 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON); 569 g_signal_emitv (paramv, signal_id, 0, NULL); 570 for (n = 0; n < num_params + 1; n++) 571 g_value_unset (¶mv[n]); 572 g_free (paramv); 573 } 574 575 static void 576 hwmon_proxy_g_properties_changed (GDBusProxy *_proxy, 577 GVariant *changed_properties, 578 const gchar *const *invalidated_properties) 579 { 580 HwmonProxy *proxy = HWMON_PROXY (_proxy); 581 guint n; 582 const gchar *key; 583 GVariantIter *iter; 584 _ExtendedGDBusPropertyInfo *info; 585 g_variant_get (changed_properties, "a{sv}", &iter); 586 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 587 { 588 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, key); 589 g_datalist_remove_data (&proxy->priv->qdata, key); 590 if (info != NULL) 591 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 592 } 593 g_variant_iter_free (iter); 594 for (n = 0; invalidated_properties[n] != NULL; n++) 595 { 596 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, invalidated_properties[n]); 597 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 598 if (info != NULL) 599 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 600 } 601 } 602 603 static gint 604 hwmon_proxy_get_poll_interval (Hwmon *object) 605 { 606 HwmonProxy *proxy = HWMON_PROXY (object); 607 GVariant *variant; 608 gint value = 0; 609 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); 610 if (variant != NULL) 611 { 612 value = g_variant_get_int32 (variant); 613 g_variant_unref (variant); 614 } 615 return value; 616 } 617 618 static const gchar * 619 hwmon_proxy_get_sysfs_path (Hwmon *object) 620 { 621 HwmonProxy *proxy = HWMON_PROXY (object); 622 GVariant *variant; 623 const gchar *value = NULL; 624 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "sysfs_path"); 625 if (variant != NULL) 626 { 627 value = g_variant_get_string (variant, NULL); 628 g_variant_unref (variant); 629 } 630 return value; 631 } 632 633 static gint 634 hwmon_proxy_get_scale (Hwmon *object) 635 { 636 HwmonProxy *proxy = HWMON_PROXY (object); 637 GVariant *variant; 638 gint value = 0; 639 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "scale"); 640 if (variant != NULL) 641 { 642 value = g_variant_get_int32 (variant); 643 g_variant_unref (variant); 644 } 645 return value; 646 } 647 648 static void 649 hwmon_proxy_init (HwmonProxy *proxy) 650 { 651 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 652 proxy->priv = hwmon_proxy_get_instance_private (proxy); 653 #else 654 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HWMON_PROXY, HwmonProxyPrivate); 655 #endif 656 657 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), hwmon_interface_info ()); 658 } 659 660 static void 661 hwmon_proxy_class_init (HwmonProxyClass *klass) 662 { 663 GObjectClass *gobject_class; 664 GDBusProxyClass *proxy_class; 665 666 gobject_class = G_OBJECT_CLASS (klass); 667 gobject_class->finalize = hwmon_proxy_finalize; 668 gobject_class->get_property = hwmon_proxy_get_property; 669 gobject_class->set_property = hwmon_proxy_set_property; 670 671 proxy_class = G_DBUS_PROXY_CLASS (klass); 672 proxy_class->g_signal = hwmon_proxy_g_signal; 673 proxy_class->g_properties_changed = hwmon_proxy_g_properties_changed; 674 675 hwmon_override_properties (gobject_class, 1); 676 677 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 678 g_type_class_add_private (klass, sizeof (HwmonProxyPrivate)); 679 #endif 680 } 681 682 static void 683 hwmon_proxy_iface_init (HwmonIface *iface) 684 { 685 iface->get_poll_interval = hwmon_proxy_get_poll_interval; 686 iface->get_sysfs_path = hwmon_proxy_get_sysfs_path; 687 iface->get_scale = hwmon_proxy_get_scale; 688 } 689 690 /** 691 * hwmon_proxy_new: 692 * @connection: A #GDBusConnection. 693 * @flags: Flags from the #GDBusProxyFlags enumeration. 694 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 695 * @object_path: An object path. 696 * @cancellable: (allow-none): A #GCancellable or %NULL. 697 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 698 * @user_data: User data to pass to @callback. 699 * 700 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. See g_dbus_proxy_new() for more details. 701 * 702 * 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. 703 * You can then call hwmon_proxy_new_finish() to get the result of the operation. 704 * 705 * See hwmon_proxy_new_sync() for the synchronous, blocking version of this constructor. 706 */ 707 void 708 hwmon_proxy_new ( 709 GDBusConnection *connection, 710 GDBusProxyFlags flags, 711 const gchar *name, 712 const gchar *object_path, 713 GCancellable *cancellable, 714 GAsyncReadyCallback callback, 715 gpointer user_data) 716 { 717 g_async_initable_new_async (TYPE_HWMON_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.Hwmon", NULL); 718 } 719 720 /** 721 * hwmon_proxy_new_finish: 722 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new(). 723 * @error: Return location for error or %NULL 724 * 725 * Finishes an operation started with hwmon_proxy_new(). 726 * 727 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set. 728 */ 729 Hwmon * 730 hwmon_proxy_new_finish ( 731 GAsyncResult *res, 732 GError **error) 733 { 734 GObject *ret; 735 GObject *source_object; 736 source_object = g_async_result_get_source_object (res); 737 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 738 g_object_unref (source_object); 739 if (ret != NULL) 740 return HWMON (ret); 741 else 742 return NULL; 743 } 744 745 /** 746 * hwmon_proxy_new_sync: 747 * @connection: A #GDBusConnection. 748 * @flags: Flags from the #GDBusProxyFlags enumeration. 749 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 750 * @object_path: An object path. 751 * @cancellable: (allow-none): A #GCancellable or %NULL. 752 * @error: Return location for error or %NULL 753 * 754 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. See g_dbus_proxy_new_sync() for more details. 755 * 756 * The calling thread is blocked until a reply is received. 757 * 758 * See hwmon_proxy_new() for the asynchronous version of this constructor. 759 * 760 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set. 761 */ 762 Hwmon * 763 hwmon_proxy_new_sync ( 764 GDBusConnection *connection, 765 GDBusProxyFlags flags, 766 const gchar *name, 767 const gchar *object_path, 768 GCancellable *cancellable, 769 GError **error) 770 { 771 GInitable *ret; 772 ret = g_initable_new (TYPE_HWMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL); 773 if (ret != NULL) 774 return HWMON (ret); 775 else 776 return NULL; 777 } 778 779 780 /** 781 * hwmon_proxy_new_for_bus: 782 * @bus_type: A #GBusType. 783 * @flags: Flags from the #GDBusProxyFlags enumeration. 784 * @name: A bus name (well-known or unique). 785 * @object_path: An object path. 786 * @cancellable: (allow-none): A #GCancellable or %NULL. 787 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 788 * @user_data: User data to pass to @callback. 789 * 790 * Like hwmon_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 791 * 792 * 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. 793 * You can then call hwmon_proxy_new_for_bus_finish() to get the result of the operation. 794 * 795 * See hwmon_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 796 */ 797 void 798 hwmon_proxy_new_for_bus ( 799 GBusType bus_type, 800 GDBusProxyFlags flags, 801 const gchar *name, 802 const gchar *object_path, 803 GCancellable *cancellable, 804 GAsyncReadyCallback callback, 805 gpointer user_data) 806 { 807 g_async_initable_new_async (TYPE_HWMON_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.Hwmon", NULL); 808 } 809 810 /** 811 * hwmon_proxy_new_for_bus_finish: 812 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new_for_bus(). 813 * @error: Return location for error or %NULL 814 * 815 * Finishes an operation started with hwmon_proxy_new_for_bus(). 816 * 817 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set. 818 */ 819 Hwmon * 820 hwmon_proxy_new_for_bus_finish ( 821 GAsyncResult *res, 822 GError **error) 823 { 824 GObject *ret; 825 GObject *source_object; 826 source_object = g_async_result_get_source_object (res); 827 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 828 g_object_unref (source_object); 829 if (ret != NULL) 830 return HWMON (ret); 831 else 832 return NULL; 833 } 834 835 /** 836 * hwmon_proxy_new_for_bus_sync: 837 * @bus_type: A #GBusType. 838 * @flags: Flags from the #GDBusProxyFlags enumeration. 839 * @name: A bus name (well-known or unique). 840 * @object_path: An object path. 841 * @cancellable: (allow-none): A #GCancellable or %NULL. 842 * @error: Return location for error or %NULL 843 * 844 * Like hwmon_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 845 * 846 * The calling thread is blocked until a reply is received. 847 * 848 * See hwmon_proxy_new_for_bus() for the asynchronous version of this constructor. 849 * 850 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set. 851 */ 852 Hwmon * 853 hwmon_proxy_new_for_bus_sync ( 854 GBusType bus_type, 855 GDBusProxyFlags flags, 856 const gchar *name, 857 const gchar *object_path, 858 GCancellable *cancellable, 859 GError **error) 860 { 861 GInitable *ret; 862 ret = g_initable_new (TYPE_HWMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL); 863 if (ret != NULL) 864 return HWMON (ret); 865 else 866 return NULL; 867 } 868 869 870 /* ------------------------------------------------------------------------ */ 871 872 /** 873 * HwmonSkeleton: 874 * 875 * The #HwmonSkeleton structure contains only private data and should only be accessed using the provided API. 876 */ 877 878 /** 879 * HwmonSkeletonClass: 880 * @parent_class: The parent class. 881 * 882 * Class structure for #HwmonSkeleton. 883 */ 884 885 struct _HwmonSkeletonPrivate 886 { 887 GValue *properties; 888 GList *changed_properties; 889 GSource *changed_properties_idle_source; 890 GMainContext *context; 891 GMutex lock; 892 }; 893 894 static void 895 _hwmon_skeleton_handle_method_call ( 896 GDBusConnection *connection G_GNUC_UNUSED, 897 const gchar *sender G_GNUC_UNUSED, 898 const gchar *object_path G_GNUC_UNUSED, 899 const gchar *interface_name, 900 const gchar *method_name, 901 GVariant *parameters, 902 GDBusMethodInvocation *invocation, 903 gpointer user_data) 904 { 905 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data); 906 _ExtendedGDBusMethodInfo *info; 907 GVariantIter iter; 908 GVariant *child; 909 GValue *paramv; 910 guint num_params; 911 guint num_extra; 912 guint n; 913 guint signal_id; 914 GValue return_value = G_VALUE_INIT; 915 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 916 g_assert (info != NULL); 917 num_params = g_variant_n_children (parameters); 918 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 919 n = 0; 920 g_value_init (¶mv[n], TYPE_HWMON); 921 g_value_set_object (¶mv[n++], skeleton); 922 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 923 g_value_set_object (¶mv[n++], invocation); 924 if (info->pass_fdlist) 925 { 926 #ifdef G_OS_UNIX 927 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 928 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 929 #else 930 g_assert_not_reached (); 931 #endif 932 } 933 g_variant_iter_init (&iter, parameters); 934 while ((child = g_variant_iter_next_value (&iter)) != NULL) 935 { 936 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 937 if (arg_info->use_gvariant) 938 { 939 g_value_init (¶mv[n], G_TYPE_VARIANT); 940 g_value_set_variant (¶mv[n], child); 941 n++; 942 } 943 else 944 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 945 g_variant_unref (child); 946 } 947 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON); 948 g_value_init (&return_value, G_TYPE_BOOLEAN); 949 g_signal_emitv (paramv, signal_id, 0, &return_value); 950 if (!g_value_get_boolean (&return_value)) 951 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); 952 g_value_unset (&return_value); 953 for (n = 0; n < num_params + num_extra; n++) 954 g_value_unset (¶mv[n]); 955 g_free (paramv); 956 } 957 958 static GVariant * 959 _hwmon_skeleton_handle_get_property ( 960 GDBusConnection *connection G_GNUC_UNUSED, 961 const gchar *sender G_GNUC_UNUSED, 962 const gchar *object_path G_GNUC_UNUSED, 963 const gchar *interface_name G_GNUC_UNUSED, 964 const gchar *property_name, 965 GError **error, 966 gpointer user_data) 967 { 968 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data); 969 GValue value = G_VALUE_INIT; 970 GParamSpec *pspec; 971 _ExtendedGDBusPropertyInfo *info; 972 GVariant *ret; 973 ret = NULL; 974 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name); 975 g_assert (info != NULL); 976 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 977 if (pspec == NULL) 978 { 979 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 980 } 981 else 982 { 983 g_value_init (&value, pspec->value_type); 984 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 985 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 986 g_value_unset (&value); 987 } 988 return ret; 989 } 990 991 static gboolean 992 _hwmon_skeleton_handle_set_property ( 993 GDBusConnection *connection G_GNUC_UNUSED, 994 const gchar *sender G_GNUC_UNUSED, 995 const gchar *object_path G_GNUC_UNUSED, 996 const gchar *interface_name G_GNUC_UNUSED, 997 const gchar *property_name, 998 GVariant *variant, 999 GError **error, 1000 gpointer user_data) 1001 { 1002 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data); 1003 GValue value = G_VALUE_INIT; 1004 GParamSpec *pspec; 1005 _ExtendedGDBusPropertyInfo *info; 1006 gboolean ret; 1007 ret = FALSE; 1008 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name); 1009 g_assert (info != NULL); 1010 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 1011 if (pspec == NULL) 1012 { 1013 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 1014 } 1015 else 1016 { 1017 if (info->use_gvariant) 1018 g_value_set_variant (&value, variant); 1019 else 1020 g_dbus_gvariant_to_gvalue (variant, &value); 1021 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 1022 g_value_unset (&value); 1023 ret = TRUE; 1024 } 1025 return ret; 1026 } 1027 1028 static const GDBusInterfaceVTable _hwmon_skeleton_vtable = 1029 { 1030 _hwmon_skeleton_handle_method_call, 1031 _hwmon_skeleton_handle_get_property, 1032 _hwmon_skeleton_handle_set_property, 1033 {NULL} 1034 }; 1035 1036 static GDBusInterfaceInfo * 1037 hwmon_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 1038 { 1039 return hwmon_interface_info (); 1040 } 1041 1042 static GDBusInterfaceVTable * 1043 hwmon_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 1044 { 1045 return (GDBusInterfaceVTable *) &_hwmon_skeleton_vtable; 1046 } 1047 1048 static GVariant * 1049 hwmon_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 1050 { 1051 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton); 1052 1053 GVariantBuilder builder; 1054 guint n; 1055 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 1056 if (_hwmon_interface_info.parent_struct.properties == NULL) 1057 goto out; 1058 for (n = 0; _hwmon_interface_info.parent_struct.properties[n] != NULL; n++) 1059 { 1060 GDBusPropertyInfo *info = _hwmon_interface_info.parent_struct.properties[n]; 1061 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 1062 { 1063 GVariant *value; 1064 value = _hwmon_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.Hwmon", info->name, NULL, skeleton); 1065 if (value != NULL) 1066 { 1067 g_variant_take_ref (value); 1068 g_variant_builder_add (&builder, "{sv}", info->name, value); 1069 g_variant_unref (value); 1070 } 1071 } 1072 } 1073 out: 1074 return g_variant_builder_end (&builder); 1075 } 1076 1077 static gboolean _hwmon_emit_changed (gpointer user_data); 1078 1079 static void 1080 hwmon_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 1081 { 1082 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton); 1083 gboolean emit_changed = FALSE; 1084 1085 g_mutex_lock (&skeleton->priv->lock); 1086 if (skeleton->priv->changed_properties_idle_source != NULL) 1087 { 1088 g_source_destroy (skeleton->priv->changed_properties_idle_source); 1089 skeleton->priv->changed_properties_idle_source = NULL; 1090 emit_changed = TRUE; 1091 } 1092 g_mutex_unlock (&skeleton->priv->lock); 1093 1094 if (emit_changed) 1095 _hwmon_emit_changed (skeleton); 1096 } 1097 1098 static void hwmon_skeleton_iface_init (HwmonIface *iface); 1099 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 1100 G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 1101 G_ADD_PRIVATE (HwmonSkeleton) 1102 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init)); 1103 1104 #else 1105 G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 1106 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init)); 1107 1108 #endif 1109 static void 1110 hwmon_skeleton_finalize (GObject *object) 1111 { 1112 HwmonSkeleton *skeleton = HWMON_SKELETON (object); 1113 guint n; 1114 for (n = 0; n < 3; n++) 1115 g_value_unset (&skeleton->priv->properties[n]); 1116 g_free (skeleton->priv->properties); 1117 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 1118 if (skeleton->priv->changed_properties_idle_source != NULL) 1119 g_source_destroy (skeleton->priv->changed_properties_idle_source); 1120 g_main_context_unref (skeleton->priv->context); 1121 g_mutex_clear (&skeleton->priv->lock); 1122 G_OBJECT_CLASS (hwmon_skeleton_parent_class)->finalize (object); 1123 } 1124 1125 static void 1126 hwmon_skeleton_get_property (GObject *object, 1127 guint prop_id, 1128 GValue *value, 1129 GParamSpec *pspec G_GNUC_UNUSED) 1130 { 1131 HwmonSkeleton *skeleton = HWMON_SKELETON (object); 1132 g_assert (prop_id != 0 && prop_id - 1 < 3); 1133 g_mutex_lock (&skeleton->priv->lock); 1134 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 1135 g_mutex_unlock (&skeleton->priv->lock); 1136 } 1137 1138 static gboolean 1139 _hwmon_emit_changed (gpointer user_data) 1140 { 1141 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data); 1142 GList *l; 1143 GVariantBuilder builder; 1144 GVariantBuilder invalidated_builder; 1145 guint num_changes; 1146 1147 g_mutex_lock (&skeleton->priv->lock); 1148 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 1149 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 1150 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 1151 { 1152 ChangedProperty *cp = l->data; 1153 GVariant *variant; 1154 const GValue *cur_value; 1155 1156 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 1157 if (!_g_value_equal (cur_value, &cp->orig_value)) 1158 { 1159 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 1160 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 1161 g_variant_unref (variant); 1162 num_changes++; 1163 } 1164 } 1165 if (num_changes > 0) 1166 { 1167 GList *connections, *ll; 1168 GVariant *signal_variant; 1169 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Hwmon", 1170 &builder, &invalidated_builder)); 1171 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 1172 for (ll = connections; ll != NULL; ll = ll->next) 1173 { 1174 GDBusConnection *connection = ll->data; 1175 1176 g_dbus_connection_emit_signal (connection, 1177 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 1178 "org.freedesktop.DBus.Properties", 1179 "PropertiesChanged", 1180 signal_variant, 1181 NULL); 1182 } 1183 g_variant_unref (signal_variant); 1184 g_list_free_full (connections, g_object_unref); 1185 } 1186 else 1187 { 1188 g_variant_builder_clear (&builder); 1189 g_variant_builder_clear (&invalidated_builder); 1190 } 1191 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 1192 skeleton->priv->changed_properties = NULL; 1193 skeleton->priv->changed_properties_idle_source = NULL; 1194 g_mutex_unlock (&skeleton->priv->lock); 1195 return FALSE; 1196 } 1197 1198 static void 1199 _hwmon_schedule_emit_changed (HwmonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 1200 { 1201 ChangedProperty *cp; 1202 GList *l; 1203 cp = NULL; 1204 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 1205 { 1206 ChangedProperty *i_cp = l->data; 1207 if (i_cp->info == info) 1208 { 1209 cp = i_cp; 1210 break; 1211 } 1212 } 1213 if (cp == NULL) 1214 { 1215 cp = g_new0 (ChangedProperty, 1); 1216 cp->prop_id = prop_id; 1217 cp->info = info; 1218 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 1219 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 1220 g_value_copy (orig_value, &cp->orig_value); 1221 } 1222 } 1223 1224 static void 1225 hwmon_skeleton_notify (GObject *object, 1226 GParamSpec *pspec G_GNUC_UNUSED) 1227 { 1228 HwmonSkeleton *skeleton = HWMON_SKELETON (object); 1229 g_mutex_lock (&skeleton->priv->lock); 1230 if (skeleton->priv->changed_properties != NULL && 1231 skeleton->priv->changed_properties_idle_source == NULL) 1232 { 1233 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 1234 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 1235 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _hwmon_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 1236 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _hwmon_emit_changed"); 1237 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 1238 g_source_unref (skeleton->priv->changed_properties_idle_source); 1239 } 1240 g_mutex_unlock (&skeleton->priv->lock); 1241 } 1242 1243 static void 1244 hwmon_skeleton_set_property (GObject *object, 1245 guint prop_id, 1246 const GValue *value, 1247 GParamSpec *pspec) 1248 { 1249 HwmonSkeleton *skeleton = HWMON_SKELETON (object); 1250 g_assert (prop_id != 0 && prop_id - 1 < 3); 1251 g_mutex_lock (&skeleton->priv->lock); 1252 g_object_freeze_notify (object); 1253 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 1254 { 1255 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 1256 _hwmon_schedule_emit_changed (skeleton, _hwmon_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 1257 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 1258 g_object_notify_by_pspec (object, pspec); 1259 } 1260 g_mutex_unlock (&skeleton->priv->lock); 1261 g_object_thaw_notify (object); 1262 } 1263 1264 static void 1265 hwmon_skeleton_init (HwmonSkeleton *skeleton) 1266 { 1267 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 1268 skeleton->priv = hwmon_skeleton_get_instance_private (skeleton); 1269 #else 1270 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HWMON_SKELETON, HwmonSkeletonPrivate); 1271 #endif 1272 1273 g_mutex_init (&skeleton->priv->lock); 1274 skeleton->priv->context = g_main_context_ref_thread_default (); 1275 skeleton->priv->properties = g_new0 (GValue, 3); 1276 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); 1277 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); 1278 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); 1279 } 1280 1281 static gint 1282 hwmon_skeleton_get_poll_interval (Hwmon *object) 1283 { 1284 HwmonSkeleton *skeleton = HWMON_SKELETON (object); 1285 gint value; 1286 g_mutex_lock (&skeleton->priv->lock); 1287 value = g_value_get_int (&(skeleton->priv->properties[0])); 1288 g_mutex_unlock (&skeleton->priv->lock); 1289 return value; 1290 } 1291 1292 static const gchar * 1293 hwmon_skeleton_get_sysfs_path (Hwmon *object) 1294 { 1295 HwmonSkeleton *skeleton = HWMON_SKELETON (object); 1296 const gchar *value; 1297 g_mutex_lock (&skeleton->priv->lock); 1298 value = g_value_get_string (&(skeleton->priv->properties[1])); 1299 g_mutex_unlock (&skeleton->priv->lock); 1300 return value; 1301 } 1302 1303 static gint 1304 hwmon_skeleton_get_scale (Hwmon *object) 1305 { 1306 HwmonSkeleton *skeleton = HWMON_SKELETON (object); 1307 gint value; 1308 g_mutex_lock (&skeleton->priv->lock); 1309 value = g_value_get_int (&(skeleton->priv->properties[2])); 1310 g_mutex_unlock (&skeleton->priv->lock); 1311 return value; 1312 } 1313 1314 static void 1315 hwmon_skeleton_class_init (HwmonSkeletonClass *klass) 1316 { 1317 GObjectClass *gobject_class; 1318 GDBusInterfaceSkeletonClass *skeleton_class; 1319 1320 gobject_class = G_OBJECT_CLASS (klass); 1321 gobject_class->finalize = hwmon_skeleton_finalize; 1322 gobject_class->get_property = hwmon_skeleton_get_property; 1323 gobject_class->set_property = hwmon_skeleton_set_property; 1324 gobject_class->notify = hwmon_skeleton_notify; 1325 1326 1327 hwmon_override_properties (gobject_class, 1); 1328 1329 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 1330 skeleton_class->get_info = hwmon_skeleton_dbus_interface_get_info; 1331 skeleton_class->get_properties = hwmon_skeleton_dbus_interface_get_properties; 1332 skeleton_class->flush = hwmon_skeleton_dbus_interface_flush; 1333 skeleton_class->get_vtable = hwmon_skeleton_dbus_interface_get_vtable; 1334 1335 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 1336 g_type_class_add_private (klass, sizeof (HwmonSkeletonPrivate)); 1337 #endif 1338 } 1339 1340 static void 1341 hwmon_skeleton_iface_init (HwmonIface *iface) 1342 { 1343 iface->get_poll_interval = hwmon_skeleton_get_poll_interval; 1344 iface->get_sysfs_path = hwmon_skeleton_get_sysfs_path; 1345 iface->get_scale = hwmon_skeleton_get_scale; 1346 } 1347 1348 /** 1349 * hwmon_skeleton_new: 1350 * 1351 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. 1352 * 1353 * Returns: (transfer full) (type HwmonSkeleton): The skeleton object. 1354 */ 1355 Hwmon * 1356 hwmon_skeleton_new (void) 1357 { 1358 return HWMON (g_object_new (TYPE_HWMON_SKELETON, NULL)); 1359 } 1360 1361 /* ------------------------------------------------------------------------ 1362 * Code for interface org.openbmc.Fan 1363 * ------------------------------------------------------------------------ 1364 */ 1365 1366 /** 1367 * SECTION:Fan 1368 * @title: Fan 1369 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface 1370 * 1371 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface in C. 1372 */ 1373 1374 /* ---- Introspection data for org.openbmc.Fan ---- */ 1375 1376 static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone = 1377 { 1378 { 1379 -1, 1380 (gchar *) "cooling_zone", 1381 (gchar *) "i", 1382 NULL 1383 }, 1384 FALSE 1385 }; 1386 1387 static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] = 1388 { 1389 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone, 1390 NULL 1391 }; 1392 1393 static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone = 1394 { 1395 { 1396 -1, 1397 (gchar *) "setCoolingZone", 1398 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers, 1399 NULL, 1400 NULL 1401 }, 1402 "handle-set-cooling-zone", 1403 FALSE 1404 }; 1405 1406 static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed = 1407 { 1408 { 1409 -1, 1410 (gchar *) "speed", 1411 (gchar *) "i", 1412 NULL 1413 }, 1414 FALSE 1415 }; 1416 1417 static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] = 1418 { 1419 &_fan_method_info_get_speed_OUT_ARG_speed, 1420 NULL 1421 }; 1422 1423 static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed = 1424 { 1425 { 1426 -1, 1427 (gchar *) "getSpeed", 1428 NULL, 1429 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers, 1430 NULL 1431 }, 1432 "handle-get-speed", 1433 FALSE 1434 }; 1435 1436 static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed = 1437 { 1438 { 1439 -1, 1440 (gchar *) "speed", 1441 (gchar *) "i", 1442 NULL 1443 }, 1444 FALSE 1445 }; 1446 1447 static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] = 1448 { 1449 &_fan_method_info_set_speed_IN_ARG_speed, 1450 NULL 1451 }; 1452 1453 static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed = 1454 { 1455 { 1456 -1, 1457 (gchar *) "setSpeed", 1458 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers, 1459 NULL, 1460 NULL 1461 }, 1462 "handle-set-speed", 1463 FALSE 1464 }; 1465 1466 static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] = 1467 { 1468 &_fan_method_info_set_cooling_zone, 1469 &_fan_method_info_get_speed, 1470 &_fan_method_info_set_speed, 1471 NULL 1472 }; 1473 1474 static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed = 1475 { 1476 { 1477 -1, 1478 (gchar *) "speed", 1479 (gchar *) "i", 1480 NULL 1481 }, 1482 FALSE 1483 }; 1484 1485 static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] = 1486 { 1487 &_fan_signal_info_speed_changed_ARG_speed, 1488 NULL 1489 }; 1490 1491 static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed = 1492 { 1493 { 1494 -1, 1495 (gchar *) "SpeedChanged", 1496 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers, 1497 NULL 1498 }, 1499 "speed-changed" 1500 }; 1501 1502 static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error = 1503 { 1504 { 1505 -1, 1506 (gchar *) "TachError", 1507 NULL, 1508 NULL 1509 }, 1510 "tach-error" 1511 }; 1512 1513 static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] = 1514 { 1515 &_fan_signal_info_speed_changed, 1516 &_fan_signal_info_tach_error, 1517 NULL 1518 }; 1519 1520 static const _ExtendedGDBusPropertyInfo _fan_property_info_speed = 1521 { 1522 { 1523 -1, 1524 (gchar *) "speed", 1525 (gchar *) "i", 1526 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 1527 NULL 1528 }, 1529 "speed", 1530 FALSE 1531 }; 1532 1533 static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone = 1534 { 1535 { 1536 -1, 1537 (gchar *) "cooling_zone", 1538 (gchar *) "i", 1539 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 1540 NULL 1541 }, 1542 "cooling-zone", 1543 FALSE 1544 }; 1545 1546 static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num = 1547 { 1548 { 1549 -1, 1550 (gchar *) "pwm_num", 1551 (gchar *) "i", 1552 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 1553 NULL 1554 }, 1555 "pwm-num", 1556 FALSE 1557 }; 1558 1559 static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] = 1560 { 1561 &_fan_property_info_speed, 1562 &_fan_property_info_cooling_zone, 1563 &_fan_property_info_pwm_num, 1564 NULL 1565 }; 1566 1567 static const _ExtendedGDBusInterfaceInfo _fan_interface_info = 1568 { 1569 { 1570 -1, 1571 (gchar *) "org.openbmc.Fan", 1572 (GDBusMethodInfo **) &_fan_method_info_pointers, 1573 (GDBusSignalInfo **) &_fan_signal_info_pointers, 1574 (GDBusPropertyInfo **) &_fan_property_info_pointers, 1575 NULL 1576 }, 1577 "fan", 1578 }; 1579 1580 1581 /** 1582 * fan_interface_info: 1583 * 1584 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface. 1585 * 1586 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 1587 */ 1588 GDBusInterfaceInfo * 1589 fan_interface_info (void) 1590 { 1591 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct; 1592 } 1593 1594 /** 1595 * fan_override_properties: 1596 * @klass: The class structure for a #GObject<!-- -->-derived class. 1597 * @property_id_begin: The property id to assign to the first overridden property. 1598 * 1599 * Overrides all #GObject properties in the #Fan interface for a concrete class. 1600 * The properties are overridden in the order they are defined. 1601 * 1602 * Returns: The last property id. 1603 */ 1604 guint 1605 fan_override_properties (GObjectClass *klass, guint property_id_begin) 1606 { 1607 g_object_class_override_property (klass, property_id_begin++, "speed"); 1608 g_object_class_override_property (klass, property_id_begin++, "cooling-zone"); 1609 g_object_class_override_property (klass, property_id_begin++, "pwm-num"); 1610 return property_id_begin - 1; 1611 } 1612 1613 1614 1615 /** 1616 * Fan: 1617 * 1618 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. 1619 */ 1620 1621 /** 1622 * FanIface: 1623 * @parent_iface: The parent interface. 1624 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal. 1625 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal. 1626 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal. 1627 * @get_cooling_zone: Getter for the #Fan:cooling-zone property. 1628 * @get_pwm_num: Getter for the #Fan:pwm-num property. 1629 * @get_speed: Getter for the #Fan:speed property. 1630 * @speed_changed: Handler for the #Fan::speed-changed signal. 1631 * @tach_error: Handler for the #Fan::tach-error signal. 1632 * 1633 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. 1634 */ 1635 1636 typedef FanIface FanInterface; 1637 G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT); 1638 1639 static void 1640 fan_default_init (FanIface *iface) 1641 { 1642 /* GObject signals for incoming D-Bus method calls: */ 1643 /** 1644 * Fan::handle-set-cooling-zone: 1645 * @object: A #Fan. 1646 * @invocation: A #GDBusMethodInvocation. 1647 * @arg_cooling_zone: Argument passed by remote caller. 1648 * 1649 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method. 1650 * 1651 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call fan_complete_set_cooling_zone() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 1652 * 1653 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 1654 */ 1655 g_signal_new ("handle-set-cooling-zone", 1656 G_TYPE_FROM_INTERFACE (iface), 1657 G_SIGNAL_RUN_LAST, 1658 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone), 1659 g_signal_accumulator_true_handled, 1660 NULL, 1661 g_cclosure_marshal_generic, 1662 G_TYPE_BOOLEAN, 1663 2, 1664 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); 1665 1666 /** 1667 * Fan::handle-get-speed: 1668 * @object: A #Fan. 1669 * @invocation: A #GDBusMethodInvocation. 1670 * 1671 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method. 1672 * 1673 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call fan_complete_get_speed() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 1674 * 1675 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 1676 */ 1677 g_signal_new ("handle-get-speed", 1678 G_TYPE_FROM_INTERFACE (iface), 1679 G_SIGNAL_RUN_LAST, 1680 G_STRUCT_OFFSET (FanIface, handle_get_speed), 1681 g_signal_accumulator_true_handled, 1682 NULL, 1683 g_cclosure_marshal_generic, 1684 G_TYPE_BOOLEAN, 1685 1, 1686 G_TYPE_DBUS_METHOD_INVOCATION); 1687 1688 /** 1689 * Fan::handle-set-speed: 1690 * @object: A #Fan. 1691 * @invocation: A #GDBusMethodInvocation. 1692 * @arg_speed: Argument passed by remote caller. 1693 * 1694 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method. 1695 * 1696 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call fan_complete_set_speed() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 1697 * 1698 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 1699 */ 1700 g_signal_new ("handle-set-speed", 1701 G_TYPE_FROM_INTERFACE (iface), 1702 G_SIGNAL_RUN_LAST, 1703 G_STRUCT_OFFSET (FanIface, handle_set_speed), 1704 g_signal_accumulator_true_handled, 1705 NULL, 1706 g_cclosure_marshal_generic, 1707 G_TYPE_BOOLEAN, 1708 2, 1709 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); 1710 1711 /* GObject signals for received D-Bus signals: */ 1712 /** 1713 * Fan::speed-changed: 1714 * @object: A #Fan. 1715 * @arg_speed: Argument. 1716 * 1717 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> is received. 1718 * 1719 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 1720 */ 1721 g_signal_new ("speed-changed", 1722 G_TYPE_FROM_INTERFACE (iface), 1723 G_SIGNAL_RUN_LAST, 1724 G_STRUCT_OFFSET (FanIface, speed_changed), 1725 NULL, 1726 NULL, 1727 g_cclosure_marshal_generic, 1728 G_TYPE_NONE, 1729 1, G_TYPE_INT); 1730 1731 /** 1732 * Fan::tach-error: 1733 * @object: A #Fan. 1734 * 1735 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> is received. 1736 * 1737 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 1738 */ 1739 g_signal_new ("tach-error", 1740 G_TYPE_FROM_INTERFACE (iface), 1741 G_SIGNAL_RUN_LAST, 1742 G_STRUCT_OFFSET (FanIface, tach_error), 1743 NULL, 1744 NULL, 1745 g_cclosure_marshal_generic, 1746 G_TYPE_NONE, 1747 0); 1748 1749 /* GObject properties for D-Bus properties: */ 1750 /** 1751 * Fan:speed: 1752 * 1753 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>. 1754 * 1755 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 1756 */ 1757 g_object_interface_install_property (iface, 1758 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 1759 /** 1760 * Fan:cooling-zone: 1761 * 1762 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>. 1763 * 1764 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 1765 */ 1766 g_object_interface_install_property (iface, 1767 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 1768 /** 1769 * Fan:pwm-num: 1770 * 1771 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>. 1772 * 1773 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 1774 */ 1775 g_object_interface_install_property (iface, 1776 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 1777 } 1778 1779 /** 1780 * fan_get_speed: (skip) 1781 * @object: A #Fan. 1782 * 1783 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property. 1784 * 1785 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 1786 * 1787 * Returns: The property value. 1788 */ 1789 gint 1790 fan_get_speed (Fan *object) 1791 { 1792 return FAN_GET_IFACE (object)->get_speed (object); 1793 } 1794 1795 /** 1796 * fan_set_speed: (skip) 1797 * @object: A #Fan. 1798 * @value: The value to set. 1799 * 1800 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value. 1801 * 1802 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 1803 */ 1804 void 1805 fan_set_speed (Fan *object, gint value) 1806 { 1807 g_object_set (G_OBJECT (object), "speed", value, NULL); 1808 } 1809 1810 /** 1811 * fan_get_cooling_zone: (skip) 1812 * @object: A #Fan. 1813 * 1814 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property. 1815 * 1816 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 1817 * 1818 * Returns: The property value. 1819 */ 1820 gint 1821 fan_get_cooling_zone (Fan *object) 1822 { 1823 return FAN_GET_IFACE (object)->get_cooling_zone (object); 1824 } 1825 1826 /** 1827 * fan_set_cooling_zone: (skip) 1828 * @object: A #Fan. 1829 * @value: The value to set. 1830 * 1831 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value. 1832 * 1833 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 1834 */ 1835 void 1836 fan_set_cooling_zone (Fan *object, gint value) 1837 { 1838 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL); 1839 } 1840 1841 /** 1842 * fan_get_pwm_num: (skip) 1843 * @object: A #Fan. 1844 * 1845 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property. 1846 * 1847 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 1848 * 1849 * Returns: The property value. 1850 */ 1851 gint 1852 fan_get_pwm_num (Fan *object) 1853 { 1854 return FAN_GET_IFACE (object)->get_pwm_num (object); 1855 } 1856 1857 /** 1858 * fan_set_pwm_num: (skip) 1859 * @object: A #Fan. 1860 * @value: The value to set. 1861 * 1862 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value. 1863 * 1864 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 1865 */ 1866 void 1867 fan_set_pwm_num (Fan *object, gint value) 1868 { 1869 g_object_set (G_OBJECT (object), "pwm-num", value, NULL); 1870 } 1871 1872 /** 1873 * fan_emit_speed_changed: 1874 * @object: A #Fan. 1875 * @arg_speed: Argument to pass with the signal. 1876 * 1877 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal. 1878 */ 1879 void 1880 fan_emit_speed_changed ( 1881 Fan *object, 1882 gint arg_speed) 1883 { 1884 g_signal_emit_by_name (object, "speed-changed", arg_speed); 1885 } 1886 1887 /** 1888 * fan_emit_tach_error: 1889 * @object: A #Fan. 1890 * 1891 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal. 1892 */ 1893 void 1894 fan_emit_tach_error ( 1895 Fan *object) 1896 { 1897 g_signal_emit_by_name (object, "tach-error"); 1898 } 1899 1900 /** 1901 * fan_call_set_cooling_zone: 1902 * @proxy: A #FanProxy. 1903 * @arg_cooling_zone: Argument to pass with the method invocation. 1904 * @cancellable: (allow-none): A #GCancellable or %NULL. 1905 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 1906 * @user_data: User data to pass to @callback. 1907 * 1908 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. 1909 * 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. 1910 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation. 1911 * 1912 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method. 1913 */ 1914 void 1915 fan_call_set_cooling_zone ( 1916 Fan *proxy, 1917 gint arg_cooling_zone, 1918 GCancellable *cancellable, 1919 GAsyncReadyCallback callback, 1920 gpointer user_data) 1921 { 1922 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 1923 "setCoolingZone", 1924 g_variant_new ("(i)", 1925 arg_cooling_zone), 1926 G_DBUS_CALL_FLAGS_NONE, 1927 -1, 1928 cancellable, 1929 callback, 1930 user_data); 1931 } 1932 1933 /** 1934 * fan_call_set_cooling_zone_finish: 1935 * @proxy: A #FanProxy. 1936 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone(). 1937 * @error: Return location for error or %NULL. 1938 * 1939 * Finishes an operation started with fan_call_set_cooling_zone(). 1940 * 1941 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 1942 */ 1943 gboolean 1944 fan_call_set_cooling_zone_finish ( 1945 Fan *proxy, 1946 GAsyncResult *res, 1947 GError **error) 1948 { 1949 GVariant *_ret; 1950 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 1951 if (_ret == NULL) 1952 goto _out; 1953 g_variant_get (_ret, 1954 "()"); 1955 g_variant_unref (_ret); 1956 _out: 1957 return _ret != NULL; 1958 } 1959 1960 /** 1961 * fan_call_set_cooling_zone_sync: 1962 * @proxy: A #FanProxy. 1963 * @arg_cooling_zone: Argument to pass with the method invocation. 1964 * @cancellable: (allow-none): A #GCancellable or %NULL. 1965 * @error: Return location for error or %NULL. 1966 * 1967 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 1968 * 1969 * See fan_call_set_cooling_zone() for the asynchronous version of this method. 1970 * 1971 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 1972 */ 1973 gboolean 1974 fan_call_set_cooling_zone_sync ( 1975 Fan *proxy, 1976 gint arg_cooling_zone, 1977 GCancellable *cancellable, 1978 GError **error) 1979 { 1980 GVariant *_ret; 1981 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 1982 "setCoolingZone", 1983 g_variant_new ("(i)", 1984 arg_cooling_zone), 1985 G_DBUS_CALL_FLAGS_NONE, 1986 -1, 1987 cancellable, 1988 error); 1989 if (_ret == NULL) 1990 goto _out; 1991 g_variant_get (_ret, 1992 "()"); 1993 g_variant_unref (_ret); 1994 _out: 1995 return _ret != NULL; 1996 } 1997 1998 /** 1999 * fan_call_get_speed: 2000 * @proxy: A #FanProxy. 2001 * @cancellable: (allow-none): A #GCancellable or %NULL. 2002 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 2003 * @user_data: User data to pass to @callback. 2004 * 2005 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. 2006 * 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. 2007 * You can then call fan_call_get_speed_finish() to get the result of the operation. 2008 * 2009 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method. 2010 */ 2011 void 2012 fan_call_get_speed ( 2013 Fan *proxy, 2014 GCancellable *cancellable, 2015 GAsyncReadyCallback callback, 2016 gpointer user_data) 2017 { 2018 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 2019 "getSpeed", 2020 g_variant_new ("()"), 2021 G_DBUS_CALL_FLAGS_NONE, 2022 -1, 2023 cancellable, 2024 callback, 2025 user_data); 2026 } 2027 2028 /** 2029 * fan_call_get_speed_finish: 2030 * @proxy: A #FanProxy. 2031 * @out_speed: (out): Return location for return parameter or %NULL to ignore. 2032 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed(). 2033 * @error: Return location for error or %NULL. 2034 * 2035 * Finishes an operation started with fan_call_get_speed(). 2036 * 2037 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 2038 */ 2039 gboolean 2040 fan_call_get_speed_finish ( 2041 Fan *proxy, 2042 gint *out_speed, 2043 GAsyncResult *res, 2044 GError **error) 2045 { 2046 GVariant *_ret; 2047 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 2048 if (_ret == NULL) 2049 goto _out; 2050 g_variant_get (_ret, 2051 "(i)", 2052 out_speed); 2053 g_variant_unref (_ret); 2054 _out: 2055 return _ret != NULL; 2056 } 2057 2058 /** 2059 * fan_call_get_speed_sync: 2060 * @proxy: A #FanProxy. 2061 * @out_speed: (out): Return location for return parameter or %NULL to ignore. 2062 * @cancellable: (allow-none): A #GCancellable or %NULL. 2063 * @error: Return location for error or %NULL. 2064 * 2065 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 2066 * 2067 * See fan_call_get_speed() for the asynchronous version of this method. 2068 * 2069 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 2070 */ 2071 gboolean 2072 fan_call_get_speed_sync ( 2073 Fan *proxy, 2074 gint *out_speed, 2075 GCancellable *cancellable, 2076 GError **error) 2077 { 2078 GVariant *_ret; 2079 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 2080 "getSpeed", 2081 g_variant_new ("()"), 2082 G_DBUS_CALL_FLAGS_NONE, 2083 -1, 2084 cancellable, 2085 error); 2086 if (_ret == NULL) 2087 goto _out; 2088 g_variant_get (_ret, 2089 "(i)", 2090 out_speed); 2091 g_variant_unref (_ret); 2092 _out: 2093 return _ret != NULL; 2094 } 2095 2096 /** 2097 * fan_call_set_speed: 2098 * @proxy: A #FanProxy. 2099 * @arg_speed: Argument to pass with the method invocation. 2100 * @cancellable: (allow-none): A #GCancellable or %NULL. 2101 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 2102 * @user_data: User data to pass to @callback. 2103 * 2104 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. 2105 * 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. 2106 * You can then call fan_call_set_speed_finish() to get the result of the operation. 2107 * 2108 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method. 2109 */ 2110 void 2111 fan_call_set_speed ( 2112 Fan *proxy, 2113 gint arg_speed, 2114 GCancellable *cancellable, 2115 GAsyncReadyCallback callback, 2116 gpointer user_data) 2117 { 2118 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 2119 "setSpeed", 2120 g_variant_new ("(i)", 2121 arg_speed), 2122 G_DBUS_CALL_FLAGS_NONE, 2123 -1, 2124 cancellable, 2125 callback, 2126 user_data); 2127 } 2128 2129 /** 2130 * fan_call_set_speed_finish: 2131 * @proxy: A #FanProxy. 2132 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed(). 2133 * @error: Return location for error or %NULL. 2134 * 2135 * Finishes an operation started with fan_call_set_speed(). 2136 * 2137 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 2138 */ 2139 gboolean 2140 fan_call_set_speed_finish ( 2141 Fan *proxy, 2142 GAsyncResult *res, 2143 GError **error) 2144 { 2145 GVariant *_ret; 2146 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 2147 if (_ret == NULL) 2148 goto _out; 2149 g_variant_get (_ret, 2150 "()"); 2151 g_variant_unref (_ret); 2152 _out: 2153 return _ret != NULL; 2154 } 2155 2156 /** 2157 * fan_call_set_speed_sync: 2158 * @proxy: A #FanProxy. 2159 * @arg_speed: Argument to pass with the method invocation. 2160 * @cancellable: (allow-none): A #GCancellable or %NULL. 2161 * @error: Return location for error or %NULL. 2162 * 2163 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 2164 * 2165 * See fan_call_set_speed() for the asynchronous version of this method. 2166 * 2167 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 2168 */ 2169 gboolean 2170 fan_call_set_speed_sync ( 2171 Fan *proxy, 2172 gint arg_speed, 2173 GCancellable *cancellable, 2174 GError **error) 2175 { 2176 GVariant *_ret; 2177 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 2178 "setSpeed", 2179 g_variant_new ("(i)", 2180 arg_speed), 2181 G_DBUS_CALL_FLAGS_NONE, 2182 -1, 2183 cancellable, 2184 error); 2185 if (_ret == NULL) 2186 goto _out; 2187 g_variant_get (_ret, 2188 "()"); 2189 g_variant_unref (_ret); 2190 _out: 2191 return _ret != NULL; 2192 } 2193 2194 /** 2195 * fan_complete_set_cooling_zone: 2196 * @object: A #Fan. 2197 * @invocation: (transfer full): A #GDBusMethodInvocation. 2198 * 2199 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 2200 * 2201 * This method will free @invocation, you cannot use it afterwards. 2202 */ 2203 void 2204 fan_complete_set_cooling_zone ( 2205 Fan *object, 2206 GDBusMethodInvocation *invocation) 2207 { 2208 g_dbus_method_invocation_return_value (invocation, 2209 g_variant_new ("()")); 2210 } 2211 2212 /** 2213 * fan_complete_get_speed: 2214 * @object: A #Fan. 2215 * @invocation: (transfer full): A #GDBusMethodInvocation. 2216 * @speed: Parameter to return. 2217 * 2218 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 2219 * 2220 * This method will free @invocation, you cannot use it afterwards. 2221 */ 2222 void 2223 fan_complete_get_speed ( 2224 Fan *object, 2225 GDBusMethodInvocation *invocation, 2226 gint speed) 2227 { 2228 g_dbus_method_invocation_return_value (invocation, 2229 g_variant_new ("(i)", 2230 speed)); 2231 } 2232 2233 /** 2234 * fan_complete_set_speed: 2235 * @object: A #Fan. 2236 * @invocation: (transfer full): A #GDBusMethodInvocation. 2237 * 2238 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 2239 * 2240 * This method will free @invocation, you cannot use it afterwards. 2241 */ 2242 void 2243 fan_complete_set_speed ( 2244 Fan *object, 2245 GDBusMethodInvocation *invocation) 2246 { 2247 g_dbus_method_invocation_return_value (invocation, 2248 g_variant_new ("()")); 2249 } 2250 2251 /* ------------------------------------------------------------------------ */ 2252 2253 /** 2254 * FanProxy: 2255 * 2256 * The #FanProxy structure contains only private data and should only be accessed using the provided API. 2257 */ 2258 2259 /** 2260 * FanProxyClass: 2261 * @parent_class: The parent class. 2262 * 2263 * Class structure for #FanProxy. 2264 */ 2265 2266 struct _FanProxyPrivate 2267 { 2268 GData *qdata; 2269 }; 2270 2271 static void fan_proxy_iface_init (FanIface *iface); 2272 2273 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 2274 G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, 2275 G_ADD_PRIVATE (FanProxy) 2276 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); 2277 2278 #else 2279 G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY, 2280 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init)); 2281 2282 #endif 2283 static void 2284 fan_proxy_finalize (GObject *object) 2285 { 2286 FanProxy *proxy = FAN_PROXY (object); 2287 g_datalist_clear (&proxy->priv->qdata); 2288 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object); 2289 } 2290 2291 static void 2292 fan_proxy_get_property (GObject *object, 2293 guint prop_id, 2294 GValue *value, 2295 GParamSpec *pspec G_GNUC_UNUSED) 2296 { 2297 const _ExtendedGDBusPropertyInfo *info; 2298 GVariant *variant; 2299 g_assert (prop_id != 0 && prop_id - 1 < 3); 2300 info = _fan_property_info_pointers[prop_id - 1]; 2301 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 2302 if (info->use_gvariant) 2303 { 2304 g_value_set_variant (value, variant); 2305 } 2306 else 2307 { 2308 if (variant != NULL) 2309 g_dbus_gvariant_to_gvalue (variant, value); 2310 } 2311 if (variant != NULL) 2312 g_variant_unref (variant); 2313 } 2314 2315 static void 2316 fan_proxy_set_property_cb (GDBusProxy *proxy, 2317 GAsyncResult *res, 2318 gpointer user_data) 2319 { 2320 const _ExtendedGDBusPropertyInfo *info = user_data; 2321 GError *error; 2322 GVariant *_ret; 2323 error = NULL; 2324 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 2325 if (!_ret) 2326 { 2327 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)", 2328 info->parent_struct.name, 2329 error->message, g_quark_to_string (error->domain), error->code); 2330 g_error_free (error); 2331 } 2332 else 2333 { 2334 g_variant_unref (_ret); 2335 } 2336 } 2337 2338 static void 2339 fan_proxy_set_property (GObject *object, 2340 guint prop_id, 2341 const GValue *value, 2342 GParamSpec *pspec G_GNUC_UNUSED) 2343 { 2344 const _ExtendedGDBusPropertyInfo *info; 2345 GVariant *variant; 2346 g_assert (prop_id != 0 && prop_id - 1 < 3); 2347 info = _fan_property_info_pointers[prop_id - 1]; 2348 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 2349 g_dbus_proxy_call (G_DBUS_PROXY (object), 2350 "org.freedesktop.DBus.Properties.Set", 2351 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant), 2352 G_DBUS_CALL_FLAGS_NONE, 2353 -1, 2354 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 2355 g_variant_unref (variant); 2356 } 2357 2358 static void 2359 fan_proxy_g_signal (GDBusProxy *proxy, 2360 const gchar *sender_name G_GNUC_UNUSED, 2361 const gchar *signal_name, 2362 GVariant *parameters) 2363 { 2364 _ExtendedGDBusSignalInfo *info; 2365 GVariantIter iter; 2366 GVariant *child; 2367 GValue *paramv; 2368 guint num_params; 2369 guint n; 2370 guint signal_id; 2371 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name); 2372 if (info == NULL) 2373 return; 2374 num_params = g_variant_n_children (parameters); 2375 paramv = g_new0 (GValue, num_params + 1); 2376 g_value_init (¶mv[0], TYPE_FAN); 2377 g_value_set_object (¶mv[0], proxy); 2378 g_variant_iter_init (&iter, parameters); 2379 n = 1; 2380 while ((child = g_variant_iter_next_value (&iter)) != NULL) 2381 { 2382 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 2383 if (arg_info->use_gvariant) 2384 { 2385 g_value_init (¶mv[n], G_TYPE_VARIANT); 2386 g_value_set_variant (¶mv[n], child); 2387 n++; 2388 } 2389 else 2390 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 2391 g_variant_unref (child); 2392 } 2393 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); 2394 g_signal_emitv (paramv, signal_id, 0, NULL); 2395 for (n = 0; n < num_params + 1; n++) 2396 g_value_unset (¶mv[n]); 2397 g_free (paramv); 2398 } 2399 2400 static void 2401 fan_proxy_g_properties_changed (GDBusProxy *_proxy, 2402 GVariant *changed_properties, 2403 const gchar *const *invalidated_properties) 2404 { 2405 FanProxy *proxy = FAN_PROXY (_proxy); 2406 guint n; 2407 const gchar *key; 2408 GVariantIter *iter; 2409 _ExtendedGDBusPropertyInfo *info; 2410 g_variant_get (changed_properties, "a{sv}", &iter); 2411 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 2412 { 2413 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key); 2414 g_datalist_remove_data (&proxy->priv->qdata, key); 2415 if (info != NULL) 2416 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 2417 } 2418 g_variant_iter_free (iter); 2419 for (n = 0; invalidated_properties[n] != NULL; n++) 2420 { 2421 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]); 2422 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 2423 if (info != NULL) 2424 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 2425 } 2426 } 2427 2428 static gint 2429 fan_proxy_get_speed (Fan *object) 2430 { 2431 FanProxy *proxy = FAN_PROXY (object); 2432 GVariant *variant; 2433 gint value = 0; 2434 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed"); 2435 if (variant != NULL) 2436 { 2437 value = g_variant_get_int32 (variant); 2438 g_variant_unref (variant); 2439 } 2440 return value; 2441 } 2442 2443 static gint 2444 fan_proxy_get_cooling_zone (Fan *object) 2445 { 2446 FanProxy *proxy = FAN_PROXY (object); 2447 GVariant *variant; 2448 gint value = 0; 2449 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone"); 2450 if (variant != NULL) 2451 { 2452 value = g_variant_get_int32 (variant); 2453 g_variant_unref (variant); 2454 } 2455 return value; 2456 } 2457 2458 static gint 2459 fan_proxy_get_pwm_num (Fan *object) 2460 { 2461 FanProxy *proxy = FAN_PROXY (object); 2462 GVariant *variant; 2463 gint value = 0; 2464 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num"); 2465 if (variant != NULL) 2466 { 2467 value = g_variant_get_int32 (variant); 2468 g_variant_unref (variant); 2469 } 2470 return value; 2471 } 2472 2473 static void 2474 fan_proxy_init (FanProxy *proxy) 2475 { 2476 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 2477 proxy->priv = fan_proxy_get_instance_private (proxy); 2478 #else 2479 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate); 2480 #endif 2481 2482 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ()); 2483 } 2484 2485 static void 2486 fan_proxy_class_init (FanProxyClass *klass) 2487 { 2488 GObjectClass *gobject_class; 2489 GDBusProxyClass *proxy_class; 2490 2491 gobject_class = G_OBJECT_CLASS (klass); 2492 gobject_class->finalize = fan_proxy_finalize; 2493 gobject_class->get_property = fan_proxy_get_property; 2494 gobject_class->set_property = fan_proxy_set_property; 2495 2496 proxy_class = G_DBUS_PROXY_CLASS (klass); 2497 proxy_class->g_signal = fan_proxy_g_signal; 2498 proxy_class->g_properties_changed = fan_proxy_g_properties_changed; 2499 2500 fan_override_properties (gobject_class, 1); 2501 2502 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 2503 g_type_class_add_private (klass, sizeof (FanProxyPrivate)); 2504 #endif 2505 } 2506 2507 static void 2508 fan_proxy_iface_init (FanIface *iface) 2509 { 2510 iface->get_speed = fan_proxy_get_speed; 2511 iface->get_cooling_zone = fan_proxy_get_cooling_zone; 2512 iface->get_pwm_num = fan_proxy_get_pwm_num; 2513 } 2514 2515 /** 2516 * fan_proxy_new: 2517 * @connection: A #GDBusConnection. 2518 * @flags: Flags from the #GDBusProxyFlags enumeration. 2519 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 2520 * @object_path: An object path. 2521 * @cancellable: (allow-none): A #GCancellable or %NULL. 2522 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 2523 * @user_data: User data to pass to @callback. 2524 * 2525 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new() for more details. 2526 * 2527 * 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. 2528 * You can then call fan_proxy_new_finish() to get the result of the operation. 2529 * 2530 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor. 2531 */ 2532 void 2533 fan_proxy_new ( 2534 GDBusConnection *connection, 2535 GDBusProxyFlags flags, 2536 const gchar *name, 2537 const gchar *object_path, 2538 GCancellable *cancellable, 2539 GAsyncReadyCallback callback, 2540 gpointer user_data) 2541 { 2542 g_async_initable_new_async (TYPE_FAN_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL); 2543 } 2544 2545 /** 2546 * fan_proxy_new_finish: 2547 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new(). 2548 * @error: Return location for error or %NULL 2549 * 2550 * Finishes an operation started with fan_proxy_new(). 2551 * 2552 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. 2553 */ 2554 Fan * 2555 fan_proxy_new_finish ( 2556 GAsyncResult *res, 2557 GError **error) 2558 { 2559 GObject *ret; 2560 GObject *source_object; 2561 source_object = g_async_result_get_source_object (res); 2562 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 2563 g_object_unref (source_object); 2564 if (ret != NULL) 2565 return FAN (ret); 2566 else 2567 return NULL; 2568 } 2569 2570 /** 2571 * fan_proxy_new_sync: 2572 * @connection: A #GDBusConnection. 2573 * @flags: Flags from the #GDBusProxyFlags enumeration. 2574 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 2575 * @object_path: An object path. 2576 * @cancellable: (allow-none): A #GCancellable or %NULL. 2577 * @error: Return location for error or %NULL 2578 * 2579 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new_sync() for more details. 2580 * 2581 * The calling thread is blocked until a reply is received. 2582 * 2583 * See fan_proxy_new() for the asynchronous version of this constructor. 2584 * 2585 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. 2586 */ 2587 Fan * 2588 fan_proxy_new_sync ( 2589 GDBusConnection *connection, 2590 GDBusProxyFlags flags, 2591 const gchar *name, 2592 const gchar *object_path, 2593 GCancellable *cancellable, 2594 GError **error) 2595 { 2596 GInitable *ret; 2597 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL); 2598 if (ret != NULL) 2599 return FAN (ret); 2600 else 2601 return NULL; 2602 } 2603 2604 2605 /** 2606 * fan_proxy_new_for_bus: 2607 * @bus_type: A #GBusType. 2608 * @flags: Flags from the #GDBusProxyFlags enumeration. 2609 * @name: A bus name (well-known or unique). 2610 * @object_path: An object path. 2611 * @cancellable: (allow-none): A #GCancellable or %NULL. 2612 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 2613 * @user_data: User data to pass to @callback. 2614 * 2615 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 2616 * 2617 * 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. 2618 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation. 2619 * 2620 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 2621 */ 2622 void 2623 fan_proxy_new_for_bus ( 2624 GBusType bus_type, 2625 GDBusProxyFlags flags, 2626 const gchar *name, 2627 const gchar *object_path, 2628 GCancellable *cancellable, 2629 GAsyncReadyCallback callback, 2630 gpointer user_data) 2631 { 2632 g_async_initable_new_async (TYPE_FAN_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL); 2633 } 2634 2635 /** 2636 * fan_proxy_new_for_bus_finish: 2637 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus(). 2638 * @error: Return location for error or %NULL 2639 * 2640 * Finishes an operation started with fan_proxy_new_for_bus(). 2641 * 2642 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. 2643 */ 2644 Fan * 2645 fan_proxy_new_for_bus_finish ( 2646 GAsyncResult *res, 2647 GError **error) 2648 { 2649 GObject *ret; 2650 GObject *source_object; 2651 source_object = g_async_result_get_source_object (res); 2652 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 2653 g_object_unref (source_object); 2654 if (ret != NULL) 2655 return FAN (ret); 2656 else 2657 return NULL; 2658 } 2659 2660 /** 2661 * fan_proxy_new_for_bus_sync: 2662 * @bus_type: A #GBusType. 2663 * @flags: Flags from the #GDBusProxyFlags enumeration. 2664 * @name: A bus name (well-known or unique). 2665 * @object_path: An object path. 2666 * @cancellable: (allow-none): A #GCancellable or %NULL. 2667 * @error: Return location for error or %NULL 2668 * 2669 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 2670 * 2671 * The calling thread is blocked until a reply is received. 2672 * 2673 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor. 2674 * 2675 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set. 2676 */ 2677 Fan * 2678 fan_proxy_new_for_bus_sync ( 2679 GBusType bus_type, 2680 GDBusProxyFlags flags, 2681 const gchar *name, 2682 const gchar *object_path, 2683 GCancellable *cancellable, 2684 GError **error) 2685 { 2686 GInitable *ret; 2687 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL); 2688 if (ret != NULL) 2689 return FAN (ret); 2690 else 2691 return NULL; 2692 } 2693 2694 2695 /* ------------------------------------------------------------------------ */ 2696 2697 /** 2698 * FanSkeleton: 2699 * 2700 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API. 2701 */ 2702 2703 /** 2704 * FanSkeletonClass: 2705 * @parent_class: The parent class. 2706 * 2707 * Class structure for #FanSkeleton. 2708 */ 2709 2710 struct _FanSkeletonPrivate 2711 { 2712 GValue *properties; 2713 GList *changed_properties; 2714 GSource *changed_properties_idle_source; 2715 GMainContext *context; 2716 GMutex lock; 2717 }; 2718 2719 static void 2720 _fan_skeleton_handle_method_call ( 2721 GDBusConnection *connection G_GNUC_UNUSED, 2722 const gchar *sender G_GNUC_UNUSED, 2723 const gchar *object_path G_GNUC_UNUSED, 2724 const gchar *interface_name, 2725 const gchar *method_name, 2726 GVariant *parameters, 2727 GDBusMethodInvocation *invocation, 2728 gpointer user_data) 2729 { 2730 FanSkeleton *skeleton = FAN_SKELETON (user_data); 2731 _ExtendedGDBusMethodInfo *info; 2732 GVariantIter iter; 2733 GVariant *child; 2734 GValue *paramv; 2735 guint num_params; 2736 guint num_extra; 2737 guint n; 2738 guint signal_id; 2739 GValue return_value = G_VALUE_INIT; 2740 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 2741 g_assert (info != NULL); 2742 num_params = g_variant_n_children (parameters); 2743 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 2744 n = 0; 2745 g_value_init (¶mv[n], TYPE_FAN); 2746 g_value_set_object (¶mv[n++], skeleton); 2747 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 2748 g_value_set_object (¶mv[n++], invocation); 2749 if (info->pass_fdlist) 2750 { 2751 #ifdef G_OS_UNIX 2752 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 2753 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 2754 #else 2755 g_assert_not_reached (); 2756 #endif 2757 } 2758 g_variant_iter_init (&iter, parameters); 2759 while ((child = g_variant_iter_next_value (&iter)) != NULL) 2760 { 2761 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 2762 if (arg_info->use_gvariant) 2763 { 2764 g_value_init (¶mv[n], G_TYPE_VARIANT); 2765 g_value_set_variant (¶mv[n], child); 2766 n++; 2767 } 2768 else 2769 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 2770 g_variant_unref (child); 2771 } 2772 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN); 2773 g_value_init (&return_value, G_TYPE_BOOLEAN); 2774 g_signal_emitv (paramv, signal_id, 0, &return_value); 2775 if (!g_value_get_boolean (&return_value)) 2776 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); 2777 g_value_unset (&return_value); 2778 for (n = 0; n < num_params + num_extra; n++) 2779 g_value_unset (¶mv[n]); 2780 g_free (paramv); 2781 } 2782 2783 static GVariant * 2784 _fan_skeleton_handle_get_property ( 2785 GDBusConnection *connection G_GNUC_UNUSED, 2786 const gchar *sender G_GNUC_UNUSED, 2787 const gchar *object_path G_GNUC_UNUSED, 2788 const gchar *interface_name G_GNUC_UNUSED, 2789 const gchar *property_name, 2790 GError **error, 2791 gpointer user_data) 2792 { 2793 FanSkeleton *skeleton = FAN_SKELETON (user_data); 2794 GValue value = G_VALUE_INIT; 2795 GParamSpec *pspec; 2796 _ExtendedGDBusPropertyInfo *info; 2797 GVariant *ret; 2798 ret = NULL; 2799 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); 2800 g_assert (info != NULL); 2801 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 2802 if (pspec == NULL) 2803 { 2804 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 2805 } 2806 else 2807 { 2808 g_value_init (&value, pspec->value_type); 2809 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 2810 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 2811 g_value_unset (&value); 2812 } 2813 return ret; 2814 } 2815 2816 static gboolean 2817 _fan_skeleton_handle_set_property ( 2818 GDBusConnection *connection G_GNUC_UNUSED, 2819 const gchar *sender G_GNUC_UNUSED, 2820 const gchar *object_path G_GNUC_UNUSED, 2821 const gchar *interface_name G_GNUC_UNUSED, 2822 const gchar *property_name, 2823 GVariant *variant, 2824 GError **error, 2825 gpointer user_data) 2826 { 2827 FanSkeleton *skeleton = FAN_SKELETON (user_data); 2828 GValue value = G_VALUE_INIT; 2829 GParamSpec *pspec; 2830 _ExtendedGDBusPropertyInfo *info; 2831 gboolean ret; 2832 ret = FALSE; 2833 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name); 2834 g_assert (info != NULL); 2835 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 2836 if (pspec == NULL) 2837 { 2838 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 2839 } 2840 else 2841 { 2842 if (info->use_gvariant) 2843 g_value_set_variant (&value, variant); 2844 else 2845 g_dbus_gvariant_to_gvalue (variant, &value); 2846 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 2847 g_value_unset (&value); 2848 ret = TRUE; 2849 } 2850 return ret; 2851 } 2852 2853 static const GDBusInterfaceVTable _fan_skeleton_vtable = 2854 { 2855 _fan_skeleton_handle_method_call, 2856 _fan_skeleton_handle_get_property, 2857 _fan_skeleton_handle_set_property, 2858 {NULL} 2859 }; 2860 2861 static GDBusInterfaceInfo * 2862 fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 2863 { 2864 return fan_interface_info (); 2865 } 2866 2867 static GDBusInterfaceVTable * 2868 fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 2869 { 2870 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable; 2871 } 2872 2873 static GVariant * 2874 fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 2875 { 2876 FanSkeleton *skeleton = FAN_SKELETON (_skeleton); 2877 2878 GVariantBuilder builder; 2879 guint n; 2880 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 2881 if (_fan_interface_info.parent_struct.properties == NULL) 2882 goto out; 2883 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++) 2884 { 2885 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n]; 2886 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 2887 { 2888 GVariant *value; 2889 value = _fan_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", info->name, NULL, skeleton); 2890 if (value != NULL) 2891 { 2892 g_variant_take_ref (value); 2893 g_variant_builder_add (&builder, "{sv}", info->name, value); 2894 g_variant_unref (value); 2895 } 2896 } 2897 } 2898 out: 2899 return g_variant_builder_end (&builder); 2900 } 2901 2902 static gboolean _fan_emit_changed (gpointer user_data); 2903 2904 static void 2905 fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 2906 { 2907 FanSkeleton *skeleton = FAN_SKELETON (_skeleton); 2908 gboolean emit_changed = FALSE; 2909 2910 g_mutex_lock (&skeleton->priv->lock); 2911 if (skeleton->priv->changed_properties_idle_source != NULL) 2912 { 2913 g_source_destroy (skeleton->priv->changed_properties_idle_source); 2914 skeleton->priv->changed_properties_idle_source = NULL; 2915 emit_changed = TRUE; 2916 } 2917 g_mutex_unlock (&skeleton->priv->lock); 2918 2919 if (emit_changed) 2920 _fan_emit_changed (skeleton); 2921 } 2922 2923 static void 2924 _fan_on_signal_speed_changed ( 2925 Fan *object, 2926 gint arg_speed) 2927 { 2928 FanSkeleton *skeleton = FAN_SKELETON (object); 2929 2930 GList *connections, *l; 2931 GVariant *signal_variant; 2932 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 2933 2934 signal_variant = g_variant_ref_sink (g_variant_new ("(i)", 2935 arg_speed)); 2936 for (l = connections; l != NULL; l = l->next) 2937 { 2938 GDBusConnection *connection = l->data; 2939 g_dbus_connection_emit_signal (connection, 2940 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged", 2941 signal_variant, NULL); 2942 } 2943 g_variant_unref (signal_variant); 2944 g_list_free_full (connections, g_object_unref); 2945 } 2946 2947 static void 2948 _fan_on_signal_tach_error ( 2949 Fan *object) 2950 { 2951 FanSkeleton *skeleton = FAN_SKELETON (object); 2952 2953 GList *connections, *l; 2954 GVariant *signal_variant; 2955 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 2956 2957 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 2958 for (l = connections; l != NULL; l = l->next) 2959 { 2960 GDBusConnection *connection = l->data; 2961 g_dbus_connection_emit_signal (connection, 2962 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError", 2963 signal_variant, NULL); 2964 } 2965 g_variant_unref (signal_variant); 2966 g_list_free_full (connections, g_object_unref); 2967 } 2968 2969 static void fan_skeleton_iface_init (FanIface *iface); 2970 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 2971 G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 2972 G_ADD_PRIVATE (FanSkeleton) 2973 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); 2974 2975 #else 2976 G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 2977 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init)); 2978 2979 #endif 2980 static void 2981 fan_skeleton_finalize (GObject *object) 2982 { 2983 FanSkeleton *skeleton = FAN_SKELETON (object); 2984 guint n; 2985 for (n = 0; n < 3; n++) 2986 g_value_unset (&skeleton->priv->properties[n]); 2987 g_free (skeleton->priv->properties); 2988 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 2989 if (skeleton->priv->changed_properties_idle_source != NULL) 2990 g_source_destroy (skeleton->priv->changed_properties_idle_source); 2991 g_main_context_unref (skeleton->priv->context); 2992 g_mutex_clear (&skeleton->priv->lock); 2993 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object); 2994 } 2995 2996 static void 2997 fan_skeleton_get_property (GObject *object, 2998 guint prop_id, 2999 GValue *value, 3000 GParamSpec *pspec G_GNUC_UNUSED) 3001 { 3002 FanSkeleton *skeleton = FAN_SKELETON (object); 3003 g_assert (prop_id != 0 && prop_id - 1 < 3); 3004 g_mutex_lock (&skeleton->priv->lock); 3005 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 3006 g_mutex_unlock (&skeleton->priv->lock); 3007 } 3008 3009 static gboolean 3010 _fan_emit_changed (gpointer user_data) 3011 { 3012 FanSkeleton *skeleton = FAN_SKELETON (user_data); 3013 GList *l; 3014 GVariantBuilder builder; 3015 GVariantBuilder invalidated_builder; 3016 guint num_changes; 3017 3018 g_mutex_lock (&skeleton->priv->lock); 3019 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 3020 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 3021 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 3022 { 3023 ChangedProperty *cp = l->data; 3024 GVariant *variant; 3025 const GValue *cur_value; 3026 3027 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 3028 if (!_g_value_equal (cur_value, &cp->orig_value)) 3029 { 3030 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 3031 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 3032 g_variant_unref (variant); 3033 num_changes++; 3034 } 3035 } 3036 if (num_changes > 0) 3037 { 3038 GList *connections, *ll; 3039 GVariant *signal_variant; 3040 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan", 3041 &builder, &invalidated_builder)); 3042 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 3043 for (ll = connections; ll != NULL; ll = ll->next) 3044 { 3045 GDBusConnection *connection = ll->data; 3046 3047 g_dbus_connection_emit_signal (connection, 3048 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 3049 "org.freedesktop.DBus.Properties", 3050 "PropertiesChanged", 3051 signal_variant, 3052 NULL); 3053 } 3054 g_variant_unref (signal_variant); 3055 g_list_free_full (connections, g_object_unref); 3056 } 3057 else 3058 { 3059 g_variant_builder_clear (&builder); 3060 g_variant_builder_clear (&invalidated_builder); 3061 } 3062 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 3063 skeleton->priv->changed_properties = NULL; 3064 skeleton->priv->changed_properties_idle_source = NULL; 3065 g_mutex_unlock (&skeleton->priv->lock); 3066 return FALSE; 3067 } 3068 3069 static void 3070 _fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 3071 { 3072 ChangedProperty *cp; 3073 GList *l; 3074 cp = NULL; 3075 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 3076 { 3077 ChangedProperty *i_cp = l->data; 3078 if (i_cp->info == info) 3079 { 3080 cp = i_cp; 3081 break; 3082 } 3083 } 3084 if (cp == NULL) 3085 { 3086 cp = g_new0 (ChangedProperty, 1); 3087 cp->prop_id = prop_id; 3088 cp->info = info; 3089 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 3090 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 3091 g_value_copy (orig_value, &cp->orig_value); 3092 } 3093 } 3094 3095 static void 3096 fan_skeleton_notify (GObject *object, 3097 GParamSpec *pspec G_GNUC_UNUSED) 3098 { 3099 FanSkeleton *skeleton = FAN_SKELETON (object); 3100 g_mutex_lock (&skeleton->priv->lock); 3101 if (skeleton->priv->changed_properties != NULL && 3102 skeleton->priv->changed_properties_idle_source == NULL) 3103 { 3104 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 3105 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 3106 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 3107 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _fan_emit_changed"); 3108 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 3109 g_source_unref (skeleton->priv->changed_properties_idle_source); 3110 } 3111 g_mutex_unlock (&skeleton->priv->lock); 3112 } 3113 3114 static void 3115 fan_skeleton_set_property (GObject *object, 3116 guint prop_id, 3117 const GValue *value, 3118 GParamSpec *pspec) 3119 { 3120 FanSkeleton *skeleton = FAN_SKELETON (object); 3121 g_assert (prop_id != 0 && prop_id - 1 < 3); 3122 g_mutex_lock (&skeleton->priv->lock); 3123 g_object_freeze_notify (object); 3124 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 3125 { 3126 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 3127 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 3128 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 3129 g_object_notify_by_pspec (object, pspec); 3130 } 3131 g_mutex_unlock (&skeleton->priv->lock); 3132 g_object_thaw_notify (object); 3133 } 3134 3135 static void 3136 fan_skeleton_init (FanSkeleton *skeleton) 3137 { 3138 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 3139 skeleton->priv = fan_skeleton_get_instance_private (skeleton); 3140 #else 3141 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate); 3142 #endif 3143 3144 g_mutex_init (&skeleton->priv->lock); 3145 skeleton->priv->context = g_main_context_ref_thread_default (); 3146 skeleton->priv->properties = g_new0 (GValue, 3); 3147 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); 3148 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); 3149 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); 3150 } 3151 3152 static gint 3153 fan_skeleton_get_speed (Fan *object) 3154 { 3155 FanSkeleton *skeleton = FAN_SKELETON (object); 3156 gint value; 3157 g_mutex_lock (&skeleton->priv->lock); 3158 value = g_value_get_int (&(skeleton->priv->properties[0])); 3159 g_mutex_unlock (&skeleton->priv->lock); 3160 return value; 3161 } 3162 3163 static gint 3164 fan_skeleton_get_cooling_zone (Fan *object) 3165 { 3166 FanSkeleton *skeleton = FAN_SKELETON (object); 3167 gint value; 3168 g_mutex_lock (&skeleton->priv->lock); 3169 value = g_value_get_int (&(skeleton->priv->properties[1])); 3170 g_mutex_unlock (&skeleton->priv->lock); 3171 return value; 3172 } 3173 3174 static gint 3175 fan_skeleton_get_pwm_num (Fan *object) 3176 { 3177 FanSkeleton *skeleton = FAN_SKELETON (object); 3178 gint value; 3179 g_mutex_lock (&skeleton->priv->lock); 3180 value = g_value_get_int (&(skeleton->priv->properties[2])); 3181 g_mutex_unlock (&skeleton->priv->lock); 3182 return value; 3183 } 3184 3185 static void 3186 fan_skeleton_class_init (FanSkeletonClass *klass) 3187 { 3188 GObjectClass *gobject_class; 3189 GDBusInterfaceSkeletonClass *skeleton_class; 3190 3191 gobject_class = G_OBJECT_CLASS (klass); 3192 gobject_class->finalize = fan_skeleton_finalize; 3193 gobject_class->get_property = fan_skeleton_get_property; 3194 gobject_class->set_property = fan_skeleton_set_property; 3195 gobject_class->notify = fan_skeleton_notify; 3196 3197 3198 fan_override_properties (gobject_class, 1); 3199 3200 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 3201 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info; 3202 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties; 3203 skeleton_class->flush = fan_skeleton_dbus_interface_flush; 3204 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable; 3205 3206 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 3207 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate)); 3208 #endif 3209 } 3210 3211 static void 3212 fan_skeleton_iface_init (FanIface *iface) 3213 { 3214 iface->speed_changed = _fan_on_signal_speed_changed; 3215 iface->tach_error = _fan_on_signal_tach_error; 3216 iface->get_speed = fan_skeleton_get_speed; 3217 iface->get_cooling_zone = fan_skeleton_get_cooling_zone; 3218 iface->get_pwm_num = fan_skeleton_get_pwm_num; 3219 } 3220 3221 /** 3222 * fan_skeleton_new: 3223 * 3224 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. 3225 * 3226 * Returns: (transfer full) (type FanSkeleton): The skeleton object. 3227 */ 3228 Fan * 3229 fan_skeleton_new (void) 3230 { 3231 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL)); 3232 } 3233 3234 /* ------------------------------------------------------------------------ 3235 * Code for interface org.openbmc.SensorValue 3236 * ------------------------------------------------------------------------ 3237 */ 3238 3239 /** 3240 * SECTION:SensorValue 3241 * @title: SensorValue 3242 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface 3243 * 3244 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface in C. 3245 */ 3246 3247 /* ---- Introspection data for org.openbmc.SensorValue ---- */ 3248 3249 static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init = 3250 { 3251 { 3252 -1, 3253 (gchar *) "init", 3254 NULL, 3255 NULL, 3256 NULL 3257 }, 3258 "handle-init", 3259 FALSE 3260 }; 3261 3262 static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value = 3263 { 3264 { 3265 -1, 3266 (gchar *) "value", 3267 (gchar *) "v", 3268 NULL 3269 }, 3270 FALSE 3271 }; 3272 3273 static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] = 3274 { 3275 &_sensor_value_method_info_get_value_OUT_ARG_value, 3276 NULL 3277 }; 3278 3279 static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value = 3280 { 3281 { 3282 -1, 3283 (gchar *) "getValue", 3284 NULL, 3285 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers, 3286 NULL 3287 }, 3288 "handle-get-value", 3289 FALSE 3290 }; 3291 3292 static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value = 3293 { 3294 { 3295 -1, 3296 (gchar *) "value", 3297 (gchar *) "v", 3298 NULL 3299 }, 3300 FALSE 3301 }; 3302 3303 static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] = 3304 { 3305 &_sensor_value_method_info_set_value_IN_ARG_value, 3306 NULL 3307 }; 3308 3309 static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value = 3310 { 3311 { 3312 -1, 3313 (gchar *) "setValue", 3314 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers, 3315 NULL, 3316 NULL 3317 }, 3318 "handle-set-value", 3319 FALSE 3320 }; 3321 3322 static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] = 3323 { 3324 &_sensor_value_method_info_init, 3325 &_sensor_value_method_info_get_value, 3326 &_sensor_value_method_info_set_value, 3327 NULL 3328 }; 3329 3330 static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value = 3331 { 3332 { 3333 -1, 3334 (gchar *) "value", 3335 (gchar *) "v", 3336 NULL 3337 }, 3338 FALSE 3339 }; 3340 3341 static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units = 3342 { 3343 { 3344 -1, 3345 (gchar *) "units", 3346 (gchar *) "s", 3347 NULL 3348 }, 3349 FALSE 3350 }; 3351 3352 static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] = 3353 { 3354 &_sensor_value_signal_info_changed_ARG_value, 3355 &_sensor_value_signal_info_changed_ARG_units, 3356 NULL 3357 }; 3358 3359 static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed = 3360 { 3361 { 3362 -1, 3363 (gchar *) "Changed", 3364 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers, 3365 NULL 3366 }, 3367 "changed" 3368 }; 3369 3370 static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error = 3371 { 3372 { 3373 -1, 3374 (gchar *) "Error", 3375 NULL, 3376 NULL 3377 }, 3378 "error" 3379 }; 3380 3381 static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name = 3382 { 3383 { 3384 -1, 3385 (gchar *) "bus_name", 3386 (gchar *) "s", 3387 NULL 3388 }, 3389 FALSE 3390 }; 3391 3392 static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] = 3393 { 3394 &_sensor_value_signal_info_heartbeat_ARG_bus_name, 3395 NULL 3396 }; 3397 3398 static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat = 3399 { 3400 { 3401 -1, 3402 (gchar *) "Heartbeat", 3403 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers, 3404 NULL 3405 }, 3406 "heartbeat" 3407 }; 3408 3409 static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] = 3410 { 3411 &_sensor_value_signal_info_changed, 3412 &_sensor_value_signal_info_error, 3413 &_sensor_value_signal_info_heartbeat, 3414 NULL 3415 }; 3416 3417 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value = 3418 { 3419 { 3420 -1, 3421 (gchar *) "value", 3422 (gchar *) "v", 3423 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 3424 NULL 3425 }, 3426 "value", 3427 FALSE 3428 }; 3429 3430 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units = 3431 { 3432 { 3433 -1, 3434 (gchar *) "units", 3435 (gchar *) "s", 3436 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 3437 NULL 3438 }, 3439 "units", 3440 FALSE 3441 }; 3442 3443 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval = 3444 { 3445 { 3446 -1, 3447 (gchar *) "poll_interval", 3448 (gchar *) "i", 3449 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 3450 NULL 3451 }, 3452 "poll-interval", 3453 FALSE 3454 }; 3455 3456 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat = 3457 { 3458 { 3459 -1, 3460 (gchar *) "heatbeat", 3461 (gchar *) "i", 3462 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 3463 NULL 3464 }, 3465 "heatbeat", 3466 FALSE 3467 }; 3468 3469 static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable = 3470 { 3471 { 3472 -1, 3473 (gchar *) "settable", 3474 (gchar *) "b", 3475 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 3476 NULL 3477 }, 3478 "settable", 3479 FALSE 3480 }; 3481 3482 static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] = 3483 { 3484 &_sensor_value_property_info_value, 3485 &_sensor_value_property_info_units, 3486 &_sensor_value_property_info_poll_interval, 3487 &_sensor_value_property_info_heatbeat, 3488 &_sensor_value_property_info_settable, 3489 NULL 3490 }; 3491 3492 static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info = 3493 { 3494 { 3495 -1, 3496 (gchar *) "org.openbmc.SensorValue", 3497 (GDBusMethodInfo **) &_sensor_value_method_info_pointers, 3498 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers, 3499 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers, 3500 NULL 3501 }, 3502 "sensor-value", 3503 }; 3504 3505 3506 /** 3507 * sensor_value_interface_info: 3508 * 3509 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface. 3510 * 3511 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 3512 */ 3513 GDBusInterfaceInfo * 3514 sensor_value_interface_info (void) 3515 { 3516 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct; 3517 } 3518 3519 /** 3520 * sensor_value_override_properties: 3521 * @klass: The class structure for a #GObject<!-- -->-derived class. 3522 * @property_id_begin: The property id to assign to the first overridden property. 3523 * 3524 * Overrides all #GObject properties in the #SensorValue interface for a concrete class. 3525 * The properties are overridden in the order they are defined. 3526 * 3527 * Returns: The last property id. 3528 */ 3529 guint 3530 sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) 3531 { 3532 g_object_class_override_property (klass, property_id_begin++, "value"); 3533 g_object_class_override_property (klass, property_id_begin++, "units"); 3534 g_object_class_override_property (klass, property_id_begin++, "poll-interval"); 3535 g_object_class_override_property (klass, property_id_begin++, "heatbeat"); 3536 g_object_class_override_property (klass, property_id_begin++, "settable"); 3537 return property_id_begin - 1; 3538 } 3539 3540 3541 3542 /** 3543 * SensorValue: 3544 * 3545 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. 3546 */ 3547 3548 /** 3549 * SensorValueIface: 3550 * @parent_iface: The parent interface. 3551 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal. 3552 * @handle_init: Handler for the #SensorValue::handle-init signal. 3553 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal. 3554 * @get_heatbeat: Getter for the #SensorValue:heatbeat property. 3555 * @get_poll_interval: Getter for the #SensorValue:poll-interval property. 3556 * @get_settable: Getter for the #SensorValue:settable property. 3557 * @get_units: Getter for the #SensorValue:units property. 3558 * @get_value: Getter for the #SensorValue:value property. 3559 * @changed: Handler for the #SensorValue::changed signal. 3560 * @error: Handler for the #SensorValue::error signal. 3561 * @heartbeat: Handler for the #SensorValue::heartbeat signal. 3562 * 3563 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. 3564 */ 3565 3566 typedef SensorValueIface SensorValueInterface; 3567 G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT); 3568 3569 static void 3570 sensor_value_default_init (SensorValueIface *iface) 3571 { 3572 /* GObject signals for incoming D-Bus method calls: */ 3573 /** 3574 * SensorValue::handle-init: 3575 * @object: A #SensorValue. 3576 * @invocation: A #GDBusMethodInvocation. 3577 * 3578 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. 3579 * 3580 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 3581 * 3582 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 3583 */ 3584 g_signal_new ("handle-init", 3585 G_TYPE_FROM_INTERFACE (iface), 3586 G_SIGNAL_RUN_LAST, 3587 G_STRUCT_OFFSET (SensorValueIface, handle_init), 3588 g_signal_accumulator_true_handled, 3589 NULL, 3590 g_cclosure_marshal_generic, 3591 G_TYPE_BOOLEAN, 3592 1, 3593 G_TYPE_DBUS_METHOD_INVOCATION); 3594 3595 /** 3596 * SensorValue::handle-get-value: 3597 * @object: A #SensorValue. 3598 * @invocation: A #GDBusMethodInvocation. 3599 * 3600 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. 3601 * 3602 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 3603 * 3604 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 3605 */ 3606 g_signal_new ("handle-get-value", 3607 G_TYPE_FROM_INTERFACE (iface), 3608 G_SIGNAL_RUN_LAST, 3609 G_STRUCT_OFFSET (SensorValueIface, handle_get_value), 3610 g_signal_accumulator_true_handled, 3611 NULL, 3612 g_cclosure_marshal_generic, 3613 G_TYPE_BOOLEAN, 3614 1, 3615 G_TYPE_DBUS_METHOD_INVOCATION); 3616 3617 /** 3618 * SensorValue::handle-set-value: 3619 * @object: A #SensorValue. 3620 * @invocation: A #GDBusMethodInvocation. 3621 * @arg_value: Argument passed by remote caller. 3622 * 3623 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. 3624 * 3625 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_set_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 3626 * 3627 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 3628 */ 3629 g_signal_new ("handle-set-value", 3630 G_TYPE_FROM_INTERFACE (iface), 3631 G_SIGNAL_RUN_LAST, 3632 G_STRUCT_OFFSET (SensorValueIface, handle_set_value), 3633 g_signal_accumulator_true_handled, 3634 NULL, 3635 g_cclosure_marshal_generic, 3636 G_TYPE_BOOLEAN, 3637 2, 3638 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); 3639 3640 /* GObject signals for received D-Bus signals: */ 3641 /** 3642 * SensorValue::changed: 3643 * @object: A #SensorValue. 3644 * @arg_value: Argument. 3645 * @arg_units: Argument. 3646 * 3647 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> is received. 3648 * 3649 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 3650 */ 3651 g_signal_new ("changed", 3652 G_TYPE_FROM_INTERFACE (iface), 3653 G_SIGNAL_RUN_LAST, 3654 G_STRUCT_OFFSET (SensorValueIface, changed), 3655 NULL, 3656 NULL, 3657 g_cclosure_marshal_generic, 3658 G_TYPE_NONE, 3659 2, G_TYPE_VARIANT, G_TYPE_STRING); 3660 3661 /** 3662 * SensorValue::error: 3663 * @object: A #SensorValue. 3664 * 3665 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> is received. 3666 * 3667 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 3668 */ 3669 g_signal_new ("error", 3670 G_TYPE_FROM_INTERFACE (iface), 3671 G_SIGNAL_RUN_LAST, 3672 G_STRUCT_OFFSET (SensorValueIface, error), 3673 NULL, 3674 NULL, 3675 g_cclosure_marshal_generic, 3676 G_TYPE_NONE, 3677 0); 3678 3679 /** 3680 * SensorValue::heartbeat: 3681 * @object: A #SensorValue. 3682 * @arg_bus_name: Argument. 3683 * 3684 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> is received. 3685 * 3686 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 3687 */ 3688 g_signal_new ("heartbeat", 3689 G_TYPE_FROM_INTERFACE (iface), 3690 G_SIGNAL_RUN_LAST, 3691 G_STRUCT_OFFSET (SensorValueIface, heartbeat), 3692 NULL, 3693 NULL, 3694 g_cclosure_marshal_generic, 3695 G_TYPE_NONE, 3696 1, G_TYPE_STRING); 3697 3698 /* GObject properties for D-Bus properties: */ 3699 /** 3700 * SensorValue:value: 3701 * 3702 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>. 3703 * 3704 * 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. 3705 */ 3706 g_object_interface_install_property (iface, 3707 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 3708 /** 3709 * SensorValue:units: 3710 * 3711 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>. 3712 * 3713 * 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. 3714 */ 3715 g_object_interface_install_property (iface, 3716 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 3717 /** 3718 * SensorValue:poll-interval: 3719 * 3720 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>. 3721 * 3722 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 3723 */ 3724 g_object_interface_install_property (iface, 3725 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 3726 /** 3727 * SensorValue:heatbeat: 3728 * 3729 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>. 3730 * 3731 * 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. 3732 */ 3733 g_object_interface_install_property (iface, 3734 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 3735 /** 3736 * SensorValue:settable: 3737 * 3738 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>. 3739 * 3740 * 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. 3741 */ 3742 g_object_interface_install_property (iface, 3743 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 3744 } 3745 3746 /** 3747 * sensor_value_get_value: (skip) 3748 * @object: A #SensorValue. 3749 * 3750 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. 3751 * 3752 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 3753 * 3754 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_value() if on another thread.</warning> 3755 * 3756 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 3757 */ 3758 GVariant * 3759 sensor_value_get_value (SensorValue *object) 3760 { 3761 return SENSOR_VALUE_GET_IFACE (object)->get_value (object); 3762 } 3763 3764 /** 3765 * sensor_value_dup_value: (skip) 3766 * @object: A #SensorValue. 3767 * 3768 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. 3769 * 3770 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 3771 * 3772 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). 3773 */ 3774 GVariant * 3775 sensor_value_dup_value (SensorValue *object) 3776 { 3777 GVariant *value; 3778 g_object_get (G_OBJECT (object), "value", &value, NULL); 3779 return value; 3780 } 3781 3782 /** 3783 * sensor_value_set_value: (skip) 3784 * @object: A #SensorValue. 3785 * @value: The value to set. 3786 * 3787 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value. 3788 * 3789 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 3790 */ 3791 void 3792 sensor_value_set_value (SensorValue *object, GVariant *value) 3793 { 3794 g_object_set (G_OBJECT (object), "value", value, NULL); 3795 } 3796 3797 /** 3798 * sensor_value_get_units: (skip) 3799 * @object: A #SensorValue. 3800 * 3801 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. 3802 * 3803 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 3804 * 3805 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_units() if on another thread.</warning> 3806 * 3807 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 3808 */ 3809 const gchar * 3810 sensor_value_get_units (SensorValue *object) 3811 { 3812 return SENSOR_VALUE_GET_IFACE (object)->get_units (object); 3813 } 3814 3815 /** 3816 * sensor_value_dup_units: (skip) 3817 * @object: A #SensorValue. 3818 * 3819 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property. 3820 * 3821 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 3822 * 3823 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 3824 */ 3825 gchar * 3826 sensor_value_dup_units (SensorValue *object) 3827 { 3828 gchar *value; 3829 g_object_get (G_OBJECT (object), "units", &value, NULL); 3830 return value; 3831 } 3832 3833 /** 3834 * sensor_value_set_units: (skip) 3835 * @object: A #SensorValue. 3836 * @value: The value to set. 3837 * 3838 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value. 3839 * 3840 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 3841 */ 3842 void 3843 sensor_value_set_units (SensorValue *object, const gchar *value) 3844 { 3845 g_object_set (G_OBJECT (object), "units", value, NULL); 3846 } 3847 3848 /** 3849 * sensor_value_get_poll_interval: (skip) 3850 * @object: A #SensorValue. 3851 * 3852 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property. 3853 * 3854 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 3855 * 3856 * Returns: The property value. 3857 */ 3858 gint 3859 sensor_value_get_poll_interval (SensorValue *object) 3860 { 3861 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object); 3862 } 3863 3864 /** 3865 * sensor_value_set_poll_interval: (skip) 3866 * @object: A #SensorValue. 3867 * @value: The value to set. 3868 * 3869 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value. 3870 * 3871 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 3872 */ 3873 void 3874 sensor_value_set_poll_interval (SensorValue *object, gint value) 3875 { 3876 g_object_set (G_OBJECT (object), "poll-interval", value, NULL); 3877 } 3878 3879 /** 3880 * sensor_value_get_heatbeat: (skip) 3881 * @object: A #SensorValue. 3882 * 3883 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property. 3884 * 3885 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 3886 * 3887 * Returns: The property value. 3888 */ 3889 gint 3890 sensor_value_get_heatbeat (SensorValue *object) 3891 { 3892 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object); 3893 } 3894 3895 /** 3896 * sensor_value_set_heatbeat: (skip) 3897 * @object: A #SensorValue. 3898 * @value: The value to set. 3899 * 3900 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value. 3901 * 3902 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 3903 */ 3904 void 3905 sensor_value_set_heatbeat (SensorValue *object, gint value) 3906 { 3907 g_object_set (G_OBJECT (object), "heatbeat", value, NULL); 3908 } 3909 3910 /** 3911 * sensor_value_get_settable: (skip) 3912 * @object: A #SensorValue. 3913 * 3914 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property. 3915 * 3916 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 3917 * 3918 * Returns: The property value. 3919 */ 3920 gboolean 3921 sensor_value_get_settable (SensorValue *object) 3922 { 3923 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object); 3924 } 3925 3926 /** 3927 * sensor_value_set_settable: (skip) 3928 * @object: A #SensorValue. 3929 * @value: The value to set. 3930 * 3931 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value. 3932 * 3933 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 3934 */ 3935 void 3936 sensor_value_set_settable (SensorValue *object, gboolean value) 3937 { 3938 g_object_set (G_OBJECT (object), "settable", value, NULL); 3939 } 3940 3941 /** 3942 * sensor_value_emit_changed: 3943 * @object: A #SensorValue. 3944 * @arg_value: Argument to pass with the signal. 3945 * @arg_units: Argument to pass with the signal. 3946 * 3947 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal. 3948 */ 3949 void 3950 sensor_value_emit_changed ( 3951 SensorValue *object, 3952 GVariant *arg_value, 3953 const gchar *arg_units) 3954 { 3955 g_signal_emit_by_name (object, "changed", arg_value, arg_units); 3956 } 3957 3958 /** 3959 * sensor_value_emit_error: 3960 * @object: A #SensorValue. 3961 * 3962 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal. 3963 */ 3964 void 3965 sensor_value_emit_error ( 3966 SensorValue *object) 3967 { 3968 g_signal_emit_by_name (object, "error"); 3969 } 3970 3971 /** 3972 * sensor_value_emit_heartbeat: 3973 * @object: A #SensorValue. 3974 * @arg_bus_name: Argument to pass with the signal. 3975 * 3976 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal. 3977 */ 3978 void 3979 sensor_value_emit_heartbeat ( 3980 SensorValue *object, 3981 const gchar *arg_bus_name) 3982 { 3983 g_signal_emit_by_name (object, "heartbeat", arg_bus_name); 3984 } 3985 3986 /** 3987 * sensor_value_call_init: 3988 * @proxy: A #SensorValueProxy. 3989 * @cancellable: (allow-none): A #GCancellable or %NULL. 3990 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 3991 * @user_data: User data to pass to @callback. 3992 * 3993 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. 3994 * 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. 3995 * You can then call sensor_value_call_init_finish() to get the result of the operation. 3996 * 3997 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method. 3998 */ 3999 void 4000 sensor_value_call_init ( 4001 SensorValue *proxy, 4002 GCancellable *cancellable, 4003 GAsyncReadyCallback callback, 4004 gpointer user_data) 4005 { 4006 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 4007 "init", 4008 g_variant_new ("()"), 4009 G_DBUS_CALL_FLAGS_NONE, 4010 -1, 4011 cancellable, 4012 callback, 4013 user_data); 4014 } 4015 4016 /** 4017 * sensor_value_call_init_finish: 4018 * @proxy: A #SensorValueProxy. 4019 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init(). 4020 * @error: Return location for error or %NULL. 4021 * 4022 * Finishes an operation started with sensor_value_call_init(). 4023 * 4024 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 4025 */ 4026 gboolean 4027 sensor_value_call_init_finish ( 4028 SensorValue *proxy, 4029 GAsyncResult *res, 4030 GError **error) 4031 { 4032 GVariant *_ret; 4033 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 4034 if (_ret == NULL) 4035 goto _out; 4036 g_variant_get (_ret, 4037 "()"); 4038 g_variant_unref (_ret); 4039 _out: 4040 return _ret != NULL; 4041 } 4042 4043 /** 4044 * sensor_value_call_init_sync: 4045 * @proxy: A #SensorValueProxy. 4046 * @cancellable: (allow-none): A #GCancellable or %NULL. 4047 * @error: Return location for error or %NULL. 4048 * 4049 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 4050 * 4051 * See sensor_value_call_init() for the asynchronous version of this method. 4052 * 4053 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 4054 */ 4055 gboolean 4056 sensor_value_call_init_sync ( 4057 SensorValue *proxy, 4058 GCancellable *cancellable, 4059 GError **error) 4060 { 4061 GVariant *_ret; 4062 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 4063 "init", 4064 g_variant_new ("()"), 4065 G_DBUS_CALL_FLAGS_NONE, 4066 -1, 4067 cancellable, 4068 error); 4069 if (_ret == NULL) 4070 goto _out; 4071 g_variant_get (_ret, 4072 "()"); 4073 g_variant_unref (_ret); 4074 _out: 4075 return _ret != NULL; 4076 } 4077 4078 /** 4079 * sensor_value_call_get_value: 4080 * @proxy: A #SensorValueProxy. 4081 * @cancellable: (allow-none): A #GCancellable or %NULL. 4082 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 4083 * @user_data: User data to pass to @callback. 4084 * 4085 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. 4086 * 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. 4087 * You can then call sensor_value_call_get_value_finish() to get the result of the operation. 4088 * 4089 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method. 4090 */ 4091 void 4092 sensor_value_call_get_value ( 4093 SensorValue *proxy, 4094 GCancellable *cancellable, 4095 GAsyncReadyCallback callback, 4096 gpointer user_data) 4097 { 4098 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 4099 "getValue", 4100 g_variant_new ("()"), 4101 G_DBUS_CALL_FLAGS_NONE, 4102 -1, 4103 cancellable, 4104 callback, 4105 user_data); 4106 } 4107 4108 /** 4109 * sensor_value_call_get_value_finish: 4110 * @proxy: A #SensorValueProxy. 4111 * @out_value: (out): Return location for return parameter or %NULL to ignore. 4112 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value(). 4113 * @error: Return location for error or %NULL. 4114 * 4115 * Finishes an operation started with sensor_value_call_get_value(). 4116 * 4117 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 4118 */ 4119 gboolean 4120 sensor_value_call_get_value_finish ( 4121 SensorValue *proxy, 4122 GVariant **out_value, 4123 GAsyncResult *res, 4124 GError **error) 4125 { 4126 GVariant *_ret; 4127 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 4128 if (_ret == NULL) 4129 goto _out; 4130 g_variant_get (_ret, 4131 "(@v)", 4132 out_value); 4133 g_variant_unref (_ret); 4134 _out: 4135 return _ret != NULL; 4136 } 4137 4138 /** 4139 * sensor_value_call_get_value_sync: 4140 * @proxy: A #SensorValueProxy. 4141 * @out_value: (out): Return location for return parameter or %NULL to ignore. 4142 * @cancellable: (allow-none): A #GCancellable or %NULL. 4143 * @error: Return location for error or %NULL. 4144 * 4145 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 4146 * 4147 * See sensor_value_call_get_value() for the asynchronous version of this method. 4148 * 4149 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 4150 */ 4151 gboolean 4152 sensor_value_call_get_value_sync ( 4153 SensorValue *proxy, 4154 GVariant **out_value, 4155 GCancellable *cancellable, 4156 GError **error) 4157 { 4158 GVariant *_ret; 4159 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 4160 "getValue", 4161 g_variant_new ("()"), 4162 G_DBUS_CALL_FLAGS_NONE, 4163 -1, 4164 cancellable, 4165 error); 4166 if (_ret == NULL) 4167 goto _out; 4168 g_variant_get (_ret, 4169 "(@v)", 4170 out_value); 4171 g_variant_unref (_ret); 4172 _out: 4173 return _ret != NULL; 4174 } 4175 4176 /** 4177 * sensor_value_call_set_value: 4178 * @proxy: A #SensorValueProxy. 4179 * @arg_value: Argument to pass with the method invocation. 4180 * @cancellable: (allow-none): A #GCancellable or %NULL. 4181 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 4182 * @user_data: User data to pass to @callback. 4183 * 4184 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. 4185 * 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. 4186 * You can then call sensor_value_call_set_value_finish() to get the result of the operation. 4187 * 4188 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method. 4189 */ 4190 void 4191 sensor_value_call_set_value ( 4192 SensorValue *proxy, 4193 GVariant *arg_value, 4194 GCancellable *cancellable, 4195 GAsyncReadyCallback callback, 4196 gpointer user_data) 4197 { 4198 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 4199 "setValue", 4200 g_variant_new ("(@v)", 4201 arg_value), 4202 G_DBUS_CALL_FLAGS_NONE, 4203 -1, 4204 cancellable, 4205 callback, 4206 user_data); 4207 } 4208 4209 /** 4210 * sensor_value_call_set_value_finish: 4211 * @proxy: A #SensorValueProxy. 4212 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value(). 4213 * @error: Return location for error or %NULL. 4214 * 4215 * Finishes an operation started with sensor_value_call_set_value(). 4216 * 4217 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 4218 */ 4219 gboolean 4220 sensor_value_call_set_value_finish ( 4221 SensorValue *proxy, 4222 GAsyncResult *res, 4223 GError **error) 4224 { 4225 GVariant *_ret; 4226 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 4227 if (_ret == NULL) 4228 goto _out; 4229 g_variant_get (_ret, 4230 "()"); 4231 g_variant_unref (_ret); 4232 _out: 4233 return _ret != NULL; 4234 } 4235 4236 /** 4237 * sensor_value_call_set_value_sync: 4238 * @proxy: A #SensorValueProxy. 4239 * @arg_value: Argument to pass with the method invocation. 4240 * @cancellable: (allow-none): A #GCancellable or %NULL. 4241 * @error: Return location for error or %NULL. 4242 * 4243 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 4244 * 4245 * See sensor_value_call_set_value() for the asynchronous version of this method. 4246 * 4247 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 4248 */ 4249 gboolean 4250 sensor_value_call_set_value_sync ( 4251 SensorValue *proxy, 4252 GVariant *arg_value, 4253 GCancellable *cancellable, 4254 GError **error) 4255 { 4256 GVariant *_ret; 4257 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 4258 "setValue", 4259 g_variant_new ("(@v)", 4260 arg_value), 4261 G_DBUS_CALL_FLAGS_NONE, 4262 -1, 4263 cancellable, 4264 error); 4265 if (_ret == NULL) 4266 goto _out; 4267 g_variant_get (_ret, 4268 "()"); 4269 g_variant_unref (_ret); 4270 _out: 4271 return _ret != NULL; 4272 } 4273 4274 /** 4275 * sensor_value_complete_init: 4276 * @object: A #SensorValue. 4277 * @invocation: (transfer full): A #GDBusMethodInvocation. 4278 * 4279 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 4280 * 4281 * This method will free @invocation, you cannot use it afterwards. 4282 */ 4283 void 4284 sensor_value_complete_init ( 4285 SensorValue *object, 4286 GDBusMethodInvocation *invocation) 4287 { 4288 g_dbus_method_invocation_return_value (invocation, 4289 g_variant_new ("()")); 4290 } 4291 4292 /** 4293 * sensor_value_complete_get_value: 4294 * @object: A #SensorValue. 4295 * @invocation: (transfer full): A #GDBusMethodInvocation. 4296 * @value: Parameter to return. 4297 * 4298 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 4299 * 4300 * This method will free @invocation, you cannot use it afterwards. 4301 */ 4302 void 4303 sensor_value_complete_get_value ( 4304 SensorValue *object, 4305 GDBusMethodInvocation *invocation, 4306 GVariant *value) 4307 { 4308 g_dbus_method_invocation_return_value (invocation, 4309 g_variant_new ("(@v)", 4310 value)); 4311 } 4312 4313 /** 4314 * sensor_value_complete_set_value: 4315 * @object: A #SensorValue. 4316 * @invocation: (transfer full): A #GDBusMethodInvocation. 4317 * 4318 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 4319 * 4320 * This method will free @invocation, you cannot use it afterwards. 4321 */ 4322 void 4323 sensor_value_complete_set_value ( 4324 SensorValue *object, 4325 GDBusMethodInvocation *invocation) 4326 { 4327 g_dbus_method_invocation_return_value (invocation, 4328 g_variant_new ("()")); 4329 } 4330 4331 /* ------------------------------------------------------------------------ */ 4332 4333 /** 4334 * SensorValueProxy: 4335 * 4336 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API. 4337 */ 4338 4339 /** 4340 * SensorValueProxyClass: 4341 * @parent_class: The parent class. 4342 * 4343 * Class structure for #SensorValueProxy. 4344 */ 4345 4346 struct _SensorValueProxyPrivate 4347 { 4348 GData *qdata; 4349 }; 4350 4351 static void sensor_value_proxy_iface_init (SensorValueIface *iface); 4352 4353 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 4354 G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, 4355 G_ADD_PRIVATE (SensorValueProxy) 4356 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); 4357 4358 #else 4359 G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY, 4360 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init)); 4361 4362 #endif 4363 static void 4364 sensor_value_proxy_finalize (GObject *object) 4365 { 4366 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); 4367 g_datalist_clear (&proxy->priv->qdata); 4368 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object); 4369 } 4370 4371 static void 4372 sensor_value_proxy_get_property (GObject *object, 4373 guint prop_id, 4374 GValue *value, 4375 GParamSpec *pspec G_GNUC_UNUSED) 4376 { 4377 const _ExtendedGDBusPropertyInfo *info; 4378 GVariant *variant; 4379 g_assert (prop_id != 0 && prop_id - 1 < 5); 4380 info = _sensor_value_property_info_pointers[prop_id - 1]; 4381 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 4382 if (info->use_gvariant) 4383 { 4384 g_value_set_variant (value, variant); 4385 } 4386 else 4387 { 4388 if (variant != NULL) 4389 g_dbus_gvariant_to_gvalue (variant, value); 4390 } 4391 if (variant != NULL) 4392 g_variant_unref (variant); 4393 } 4394 4395 static void 4396 sensor_value_proxy_set_property_cb (GDBusProxy *proxy, 4397 GAsyncResult *res, 4398 gpointer user_data) 4399 { 4400 const _ExtendedGDBusPropertyInfo *info = user_data; 4401 GError *error; 4402 GVariant *_ret; 4403 error = NULL; 4404 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 4405 if (!_ret) 4406 { 4407 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)", 4408 info->parent_struct.name, 4409 error->message, g_quark_to_string (error->domain), error->code); 4410 g_error_free (error); 4411 } 4412 else 4413 { 4414 g_variant_unref (_ret); 4415 } 4416 } 4417 4418 static void 4419 sensor_value_proxy_set_property (GObject *object, 4420 guint prop_id, 4421 const GValue *value, 4422 GParamSpec *pspec G_GNUC_UNUSED) 4423 { 4424 const _ExtendedGDBusPropertyInfo *info; 4425 GVariant *variant; 4426 g_assert (prop_id != 0 && prop_id - 1 < 5); 4427 info = _sensor_value_property_info_pointers[prop_id - 1]; 4428 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 4429 g_dbus_proxy_call (G_DBUS_PROXY (object), 4430 "org.freedesktop.DBus.Properties.Set", 4431 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant), 4432 G_DBUS_CALL_FLAGS_NONE, 4433 -1, 4434 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 4435 g_variant_unref (variant); 4436 } 4437 4438 static void 4439 sensor_value_proxy_g_signal (GDBusProxy *proxy, 4440 const gchar *sender_name G_GNUC_UNUSED, 4441 const gchar *signal_name, 4442 GVariant *parameters) 4443 { 4444 _ExtendedGDBusSignalInfo *info; 4445 GVariantIter iter; 4446 GVariant *child; 4447 GValue *paramv; 4448 guint num_params; 4449 guint n; 4450 guint signal_id; 4451 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name); 4452 if (info == NULL) 4453 return; 4454 num_params = g_variant_n_children (parameters); 4455 paramv = g_new0 (GValue, num_params + 1); 4456 g_value_init (¶mv[0], TYPE_SENSOR_VALUE); 4457 g_value_set_object (¶mv[0], proxy); 4458 g_variant_iter_init (&iter, parameters); 4459 n = 1; 4460 while ((child = g_variant_iter_next_value (&iter)) != NULL) 4461 { 4462 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 4463 if (arg_info->use_gvariant) 4464 { 4465 g_value_init (¶mv[n], G_TYPE_VARIANT); 4466 g_value_set_variant (¶mv[n], child); 4467 n++; 4468 } 4469 else 4470 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 4471 g_variant_unref (child); 4472 } 4473 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); 4474 g_signal_emitv (paramv, signal_id, 0, NULL); 4475 for (n = 0; n < num_params + 1; n++) 4476 g_value_unset (¶mv[n]); 4477 g_free (paramv); 4478 } 4479 4480 static void 4481 sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy, 4482 GVariant *changed_properties, 4483 const gchar *const *invalidated_properties) 4484 { 4485 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy); 4486 guint n; 4487 const gchar *key; 4488 GVariantIter *iter; 4489 _ExtendedGDBusPropertyInfo *info; 4490 g_variant_get (changed_properties, "a{sv}", &iter); 4491 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 4492 { 4493 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key); 4494 g_datalist_remove_data (&proxy->priv->qdata, key); 4495 if (info != NULL) 4496 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 4497 } 4498 g_variant_iter_free (iter); 4499 for (n = 0; invalidated_properties[n] != NULL; n++) 4500 { 4501 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]); 4502 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 4503 if (info != NULL) 4504 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 4505 } 4506 } 4507 4508 static GVariant * 4509 sensor_value_proxy_get_value (SensorValue *object) 4510 { 4511 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); 4512 GVariant *variant; 4513 GVariant *value = NULL; 4514 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value"); 4515 value = variant; 4516 if (variant != NULL) 4517 g_variant_unref (variant); 4518 return value; 4519 } 4520 4521 static const gchar * 4522 sensor_value_proxy_get_units (SensorValue *object) 4523 { 4524 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); 4525 GVariant *variant; 4526 const gchar *value = NULL; 4527 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units"); 4528 if (variant != NULL) 4529 { 4530 value = g_variant_get_string (variant, NULL); 4531 g_variant_unref (variant); 4532 } 4533 return value; 4534 } 4535 4536 static gint 4537 sensor_value_proxy_get_poll_interval (SensorValue *object) 4538 { 4539 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); 4540 GVariant *variant; 4541 gint value = 0; 4542 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); 4543 if (variant != NULL) 4544 { 4545 value = g_variant_get_int32 (variant); 4546 g_variant_unref (variant); 4547 } 4548 return value; 4549 } 4550 4551 static gint 4552 sensor_value_proxy_get_heatbeat (SensorValue *object) 4553 { 4554 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); 4555 GVariant *variant; 4556 gint value = 0; 4557 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); 4558 if (variant != NULL) 4559 { 4560 value = g_variant_get_int32 (variant); 4561 g_variant_unref (variant); 4562 } 4563 return value; 4564 } 4565 4566 static gboolean 4567 sensor_value_proxy_get_settable (SensorValue *object) 4568 { 4569 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); 4570 GVariant *variant; 4571 gboolean value = 0; 4572 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable"); 4573 if (variant != NULL) 4574 { 4575 value = g_variant_get_boolean (variant); 4576 g_variant_unref (variant); 4577 } 4578 return value; 4579 } 4580 4581 static void 4582 sensor_value_proxy_init (SensorValueProxy *proxy) 4583 { 4584 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 4585 proxy->priv = sensor_value_proxy_get_instance_private (proxy); 4586 #else 4587 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate); 4588 #endif 4589 4590 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ()); 4591 } 4592 4593 static void 4594 sensor_value_proxy_class_init (SensorValueProxyClass *klass) 4595 { 4596 GObjectClass *gobject_class; 4597 GDBusProxyClass *proxy_class; 4598 4599 gobject_class = G_OBJECT_CLASS (klass); 4600 gobject_class->finalize = sensor_value_proxy_finalize; 4601 gobject_class->get_property = sensor_value_proxy_get_property; 4602 gobject_class->set_property = sensor_value_proxy_set_property; 4603 4604 proxy_class = G_DBUS_PROXY_CLASS (klass); 4605 proxy_class->g_signal = sensor_value_proxy_g_signal; 4606 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed; 4607 4608 sensor_value_override_properties (gobject_class, 1); 4609 4610 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 4611 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate)); 4612 #endif 4613 } 4614 4615 static void 4616 sensor_value_proxy_iface_init (SensorValueIface *iface) 4617 { 4618 iface->get_value = sensor_value_proxy_get_value; 4619 iface->get_units = sensor_value_proxy_get_units; 4620 iface->get_poll_interval = sensor_value_proxy_get_poll_interval; 4621 iface->get_heatbeat = sensor_value_proxy_get_heatbeat; 4622 iface->get_settable = sensor_value_proxy_get_settable; 4623 } 4624 4625 /** 4626 * sensor_value_proxy_new: 4627 * @connection: A #GDBusConnection. 4628 * @flags: Flags from the #GDBusProxyFlags enumeration. 4629 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 4630 * @object_path: An object path. 4631 * @cancellable: (allow-none): A #GCancellable or %NULL. 4632 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 4633 * @user_data: User data to pass to @callback. 4634 * 4635 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new() for more details. 4636 * 4637 * 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. 4638 * You can then call sensor_value_proxy_new_finish() to get the result of the operation. 4639 * 4640 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor. 4641 */ 4642 void 4643 sensor_value_proxy_new ( 4644 GDBusConnection *connection, 4645 GDBusProxyFlags flags, 4646 const gchar *name, 4647 const gchar *object_path, 4648 GCancellable *cancellable, 4649 GAsyncReadyCallback callback, 4650 gpointer user_data) 4651 { 4652 g_async_initable_new_async (TYPE_SENSOR_VALUE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL); 4653 } 4654 4655 /** 4656 * sensor_value_proxy_new_finish: 4657 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new(). 4658 * @error: Return location for error or %NULL 4659 * 4660 * Finishes an operation started with sensor_value_proxy_new(). 4661 * 4662 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. 4663 */ 4664 SensorValue * 4665 sensor_value_proxy_new_finish ( 4666 GAsyncResult *res, 4667 GError **error) 4668 { 4669 GObject *ret; 4670 GObject *source_object; 4671 source_object = g_async_result_get_source_object (res); 4672 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 4673 g_object_unref (source_object); 4674 if (ret != NULL) 4675 return SENSOR_VALUE (ret); 4676 else 4677 return NULL; 4678 } 4679 4680 /** 4681 * sensor_value_proxy_new_sync: 4682 * @connection: A #GDBusConnection. 4683 * @flags: Flags from the #GDBusProxyFlags enumeration. 4684 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 4685 * @object_path: An object path. 4686 * @cancellable: (allow-none): A #GCancellable or %NULL. 4687 * @error: Return location for error or %NULL 4688 * 4689 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new_sync() for more details. 4690 * 4691 * The calling thread is blocked until a reply is received. 4692 * 4693 * See sensor_value_proxy_new() for the asynchronous version of this constructor. 4694 * 4695 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. 4696 */ 4697 SensorValue * 4698 sensor_value_proxy_new_sync ( 4699 GDBusConnection *connection, 4700 GDBusProxyFlags flags, 4701 const gchar *name, 4702 const gchar *object_path, 4703 GCancellable *cancellable, 4704 GError **error) 4705 { 4706 GInitable *ret; 4707 ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL); 4708 if (ret != NULL) 4709 return SENSOR_VALUE (ret); 4710 else 4711 return NULL; 4712 } 4713 4714 4715 /** 4716 * sensor_value_proxy_new_for_bus: 4717 * @bus_type: A #GBusType. 4718 * @flags: Flags from the #GDBusProxyFlags enumeration. 4719 * @name: A bus name (well-known or unique). 4720 * @object_path: An object path. 4721 * @cancellable: (allow-none): A #GCancellable or %NULL. 4722 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 4723 * @user_data: User data to pass to @callback. 4724 * 4725 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 4726 * 4727 * 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. 4728 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation. 4729 * 4730 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 4731 */ 4732 void 4733 sensor_value_proxy_new_for_bus ( 4734 GBusType bus_type, 4735 GDBusProxyFlags flags, 4736 const gchar *name, 4737 const gchar *object_path, 4738 GCancellable *cancellable, 4739 GAsyncReadyCallback callback, 4740 gpointer user_data) 4741 { 4742 g_async_initable_new_async (TYPE_SENSOR_VALUE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL); 4743 } 4744 4745 /** 4746 * sensor_value_proxy_new_for_bus_finish: 4747 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus(). 4748 * @error: Return location for error or %NULL 4749 * 4750 * Finishes an operation started with sensor_value_proxy_new_for_bus(). 4751 * 4752 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. 4753 */ 4754 SensorValue * 4755 sensor_value_proxy_new_for_bus_finish ( 4756 GAsyncResult *res, 4757 GError **error) 4758 { 4759 GObject *ret; 4760 GObject *source_object; 4761 source_object = g_async_result_get_source_object (res); 4762 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 4763 g_object_unref (source_object); 4764 if (ret != NULL) 4765 return SENSOR_VALUE (ret); 4766 else 4767 return NULL; 4768 } 4769 4770 /** 4771 * sensor_value_proxy_new_for_bus_sync: 4772 * @bus_type: A #GBusType. 4773 * @flags: Flags from the #GDBusProxyFlags enumeration. 4774 * @name: A bus name (well-known or unique). 4775 * @object_path: An object path. 4776 * @cancellable: (allow-none): A #GCancellable or %NULL. 4777 * @error: Return location for error or %NULL 4778 * 4779 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 4780 * 4781 * The calling thread is blocked until a reply is received. 4782 * 4783 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor. 4784 * 4785 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set. 4786 */ 4787 SensorValue * 4788 sensor_value_proxy_new_for_bus_sync ( 4789 GBusType bus_type, 4790 GDBusProxyFlags flags, 4791 const gchar *name, 4792 const gchar *object_path, 4793 GCancellable *cancellable, 4794 GError **error) 4795 { 4796 GInitable *ret; 4797 ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL); 4798 if (ret != NULL) 4799 return SENSOR_VALUE (ret); 4800 else 4801 return NULL; 4802 } 4803 4804 4805 /* ------------------------------------------------------------------------ */ 4806 4807 /** 4808 * SensorValueSkeleton: 4809 * 4810 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API. 4811 */ 4812 4813 /** 4814 * SensorValueSkeletonClass: 4815 * @parent_class: The parent class. 4816 * 4817 * Class structure for #SensorValueSkeleton. 4818 */ 4819 4820 struct _SensorValueSkeletonPrivate 4821 { 4822 GValue *properties; 4823 GList *changed_properties; 4824 GSource *changed_properties_idle_source; 4825 GMainContext *context; 4826 GMutex lock; 4827 }; 4828 4829 static void 4830 _sensor_value_skeleton_handle_method_call ( 4831 GDBusConnection *connection G_GNUC_UNUSED, 4832 const gchar *sender G_GNUC_UNUSED, 4833 const gchar *object_path G_GNUC_UNUSED, 4834 const gchar *interface_name, 4835 const gchar *method_name, 4836 GVariant *parameters, 4837 GDBusMethodInvocation *invocation, 4838 gpointer user_data) 4839 { 4840 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); 4841 _ExtendedGDBusMethodInfo *info; 4842 GVariantIter iter; 4843 GVariant *child; 4844 GValue *paramv; 4845 guint num_params; 4846 guint num_extra; 4847 guint n; 4848 guint signal_id; 4849 GValue return_value = G_VALUE_INIT; 4850 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 4851 g_assert (info != NULL); 4852 num_params = g_variant_n_children (parameters); 4853 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 4854 n = 0; 4855 g_value_init (¶mv[n], TYPE_SENSOR_VALUE); 4856 g_value_set_object (¶mv[n++], skeleton); 4857 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 4858 g_value_set_object (¶mv[n++], invocation); 4859 if (info->pass_fdlist) 4860 { 4861 #ifdef G_OS_UNIX 4862 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 4863 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 4864 #else 4865 g_assert_not_reached (); 4866 #endif 4867 } 4868 g_variant_iter_init (&iter, parameters); 4869 while ((child = g_variant_iter_next_value (&iter)) != NULL) 4870 { 4871 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 4872 if (arg_info->use_gvariant) 4873 { 4874 g_value_init (¶mv[n], G_TYPE_VARIANT); 4875 g_value_set_variant (¶mv[n], child); 4876 n++; 4877 } 4878 else 4879 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 4880 g_variant_unref (child); 4881 } 4882 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE); 4883 g_value_init (&return_value, G_TYPE_BOOLEAN); 4884 g_signal_emitv (paramv, signal_id, 0, &return_value); 4885 if (!g_value_get_boolean (&return_value)) 4886 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); 4887 g_value_unset (&return_value); 4888 for (n = 0; n < num_params + num_extra; n++) 4889 g_value_unset (¶mv[n]); 4890 g_free (paramv); 4891 } 4892 4893 static GVariant * 4894 _sensor_value_skeleton_handle_get_property ( 4895 GDBusConnection *connection G_GNUC_UNUSED, 4896 const gchar *sender G_GNUC_UNUSED, 4897 const gchar *object_path G_GNUC_UNUSED, 4898 const gchar *interface_name G_GNUC_UNUSED, 4899 const gchar *property_name, 4900 GError **error, 4901 gpointer user_data) 4902 { 4903 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); 4904 GValue value = G_VALUE_INIT; 4905 GParamSpec *pspec; 4906 _ExtendedGDBusPropertyInfo *info; 4907 GVariant *ret; 4908 ret = NULL; 4909 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); 4910 g_assert (info != NULL); 4911 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 4912 if (pspec == NULL) 4913 { 4914 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 4915 } 4916 else 4917 { 4918 g_value_init (&value, pspec->value_type); 4919 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 4920 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 4921 g_value_unset (&value); 4922 } 4923 return ret; 4924 } 4925 4926 static gboolean 4927 _sensor_value_skeleton_handle_set_property ( 4928 GDBusConnection *connection G_GNUC_UNUSED, 4929 const gchar *sender G_GNUC_UNUSED, 4930 const gchar *object_path G_GNUC_UNUSED, 4931 const gchar *interface_name G_GNUC_UNUSED, 4932 const gchar *property_name, 4933 GVariant *variant, 4934 GError **error, 4935 gpointer user_data) 4936 { 4937 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); 4938 GValue value = G_VALUE_INIT; 4939 GParamSpec *pspec; 4940 _ExtendedGDBusPropertyInfo *info; 4941 gboolean ret; 4942 ret = FALSE; 4943 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name); 4944 g_assert (info != NULL); 4945 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 4946 if (pspec == NULL) 4947 { 4948 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 4949 } 4950 else 4951 { 4952 if (info->use_gvariant) 4953 g_value_set_variant (&value, variant); 4954 else 4955 g_dbus_gvariant_to_gvalue (variant, &value); 4956 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 4957 g_value_unset (&value); 4958 ret = TRUE; 4959 } 4960 return ret; 4961 } 4962 4963 static const GDBusInterfaceVTable _sensor_value_skeleton_vtable = 4964 { 4965 _sensor_value_skeleton_handle_method_call, 4966 _sensor_value_skeleton_handle_get_property, 4967 _sensor_value_skeleton_handle_set_property, 4968 {NULL} 4969 }; 4970 4971 static GDBusInterfaceInfo * 4972 sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 4973 { 4974 return sensor_value_interface_info (); 4975 } 4976 4977 static GDBusInterfaceVTable * 4978 sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 4979 { 4980 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable; 4981 } 4982 4983 static GVariant * 4984 sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 4985 { 4986 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); 4987 4988 GVariantBuilder builder; 4989 guint n; 4990 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 4991 if (_sensor_value_interface_info.parent_struct.properties == NULL) 4992 goto out; 4993 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++) 4994 { 4995 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n]; 4996 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 4997 { 4998 GVariant *value; 4999 value = _sensor_value_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", info->name, NULL, skeleton); 5000 if (value != NULL) 5001 { 5002 g_variant_take_ref (value); 5003 g_variant_builder_add (&builder, "{sv}", info->name, value); 5004 g_variant_unref (value); 5005 } 5006 } 5007 } 5008 out: 5009 return g_variant_builder_end (&builder); 5010 } 5011 5012 static gboolean _sensor_value_emit_changed (gpointer user_data); 5013 5014 static void 5015 sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 5016 { 5017 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton); 5018 gboolean emit_changed = FALSE; 5019 5020 g_mutex_lock (&skeleton->priv->lock); 5021 if (skeleton->priv->changed_properties_idle_source != NULL) 5022 { 5023 g_source_destroy (skeleton->priv->changed_properties_idle_source); 5024 skeleton->priv->changed_properties_idle_source = NULL; 5025 emit_changed = TRUE; 5026 } 5027 g_mutex_unlock (&skeleton->priv->lock); 5028 5029 if (emit_changed) 5030 _sensor_value_emit_changed (skeleton); 5031 } 5032 5033 static void 5034 _sensor_value_on_signal_changed ( 5035 SensorValue *object, 5036 GVariant *arg_value, 5037 const gchar *arg_units) 5038 { 5039 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5040 5041 GList *connections, *l; 5042 GVariant *signal_variant; 5043 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 5044 5045 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)", 5046 arg_value, 5047 arg_units)); 5048 for (l = connections; l != NULL; l = l->next) 5049 { 5050 GDBusConnection *connection = l->data; 5051 g_dbus_connection_emit_signal (connection, 5052 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed", 5053 signal_variant, NULL); 5054 } 5055 g_variant_unref (signal_variant); 5056 g_list_free_full (connections, g_object_unref); 5057 } 5058 5059 static void 5060 _sensor_value_on_signal_error ( 5061 SensorValue *object) 5062 { 5063 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5064 5065 GList *connections, *l; 5066 GVariant *signal_variant; 5067 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 5068 5069 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 5070 for (l = connections; l != NULL; l = l->next) 5071 { 5072 GDBusConnection *connection = l->data; 5073 g_dbus_connection_emit_signal (connection, 5074 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error", 5075 signal_variant, NULL); 5076 } 5077 g_variant_unref (signal_variant); 5078 g_list_free_full (connections, g_object_unref); 5079 } 5080 5081 static void 5082 _sensor_value_on_signal_heartbeat ( 5083 SensorValue *object, 5084 const gchar *arg_bus_name) 5085 { 5086 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5087 5088 GList *connections, *l; 5089 GVariant *signal_variant; 5090 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 5091 5092 signal_variant = g_variant_ref_sink (g_variant_new ("(s)", 5093 arg_bus_name)); 5094 for (l = connections; l != NULL; l = l->next) 5095 { 5096 GDBusConnection *connection = l->data; 5097 g_dbus_connection_emit_signal (connection, 5098 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat", 5099 signal_variant, NULL); 5100 } 5101 g_variant_unref (signal_variant); 5102 g_list_free_full (connections, g_object_unref); 5103 } 5104 5105 static void sensor_value_skeleton_iface_init (SensorValueIface *iface); 5106 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 5107 G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 5108 G_ADD_PRIVATE (SensorValueSkeleton) 5109 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); 5110 5111 #else 5112 G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 5113 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init)); 5114 5115 #endif 5116 static void 5117 sensor_value_skeleton_finalize (GObject *object) 5118 { 5119 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5120 guint n; 5121 for (n = 0; n < 5; n++) 5122 g_value_unset (&skeleton->priv->properties[n]); 5123 g_free (skeleton->priv->properties); 5124 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 5125 if (skeleton->priv->changed_properties_idle_source != NULL) 5126 g_source_destroy (skeleton->priv->changed_properties_idle_source); 5127 g_main_context_unref (skeleton->priv->context); 5128 g_mutex_clear (&skeleton->priv->lock); 5129 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object); 5130 } 5131 5132 static void 5133 sensor_value_skeleton_get_property (GObject *object, 5134 guint prop_id, 5135 GValue *value, 5136 GParamSpec *pspec G_GNUC_UNUSED) 5137 { 5138 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5139 g_assert (prop_id != 0 && prop_id - 1 < 5); 5140 g_mutex_lock (&skeleton->priv->lock); 5141 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 5142 g_mutex_unlock (&skeleton->priv->lock); 5143 } 5144 5145 static gboolean 5146 _sensor_value_emit_changed (gpointer user_data) 5147 { 5148 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data); 5149 GList *l; 5150 GVariantBuilder builder; 5151 GVariantBuilder invalidated_builder; 5152 guint num_changes; 5153 5154 g_mutex_lock (&skeleton->priv->lock); 5155 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 5156 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 5157 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 5158 { 5159 ChangedProperty *cp = l->data; 5160 GVariant *variant; 5161 const GValue *cur_value; 5162 5163 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 5164 if (!_g_value_equal (cur_value, &cp->orig_value)) 5165 { 5166 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 5167 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 5168 g_variant_unref (variant); 5169 num_changes++; 5170 } 5171 } 5172 if (num_changes > 0) 5173 { 5174 GList *connections, *ll; 5175 GVariant *signal_variant; 5176 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue", 5177 &builder, &invalidated_builder)); 5178 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 5179 for (ll = connections; ll != NULL; ll = ll->next) 5180 { 5181 GDBusConnection *connection = ll->data; 5182 5183 g_dbus_connection_emit_signal (connection, 5184 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 5185 "org.freedesktop.DBus.Properties", 5186 "PropertiesChanged", 5187 signal_variant, 5188 NULL); 5189 } 5190 g_variant_unref (signal_variant); 5191 g_list_free_full (connections, g_object_unref); 5192 } 5193 else 5194 { 5195 g_variant_builder_clear (&builder); 5196 g_variant_builder_clear (&invalidated_builder); 5197 } 5198 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 5199 skeleton->priv->changed_properties = NULL; 5200 skeleton->priv->changed_properties_idle_source = NULL; 5201 g_mutex_unlock (&skeleton->priv->lock); 5202 return FALSE; 5203 } 5204 5205 static void 5206 _sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 5207 { 5208 ChangedProperty *cp; 5209 GList *l; 5210 cp = NULL; 5211 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 5212 { 5213 ChangedProperty *i_cp = l->data; 5214 if (i_cp->info == info) 5215 { 5216 cp = i_cp; 5217 break; 5218 } 5219 } 5220 if (cp == NULL) 5221 { 5222 cp = g_new0 (ChangedProperty, 1); 5223 cp->prop_id = prop_id; 5224 cp->info = info; 5225 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 5226 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 5227 g_value_copy (orig_value, &cp->orig_value); 5228 } 5229 } 5230 5231 static void 5232 sensor_value_skeleton_notify (GObject *object, 5233 GParamSpec *pspec G_GNUC_UNUSED) 5234 { 5235 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5236 g_mutex_lock (&skeleton->priv->lock); 5237 if (skeleton->priv->changed_properties != NULL && 5238 skeleton->priv->changed_properties_idle_source == NULL) 5239 { 5240 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 5241 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 5242 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 5243 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_value_emit_changed"); 5244 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 5245 g_source_unref (skeleton->priv->changed_properties_idle_source); 5246 } 5247 g_mutex_unlock (&skeleton->priv->lock); 5248 } 5249 5250 static void 5251 sensor_value_skeleton_set_property (GObject *object, 5252 guint prop_id, 5253 const GValue *value, 5254 GParamSpec *pspec) 5255 { 5256 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5257 g_assert (prop_id != 0 && prop_id - 1 < 5); 5258 g_mutex_lock (&skeleton->priv->lock); 5259 g_object_freeze_notify (object); 5260 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 5261 { 5262 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 5263 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 5264 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 5265 g_object_notify_by_pspec (object, pspec); 5266 } 5267 g_mutex_unlock (&skeleton->priv->lock); 5268 g_object_thaw_notify (object); 5269 } 5270 5271 static void 5272 sensor_value_skeleton_init (SensorValueSkeleton *skeleton) 5273 { 5274 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 5275 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton); 5276 #else 5277 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate); 5278 #endif 5279 5280 g_mutex_init (&skeleton->priv->lock); 5281 skeleton->priv->context = g_main_context_ref_thread_default (); 5282 skeleton->priv->properties = g_new0 (GValue, 5); 5283 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); 5284 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); 5285 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); 5286 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); 5287 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); 5288 } 5289 5290 static GVariant * 5291 sensor_value_skeleton_get_value (SensorValue *object) 5292 { 5293 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5294 GVariant *value; 5295 g_mutex_lock (&skeleton->priv->lock); 5296 value = g_value_get_variant (&(skeleton->priv->properties[0])); 5297 g_mutex_unlock (&skeleton->priv->lock); 5298 return value; 5299 } 5300 5301 static const gchar * 5302 sensor_value_skeleton_get_units (SensorValue *object) 5303 { 5304 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5305 const gchar *value; 5306 g_mutex_lock (&skeleton->priv->lock); 5307 value = g_value_get_string (&(skeleton->priv->properties[1])); 5308 g_mutex_unlock (&skeleton->priv->lock); 5309 return value; 5310 } 5311 5312 static gint 5313 sensor_value_skeleton_get_poll_interval (SensorValue *object) 5314 { 5315 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5316 gint value; 5317 g_mutex_lock (&skeleton->priv->lock); 5318 value = g_value_get_int (&(skeleton->priv->properties[2])); 5319 g_mutex_unlock (&skeleton->priv->lock); 5320 return value; 5321 } 5322 5323 static gint 5324 sensor_value_skeleton_get_heatbeat (SensorValue *object) 5325 { 5326 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5327 gint value; 5328 g_mutex_lock (&skeleton->priv->lock); 5329 value = g_value_get_int (&(skeleton->priv->properties[3])); 5330 g_mutex_unlock (&skeleton->priv->lock); 5331 return value; 5332 } 5333 5334 static gboolean 5335 sensor_value_skeleton_get_settable (SensorValue *object) 5336 { 5337 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); 5338 gboolean value; 5339 g_mutex_lock (&skeleton->priv->lock); 5340 value = g_value_get_boolean (&(skeleton->priv->properties[4])); 5341 g_mutex_unlock (&skeleton->priv->lock); 5342 return value; 5343 } 5344 5345 static void 5346 sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass) 5347 { 5348 GObjectClass *gobject_class; 5349 GDBusInterfaceSkeletonClass *skeleton_class; 5350 5351 gobject_class = G_OBJECT_CLASS (klass); 5352 gobject_class->finalize = sensor_value_skeleton_finalize; 5353 gobject_class->get_property = sensor_value_skeleton_get_property; 5354 gobject_class->set_property = sensor_value_skeleton_set_property; 5355 gobject_class->notify = sensor_value_skeleton_notify; 5356 5357 5358 sensor_value_override_properties (gobject_class, 1); 5359 5360 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 5361 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info; 5362 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties; 5363 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush; 5364 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable; 5365 5366 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 5367 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate)); 5368 #endif 5369 } 5370 5371 static void 5372 sensor_value_skeleton_iface_init (SensorValueIface *iface) 5373 { 5374 iface->changed = _sensor_value_on_signal_changed; 5375 iface->error = _sensor_value_on_signal_error; 5376 iface->heartbeat = _sensor_value_on_signal_heartbeat; 5377 iface->get_value = sensor_value_skeleton_get_value; 5378 iface->get_units = sensor_value_skeleton_get_units; 5379 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval; 5380 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat; 5381 iface->get_settable = sensor_value_skeleton_get_settable; 5382 } 5383 5384 /** 5385 * sensor_value_skeleton_new: 5386 * 5387 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. 5388 * 5389 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object. 5390 */ 5391 SensorValue * 5392 sensor_value_skeleton_new (void) 5393 { 5394 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL)); 5395 } 5396 5397 /* ------------------------------------------------------------------------ 5398 * Code for interface org.openbmc.SensorThreshold 5399 * ------------------------------------------------------------------------ 5400 */ 5401 5402 /** 5403 * SECTION:SensorThreshold 5404 * @title: SensorThreshold 5405 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface 5406 * 5407 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface in C. 5408 */ 5409 5410 /* ---- Introspection data for org.openbmc.SensorThreshold ---- */ 5411 5412 static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state = 5413 { 5414 { 5415 -1, 5416 (gchar *) "state", 5417 (gchar *) "y", 5418 NULL 5419 }, 5420 FALSE 5421 }; 5422 5423 static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] = 5424 { 5425 &_sensor_threshold_method_info_get_state_OUT_ARG_state, 5426 NULL 5427 }; 5428 5429 static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state = 5430 { 5431 { 5432 -1, 5433 (gchar *) "getState", 5434 NULL, 5435 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers, 5436 NULL 5437 }, 5438 "handle-get-state", 5439 FALSE 5440 }; 5441 5442 static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] = 5443 { 5444 &_sensor_threshold_method_info_get_state, 5445 NULL 5446 }; 5447 5448 static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning = 5449 { 5450 { 5451 -1, 5452 (gchar *) "Warning", 5453 NULL, 5454 NULL 5455 }, 5456 "warning" 5457 }; 5458 5459 static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical = 5460 { 5461 { 5462 -1, 5463 (gchar *) "Critical", 5464 NULL, 5465 NULL 5466 }, 5467 "critical" 5468 }; 5469 5470 static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal = 5471 { 5472 { 5473 -1, 5474 (gchar *) "Normal", 5475 NULL, 5476 NULL 5477 }, 5478 "normal" 5479 }; 5480 5481 static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] = 5482 { 5483 &_sensor_threshold_signal_info_warning, 5484 &_sensor_threshold_signal_info_critical, 5485 &_sensor_threshold_signal_info_normal, 5486 NULL 5487 }; 5488 5489 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical = 5490 { 5491 { 5492 -1, 5493 (gchar *) "lower_critical", 5494 (gchar *) "v", 5495 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 5496 NULL 5497 }, 5498 "lower-critical", 5499 FALSE 5500 }; 5501 5502 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning = 5503 { 5504 { 5505 -1, 5506 (gchar *) "lower_warning", 5507 (gchar *) "v", 5508 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 5509 NULL 5510 }, 5511 "lower-warning", 5512 FALSE 5513 }; 5514 5515 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning = 5516 { 5517 { 5518 -1, 5519 (gchar *) "upper_warning", 5520 (gchar *) "v", 5521 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 5522 NULL 5523 }, 5524 "upper-warning", 5525 FALSE 5526 }; 5527 5528 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical = 5529 { 5530 { 5531 -1, 5532 (gchar *) "upper_critical", 5533 (gchar *) "v", 5534 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 5535 NULL 5536 }, 5537 "upper-critical", 5538 FALSE 5539 }; 5540 5541 static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state = 5542 { 5543 { 5544 -1, 5545 (gchar *) "state", 5546 (gchar *) "y", 5547 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 5548 NULL 5549 }, 5550 "state", 5551 FALSE 5552 }; 5553 5554 static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] = 5555 { 5556 &_sensor_threshold_property_info_lower_critical, 5557 &_sensor_threshold_property_info_lower_warning, 5558 &_sensor_threshold_property_info_upper_warning, 5559 &_sensor_threshold_property_info_upper_critical, 5560 &_sensor_threshold_property_info_state, 5561 NULL 5562 }; 5563 5564 static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info = 5565 { 5566 { 5567 -1, 5568 (gchar *) "org.openbmc.SensorThreshold", 5569 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers, 5570 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers, 5571 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers, 5572 NULL 5573 }, 5574 "sensor-threshold", 5575 }; 5576 5577 5578 /** 5579 * sensor_threshold_interface_info: 5580 * 5581 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface. 5582 * 5583 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 5584 */ 5585 GDBusInterfaceInfo * 5586 sensor_threshold_interface_info (void) 5587 { 5588 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct; 5589 } 5590 5591 /** 5592 * sensor_threshold_override_properties: 5593 * @klass: The class structure for a #GObject<!-- -->-derived class. 5594 * @property_id_begin: The property id to assign to the first overridden property. 5595 * 5596 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class. 5597 * The properties are overridden in the order they are defined. 5598 * 5599 * Returns: The last property id. 5600 */ 5601 guint 5602 sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin) 5603 { 5604 g_object_class_override_property (klass, property_id_begin++, "lower-critical"); 5605 g_object_class_override_property (klass, property_id_begin++, "lower-warning"); 5606 g_object_class_override_property (klass, property_id_begin++, "upper-warning"); 5607 g_object_class_override_property (klass, property_id_begin++, "upper-critical"); 5608 g_object_class_override_property (klass, property_id_begin++, "state"); 5609 return property_id_begin - 1; 5610 } 5611 5612 5613 5614 /** 5615 * SensorThreshold: 5616 * 5617 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. 5618 */ 5619 5620 /** 5621 * SensorThresholdIface: 5622 * @parent_iface: The parent interface. 5623 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal. 5624 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property. 5625 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property. 5626 * @get_state: Getter for the #SensorThreshold:state property. 5627 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property. 5628 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property. 5629 * @critical: Handler for the #SensorThreshold::critical signal. 5630 * @normal: Handler for the #SensorThreshold::normal signal. 5631 * @warning: Handler for the #SensorThreshold::warning signal. 5632 * 5633 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. 5634 */ 5635 5636 typedef SensorThresholdIface SensorThresholdInterface; 5637 G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT); 5638 5639 static void 5640 sensor_threshold_default_init (SensorThresholdIface *iface) 5641 { 5642 /* GObject signals for incoming D-Bus method calls: */ 5643 /** 5644 * SensorThreshold::handle-get-state: 5645 * @object: A #SensorThreshold. 5646 * @invocation: A #GDBusMethodInvocation. 5647 * 5648 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. 5649 * 5650 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_threshold_complete_get_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 5651 * 5652 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 5653 */ 5654 g_signal_new ("handle-get-state", 5655 G_TYPE_FROM_INTERFACE (iface), 5656 G_SIGNAL_RUN_LAST, 5657 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state), 5658 g_signal_accumulator_true_handled, 5659 NULL, 5660 g_cclosure_marshal_generic, 5661 G_TYPE_BOOLEAN, 5662 1, 5663 G_TYPE_DBUS_METHOD_INVOCATION); 5664 5665 /* GObject signals for received D-Bus signals: */ 5666 /** 5667 * SensorThreshold::warning: 5668 * @object: A #SensorThreshold. 5669 * 5670 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> is received. 5671 * 5672 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 5673 */ 5674 g_signal_new ("warning", 5675 G_TYPE_FROM_INTERFACE (iface), 5676 G_SIGNAL_RUN_LAST, 5677 G_STRUCT_OFFSET (SensorThresholdIface, warning), 5678 NULL, 5679 NULL, 5680 g_cclosure_marshal_generic, 5681 G_TYPE_NONE, 5682 0); 5683 5684 /** 5685 * SensorThreshold::critical: 5686 * @object: A #SensorThreshold. 5687 * 5688 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> is received. 5689 * 5690 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 5691 */ 5692 g_signal_new ("critical", 5693 G_TYPE_FROM_INTERFACE (iface), 5694 G_SIGNAL_RUN_LAST, 5695 G_STRUCT_OFFSET (SensorThresholdIface, critical), 5696 NULL, 5697 NULL, 5698 g_cclosure_marshal_generic, 5699 G_TYPE_NONE, 5700 0); 5701 5702 /** 5703 * SensorThreshold::normal: 5704 * @object: A #SensorThreshold. 5705 * 5706 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> is received. 5707 * 5708 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 5709 */ 5710 g_signal_new ("normal", 5711 G_TYPE_FROM_INTERFACE (iface), 5712 G_SIGNAL_RUN_LAST, 5713 G_STRUCT_OFFSET (SensorThresholdIface, normal), 5714 NULL, 5715 NULL, 5716 g_cclosure_marshal_generic, 5717 G_TYPE_NONE, 5718 0); 5719 5720 /* GObject properties for D-Bus properties: */ 5721 /** 5722 * SensorThreshold:lower-critical: 5723 * 5724 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>. 5725 * 5726 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 5727 */ 5728 g_object_interface_install_property (iface, 5729 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 5730 /** 5731 * SensorThreshold:lower-warning: 5732 * 5733 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>. 5734 * 5735 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 5736 */ 5737 g_object_interface_install_property (iface, 5738 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 5739 /** 5740 * SensorThreshold:upper-warning: 5741 * 5742 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>. 5743 * 5744 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 5745 */ 5746 g_object_interface_install_property (iface, 5747 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 5748 /** 5749 * SensorThreshold:upper-critical: 5750 * 5751 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>. 5752 * 5753 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 5754 */ 5755 g_object_interface_install_property (iface, 5756 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 5757 /** 5758 * SensorThreshold:state: 5759 * 5760 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>. 5761 * 5762 * 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. 5763 */ 5764 g_object_interface_install_property (iface, 5765 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 5766 } 5767 5768 /** 5769 * sensor_threshold_get_lower_critical: (skip) 5770 * @object: A #SensorThreshold. 5771 * 5772 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. 5773 * 5774 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5775 * 5776 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_critical() if on another thread.</warning> 5777 * 5778 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 5779 */ 5780 GVariant * 5781 sensor_threshold_get_lower_critical (SensorThreshold *object) 5782 { 5783 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object); 5784 } 5785 5786 /** 5787 * sensor_threshold_dup_lower_critical: (skip) 5788 * @object: A #SensorThreshold. 5789 * 5790 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property. 5791 * 5792 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5793 * 5794 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). 5795 */ 5796 GVariant * 5797 sensor_threshold_dup_lower_critical (SensorThreshold *object) 5798 { 5799 GVariant *value; 5800 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL); 5801 return value; 5802 } 5803 5804 /** 5805 * sensor_threshold_set_lower_critical: (skip) 5806 * @object: A #SensorThreshold. 5807 * @value: The value to set. 5808 * 5809 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value. 5810 * 5811 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5812 */ 5813 void 5814 sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value) 5815 { 5816 g_object_set (G_OBJECT (object), "lower-critical", value, NULL); 5817 } 5818 5819 /** 5820 * sensor_threshold_get_lower_warning: (skip) 5821 * @object: A #SensorThreshold. 5822 * 5823 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. 5824 * 5825 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5826 * 5827 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_warning() if on another thread.</warning> 5828 * 5829 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 5830 */ 5831 GVariant * 5832 sensor_threshold_get_lower_warning (SensorThreshold *object) 5833 { 5834 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object); 5835 } 5836 5837 /** 5838 * sensor_threshold_dup_lower_warning: (skip) 5839 * @object: A #SensorThreshold. 5840 * 5841 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property. 5842 * 5843 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5844 * 5845 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). 5846 */ 5847 GVariant * 5848 sensor_threshold_dup_lower_warning (SensorThreshold *object) 5849 { 5850 GVariant *value; 5851 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL); 5852 return value; 5853 } 5854 5855 /** 5856 * sensor_threshold_set_lower_warning: (skip) 5857 * @object: A #SensorThreshold. 5858 * @value: The value to set. 5859 * 5860 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value. 5861 * 5862 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5863 */ 5864 void 5865 sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value) 5866 { 5867 g_object_set (G_OBJECT (object), "lower-warning", value, NULL); 5868 } 5869 5870 /** 5871 * sensor_threshold_get_upper_warning: (skip) 5872 * @object: A #SensorThreshold. 5873 * 5874 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. 5875 * 5876 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5877 * 5878 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_warning() if on another thread.</warning> 5879 * 5880 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 5881 */ 5882 GVariant * 5883 sensor_threshold_get_upper_warning (SensorThreshold *object) 5884 { 5885 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object); 5886 } 5887 5888 /** 5889 * sensor_threshold_dup_upper_warning: (skip) 5890 * @object: A #SensorThreshold. 5891 * 5892 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property. 5893 * 5894 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5895 * 5896 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). 5897 */ 5898 GVariant * 5899 sensor_threshold_dup_upper_warning (SensorThreshold *object) 5900 { 5901 GVariant *value; 5902 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL); 5903 return value; 5904 } 5905 5906 /** 5907 * sensor_threshold_set_upper_warning: (skip) 5908 * @object: A #SensorThreshold. 5909 * @value: The value to set. 5910 * 5911 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value. 5912 * 5913 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5914 */ 5915 void 5916 sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value) 5917 { 5918 g_object_set (G_OBJECT (object), "upper-warning", value, NULL); 5919 } 5920 5921 /** 5922 * sensor_threshold_get_upper_critical: (skip) 5923 * @object: A #SensorThreshold. 5924 * 5925 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. 5926 * 5927 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5928 * 5929 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_critical() if on another thread.</warning> 5930 * 5931 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 5932 */ 5933 GVariant * 5934 sensor_threshold_get_upper_critical (SensorThreshold *object) 5935 { 5936 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object); 5937 } 5938 5939 /** 5940 * sensor_threshold_dup_upper_critical: (skip) 5941 * @object: A #SensorThreshold. 5942 * 5943 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property. 5944 * 5945 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5946 * 5947 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). 5948 */ 5949 GVariant * 5950 sensor_threshold_dup_upper_critical (SensorThreshold *object) 5951 { 5952 GVariant *value; 5953 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL); 5954 return value; 5955 } 5956 5957 /** 5958 * sensor_threshold_set_upper_critical: (skip) 5959 * @object: A #SensorThreshold. 5960 * @value: The value to set. 5961 * 5962 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value. 5963 * 5964 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 5965 */ 5966 void 5967 sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value) 5968 { 5969 g_object_set (G_OBJECT (object), "upper-critical", value, NULL); 5970 } 5971 5972 /** 5973 * sensor_threshold_get_state: (skip) 5974 * @object: A #SensorThreshold. 5975 * 5976 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property. 5977 * 5978 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 5979 * 5980 * Returns: The property value. 5981 */ 5982 guchar 5983 sensor_threshold_get_state (SensorThreshold *object) 5984 { 5985 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object); 5986 } 5987 5988 /** 5989 * sensor_threshold_set_state: (skip) 5990 * @object: A #SensorThreshold. 5991 * @value: The value to set. 5992 * 5993 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value. 5994 * 5995 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 5996 */ 5997 void 5998 sensor_threshold_set_state (SensorThreshold *object, guchar value) 5999 { 6000 g_object_set (G_OBJECT (object), "state", value, NULL); 6001 } 6002 6003 /** 6004 * sensor_threshold_emit_warning: 6005 * @object: A #SensorThreshold. 6006 * 6007 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal. 6008 */ 6009 void 6010 sensor_threshold_emit_warning ( 6011 SensorThreshold *object) 6012 { 6013 g_signal_emit_by_name (object, "warning"); 6014 } 6015 6016 /** 6017 * sensor_threshold_emit_critical: 6018 * @object: A #SensorThreshold. 6019 * 6020 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal. 6021 */ 6022 void 6023 sensor_threshold_emit_critical ( 6024 SensorThreshold *object) 6025 { 6026 g_signal_emit_by_name (object, "critical"); 6027 } 6028 6029 /** 6030 * sensor_threshold_emit_normal: 6031 * @object: A #SensorThreshold. 6032 * 6033 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal. 6034 */ 6035 void 6036 sensor_threshold_emit_normal ( 6037 SensorThreshold *object) 6038 { 6039 g_signal_emit_by_name (object, "normal"); 6040 } 6041 6042 /** 6043 * sensor_threshold_call_get_state: 6044 * @proxy: A #SensorThresholdProxy. 6045 * @cancellable: (allow-none): A #GCancellable or %NULL. 6046 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 6047 * @user_data: User data to pass to @callback. 6048 * 6049 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. 6050 * 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. 6051 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation. 6052 * 6053 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method. 6054 */ 6055 void 6056 sensor_threshold_call_get_state ( 6057 SensorThreshold *proxy, 6058 GCancellable *cancellable, 6059 GAsyncReadyCallback callback, 6060 gpointer user_data) 6061 { 6062 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 6063 "getState", 6064 g_variant_new ("()"), 6065 G_DBUS_CALL_FLAGS_NONE, 6066 -1, 6067 cancellable, 6068 callback, 6069 user_data); 6070 } 6071 6072 /** 6073 * sensor_threshold_call_get_state_finish: 6074 * @proxy: A #SensorThresholdProxy. 6075 * @out_state: (out): Return location for return parameter or %NULL to ignore. 6076 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state(). 6077 * @error: Return location for error or %NULL. 6078 * 6079 * Finishes an operation started with sensor_threshold_call_get_state(). 6080 * 6081 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 6082 */ 6083 gboolean 6084 sensor_threshold_call_get_state_finish ( 6085 SensorThreshold *proxy, 6086 guchar *out_state, 6087 GAsyncResult *res, 6088 GError **error) 6089 { 6090 GVariant *_ret; 6091 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 6092 if (_ret == NULL) 6093 goto _out; 6094 g_variant_get (_ret, 6095 "(y)", 6096 out_state); 6097 g_variant_unref (_ret); 6098 _out: 6099 return _ret != NULL; 6100 } 6101 6102 /** 6103 * sensor_threshold_call_get_state_sync: 6104 * @proxy: A #SensorThresholdProxy. 6105 * @out_state: (out): Return location for return parameter or %NULL to ignore. 6106 * @cancellable: (allow-none): A #GCancellable or %NULL. 6107 * @error: Return location for error or %NULL. 6108 * 6109 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 6110 * 6111 * See sensor_threshold_call_get_state() for the asynchronous version of this method. 6112 * 6113 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 6114 */ 6115 gboolean 6116 sensor_threshold_call_get_state_sync ( 6117 SensorThreshold *proxy, 6118 guchar *out_state, 6119 GCancellable *cancellable, 6120 GError **error) 6121 { 6122 GVariant *_ret; 6123 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 6124 "getState", 6125 g_variant_new ("()"), 6126 G_DBUS_CALL_FLAGS_NONE, 6127 -1, 6128 cancellable, 6129 error); 6130 if (_ret == NULL) 6131 goto _out; 6132 g_variant_get (_ret, 6133 "(y)", 6134 out_state); 6135 g_variant_unref (_ret); 6136 _out: 6137 return _ret != NULL; 6138 } 6139 6140 /** 6141 * sensor_threshold_complete_get_state: 6142 * @object: A #SensorThreshold. 6143 * @invocation: (transfer full): A #GDBusMethodInvocation. 6144 * @state: Parameter to return. 6145 * 6146 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 6147 * 6148 * This method will free @invocation, you cannot use it afterwards. 6149 */ 6150 void 6151 sensor_threshold_complete_get_state ( 6152 SensorThreshold *object, 6153 GDBusMethodInvocation *invocation, 6154 guchar state) 6155 { 6156 g_dbus_method_invocation_return_value (invocation, 6157 g_variant_new ("(y)", 6158 state)); 6159 } 6160 6161 /* ------------------------------------------------------------------------ */ 6162 6163 /** 6164 * SensorThresholdProxy: 6165 * 6166 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API. 6167 */ 6168 6169 /** 6170 * SensorThresholdProxyClass: 6171 * @parent_class: The parent class. 6172 * 6173 * Class structure for #SensorThresholdProxy. 6174 */ 6175 6176 struct _SensorThresholdProxyPrivate 6177 { 6178 GData *qdata; 6179 }; 6180 6181 static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface); 6182 6183 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 6184 G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, 6185 G_ADD_PRIVATE (SensorThresholdProxy) 6186 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); 6187 6188 #else 6189 G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY, 6190 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init)); 6191 6192 #endif 6193 static void 6194 sensor_threshold_proxy_finalize (GObject *object) 6195 { 6196 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); 6197 g_datalist_clear (&proxy->priv->qdata); 6198 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object); 6199 } 6200 6201 static void 6202 sensor_threshold_proxy_get_property (GObject *object, 6203 guint prop_id, 6204 GValue *value, 6205 GParamSpec *pspec G_GNUC_UNUSED) 6206 { 6207 const _ExtendedGDBusPropertyInfo *info; 6208 GVariant *variant; 6209 g_assert (prop_id != 0 && prop_id - 1 < 5); 6210 info = _sensor_threshold_property_info_pointers[prop_id - 1]; 6211 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 6212 if (info->use_gvariant) 6213 { 6214 g_value_set_variant (value, variant); 6215 } 6216 else 6217 { 6218 if (variant != NULL) 6219 g_dbus_gvariant_to_gvalue (variant, value); 6220 } 6221 if (variant != NULL) 6222 g_variant_unref (variant); 6223 } 6224 6225 static void 6226 sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy, 6227 GAsyncResult *res, 6228 gpointer user_data) 6229 { 6230 const _ExtendedGDBusPropertyInfo *info = user_data; 6231 GError *error; 6232 GVariant *_ret; 6233 error = NULL; 6234 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 6235 if (!_ret) 6236 { 6237 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)", 6238 info->parent_struct.name, 6239 error->message, g_quark_to_string (error->domain), error->code); 6240 g_error_free (error); 6241 } 6242 else 6243 { 6244 g_variant_unref (_ret); 6245 } 6246 } 6247 6248 static void 6249 sensor_threshold_proxy_set_property (GObject *object, 6250 guint prop_id, 6251 const GValue *value, 6252 GParamSpec *pspec G_GNUC_UNUSED) 6253 { 6254 const _ExtendedGDBusPropertyInfo *info; 6255 GVariant *variant; 6256 g_assert (prop_id != 0 && prop_id - 1 < 5); 6257 info = _sensor_threshold_property_info_pointers[prop_id - 1]; 6258 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 6259 g_dbus_proxy_call (G_DBUS_PROXY (object), 6260 "org.freedesktop.DBus.Properties.Set", 6261 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant), 6262 G_DBUS_CALL_FLAGS_NONE, 6263 -1, 6264 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 6265 g_variant_unref (variant); 6266 } 6267 6268 static void 6269 sensor_threshold_proxy_g_signal (GDBusProxy *proxy, 6270 const gchar *sender_name G_GNUC_UNUSED, 6271 const gchar *signal_name, 6272 GVariant *parameters) 6273 { 6274 _ExtendedGDBusSignalInfo *info; 6275 GVariantIter iter; 6276 GVariant *child; 6277 GValue *paramv; 6278 guint num_params; 6279 guint n; 6280 guint signal_id; 6281 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name); 6282 if (info == NULL) 6283 return; 6284 num_params = g_variant_n_children (parameters); 6285 paramv = g_new0 (GValue, num_params + 1); 6286 g_value_init (¶mv[0], TYPE_SENSOR_THRESHOLD); 6287 g_value_set_object (¶mv[0], proxy); 6288 g_variant_iter_init (&iter, parameters); 6289 n = 1; 6290 while ((child = g_variant_iter_next_value (&iter)) != NULL) 6291 { 6292 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 6293 if (arg_info->use_gvariant) 6294 { 6295 g_value_init (¶mv[n], G_TYPE_VARIANT); 6296 g_value_set_variant (¶mv[n], child); 6297 n++; 6298 } 6299 else 6300 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 6301 g_variant_unref (child); 6302 } 6303 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); 6304 g_signal_emitv (paramv, signal_id, 0, NULL); 6305 for (n = 0; n < num_params + 1; n++) 6306 g_value_unset (¶mv[n]); 6307 g_free (paramv); 6308 } 6309 6310 static void 6311 sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy, 6312 GVariant *changed_properties, 6313 const gchar *const *invalidated_properties) 6314 { 6315 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy); 6316 guint n; 6317 const gchar *key; 6318 GVariantIter *iter; 6319 _ExtendedGDBusPropertyInfo *info; 6320 g_variant_get (changed_properties, "a{sv}", &iter); 6321 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 6322 { 6323 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key); 6324 g_datalist_remove_data (&proxy->priv->qdata, key); 6325 if (info != NULL) 6326 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 6327 } 6328 g_variant_iter_free (iter); 6329 for (n = 0; invalidated_properties[n] != NULL; n++) 6330 { 6331 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]); 6332 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 6333 if (info != NULL) 6334 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 6335 } 6336 } 6337 6338 static GVariant * 6339 sensor_threshold_proxy_get_lower_critical (SensorThreshold *object) 6340 { 6341 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); 6342 GVariant *variant; 6343 GVariant *value = NULL; 6344 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical"); 6345 value = variant; 6346 if (variant != NULL) 6347 g_variant_unref (variant); 6348 return value; 6349 } 6350 6351 static GVariant * 6352 sensor_threshold_proxy_get_lower_warning (SensorThreshold *object) 6353 { 6354 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); 6355 GVariant *variant; 6356 GVariant *value = NULL; 6357 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning"); 6358 value = variant; 6359 if (variant != NULL) 6360 g_variant_unref (variant); 6361 return value; 6362 } 6363 6364 static GVariant * 6365 sensor_threshold_proxy_get_upper_warning (SensorThreshold *object) 6366 { 6367 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); 6368 GVariant *variant; 6369 GVariant *value = NULL; 6370 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning"); 6371 value = variant; 6372 if (variant != NULL) 6373 g_variant_unref (variant); 6374 return value; 6375 } 6376 6377 static GVariant * 6378 sensor_threshold_proxy_get_upper_critical (SensorThreshold *object) 6379 { 6380 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); 6381 GVariant *variant; 6382 GVariant *value = NULL; 6383 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical"); 6384 value = variant; 6385 if (variant != NULL) 6386 g_variant_unref (variant); 6387 return value; 6388 } 6389 6390 static guchar 6391 sensor_threshold_proxy_get_state (SensorThreshold *object) 6392 { 6393 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object); 6394 GVariant *variant; 6395 guchar value = 0; 6396 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); 6397 if (variant != NULL) 6398 { 6399 value = g_variant_get_byte (variant); 6400 g_variant_unref (variant); 6401 } 6402 return value; 6403 } 6404 6405 static void 6406 sensor_threshold_proxy_init (SensorThresholdProxy *proxy) 6407 { 6408 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 6409 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy); 6410 #else 6411 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate); 6412 #endif 6413 6414 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ()); 6415 } 6416 6417 static void 6418 sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass) 6419 { 6420 GObjectClass *gobject_class; 6421 GDBusProxyClass *proxy_class; 6422 6423 gobject_class = G_OBJECT_CLASS (klass); 6424 gobject_class->finalize = sensor_threshold_proxy_finalize; 6425 gobject_class->get_property = sensor_threshold_proxy_get_property; 6426 gobject_class->set_property = sensor_threshold_proxy_set_property; 6427 6428 proxy_class = G_DBUS_PROXY_CLASS (klass); 6429 proxy_class->g_signal = sensor_threshold_proxy_g_signal; 6430 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed; 6431 6432 sensor_threshold_override_properties (gobject_class, 1); 6433 6434 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 6435 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate)); 6436 #endif 6437 } 6438 6439 static void 6440 sensor_threshold_proxy_iface_init (SensorThresholdIface *iface) 6441 { 6442 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical; 6443 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning; 6444 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning; 6445 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical; 6446 iface->get_state = sensor_threshold_proxy_get_state; 6447 } 6448 6449 /** 6450 * sensor_threshold_proxy_new: 6451 * @connection: A #GDBusConnection. 6452 * @flags: Flags from the #GDBusProxyFlags enumeration. 6453 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 6454 * @object_path: An object path. 6455 * @cancellable: (allow-none): A #GCancellable or %NULL. 6456 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 6457 * @user_data: User data to pass to @callback. 6458 * 6459 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new() for more details. 6460 * 6461 * 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. 6462 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation. 6463 * 6464 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor. 6465 */ 6466 void 6467 sensor_threshold_proxy_new ( 6468 GDBusConnection *connection, 6469 GDBusProxyFlags flags, 6470 const gchar *name, 6471 const gchar *object_path, 6472 GCancellable *cancellable, 6473 GAsyncReadyCallback callback, 6474 gpointer user_data) 6475 { 6476 g_async_initable_new_async (TYPE_SENSOR_THRESHOLD_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL); 6477 } 6478 6479 /** 6480 * sensor_threshold_proxy_new_finish: 6481 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new(). 6482 * @error: Return location for error or %NULL 6483 * 6484 * Finishes an operation started with sensor_threshold_proxy_new(). 6485 * 6486 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. 6487 */ 6488 SensorThreshold * 6489 sensor_threshold_proxy_new_finish ( 6490 GAsyncResult *res, 6491 GError **error) 6492 { 6493 GObject *ret; 6494 GObject *source_object; 6495 source_object = g_async_result_get_source_object (res); 6496 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 6497 g_object_unref (source_object); 6498 if (ret != NULL) 6499 return SENSOR_THRESHOLD (ret); 6500 else 6501 return NULL; 6502 } 6503 6504 /** 6505 * sensor_threshold_proxy_new_sync: 6506 * @connection: A #GDBusConnection. 6507 * @flags: Flags from the #GDBusProxyFlags enumeration. 6508 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 6509 * @object_path: An object path. 6510 * @cancellable: (allow-none): A #GCancellable or %NULL. 6511 * @error: Return location for error or %NULL 6512 * 6513 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new_sync() for more details. 6514 * 6515 * The calling thread is blocked until a reply is received. 6516 * 6517 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor. 6518 * 6519 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. 6520 */ 6521 SensorThreshold * 6522 sensor_threshold_proxy_new_sync ( 6523 GDBusConnection *connection, 6524 GDBusProxyFlags flags, 6525 const gchar *name, 6526 const gchar *object_path, 6527 GCancellable *cancellable, 6528 GError **error) 6529 { 6530 GInitable *ret; 6531 ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL); 6532 if (ret != NULL) 6533 return SENSOR_THRESHOLD (ret); 6534 else 6535 return NULL; 6536 } 6537 6538 6539 /** 6540 * sensor_threshold_proxy_new_for_bus: 6541 * @bus_type: A #GBusType. 6542 * @flags: Flags from the #GDBusProxyFlags enumeration. 6543 * @name: A bus name (well-known or unique). 6544 * @object_path: An object path. 6545 * @cancellable: (allow-none): A #GCancellable or %NULL. 6546 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 6547 * @user_data: User data to pass to @callback. 6548 * 6549 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 6550 * 6551 * 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. 6552 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation. 6553 * 6554 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 6555 */ 6556 void 6557 sensor_threshold_proxy_new_for_bus ( 6558 GBusType bus_type, 6559 GDBusProxyFlags flags, 6560 const gchar *name, 6561 const gchar *object_path, 6562 GCancellable *cancellable, 6563 GAsyncReadyCallback callback, 6564 gpointer user_data) 6565 { 6566 g_async_initable_new_async (TYPE_SENSOR_THRESHOLD_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL); 6567 } 6568 6569 /** 6570 * sensor_threshold_proxy_new_for_bus_finish: 6571 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus(). 6572 * @error: Return location for error or %NULL 6573 * 6574 * Finishes an operation started with sensor_threshold_proxy_new_for_bus(). 6575 * 6576 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. 6577 */ 6578 SensorThreshold * 6579 sensor_threshold_proxy_new_for_bus_finish ( 6580 GAsyncResult *res, 6581 GError **error) 6582 { 6583 GObject *ret; 6584 GObject *source_object; 6585 source_object = g_async_result_get_source_object (res); 6586 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 6587 g_object_unref (source_object); 6588 if (ret != NULL) 6589 return SENSOR_THRESHOLD (ret); 6590 else 6591 return NULL; 6592 } 6593 6594 /** 6595 * sensor_threshold_proxy_new_for_bus_sync: 6596 * @bus_type: A #GBusType. 6597 * @flags: Flags from the #GDBusProxyFlags enumeration. 6598 * @name: A bus name (well-known or unique). 6599 * @object_path: An object path. 6600 * @cancellable: (allow-none): A #GCancellable or %NULL. 6601 * @error: Return location for error or %NULL 6602 * 6603 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 6604 * 6605 * The calling thread is blocked until a reply is received. 6606 * 6607 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor. 6608 * 6609 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set. 6610 */ 6611 SensorThreshold * 6612 sensor_threshold_proxy_new_for_bus_sync ( 6613 GBusType bus_type, 6614 GDBusProxyFlags flags, 6615 const gchar *name, 6616 const gchar *object_path, 6617 GCancellable *cancellable, 6618 GError **error) 6619 { 6620 GInitable *ret; 6621 ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL); 6622 if (ret != NULL) 6623 return SENSOR_THRESHOLD (ret); 6624 else 6625 return NULL; 6626 } 6627 6628 6629 /* ------------------------------------------------------------------------ */ 6630 6631 /** 6632 * SensorThresholdSkeleton: 6633 * 6634 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API. 6635 */ 6636 6637 /** 6638 * SensorThresholdSkeletonClass: 6639 * @parent_class: The parent class. 6640 * 6641 * Class structure for #SensorThresholdSkeleton. 6642 */ 6643 6644 struct _SensorThresholdSkeletonPrivate 6645 { 6646 GValue *properties; 6647 GList *changed_properties; 6648 GSource *changed_properties_idle_source; 6649 GMainContext *context; 6650 GMutex lock; 6651 }; 6652 6653 static void 6654 _sensor_threshold_skeleton_handle_method_call ( 6655 GDBusConnection *connection G_GNUC_UNUSED, 6656 const gchar *sender G_GNUC_UNUSED, 6657 const gchar *object_path G_GNUC_UNUSED, 6658 const gchar *interface_name, 6659 const gchar *method_name, 6660 GVariant *parameters, 6661 GDBusMethodInvocation *invocation, 6662 gpointer user_data) 6663 { 6664 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); 6665 _ExtendedGDBusMethodInfo *info; 6666 GVariantIter iter; 6667 GVariant *child; 6668 GValue *paramv; 6669 guint num_params; 6670 guint num_extra; 6671 guint n; 6672 guint signal_id; 6673 GValue return_value = G_VALUE_INIT; 6674 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 6675 g_assert (info != NULL); 6676 num_params = g_variant_n_children (parameters); 6677 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 6678 n = 0; 6679 g_value_init (¶mv[n], TYPE_SENSOR_THRESHOLD); 6680 g_value_set_object (¶mv[n++], skeleton); 6681 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 6682 g_value_set_object (¶mv[n++], invocation); 6683 if (info->pass_fdlist) 6684 { 6685 #ifdef G_OS_UNIX 6686 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 6687 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 6688 #else 6689 g_assert_not_reached (); 6690 #endif 6691 } 6692 g_variant_iter_init (&iter, parameters); 6693 while ((child = g_variant_iter_next_value (&iter)) != NULL) 6694 { 6695 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 6696 if (arg_info->use_gvariant) 6697 { 6698 g_value_init (¶mv[n], G_TYPE_VARIANT); 6699 g_value_set_variant (¶mv[n], child); 6700 n++; 6701 } 6702 else 6703 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 6704 g_variant_unref (child); 6705 } 6706 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD); 6707 g_value_init (&return_value, G_TYPE_BOOLEAN); 6708 g_signal_emitv (paramv, signal_id, 0, &return_value); 6709 if (!g_value_get_boolean (&return_value)) 6710 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); 6711 g_value_unset (&return_value); 6712 for (n = 0; n < num_params + num_extra; n++) 6713 g_value_unset (¶mv[n]); 6714 g_free (paramv); 6715 } 6716 6717 static GVariant * 6718 _sensor_threshold_skeleton_handle_get_property ( 6719 GDBusConnection *connection G_GNUC_UNUSED, 6720 const gchar *sender G_GNUC_UNUSED, 6721 const gchar *object_path G_GNUC_UNUSED, 6722 const gchar *interface_name G_GNUC_UNUSED, 6723 const gchar *property_name, 6724 GError **error, 6725 gpointer user_data) 6726 { 6727 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); 6728 GValue value = G_VALUE_INIT; 6729 GParamSpec *pspec; 6730 _ExtendedGDBusPropertyInfo *info; 6731 GVariant *ret; 6732 ret = NULL; 6733 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); 6734 g_assert (info != NULL); 6735 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 6736 if (pspec == NULL) 6737 { 6738 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 6739 } 6740 else 6741 { 6742 g_value_init (&value, pspec->value_type); 6743 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 6744 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 6745 g_value_unset (&value); 6746 } 6747 return ret; 6748 } 6749 6750 static gboolean 6751 _sensor_threshold_skeleton_handle_set_property ( 6752 GDBusConnection *connection G_GNUC_UNUSED, 6753 const gchar *sender G_GNUC_UNUSED, 6754 const gchar *object_path G_GNUC_UNUSED, 6755 const gchar *interface_name G_GNUC_UNUSED, 6756 const gchar *property_name, 6757 GVariant *variant, 6758 GError **error, 6759 gpointer user_data) 6760 { 6761 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); 6762 GValue value = G_VALUE_INIT; 6763 GParamSpec *pspec; 6764 _ExtendedGDBusPropertyInfo *info; 6765 gboolean ret; 6766 ret = FALSE; 6767 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name); 6768 g_assert (info != NULL); 6769 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 6770 if (pspec == NULL) 6771 { 6772 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 6773 } 6774 else 6775 { 6776 if (info->use_gvariant) 6777 g_value_set_variant (&value, variant); 6778 else 6779 g_dbus_gvariant_to_gvalue (variant, &value); 6780 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 6781 g_value_unset (&value); 6782 ret = TRUE; 6783 } 6784 return ret; 6785 } 6786 6787 static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable = 6788 { 6789 _sensor_threshold_skeleton_handle_method_call, 6790 _sensor_threshold_skeleton_handle_get_property, 6791 _sensor_threshold_skeleton_handle_set_property, 6792 {NULL} 6793 }; 6794 6795 static GDBusInterfaceInfo * 6796 sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 6797 { 6798 return sensor_threshold_interface_info (); 6799 } 6800 6801 static GDBusInterfaceVTable * 6802 sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 6803 { 6804 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable; 6805 } 6806 6807 static GVariant * 6808 sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 6809 { 6810 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); 6811 6812 GVariantBuilder builder; 6813 guint n; 6814 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 6815 if (_sensor_threshold_interface_info.parent_struct.properties == NULL) 6816 goto out; 6817 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++) 6818 { 6819 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n]; 6820 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 6821 { 6822 GVariant *value; 6823 value = _sensor_threshold_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", info->name, NULL, skeleton); 6824 if (value != NULL) 6825 { 6826 g_variant_take_ref (value); 6827 g_variant_builder_add (&builder, "{sv}", info->name, value); 6828 g_variant_unref (value); 6829 } 6830 } 6831 } 6832 out: 6833 return g_variant_builder_end (&builder); 6834 } 6835 6836 static gboolean _sensor_threshold_emit_changed (gpointer user_data); 6837 6838 static void 6839 sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 6840 { 6841 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton); 6842 gboolean emit_changed = FALSE; 6843 6844 g_mutex_lock (&skeleton->priv->lock); 6845 if (skeleton->priv->changed_properties_idle_source != NULL) 6846 { 6847 g_source_destroy (skeleton->priv->changed_properties_idle_source); 6848 skeleton->priv->changed_properties_idle_source = NULL; 6849 emit_changed = TRUE; 6850 } 6851 g_mutex_unlock (&skeleton->priv->lock); 6852 6853 if (emit_changed) 6854 _sensor_threshold_emit_changed (skeleton); 6855 } 6856 6857 static void 6858 _sensor_threshold_on_signal_warning ( 6859 SensorThreshold *object) 6860 { 6861 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 6862 6863 GList *connections, *l; 6864 GVariant *signal_variant; 6865 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 6866 6867 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 6868 for (l = connections; l != NULL; l = l->next) 6869 { 6870 GDBusConnection *connection = l->data; 6871 g_dbus_connection_emit_signal (connection, 6872 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning", 6873 signal_variant, NULL); 6874 } 6875 g_variant_unref (signal_variant); 6876 g_list_free_full (connections, g_object_unref); 6877 } 6878 6879 static void 6880 _sensor_threshold_on_signal_critical ( 6881 SensorThreshold *object) 6882 { 6883 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 6884 6885 GList *connections, *l; 6886 GVariant *signal_variant; 6887 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 6888 6889 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 6890 for (l = connections; l != NULL; l = l->next) 6891 { 6892 GDBusConnection *connection = l->data; 6893 g_dbus_connection_emit_signal (connection, 6894 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical", 6895 signal_variant, NULL); 6896 } 6897 g_variant_unref (signal_variant); 6898 g_list_free_full (connections, g_object_unref); 6899 } 6900 6901 static void 6902 _sensor_threshold_on_signal_normal ( 6903 SensorThreshold *object) 6904 { 6905 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 6906 6907 GList *connections, *l; 6908 GVariant *signal_variant; 6909 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 6910 6911 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 6912 for (l = connections; l != NULL; l = l->next) 6913 { 6914 GDBusConnection *connection = l->data; 6915 g_dbus_connection_emit_signal (connection, 6916 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal", 6917 signal_variant, NULL); 6918 } 6919 g_variant_unref (signal_variant); 6920 g_list_free_full (connections, g_object_unref); 6921 } 6922 6923 static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface); 6924 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 6925 G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 6926 G_ADD_PRIVATE (SensorThresholdSkeleton) 6927 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); 6928 6929 #else 6930 G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 6931 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init)); 6932 6933 #endif 6934 static void 6935 sensor_threshold_skeleton_finalize (GObject *object) 6936 { 6937 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 6938 guint n; 6939 for (n = 0; n < 5; n++) 6940 g_value_unset (&skeleton->priv->properties[n]); 6941 g_free (skeleton->priv->properties); 6942 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 6943 if (skeleton->priv->changed_properties_idle_source != NULL) 6944 g_source_destroy (skeleton->priv->changed_properties_idle_source); 6945 g_main_context_unref (skeleton->priv->context); 6946 g_mutex_clear (&skeleton->priv->lock); 6947 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object); 6948 } 6949 6950 static void 6951 sensor_threshold_skeleton_get_property (GObject *object, 6952 guint prop_id, 6953 GValue *value, 6954 GParamSpec *pspec G_GNUC_UNUSED) 6955 { 6956 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 6957 g_assert (prop_id != 0 && prop_id - 1 < 5); 6958 g_mutex_lock (&skeleton->priv->lock); 6959 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 6960 g_mutex_unlock (&skeleton->priv->lock); 6961 } 6962 6963 static gboolean 6964 _sensor_threshold_emit_changed (gpointer user_data) 6965 { 6966 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data); 6967 GList *l; 6968 GVariantBuilder builder; 6969 GVariantBuilder invalidated_builder; 6970 guint num_changes; 6971 6972 g_mutex_lock (&skeleton->priv->lock); 6973 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 6974 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 6975 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 6976 { 6977 ChangedProperty *cp = l->data; 6978 GVariant *variant; 6979 const GValue *cur_value; 6980 6981 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 6982 if (!_g_value_equal (cur_value, &cp->orig_value)) 6983 { 6984 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 6985 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 6986 g_variant_unref (variant); 6987 num_changes++; 6988 } 6989 } 6990 if (num_changes > 0) 6991 { 6992 GList *connections, *ll; 6993 GVariant *signal_variant; 6994 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold", 6995 &builder, &invalidated_builder)); 6996 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 6997 for (ll = connections; ll != NULL; ll = ll->next) 6998 { 6999 GDBusConnection *connection = ll->data; 7000 7001 g_dbus_connection_emit_signal (connection, 7002 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 7003 "org.freedesktop.DBus.Properties", 7004 "PropertiesChanged", 7005 signal_variant, 7006 NULL); 7007 } 7008 g_variant_unref (signal_variant); 7009 g_list_free_full (connections, g_object_unref); 7010 } 7011 else 7012 { 7013 g_variant_builder_clear (&builder); 7014 g_variant_builder_clear (&invalidated_builder); 7015 } 7016 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 7017 skeleton->priv->changed_properties = NULL; 7018 skeleton->priv->changed_properties_idle_source = NULL; 7019 g_mutex_unlock (&skeleton->priv->lock); 7020 return FALSE; 7021 } 7022 7023 static void 7024 _sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 7025 { 7026 ChangedProperty *cp; 7027 GList *l; 7028 cp = NULL; 7029 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 7030 { 7031 ChangedProperty *i_cp = l->data; 7032 if (i_cp->info == info) 7033 { 7034 cp = i_cp; 7035 break; 7036 } 7037 } 7038 if (cp == NULL) 7039 { 7040 cp = g_new0 (ChangedProperty, 1); 7041 cp->prop_id = prop_id; 7042 cp->info = info; 7043 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 7044 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 7045 g_value_copy (orig_value, &cp->orig_value); 7046 } 7047 } 7048 7049 static void 7050 sensor_threshold_skeleton_notify (GObject *object, 7051 GParamSpec *pspec G_GNUC_UNUSED) 7052 { 7053 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 7054 g_mutex_lock (&skeleton->priv->lock); 7055 if (skeleton->priv->changed_properties != NULL && 7056 skeleton->priv->changed_properties_idle_source == NULL) 7057 { 7058 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 7059 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 7060 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 7061 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_threshold_emit_changed"); 7062 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 7063 g_source_unref (skeleton->priv->changed_properties_idle_source); 7064 } 7065 g_mutex_unlock (&skeleton->priv->lock); 7066 } 7067 7068 static void 7069 sensor_threshold_skeleton_set_property (GObject *object, 7070 guint prop_id, 7071 const GValue *value, 7072 GParamSpec *pspec) 7073 { 7074 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 7075 g_assert (prop_id != 0 && prop_id - 1 < 5); 7076 g_mutex_lock (&skeleton->priv->lock); 7077 g_object_freeze_notify (object); 7078 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 7079 { 7080 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 7081 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 7082 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 7083 g_object_notify_by_pspec (object, pspec); 7084 } 7085 g_mutex_unlock (&skeleton->priv->lock); 7086 g_object_thaw_notify (object); 7087 } 7088 7089 static void 7090 sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton) 7091 { 7092 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 7093 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton); 7094 #else 7095 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate); 7096 #endif 7097 7098 g_mutex_init (&skeleton->priv->lock); 7099 skeleton->priv->context = g_main_context_ref_thread_default (); 7100 skeleton->priv->properties = g_new0 (GValue, 5); 7101 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); 7102 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT); 7103 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT); 7104 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT); 7105 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR); 7106 } 7107 7108 static GVariant * 7109 sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object) 7110 { 7111 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 7112 GVariant *value; 7113 g_mutex_lock (&skeleton->priv->lock); 7114 value = g_value_get_variant (&(skeleton->priv->properties[0])); 7115 g_mutex_unlock (&skeleton->priv->lock); 7116 return value; 7117 } 7118 7119 static GVariant * 7120 sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object) 7121 { 7122 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 7123 GVariant *value; 7124 g_mutex_lock (&skeleton->priv->lock); 7125 value = g_value_get_variant (&(skeleton->priv->properties[1])); 7126 g_mutex_unlock (&skeleton->priv->lock); 7127 return value; 7128 } 7129 7130 static GVariant * 7131 sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object) 7132 { 7133 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 7134 GVariant *value; 7135 g_mutex_lock (&skeleton->priv->lock); 7136 value = g_value_get_variant (&(skeleton->priv->properties[2])); 7137 g_mutex_unlock (&skeleton->priv->lock); 7138 return value; 7139 } 7140 7141 static GVariant * 7142 sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object) 7143 { 7144 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 7145 GVariant *value; 7146 g_mutex_lock (&skeleton->priv->lock); 7147 value = g_value_get_variant (&(skeleton->priv->properties[3])); 7148 g_mutex_unlock (&skeleton->priv->lock); 7149 return value; 7150 } 7151 7152 static guchar 7153 sensor_threshold_skeleton_get_state (SensorThreshold *object) 7154 { 7155 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object); 7156 guchar value; 7157 g_mutex_lock (&skeleton->priv->lock); 7158 value = g_value_get_uchar (&(skeleton->priv->properties[4])); 7159 g_mutex_unlock (&skeleton->priv->lock); 7160 return value; 7161 } 7162 7163 static void 7164 sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass) 7165 { 7166 GObjectClass *gobject_class; 7167 GDBusInterfaceSkeletonClass *skeleton_class; 7168 7169 gobject_class = G_OBJECT_CLASS (klass); 7170 gobject_class->finalize = sensor_threshold_skeleton_finalize; 7171 gobject_class->get_property = sensor_threshold_skeleton_get_property; 7172 gobject_class->set_property = sensor_threshold_skeleton_set_property; 7173 gobject_class->notify = sensor_threshold_skeleton_notify; 7174 7175 7176 sensor_threshold_override_properties (gobject_class, 1); 7177 7178 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 7179 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info; 7180 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties; 7181 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush; 7182 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable; 7183 7184 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 7185 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate)); 7186 #endif 7187 } 7188 7189 static void 7190 sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface) 7191 { 7192 iface->warning = _sensor_threshold_on_signal_warning; 7193 iface->critical = _sensor_threshold_on_signal_critical; 7194 iface->normal = _sensor_threshold_on_signal_normal; 7195 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical; 7196 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning; 7197 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning; 7198 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical; 7199 iface->get_state = sensor_threshold_skeleton_get_state; 7200 } 7201 7202 /** 7203 * sensor_threshold_skeleton_new: 7204 * 7205 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. 7206 * 7207 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object. 7208 */ 7209 SensorThreshold * 7210 sensor_threshold_skeleton_new (void) 7211 { 7212 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL)); 7213 } 7214 7215 /* ------------------------------------------------------------------------ 7216 * Code for interface org.openbmc.SensorI2c 7217 * ------------------------------------------------------------------------ 7218 */ 7219 7220 /** 7221 * SECTION:SensorI2c 7222 * @title: SensorI2c 7223 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface 7224 * 7225 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface in C. 7226 */ 7227 7228 /* ---- Introspection data for org.openbmc.SensorI2c ---- */ 7229 7230 static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path = 7231 { 7232 { 7233 -1, 7234 (gchar *) "dev_path", 7235 (gchar *) "s", 7236 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 7237 NULL 7238 }, 7239 "dev-path", 7240 FALSE 7241 }; 7242 7243 static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address = 7244 { 7245 { 7246 -1, 7247 (gchar *) "address", 7248 (gchar *) "s", 7249 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 7250 NULL 7251 }, 7252 "address", 7253 FALSE 7254 }; 7255 7256 static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] = 7257 { 7258 &_sensor_i2c_property_info_dev_path, 7259 &_sensor_i2c_property_info_address, 7260 NULL 7261 }; 7262 7263 static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info = 7264 { 7265 { 7266 -1, 7267 (gchar *) "org.openbmc.SensorI2c", 7268 NULL, 7269 NULL, 7270 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers, 7271 NULL 7272 }, 7273 "sensor-i2c", 7274 }; 7275 7276 7277 /** 7278 * sensor_i2c_interface_info: 7279 * 7280 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface. 7281 * 7282 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 7283 */ 7284 GDBusInterfaceInfo * 7285 sensor_i2c_interface_info (void) 7286 { 7287 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct; 7288 } 7289 7290 /** 7291 * sensor_i2c_override_properties: 7292 * @klass: The class structure for a #GObject<!-- -->-derived class. 7293 * @property_id_begin: The property id to assign to the first overridden property. 7294 * 7295 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class. 7296 * The properties are overridden in the order they are defined. 7297 * 7298 * Returns: The last property id. 7299 */ 7300 guint 7301 sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin) 7302 { 7303 g_object_class_override_property (klass, property_id_begin++, "dev-path"); 7304 g_object_class_override_property (klass, property_id_begin++, "address"); 7305 return property_id_begin - 1; 7306 } 7307 7308 7309 7310 /** 7311 * SensorI2c: 7312 * 7313 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. 7314 */ 7315 7316 /** 7317 * SensorI2cIface: 7318 * @parent_iface: The parent interface. 7319 * @get_address: Getter for the #SensorI2c:address property. 7320 * @get_dev_path: Getter for the #SensorI2c:dev-path property. 7321 * 7322 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. 7323 */ 7324 7325 typedef SensorI2cIface SensorI2cInterface; 7326 G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT); 7327 7328 static void 7329 sensor_i2c_default_init (SensorI2cIface *iface) 7330 { 7331 /* GObject properties for D-Bus properties: */ 7332 /** 7333 * SensorI2c:dev-path: 7334 * 7335 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>. 7336 * 7337 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 7338 */ 7339 g_object_interface_install_property (iface, 7340 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 7341 /** 7342 * SensorI2c:address: 7343 * 7344 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>. 7345 * 7346 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 7347 */ 7348 g_object_interface_install_property (iface, 7349 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 7350 } 7351 7352 /** 7353 * sensor_i2c_get_dev_path: (skip) 7354 * @object: A #SensorI2c. 7355 * 7356 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. 7357 * 7358 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 7359 * 7360 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_dev_path() if on another thread.</warning> 7361 * 7362 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 7363 */ 7364 const gchar * 7365 sensor_i2c_get_dev_path (SensorI2c *object) 7366 { 7367 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object); 7368 } 7369 7370 /** 7371 * sensor_i2c_dup_dev_path: (skip) 7372 * @object: A #SensorI2c. 7373 * 7374 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property. 7375 * 7376 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 7377 * 7378 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 7379 */ 7380 gchar * 7381 sensor_i2c_dup_dev_path (SensorI2c *object) 7382 { 7383 gchar *value; 7384 g_object_get (G_OBJECT (object), "dev-path", &value, NULL); 7385 return value; 7386 } 7387 7388 /** 7389 * sensor_i2c_set_dev_path: (skip) 7390 * @object: A #SensorI2c. 7391 * @value: The value to set. 7392 * 7393 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value. 7394 * 7395 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 7396 */ 7397 void 7398 sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value) 7399 { 7400 g_object_set (G_OBJECT (object), "dev-path", value, NULL); 7401 } 7402 7403 /** 7404 * sensor_i2c_get_address: (skip) 7405 * @object: A #SensorI2c. 7406 * 7407 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. 7408 * 7409 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 7410 * 7411 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_address() if on another thread.</warning> 7412 * 7413 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 7414 */ 7415 const gchar * 7416 sensor_i2c_get_address (SensorI2c *object) 7417 { 7418 return SENSOR_I2C_GET_IFACE (object)->get_address (object); 7419 } 7420 7421 /** 7422 * sensor_i2c_dup_address: (skip) 7423 * @object: A #SensorI2c. 7424 * 7425 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property. 7426 * 7427 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 7428 * 7429 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 7430 */ 7431 gchar * 7432 sensor_i2c_dup_address (SensorI2c *object) 7433 { 7434 gchar *value; 7435 g_object_get (G_OBJECT (object), "address", &value, NULL); 7436 return value; 7437 } 7438 7439 /** 7440 * sensor_i2c_set_address: (skip) 7441 * @object: A #SensorI2c. 7442 * @value: The value to set. 7443 * 7444 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value. 7445 * 7446 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 7447 */ 7448 void 7449 sensor_i2c_set_address (SensorI2c *object, const gchar *value) 7450 { 7451 g_object_set (G_OBJECT (object), "address", value, NULL); 7452 } 7453 7454 /* ------------------------------------------------------------------------ */ 7455 7456 /** 7457 * SensorI2cProxy: 7458 * 7459 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API. 7460 */ 7461 7462 /** 7463 * SensorI2cProxyClass: 7464 * @parent_class: The parent class. 7465 * 7466 * Class structure for #SensorI2cProxy. 7467 */ 7468 7469 struct _SensorI2cProxyPrivate 7470 { 7471 GData *qdata; 7472 }; 7473 7474 static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface); 7475 7476 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 7477 G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, 7478 G_ADD_PRIVATE (SensorI2cProxy) 7479 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); 7480 7481 #else 7482 G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY, 7483 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init)); 7484 7485 #endif 7486 static void 7487 sensor_i2c_proxy_finalize (GObject *object) 7488 { 7489 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); 7490 g_datalist_clear (&proxy->priv->qdata); 7491 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object); 7492 } 7493 7494 static void 7495 sensor_i2c_proxy_get_property (GObject *object, 7496 guint prop_id, 7497 GValue *value, 7498 GParamSpec *pspec G_GNUC_UNUSED) 7499 { 7500 const _ExtendedGDBusPropertyInfo *info; 7501 GVariant *variant; 7502 g_assert (prop_id != 0 && prop_id - 1 < 2); 7503 info = _sensor_i2c_property_info_pointers[prop_id - 1]; 7504 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 7505 if (info->use_gvariant) 7506 { 7507 g_value_set_variant (value, variant); 7508 } 7509 else 7510 { 7511 if (variant != NULL) 7512 g_dbus_gvariant_to_gvalue (variant, value); 7513 } 7514 if (variant != NULL) 7515 g_variant_unref (variant); 7516 } 7517 7518 static void 7519 sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy, 7520 GAsyncResult *res, 7521 gpointer user_data) 7522 { 7523 const _ExtendedGDBusPropertyInfo *info = user_data; 7524 GError *error; 7525 GVariant *_ret; 7526 error = NULL; 7527 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 7528 if (!_ret) 7529 { 7530 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)", 7531 info->parent_struct.name, 7532 error->message, g_quark_to_string (error->domain), error->code); 7533 g_error_free (error); 7534 } 7535 else 7536 { 7537 g_variant_unref (_ret); 7538 } 7539 } 7540 7541 static void 7542 sensor_i2c_proxy_set_property (GObject *object, 7543 guint prop_id, 7544 const GValue *value, 7545 GParamSpec *pspec G_GNUC_UNUSED) 7546 { 7547 const _ExtendedGDBusPropertyInfo *info; 7548 GVariant *variant; 7549 g_assert (prop_id != 0 && prop_id - 1 < 2); 7550 info = _sensor_i2c_property_info_pointers[prop_id - 1]; 7551 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 7552 g_dbus_proxy_call (G_DBUS_PROXY (object), 7553 "org.freedesktop.DBus.Properties.Set", 7554 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant), 7555 G_DBUS_CALL_FLAGS_NONE, 7556 -1, 7557 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 7558 g_variant_unref (variant); 7559 } 7560 7561 static void 7562 sensor_i2c_proxy_g_signal (GDBusProxy *proxy, 7563 const gchar *sender_name G_GNUC_UNUSED, 7564 const gchar *signal_name, 7565 GVariant *parameters) 7566 { 7567 _ExtendedGDBusSignalInfo *info; 7568 GVariantIter iter; 7569 GVariant *child; 7570 GValue *paramv; 7571 guint num_params; 7572 guint n; 7573 guint signal_id; 7574 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name); 7575 if (info == NULL) 7576 return; 7577 num_params = g_variant_n_children (parameters); 7578 paramv = g_new0 (GValue, num_params + 1); 7579 g_value_init (¶mv[0], TYPE_SENSOR_I2C); 7580 g_value_set_object (¶mv[0], proxy); 7581 g_variant_iter_init (&iter, parameters); 7582 n = 1; 7583 while ((child = g_variant_iter_next_value (&iter)) != NULL) 7584 { 7585 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 7586 if (arg_info->use_gvariant) 7587 { 7588 g_value_init (¶mv[n], G_TYPE_VARIANT); 7589 g_value_set_variant (¶mv[n], child); 7590 n++; 7591 } 7592 else 7593 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 7594 g_variant_unref (child); 7595 } 7596 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); 7597 g_signal_emitv (paramv, signal_id, 0, NULL); 7598 for (n = 0; n < num_params + 1; n++) 7599 g_value_unset (¶mv[n]); 7600 g_free (paramv); 7601 } 7602 7603 static void 7604 sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy, 7605 GVariant *changed_properties, 7606 const gchar *const *invalidated_properties) 7607 { 7608 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy); 7609 guint n; 7610 const gchar *key; 7611 GVariantIter *iter; 7612 _ExtendedGDBusPropertyInfo *info; 7613 g_variant_get (changed_properties, "a{sv}", &iter); 7614 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 7615 { 7616 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key); 7617 g_datalist_remove_data (&proxy->priv->qdata, key); 7618 if (info != NULL) 7619 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 7620 } 7621 g_variant_iter_free (iter); 7622 for (n = 0; invalidated_properties[n] != NULL; n++) 7623 { 7624 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]); 7625 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 7626 if (info != NULL) 7627 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 7628 } 7629 } 7630 7631 static const gchar * 7632 sensor_i2c_proxy_get_dev_path (SensorI2c *object) 7633 { 7634 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); 7635 GVariant *variant; 7636 const gchar *value = NULL; 7637 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path"); 7638 if (variant != NULL) 7639 { 7640 value = g_variant_get_string (variant, NULL); 7641 g_variant_unref (variant); 7642 } 7643 return value; 7644 } 7645 7646 static const gchar * 7647 sensor_i2c_proxy_get_address (SensorI2c *object) 7648 { 7649 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object); 7650 GVariant *variant; 7651 const gchar *value = NULL; 7652 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address"); 7653 if (variant != NULL) 7654 { 7655 value = g_variant_get_string (variant, NULL); 7656 g_variant_unref (variant); 7657 } 7658 return value; 7659 } 7660 7661 static void 7662 sensor_i2c_proxy_init (SensorI2cProxy *proxy) 7663 { 7664 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 7665 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy); 7666 #else 7667 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate); 7668 #endif 7669 7670 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ()); 7671 } 7672 7673 static void 7674 sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass) 7675 { 7676 GObjectClass *gobject_class; 7677 GDBusProxyClass *proxy_class; 7678 7679 gobject_class = G_OBJECT_CLASS (klass); 7680 gobject_class->finalize = sensor_i2c_proxy_finalize; 7681 gobject_class->get_property = sensor_i2c_proxy_get_property; 7682 gobject_class->set_property = sensor_i2c_proxy_set_property; 7683 7684 proxy_class = G_DBUS_PROXY_CLASS (klass); 7685 proxy_class->g_signal = sensor_i2c_proxy_g_signal; 7686 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed; 7687 7688 sensor_i2c_override_properties (gobject_class, 1); 7689 7690 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 7691 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate)); 7692 #endif 7693 } 7694 7695 static void 7696 sensor_i2c_proxy_iface_init (SensorI2cIface *iface) 7697 { 7698 iface->get_dev_path = sensor_i2c_proxy_get_dev_path; 7699 iface->get_address = sensor_i2c_proxy_get_address; 7700 } 7701 7702 /** 7703 * sensor_i2c_proxy_new: 7704 * @connection: A #GDBusConnection. 7705 * @flags: Flags from the #GDBusProxyFlags enumeration. 7706 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 7707 * @object_path: An object path. 7708 * @cancellable: (allow-none): A #GCancellable or %NULL. 7709 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 7710 * @user_data: User data to pass to @callback. 7711 * 7712 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new() for more details. 7713 * 7714 * 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. 7715 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation. 7716 * 7717 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor. 7718 */ 7719 void 7720 sensor_i2c_proxy_new ( 7721 GDBusConnection *connection, 7722 GDBusProxyFlags flags, 7723 const gchar *name, 7724 const gchar *object_path, 7725 GCancellable *cancellable, 7726 GAsyncReadyCallback callback, 7727 gpointer user_data) 7728 { 7729 g_async_initable_new_async (TYPE_SENSOR_I2C_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL); 7730 } 7731 7732 /** 7733 * sensor_i2c_proxy_new_finish: 7734 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new(). 7735 * @error: Return location for error or %NULL 7736 * 7737 * Finishes an operation started with sensor_i2c_proxy_new(). 7738 * 7739 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. 7740 */ 7741 SensorI2c * 7742 sensor_i2c_proxy_new_finish ( 7743 GAsyncResult *res, 7744 GError **error) 7745 { 7746 GObject *ret; 7747 GObject *source_object; 7748 source_object = g_async_result_get_source_object (res); 7749 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 7750 g_object_unref (source_object); 7751 if (ret != NULL) 7752 return SENSOR_I2C (ret); 7753 else 7754 return NULL; 7755 } 7756 7757 /** 7758 * sensor_i2c_proxy_new_sync: 7759 * @connection: A #GDBusConnection. 7760 * @flags: Flags from the #GDBusProxyFlags enumeration. 7761 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 7762 * @object_path: An object path. 7763 * @cancellable: (allow-none): A #GCancellable or %NULL. 7764 * @error: Return location for error or %NULL 7765 * 7766 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new_sync() for more details. 7767 * 7768 * The calling thread is blocked until a reply is received. 7769 * 7770 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor. 7771 * 7772 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. 7773 */ 7774 SensorI2c * 7775 sensor_i2c_proxy_new_sync ( 7776 GDBusConnection *connection, 7777 GDBusProxyFlags flags, 7778 const gchar *name, 7779 const gchar *object_path, 7780 GCancellable *cancellable, 7781 GError **error) 7782 { 7783 GInitable *ret; 7784 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL); 7785 if (ret != NULL) 7786 return SENSOR_I2C (ret); 7787 else 7788 return NULL; 7789 } 7790 7791 7792 /** 7793 * sensor_i2c_proxy_new_for_bus: 7794 * @bus_type: A #GBusType. 7795 * @flags: Flags from the #GDBusProxyFlags enumeration. 7796 * @name: A bus name (well-known or unique). 7797 * @object_path: An object path. 7798 * @cancellable: (allow-none): A #GCancellable or %NULL. 7799 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 7800 * @user_data: User data to pass to @callback. 7801 * 7802 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 7803 * 7804 * 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. 7805 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation. 7806 * 7807 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 7808 */ 7809 void 7810 sensor_i2c_proxy_new_for_bus ( 7811 GBusType bus_type, 7812 GDBusProxyFlags flags, 7813 const gchar *name, 7814 const gchar *object_path, 7815 GCancellable *cancellable, 7816 GAsyncReadyCallback callback, 7817 gpointer user_data) 7818 { 7819 g_async_initable_new_async (TYPE_SENSOR_I2C_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL); 7820 } 7821 7822 /** 7823 * sensor_i2c_proxy_new_for_bus_finish: 7824 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus(). 7825 * @error: Return location for error or %NULL 7826 * 7827 * Finishes an operation started with sensor_i2c_proxy_new_for_bus(). 7828 * 7829 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. 7830 */ 7831 SensorI2c * 7832 sensor_i2c_proxy_new_for_bus_finish ( 7833 GAsyncResult *res, 7834 GError **error) 7835 { 7836 GObject *ret; 7837 GObject *source_object; 7838 source_object = g_async_result_get_source_object (res); 7839 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 7840 g_object_unref (source_object); 7841 if (ret != NULL) 7842 return SENSOR_I2C (ret); 7843 else 7844 return NULL; 7845 } 7846 7847 /** 7848 * sensor_i2c_proxy_new_for_bus_sync: 7849 * @bus_type: A #GBusType. 7850 * @flags: Flags from the #GDBusProxyFlags enumeration. 7851 * @name: A bus name (well-known or unique). 7852 * @object_path: An object path. 7853 * @cancellable: (allow-none): A #GCancellable or %NULL. 7854 * @error: Return location for error or %NULL 7855 * 7856 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 7857 * 7858 * The calling thread is blocked until a reply is received. 7859 * 7860 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor. 7861 * 7862 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set. 7863 */ 7864 SensorI2c * 7865 sensor_i2c_proxy_new_for_bus_sync ( 7866 GBusType bus_type, 7867 GDBusProxyFlags flags, 7868 const gchar *name, 7869 const gchar *object_path, 7870 GCancellable *cancellable, 7871 GError **error) 7872 { 7873 GInitable *ret; 7874 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL); 7875 if (ret != NULL) 7876 return SENSOR_I2C (ret); 7877 else 7878 return NULL; 7879 } 7880 7881 7882 /* ------------------------------------------------------------------------ */ 7883 7884 /** 7885 * SensorI2cSkeleton: 7886 * 7887 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API. 7888 */ 7889 7890 /** 7891 * SensorI2cSkeletonClass: 7892 * @parent_class: The parent class. 7893 * 7894 * Class structure for #SensorI2cSkeleton. 7895 */ 7896 7897 struct _SensorI2cSkeletonPrivate 7898 { 7899 GValue *properties; 7900 GList *changed_properties; 7901 GSource *changed_properties_idle_source; 7902 GMainContext *context; 7903 GMutex lock; 7904 }; 7905 7906 static void 7907 _sensor_i2c_skeleton_handle_method_call ( 7908 GDBusConnection *connection G_GNUC_UNUSED, 7909 const gchar *sender G_GNUC_UNUSED, 7910 const gchar *object_path G_GNUC_UNUSED, 7911 const gchar *interface_name, 7912 const gchar *method_name, 7913 GVariant *parameters, 7914 GDBusMethodInvocation *invocation, 7915 gpointer user_data) 7916 { 7917 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); 7918 _ExtendedGDBusMethodInfo *info; 7919 GVariantIter iter; 7920 GVariant *child; 7921 GValue *paramv; 7922 guint num_params; 7923 guint num_extra; 7924 guint n; 7925 guint signal_id; 7926 GValue return_value = G_VALUE_INIT; 7927 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 7928 g_assert (info != NULL); 7929 num_params = g_variant_n_children (parameters); 7930 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 7931 n = 0; 7932 g_value_init (¶mv[n], TYPE_SENSOR_I2C); 7933 g_value_set_object (¶mv[n++], skeleton); 7934 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 7935 g_value_set_object (¶mv[n++], invocation); 7936 if (info->pass_fdlist) 7937 { 7938 #ifdef G_OS_UNIX 7939 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 7940 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 7941 #else 7942 g_assert_not_reached (); 7943 #endif 7944 } 7945 g_variant_iter_init (&iter, parameters); 7946 while ((child = g_variant_iter_next_value (&iter)) != NULL) 7947 { 7948 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 7949 if (arg_info->use_gvariant) 7950 { 7951 g_value_init (¶mv[n], G_TYPE_VARIANT); 7952 g_value_set_variant (¶mv[n], child); 7953 n++; 7954 } 7955 else 7956 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 7957 g_variant_unref (child); 7958 } 7959 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C); 7960 g_value_init (&return_value, G_TYPE_BOOLEAN); 7961 g_signal_emitv (paramv, signal_id, 0, &return_value); 7962 if (!g_value_get_boolean (&return_value)) 7963 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); 7964 g_value_unset (&return_value); 7965 for (n = 0; n < num_params + num_extra; n++) 7966 g_value_unset (¶mv[n]); 7967 g_free (paramv); 7968 } 7969 7970 static GVariant * 7971 _sensor_i2c_skeleton_handle_get_property ( 7972 GDBusConnection *connection G_GNUC_UNUSED, 7973 const gchar *sender G_GNUC_UNUSED, 7974 const gchar *object_path G_GNUC_UNUSED, 7975 const gchar *interface_name G_GNUC_UNUSED, 7976 const gchar *property_name, 7977 GError **error, 7978 gpointer user_data) 7979 { 7980 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); 7981 GValue value = G_VALUE_INIT; 7982 GParamSpec *pspec; 7983 _ExtendedGDBusPropertyInfo *info; 7984 GVariant *ret; 7985 ret = NULL; 7986 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); 7987 g_assert (info != NULL); 7988 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 7989 if (pspec == NULL) 7990 { 7991 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 7992 } 7993 else 7994 { 7995 g_value_init (&value, pspec->value_type); 7996 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 7997 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 7998 g_value_unset (&value); 7999 } 8000 return ret; 8001 } 8002 8003 static gboolean 8004 _sensor_i2c_skeleton_handle_set_property ( 8005 GDBusConnection *connection G_GNUC_UNUSED, 8006 const gchar *sender G_GNUC_UNUSED, 8007 const gchar *object_path G_GNUC_UNUSED, 8008 const gchar *interface_name G_GNUC_UNUSED, 8009 const gchar *property_name, 8010 GVariant *variant, 8011 GError **error, 8012 gpointer user_data) 8013 { 8014 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); 8015 GValue value = G_VALUE_INIT; 8016 GParamSpec *pspec; 8017 _ExtendedGDBusPropertyInfo *info; 8018 gboolean ret; 8019 ret = FALSE; 8020 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name); 8021 g_assert (info != NULL); 8022 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 8023 if (pspec == NULL) 8024 { 8025 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 8026 } 8027 else 8028 { 8029 if (info->use_gvariant) 8030 g_value_set_variant (&value, variant); 8031 else 8032 g_dbus_gvariant_to_gvalue (variant, &value); 8033 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 8034 g_value_unset (&value); 8035 ret = TRUE; 8036 } 8037 return ret; 8038 } 8039 8040 static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable = 8041 { 8042 _sensor_i2c_skeleton_handle_method_call, 8043 _sensor_i2c_skeleton_handle_get_property, 8044 _sensor_i2c_skeleton_handle_set_property, 8045 {NULL} 8046 }; 8047 8048 static GDBusInterfaceInfo * 8049 sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 8050 { 8051 return sensor_i2c_interface_info (); 8052 } 8053 8054 static GDBusInterfaceVTable * 8055 sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 8056 { 8057 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable; 8058 } 8059 8060 static GVariant * 8061 sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 8062 { 8063 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); 8064 8065 GVariantBuilder builder; 8066 guint n; 8067 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 8068 if (_sensor_i2c_interface_info.parent_struct.properties == NULL) 8069 goto out; 8070 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++) 8071 { 8072 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n]; 8073 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 8074 { 8075 GVariant *value; 8076 value = _sensor_i2c_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorI2c", info->name, NULL, skeleton); 8077 if (value != NULL) 8078 { 8079 g_variant_take_ref (value); 8080 g_variant_builder_add (&builder, "{sv}", info->name, value); 8081 g_variant_unref (value); 8082 } 8083 } 8084 } 8085 out: 8086 return g_variant_builder_end (&builder); 8087 } 8088 8089 static gboolean _sensor_i2c_emit_changed (gpointer user_data); 8090 8091 static void 8092 sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 8093 { 8094 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton); 8095 gboolean emit_changed = FALSE; 8096 8097 g_mutex_lock (&skeleton->priv->lock); 8098 if (skeleton->priv->changed_properties_idle_source != NULL) 8099 { 8100 g_source_destroy (skeleton->priv->changed_properties_idle_source); 8101 skeleton->priv->changed_properties_idle_source = NULL; 8102 emit_changed = TRUE; 8103 } 8104 g_mutex_unlock (&skeleton->priv->lock); 8105 8106 if (emit_changed) 8107 _sensor_i2c_emit_changed (skeleton); 8108 } 8109 8110 static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface); 8111 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 8112 G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 8113 G_ADD_PRIVATE (SensorI2cSkeleton) 8114 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); 8115 8116 #else 8117 G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 8118 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init)); 8119 8120 #endif 8121 static void 8122 sensor_i2c_skeleton_finalize (GObject *object) 8123 { 8124 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); 8125 guint n; 8126 for (n = 0; n < 2; n++) 8127 g_value_unset (&skeleton->priv->properties[n]); 8128 g_free (skeleton->priv->properties); 8129 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 8130 if (skeleton->priv->changed_properties_idle_source != NULL) 8131 g_source_destroy (skeleton->priv->changed_properties_idle_source); 8132 g_main_context_unref (skeleton->priv->context); 8133 g_mutex_clear (&skeleton->priv->lock); 8134 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object); 8135 } 8136 8137 static void 8138 sensor_i2c_skeleton_get_property (GObject *object, 8139 guint prop_id, 8140 GValue *value, 8141 GParamSpec *pspec G_GNUC_UNUSED) 8142 { 8143 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); 8144 g_assert (prop_id != 0 && prop_id - 1 < 2); 8145 g_mutex_lock (&skeleton->priv->lock); 8146 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 8147 g_mutex_unlock (&skeleton->priv->lock); 8148 } 8149 8150 static gboolean 8151 _sensor_i2c_emit_changed (gpointer user_data) 8152 { 8153 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data); 8154 GList *l; 8155 GVariantBuilder builder; 8156 GVariantBuilder invalidated_builder; 8157 guint num_changes; 8158 8159 g_mutex_lock (&skeleton->priv->lock); 8160 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 8161 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 8162 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 8163 { 8164 ChangedProperty *cp = l->data; 8165 GVariant *variant; 8166 const GValue *cur_value; 8167 8168 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 8169 if (!_g_value_equal (cur_value, &cp->orig_value)) 8170 { 8171 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 8172 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 8173 g_variant_unref (variant); 8174 num_changes++; 8175 } 8176 } 8177 if (num_changes > 0) 8178 { 8179 GList *connections, *ll; 8180 GVariant *signal_variant; 8181 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c", 8182 &builder, &invalidated_builder)); 8183 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 8184 for (ll = connections; ll != NULL; ll = ll->next) 8185 { 8186 GDBusConnection *connection = ll->data; 8187 8188 g_dbus_connection_emit_signal (connection, 8189 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 8190 "org.freedesktop.DBus.Properties", 8191 "PropertiesChanged", 8192 signal_variant, 8193 NULL); 8194 } 8195 g_variant_unref (signal_variant); 8196 g_list_free_full (connections, g_object_unref); 8197 } 8198 else 8199 { 8200 g_variant_builder_clear (&builder); 8201 g_variant_builder_clear (&invalidated_builder); 8202 } 8203 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 8204 skeleton->priv->changed_properties = NULL; 8205 skeleton->priv->changed_properties_idle_source = NULL; 8206 g_mutex_unlock (&skeleton->priv->lock); 8207 return FALSE; 8208 } 8209 8210 static void 8211 _sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 8212 { 8213 ChangedProperty *cp; 8214 GList *l; 8215 cp = NULL; 8216 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 8217 { 8218 ChangedProperty *i_cp = l->data; 8219 if (i_cp->info == info) 8220 { 8221 cp = i_cp; 8222 break; 8223 } 8224 } 8225 if (cp == NULL) 8226 { 8227 cp = g_new0 (ChangedProperty, 1); 8228 cp->prop_id = prop_id; 8229 cp->info = info; 8230 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 8231 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 8232 g_value_copy (orig_value, &cp->orig_value); 8233 } 8234 } 8235 8236 static void 8237 sensor_i2c_skeleton_notify (GObject *object, 8238 GParamSpec *pspec G_GNUC_UNUSED) 8239 { 8240 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); 8241 g_mutex_lock (&skeleton->priv->lock); 8242 if (skeleton->priv->changed_properties != NULL && 8243 skeleton->priv->changed_properties_idle_source == NULL) 8244 { 8245 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 8246 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 8247 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 8248 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_i2c_emit_changed"); 8249 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 8250 g_source_unref (skeleton->priv->changed_properties_idle_source); 8251 } 8252 g_mutex_unlock (&skeleton->priv->lock); 8253 } 8254 8255 static void 8256 sensor_i2c_skeleton_set_property (GObject *object, 8257 guint prop_id, 8258 const GValue *value, 8259 GParamSpec *pspec) 8260 { 8261 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); 8262 g_assert (prop_id != 0 && prop_id - 1 < 2); 8263 g_mutex_lock (&skeleton->priv->lock); 8264 g_object_freeze_notify (object); 8265 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 8266 { 8267 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 8268 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 8269 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 8270 g_object_notify_by_pspec (object, pspec); 8271 } 8272 g_mutex_unlock (&skeleton->priv->lock); 8273 g_object_thaw_notify (object); 8274 } 8275 8276 static void 8277 sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton) 8278 { 8279 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 8280 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton); 8281 #else 8282 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate); 8283 #endif 8284 8285 g_mutex_init (&skeleton->priv->lock); 8286 skeleton->priv->context = g_main_context_ref_thread_default (); 8287 skeleton->priv->properties = g_new0 (GValue, 2); 8288 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); 8289 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); 8290 } 8291 8292 static const gchar * 8293 sensor_i2c_skeleton_get_dev_path (SensorI2c *object) 8294 { 8295 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); 8296 const gchar *value; 8297 g_mutex_lock (&skeleton->priv->lock); 8298 value = g_value_get_string (&(skeleton->priv->properties[0])); 8299 g_mutex_unlock (&skeleton->priv->lock); 8300 return value; 8301 } 8302 8303 static const gchar * 8304 sensor_i2c_skeleton_get_address (SensorI2c *object) 8305 { 8306 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object); 8307 const gchar *value; 8308 g_mutex_lock (&skeleton->priv->lock); 8309 value = g_value_get_string (&(skeleton->priv->properties[1])); 8310 g_mutex_unlock (&skeleton->priv->lock); 8311 return value; 8312 } 8313 8314 static void 8315 sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass) 8316 { 8317 GObjectClass *gobject_class; 8318 GDBusInterfaceSkeletonClass *skeleton_class; 8319 8320 gobject_class = G_OBJECT_CLASS (klass); 8321 gobject_class->finalize = sensor_i2c_skeleton_finalize; 8322 gobject_class->get_property = sensor_i2c_skeleton_get_property; 8323 gobject_class->set_property = sensor_i2c_skeleton_set_property; 8324 gobject_class->notify = sensor_i2c_skeleton_notify; 8325 8326 8327 sensor_i2c_override_properties (gobject_class, 1); 8328 8329 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 8330 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info; 8331 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties; 8332 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush; 8333 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable; 8334 8335 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 8336 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate)); 8337 #endif 8338 } 8339 8340 static void 8341 sensor_i2c_skeleton_iface_init (SensorI2cIface *iface) 8342 { 8343 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path; 8344 iface->get_address = sensor_i2c_skeleton_get_address; 8345 } 8346 8347 /** 8348 * sensor_i2c_skeleton_new: 8349 * 8350 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. 8351 * 8352 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object. 8353 */ 8354 SensorI2c * 8355 sensor_i2c_skeleton_new (void) 8356 { 8357 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL)); 8358 } 8359 8360 /* ------------------------------------------------------------------------ 8361 * Code for interface org.openbmc.SensorMatch 8362 * ------------------------------------------------------------------------ 8363 */ 8364 8365 /** 8366 * SECTION:SensorMatch 8367 * @title: SensorMatch 8368 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface 8369 * 8370 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface in C. 8371 */ 8372 8373 /* ---- Introspection data for org.openbmc.SensorMatch ---- */ 8374 8375 static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state = 8376 { 8377 { 8378 -1, 8379 (gchar *) "state", 8380 (gchar *) "y", 8381 NULL 8382 }, 8383 FALSE 8384 }; 8385 8386 static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] = 8387 { 8388 &_sensor_match_signal_info_sensor_match_ARG_state, 8389 NULL 8390 }; 8391 8392 static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match = 8393 { 8394 { 8395 -1, 8396 (gchar *) "SensorMatch", 8397 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers, 8398 NULL 8399 }, 8400 "sensor-match" 8401 }; 8402 8403 static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] = 8404 { 8405 &_sensor_match_signal_info_sensor_match, 8406 NULL 8407 }; 8408 8409 static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value = 8410 { 8411 { 8412 -1, 8413 (gchar *) "match_value", 8414 (gchar *) "v", 8415 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 8416 NULL 8417 }, 8418 "match-value", 8419 FALSE 8420 }; 8421 8422 static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state = 8423 { 8424 { 8425 -1, 8426 (gchar *) "state", 8427 (gchar *) "y", 8428 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 8429 NULL 8430 }, 8431 "state", 8432 FALSE 8433 }; 8434 8435 static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] = 8436 { 8437 &_sensor_match_property_info_match_value, 8438 &_sensor_match_property_info_state, 8439 NULL 8440 }; 8441 8442 static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info = 8443 { 8444 { 8445 -1, 8446 (gchar *) "org.openbmc.SensorMatch", 8447 NULL, 8448 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers, 8449 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers, 8450 NULL 8451 }, 8452 "sensor-match", 8453 }; 8454 8455 8456 /** 8457 * sensor_match_interface_info: 8458 * 8459 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface. 8460 * 8461 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 8462 */ 8463 GDBusInterfaceInfo * 8464 sensor_match_interface_info (void) 8465 { 8466 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct; 8467 } 8468 8469 /** 8470 * sensor_match_override_properties: 8471 * @klass: The class structure for a #GObject<!-- -->-derived class. 8472 * @property_id_begin: The property id to assign to the first overridden property. 8473 * 8474 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class. 8475 * The properties are overridden in the order they are defined. 8476 * 8477 * Returns: The last property id. 8478 */ 8479 guint 8480 sensor_match_override_properties (GObjectClass *klass, guint property_id_begin) 8481 { 8482 g_object_class_override_property (klass, property_id_begin++, "match-value"); 8483 g_object_class_override_property (klass, property_id_begin++, "state"); 8484 return property_id_begin - 1; 8485 } 8486 8487 8488 8489 /** 8490 * SensorMatch: 8491 * 8492 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. 8493 */ 8494 8495 /** 8496 * SensorMatchIface: 8497 * @parent_iface: The parent interface. 8498 * @get_match_value: Getter for the #SensorMatch:match-value property. 8499 * @get_state: Getter for the #SensorMatch:state property. 8500 * @sensor_match: Handler for the #SensorMatch::sensor-match signal. 8501 * 8502 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. 8503 */ 8504 8505 typedef SensorMatchIface SensorMatchInterface; 8506 G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT); 8507 8508 static void 8509 sensor_match_default_init (SensorMatchIface *iface) 8510 { 8511 /* GObject signals for received D-Bus signals: */ 8512 /** 8513 * SensorMatch::sensor-match: 8514 * @object: A #SensorMatch. 8515 * @arg_state: Argument. 8516 * 8517 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> is received. 8518 * 8519 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 8520 */ 8521 g_signal_new ("sensor-match", 8522 G_TYPE_FROM_INTERFACE (iface), 8523 G_SIGNAL_RUN_LAST, 8524 G_STRUCT_OFFSET (SensorMatchIface, sensor_match), 8525 NULL, 8526 NULL, 8527 g_cclosure_marshal_generic, 8528 G_TYPE_NONE, 8529 1, G_TYPE_UCHAR); 8530 8531 /* GObject properties for D-Bus properties: */ 8532 /** 8533 * SensorMatch:match-value: 8534 * 8535 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>. 8536 * 8537 * 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. 8538 */ 8539 g_object_interface_install_property (iface, 8540 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 8541 /** 8542 * SensorMatch:state: 8543 * 8544 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>. 8545 * 8546 * 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. 8547 */ 8548 g_object_interface_install_property (iface, 8549 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 8550 } 8551 8552 /** 8553 * sensor_match_get_match_value: (skip) 8554 * @object: A #SensorMatch. 8555 * 8556 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. 8557 * 8558 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 8559 * 8560 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_match_dup_match_value() if on another thread.</warning> 8561 * 8562 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 8563 */ 8564 GVariant * 8565 sensor_match_get_match_value (SensorMatch *object) 8566 { 8567 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object); 8568 } 8569 8570 /** 8571 * sensor_match_dup_match_value: (skip) 8572 * @object: A #SensorMatch. 8573 * 8574 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. 8575 * 8576 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 8577 * 8578 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). 8579 */ 8580 GVariant * 8581 sensor_match_dup_match_value (SensorMatch *object) 8582 { 8583 GVariant *value; 8584 g_object_get (G_OBJECT (object), "match-value", &value, NULL); 8585 return value; 8586 } 8587 8588 /** 8589 * sensor_match_set_match_value: (skip) 8590 * @object: A #SensorMatch. 8591 * @value: The value to set. 8592 * 8593 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value. 8594 * 8595 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 8596 */ 8597 void 8598 sensor_match_set_match_value (SensorMatch *object, GVariant *value) 8599 { 8600 g_object_set (G_OBJECT (object), "match-value", value, NULL); 8601 } 8602 8603 /** 8604 * sensor_match_get_state: (skip) 8605 * @object: A #SensorMatch. 8606 * 8607 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property. 8608 * 8609 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 8610 * 8611 * Returns: The property value. 8612 */ 8613 guchar 8614 sensor_match_get_state (SensorMatch *object) 8615 { 8616 return SENSOR_MATCH_GET_IFACE (object)->get_state (object); 8617 } 8618 8619 /** 8620 * sensor_match_set_state: (skip) 8621 * @object: A #SensorMatch. 8622 * @value: The value to set. 8623 * 8624 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value. 8625 * 8626 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 8627 */ 8628 void 8629 sensor_match_set_state (SensorMatch *object, guchar value) 8630 { 8631 g_object_set (G_OBJECT (object), "state", value, NULL); 8632 } 8633 8634 /** 8635 * sensor_match_emit_sensor_match: 8636 * @object: A #SensorMatch. 8637 * @arg_state: Argument to pass with the signal. 8638 * 8639 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal. 8640 */ 8641 void 8642 sensor_match_emit_sensor_match ( 8643 SensorMatch *object, 8644 guchar arg_state) 8645 { 8646 g_signal_emit_by_name (object, "sensor-match", arg_state); 8647 } 8648 8649 /* ------------------------------------------------------------------------ */ 8650 8651 /** 8652 * SensorMatchProxy: 8653 * 8654 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API. 8655 */ 8656 8657 /** 8658 * SensorMatchProxyClass: 8659 * @parent_class: The parent class. 8660 * 8661 * Class structure for #SensorMatchProxy. 8662 */ 8663 8664 struct _SensorMatchProxyPrivate 8665 { 8666 GData *qdata; 8667 }; 8668 8669 static void sensor_match_proxy_iface_init (SensorMatchIface *iface); 8670 8671 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 8672 G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, 8673 G_ADD_PRIVATE (SensorMatchProxy) 8674 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); 8675 8676 #else 8677 G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, 8678 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); 8679 8680 #endif 8681 static void 8682 sensor_match_proxy_finalize (GObject *object) 8683 { 8684 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); 8685 g_datalist_clear (&proxy->priv->qdata); 8686 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object); 8687 } 8688 8689 static void 8690 sensor_match_proxy_get_property (GObject *object, 8691 guint prop_id, 8692 GValue *value, 8693 GParamSpec *pspec G_GNUC_UNUSED) 8694 { 8695 const _ExtendedGDBusPropertyInfo *info; 8696 GVariant *variant; 8697 g_assert (prop_id != 0 && prop_id - 1 < 2); 8698 info = _sensor_match_property_info_pointers[prop_id - 1]; 8699 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 8700 if (info->use_gvariant) 8701 { 8702 g_value_set_variant (value, variant); 8703 } 8704 else 8705 { 8706 if (variant != NULL) 8707 g_dbus_gvariant_to_gvalue (variant, value); 8708 } 8709 if (variant != NULL) 8710 g_variant_unref (variant); 8711 } 8712 8713 static void 8714 sensor_match_proxy_set_property_cb (GDBusProxy *proxy, 8715 GAsyncResult *res, 8716 gpointer user_data) 8717 { 8718 const _ExtendedGDBusPropertyInfo *info = user_data; 8719 GError *error; 8720 GVariant *_ret; 8721 error = NULL; 8722 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 8723 if (!_ret) 8724 { 8725 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)", 8726 info->parent_struct.name, 8727 error->message, g_quark_to_string (error->domain), error->code); 8728 g_error_free (error); 8729 } 8730 else 8731 { 8732 g_variant_unref (_ret); 8733 } 8734 } 8735 8736 static void 8737 sensor_match_proxy_set_property (GObject *object, 8738 guint prop_id, 8739 const GValue *value, 8740 GParamSpec *pspec G_GNUC_UNUSED) 8741 { 8742 const _ExtendedGDBusPropertyInfo *info; 8743 GVariant *variant; 8744 g_assert (prop_id != 0 && prop_id - 1 < 2); 8745 info = _sensor_match_property_info_pointers[prop_id - 1]; 8746 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 8747 g_dbus_proxy_call (G_DBUS_PROXY (object), 8748 "org.freedesktop.DBus.Properties.Set", 8749 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant), 8750 G_DBUS_CALL_FLAGS_NONE, 8751 -1, 8752 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 8753 g_variant_unref (variant); 8754 } 8755 8756 static void 8757 sensor_match_proxy_g_signal (GDBusProxy *proxy, 8758 const gchar *sender_name G_GNUC_UNUSED, 8759 const gchar *signal_name, 8760 GVariant *parameters) 8761 { 8762 _ExtendedGDBusSignalInfo *info; 8763 GVariantIter iter; 8764 GVariant *child; 8765 GValue *paramv; 8766 guint num_params; 8767 guint n; 8768 guint signal_id; 8769 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name); 8770 if (info == NULL) 8771 return; 8772 num_params = g_variant_n_children (parameters); 8773 paramv = g_new0 (GValue, num_params + 1); 8774 g_value_init (¶mv[0], TYPE_SENSOR_MATCH); 8775 g_value_set_object (¶mv[0], proxy); 8776 g_variant_iter_init (&iter, parameters); 8777 n = 1; 8778 while ((child = g_variant_iter_next_value (&iter)) != NULL) 8779 { 8780 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 8781 if (arg_info->use_gvariant) 8782 { 8783 g_value_init (¶mv[n], G_TYPE_VARIANT); 8784 g_value_set_variant (¶mv[n], child); 8785 n++; 8786 } 8787 else 8788 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 8789 g_variant_unref (child); 8790 } 8791 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); 8792 g_signal_emitv (paramv, signal_id, 0, NULL); 8793 for (n = 0; n < num_params + 1; n++) 8794 g_value_unset (¶mv[n]); 8795 g_free (paramv); 8796 } 8797 8798 static void 8799 sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy, 8800 GVariant *changed_properties, 8801 const gchar *const *invalidated_properties) 8802 { 8803 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy); 8804 guint n; 8805 const gchar *key; 8806 GVariantIter *iter; 8807 _ExtendedGDBusPropertyInfo *info; 8808 g_variant_get (changed_properties, "a{sv}", &iter); 8809 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 8810 { 8811 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key); 8812 g_datalist_remove_data (&proxy->priv->qdata, key); 8813 if (info != NULL) 8814 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 8815 } 8816 g_variant_iter_free (iter); 8817 for (n = 0; invalidated_properties[n] != NULL; n++) 8818 { 8819 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]); 8820 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 8821 if (info != NULL) 8822 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 8823 } 8824 } 8825 8826 static GVariant * 8827 sensor_match_proxy_get_match_value (SensorMatch *object) 8828 { 8829 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); 8830 GVariant *variant; 8831 GVariant *value = NULL; 8832 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value"); 8833 value = variant; 8834 if (variant != NULL) 8835 g_variant_unref (variant); 8836 return value; 8837 } 8838 8839 static guchar 8840 sensor_match_proxy_get_state (SensorMatch *object) 8841 { 8842 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); 8843 GVariant *variant; 8844 guchar value = 0; 8845 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); 8846 if (variant != NULL) 8847 { 8848 value = g_variant_get_byte (variant); 8849 g_variant_unref (variant); 8850 } 8851 return value; 8852 } 8853 8854 static void 8855 sensor_match_proxy_init (SensorMatchProxy *proxy) 8856 { 8857 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 8858 proxy->priv = sensor_match_proxy_get_instance_private (proxy); 8859 #else 8860 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate); 8861 #endif 8862 8863 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ()); 8864 } 8865 8866 static void 8867 sensor_match_proxy_class_init (SensorMatchProxyClass *klass) 8868 { 8869 GObjectClass *gobject_class; 8870 GDBusProxyClass *proxy_class; 8871 8872 gobject_class = G_OBJECT_CLASS (klass); 8873 gobject_class->finalize = sensor_match_proxy_finalize; 8874 gobject_class->get_property = sensor_match_proxy_get_property; 8875 gobject_class->set_property = sensor_match_proxy_set_property; 8876 8877 proxy_class = G_DBUS_PROXY_CLASS (klass); 8878 proxy_class->g_signal = sensor_match_proxy_g_signal; 8879 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed; 8880 8881 sensor_match_override_properties (gobject_class, 1); 8882 8883 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 8884 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate)); 8885 #endif 8886 } 8887 8888 static void 8889 sensor_match_proxy_iface_init (SensorMatchIface *iface) 8890 { 8891 iface->get_match_value = sensor_match_proxy_get_match_value; 8892 iface->get_state = sensor_match_proxy_get_state; 8893 } 8894 8895 /** 8896 * sensor_match_proxy_new: 8897 * @connection: A #GDBusConnection. 8898 * @flags: Flags from the #GDBusProxyFlags enumeration. 8899 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 8900 * @object_path: An object path. 8901 * @cancellable: (allow-none): A #GCancellable or %NULL. 8902 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 8903 * @user_data: User data to pass to @callback. 8904 * 8905 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new() for more details. 8906 * 8907 * 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. 8908 * You can then call sensor_match_proxy_new_finish() to get the result of the operation. 8909 * 8910 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor. 8911 */ 8912 void 8913 sensor_match_proxy_new ( 8914 GDBusConnection *connection, 8915 GDBusProxyFlags flags, 8916 const gchar *name, 8917 const gchar *object_path, 8918 GCancellable *cancellable, 8919 GAsyncReadyCallback callback, 8920 gpointer user_data) 8921 { 8922 g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); 8923 } 8924 8925 /** 8926 * sensor_match_proxy_new_finish: 8927 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new(). 8928 * @error: Return location for error or %NULL 8929 * 8930 * Finishes an operation started with sensor_match_proxy_new(). 8931 * 8932 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. 8933 */ 8934 SensorMatch * 8935 sensor_match_proxy_new_finish ( 8936 GAsyncResult *res, 8937 GError **error) 8938 { 8939 GObject *ret; 8940 GObject *source_object; 8941 source_object = g_async_result_get_source_object (res); 8942 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 8943 g_object_unref (source_object); 8944 if (ret != NULL) 8945 return SENSOR_MATCH (ret); 8946 else 8947 return NULL; 8948 } 8949 8950 /** 8951 * sensor_match_proxy_new_sync: 8952 * @connection: A #GDBusConnection. 8953 * @flags: Flags from the #GDBusProxyFlags enumeration. 8954 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 8955 * @object_path: An object path. 8956 * @cancellable: (allow-none): A #GCancellable or %NULL. 8957 * @error: Return location for error or %NULL 8958 * 8959 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new_sync() for more details. 8960 * 8961 * The calling thread is blocked until a reply is received. 8962 * 8963 * See sensor_match_proxy_new() for the asynchronous version of this constructor. 8964 * 8965 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. 8966 */ 8967 SensorMatch * 8968 sensor_match_proxy_new_sync ( 8969 GDBusConnection *connection, 8970 GDBusProxyFlags flags, 8971 const gchar *name, 8972 const gchar *object_path, 8973 GCancellable *cancellable, 8974 GError **error) 8975 { 8976 GInitable *ret; 8977 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); 8978 if (ret != NULL) 8979 return SENSOR_MATCH (ret); 8980 else 8981 return NULL; 8982 } 8983 8984 8985 /** 8986 * sensor_match_proxy_new_for_bus: 8987 * @bus_type: A #GBusType. 8988 * @flags: Flags from the #GDBusProxyFlags enumeration. 8989 * @name: A bus name (well-known or unique). 8990 * @object_path: An object path. 8991 * @cancellable: (allow-none): A #GCancellable or %NULL. 8992 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 8993 * @user_data: User data to pass to @callback. 8994 * 8995 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 8996 * 8997 * 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. 8998 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation. 8999 * 9000 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 9001 */ 9002 void 9003 sensor_match_proxy_new_for_bus ( 9004 GBusType bus_type, 9005 GDBusProxyFlags flags, 9006 const gchar *name, 9007 const gchar *object_path, 9008 GCancellable *cancellable, 9009 GAsyncReadyCallback callback, 9010 gpointer user_data) 9011 { 9012 g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); 9013 } 9014 9015 /** 9016 * sensor_match_proxy_new_for_bus_finish: 9017 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus(). 9018 * @error: Return location for error or %NULL 9019 * 9020 * Finishes an operation started with sensor_match_proxy_new_for_bus(). 9021 * 9022 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. 9023 */ 9024 SensorMatch * 9025 sensor_match_proxy_new_for_bus_finish ( 9026 GAsyncResult *res, 9027 GError **error) 9028 { 9029 GObject *ret; 9030 GObject *source_object; 9031 source_object = g_async_result_get_source_object (res); 9032 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 9033 g_object_unref (source_object); 9034 if (ret != NULL) 9035 return SENSOR_MATCH (ret); 9036 else 9037 return NULL; 9038 } 9039 9040 /** 9041 * sensor_match_proxy_new_for_bus_sync: 9042 * @bus_type: A #GBusType. 9043 * @flags: Flags from the #GDBusProxyFlags enumeration. 9044 * @name: A bus name (well-known or unique). 9045 * @object_path: An object path. 9046 * @cancellable: (allow-none): A #GCancellable or %NULL. 9047 * @error: Return location for error or %NULL 9048 * 9049 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 9050 * 9051 * The calling thread is blocked until a reply is received. 9052 * 9053 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor. 9054 * 9055 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. 9056 */ 9057 SensorMatch * 9058 sensor_match_proxy_new_for_bus_sync ( 9059 GBusType bus_type, 9060 GDBusProxyFlags flags, 9061 const gchar *name, 9062 const gchar *object_path, 9063 GCancellable *cancellable, 9064 GError **error) 9065 { 9066 GInitable *ret; 9067 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); 9068 if (ret != NULL) 9069 return SENSOR_MATCH (ret); 9070 else 9071 return NULL; 9072 } 9073 9074 9075 /* ------------------------------------------------------------------------ */ 9076 9077 /** 9078 * SensorMatchSkeleton: 9079 * 9080 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API. 9081 */ 9082 9083 /** 9084 * SensorMatchSkeletonClass: 9085 * @parent_class: The parent class. 9086 * 9087 * Class structure for #SensorMatchSkeleton. 9088 */ 9089 9090 struct _SensorMatchSkeletonPrivate 9091 { 9092 GValue *properties; 9093 GList *changed_properties; 9094 GSource *changed_properties_idle_source; 9095 GMainContext *context; 9096 GMutex lock; 9097 }; 9098 9099 static void 9100 _sensor_match_skeleton_handle_method_call ( 9101 GDBusConnection *connection G_GNUC_UNUSED, 9102 const gchar *sender G_GNUC_UNUSED, 9103 const gchar *object_path G_GNUC_UNUSED, 9104 const gchar *interface_name, 9105 const gchar *method_name, 9106 GVariant *parameters, 9107 GDBusMethodInvocation *invocation, 9108 gpointer user_data) 9109 { 9110 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); 9111 _ExtendedGDBusMethodInfo *info; 9112 GVariantIter iter; 9113 GVariant *child; 9114 GValue *paramv; 9115 guint num_params; 9116 guint num_extra; 9117 guint n; 9118 guint signal_id; 9119 GValue return_value = G_VALUE_INIT; 9120 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 9121 g_assert (info != NULL); 9122 num_params = g_variant_n_children (parameters); 9123 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 9124 n = 0; 9125 g_value_init (¶mv[n], TYPE_SENSOR_MATCH); 9126 g_value_set_object (¶mv[n++], skeleton); 9127 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 9128 g_value_set_object (¶mv[n++], invocation); 9129 if (info->pass_fdlist) 9130 { 9131 #ifdef G_OS_UNIX 9132 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 9133 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 9134 #else 9135 g_assert_not_reached (); 9136 #endif 9137 } 9138 g_variant_iter_init (&iter, parameters); 9139 while ((child = g_variant_iter_next_value (&iter)) != NULL) 9140 { 9141 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 9142 if (arg_info->use_gvariant) 9143 { 9144 g_value_init (¶mv[n], G_TYPE_VARIANT); 9145 g_value_set_variant (¶mv[n], child); 9146 n++; 9147 } 9148 else 9149 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 9150 g_variant_unref (child); 9151 } 9152 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); 9153 g_value_init (&return_value, G_TYPE_BOOLEAN); 9154 g_signal_emitv (paramv, signal_id, 0, &return_value); 9155 if (!g_value_get_boolean (&return_value)) 9156 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); 9157 g_value_unset (&return_value); 9158 for (n = 0; n < num_params + num_extra; n++) 9159 g_value_unset (¶mv[n]); 9160 g_free (paramv); 9161 } 9162 9163 static GVariant * 9164 _sensor_match_skeleton_handle_get_property ( 9165 GDBusConnection *connection G_GNUC_UNUSED, 9166 const gchar *sender G_GNUC_UNUSED, 9167 const gchar *object_path G_GNUC_UNUSED, 9168 const gchar *interface_name G_GNUC_UNUSED, 9169 const gchar *property_name, 9170 GError **error, 9171 gpointer user_data) 9172 { 9173 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); 9174 GValue value = G_VALUE_INIT; 9175 GParamSpec *pspec; 9176 _ExtendedGDBusPropertyInfo *info; 9177 GVariant *ret; 9178 ret = NULL; 9179 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); 9180 g_assert (info != NULL); 9181 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 9182 if (pspec == NULL) 9183 { 9184 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 9185 } 9186 else 9187 { 9188 g_value_init (&value, pspec->value_type); 9189 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 9190 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 9191 g_value_unset (&value); 9192 } 9193 return ret; 9194 } 9195 9196 static gboolean 9197 _sensor_match_skeleton_handle_set_property ( 9198 GDBusConnection *connection G_GNUC_UNUSED, 9199 const gchar *sender G_GNUC_UNUSED, 9200 const gchar *object_path G_GNUC_UNUSED, 9201 const gchar *interface_name G_GNUC_UNUSED, 9202 const gchar *property_name, 9203 GVariant *variant, 9204 GError **error, 9205 gpointer user_data) 9206 { 9207 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); 9208 GValue value = G_VALUE_INIT; 9209 GParamSpec *pspec; 9210 _ExtendedGDBusPropertyInfo *info; 9211 gboolean ret; 9212 ret = FALSE; 9213 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); 9214 g_assert (info != NULL); 9215 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 9216 if (pspec == NULL) 9217 { 9218 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 9219 } 9220 else 9221 { 9222 if (info->use_gvariant) 9223 g_value_set_variant (&value, variant); 9224 else 9225 g_dbus_gvariant_to_gvalue (variant, &value); 9226 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 9227 g_value_unset (&value); 9228 ret = TRUE; 9229 } 9230 return ret; 9231 } 9232 9233 static const GDBusInterfaceVTable _sensor_match_skeleton_vtable = 9234 { 9235 _sensor_match_skeleton_handle_method_call, 9236 _sensor_match_skeleton_handle_get_property, 9237 _sensor_match_skeleton_handle_set_property, 9238 {NULL} 9239 }; 9240 9241 static GDBusInterfaceInfo * 9242 sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 9243 { 9244 return sensor_match_interface_info (); 9245 } 9246 9247 static GDBusInterfaceVTable * 9248 sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 9249 { 9250 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable; 9251 } 9252 9253 static GVariant * 9254 sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 9255 { 9256 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); 9257 9258 GVariantBuilder builder; 9259 guint n; 9260 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 9261 if (_sensor_match_interface_info.parent_struct.properties == NULL) 9262 goto out; 9263 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++) 9264 { 9265 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n]; 9266 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 9267 { 9268 GVariant *value; 9269 value = _sensor_match_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", info->name, NULL, skeleton); 9270 if (value != NULL) 9271 { 9272 g_variant_take_ref (value); 9273 g_variant_builder_add (&builder, "{sv}", info->name, value); 9274 g_variant_unref (value); 9275 } 9276 } 9277 } 9278 out: 9279 return g_variant_builder_end (&builder); 9280 } 9281 9282 static gboolean _sensor_match_emit_changed (gpointer user_data); 9283 9284 static void 9285 sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 9286 { 9287 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); 9288 gboolean emit_changed = FALSE; 9289 9290 g_mutex_lock (&skeleton->priv->lock); 9291 if (skeleton->priv->changed_properties_idle_source != NULL) 9292 { 9293 g_source_destroy (skeleton->priv->changed_properties_idle_source); 9294 skeleton->priv->changed_properties_idle_source = NULL; 9295 emit_changed = TRUE; 9296 } 9297 g_mutex_unlock (&skeleton->priv->lock); 9298 9299 if (emit_changed) 9300 _sensor_match_emit_changed (skeleton); 9301 } 9302 9303 static void 9304 _sensor_match_on_signal_sensor_match ( 9305 SensorMatch *object, 9306 guchar arg_state) 9307 { 9308 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); 9309 9310 GList *connections, *l; 9311 GVariant *signal_variant; 9312 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 9313 9314 signal_variant = g_variant_ref_sink (g_variant_new ("(y)", 9315 arg_state)); 9316 for (l = connections; l != NULL; l = l->next) 9317 { 9318 GDBusConnection *connection = l->data; 9319 g_dbus_connection_emit_signal (connection, 9320 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch", 9321 signal_variant, NULL); 9322 } 9323 g_variant_unref (signal_variant); 9324 g_list_free_full (connections, g_object_unref); 9325 } 9326 9327 static void sensor_match_skeleton_iface_init (SensorMatchIface *iface); 9328 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 9329 G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 9330 G_ADD_PRIVATE (SensorMatchSkeleton) 9331 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); 9332 9333 #else 9334 G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 9335 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); 9336 9337 #endif 9338 static void 9339 sensor_match_skeleton_finalize (GObject *object) 9340 { 9341 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); 9342 guint n; 9343 for (n = 0; n < 2; n++) 9344 g_value_unset (&skeleton->priv->properties[n]); 9345 g_free (skeleton->priv->properties); 9346 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 9347 if (skeleton->priv->changed_properties_idle_source != NULL) 9348 g_source_destroy (skeleton->priv->changed_properties_idle_source); 9349 g_main_context_unref (skeleton->priv->context); 9350 g_mutex_clear (&skeleton->priv->lock); 9351 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object); 9352 } 9353 9354 static void 9355 sensor_match_skeleton_get_property (GObject *object, 9356 guint prop_id, 9357 GValue *value, 9358 GParamSpec *pspec G_GNUC_UNUSED) 9359 { 9360 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); 9361 g_assert (prop_id != 0 && prop_id - 1 < 2); 9362 g_mutex_lock (&skeleton->priv->lock); 9363 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 9364 g_mutex_unlock (&skeleton->priv->lock); 9365 } 9366 9367 static gboolean 9368 _sensor_match_emit_changed (gpointer user_data) 9369 { 9370 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); 9371 GList *l; 9372 GVariantBuilder builder; 9373 GVariantBuilder invalidated_builder; 9374 guint num_changes; 9375 9376 g_mutex_lock (&skeleton->priv->lock); 9377 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 9378 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 9379 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 9380 { 9381 ChangedProperty *cp = l->data; 9382 GVariant *variant; 9383 const GValue *cur_value; 9384 9385 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 9386 if (!_g_value_equal (cur_value, &cp->orig_value)) 9387 { 9388 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 9389 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 9390 g_variant_unref (variant); 9391 num_changes++; 9392 } 9393 } 9394 if (num_changes > 0) 9395 { 9396 GList *connections, *ll; 9397 GVariant *signal_variant; 9398 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch", 9399 &builder, &invalidated_builder)); 9400 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 9401 for (ll = connections; ll != NULL; ll = ll->next) 9402 { 9403 GDBusConnection *connection = ll->data; 9404 9405 g_dbus_connection_emit_signal (connection, 9406 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 9407 "org.freedesktop.DBus.Properties", 9408 "PropertiesChanged", 9409 signal_variant, 9410 NULL); 9411 } 9412 g_variant_unref (signal_variant); 9413 g_list_free_full (connections, g_object_unref); 9414 } 9415 else 9416 { 9417 g_variant_builder_clear (&builder); 9418 g_variant_builder_clear (&invalidated_builder); 9419 } 9420 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 9421 skeleton->priv->changed_properties = NULL; 9422 skeleton->priv->changed_properties_idle_source = NULL; 9423 g_mutex_unlock (&skeleton->priv->lock); 9424 return FALSE; 9425 } 9426 9427 static void 9428 _sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 9429 { 9430 ChangedProperty *cp; 9431 GList *l; 9432 cp = NULL; 9433 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 9434 { 9435 ChangedProperty *i_cp = l->data; 9436 if (i_cp->info == info) 9437 { 9438 cp = i_cp; 9439 break; 9440 } 9441 } 9442 if (cp == NULL) 9443 { 9444 cp = g_new0 (ChangedProperty, 1); 9445 cp->prop_id = prop_id; 9446 cp->info = info; 9447 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 9448 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 9449 g_value_copy (orig_value, &cp->orig_value); 9450 } 9451 } 9452 9453 static void 9454 sensor_match_skeleton_notify (GObject *object, 9455 GParamSpec *pspec G_GNUC_UNUSED) 9456 { 9457 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); 9458 g_mutex_lock (&skeleton->priv->lock); 9459 if (skeleton->priv->changed_properties != NULL && 9460 skeleton->priv->changed_properties_idle_source == NULL) 9461 { 9462 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 9463 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 9464 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 9465 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_match_emit_changed"); 9466 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 9467 g_source_unref (skeleton->priv->changed_properties_idle_source); 9468 } 9469 g_mutex_unlock (&skeleton->priv->lock); 9470 } 9471 9472 static void 9473 sensor_match_skeleton_set_property (GObject *object, 9474 guint prop_id, 9475 const GValue *value, 9476 GParamSpec *pspec) 9477 { 9478 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); 9479 g_assert (prop_id != 0 && prop_id - 1 < 2); 9480 g_mutex_lock (&skeleton->priv->lock); 9481 g_object_freeze_notify (object); 9482 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 9483 { 9484 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 9485 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 9486 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 9487 g_object_notify_by_pspec (object, pspec); 9488 } 9489 g_mutex_unlock (&skeleton->priv->lock); 9490 g_object_thaw_notify (object); 9491 } 9492 9493 static void 9494 sensor_match_skeleton_init (SensorMatchSkeleton *skeleton) 9495 { 9496 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 9497 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton); 9498 #else 9499 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate); 9500 #endif 9501 9502 g_mutex_init (&skeleton->priv->lock); 9503 skeleton->priv->context = g_main_context_ref_thread_default (); 9504 skeleton->priv->properties = g_new0 (GValue, 2); 9505 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); 9506 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR); 9507 } 9508 9509 static GVariant * 9510 sensor_match_skeleton_get_match_value (SensorMatch *object) 9511 { 9512 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); 9513 GVariant *value; 9514 g_mutex_lock (&skeleton->priv->lock); 9515 value = g_value_get_variant (&(skeleton->priv->properties[0])); 9516 g_mutex_unlock (&skeleton->priv->lock); 9517 return value; 9518 } 9519 9520 static guchar 9521 sensor_match_skeleton_get_state (SensorMatch *object) 9522 { 9523 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); 9524 guchar value; 9525 g_mutex_lock (&skeleton->priv->lock); 9526 value = g_value_get_uchar (&(skeleton->priv->properties[1])); 9527 g_mutex_unlock (&skeleton->priv->lock); 9528 return value; 9529 } 9530 9531 static void 9532 sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass) 9533 { 9534 GObjectClass *gobject_class; 9535 GDBusInterfaceSkeletonClass *skeleton_class; 9536 9537 gobject_class = G_OBJECT_CLASS (klass); 9538 gobject_class->finalize = sensor_match_skeleton_finalize; 9539 gobject_class->get_property = sensor_match_skeleton_get_property; 9540 gobject_class->set_property = sensor_match_skeleton_set_property; 9541 gobject_class->notify = sensor_match_skeleton_notify; 9542 9543 9544 sensor_match_override_properties (gobject_class, 1); 9545 9546 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 9547 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info; 9548 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties; 9549 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush; 9550 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable; 9551 9552 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 9553 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate)); 9554 #endif 9555 } 9556 9557 static void 9558 sensor_match_skeleton_iface_init (SensorMatchIface *iface) 9559 { 9560 iface->sensor_match = _sensor_match_on_signal_sensor_match; 9561 iface->get_match_value = sensor_match_skeleton_get_match_value; 9562 iface->get_state = sensor_match_skeleton_get_state; 9563 } 9564 9565 /** 9566 * sensor_match_skeleton_new: 9567 * 9568 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. 9569 * 9570 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object. 9571 */ 9572 SensorMatch * 9573 sensor_match_skeleton_new (void) 9574 { 9575 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL)); 9576 } 9577 9578 /* ------------------------------------------------------------------------ 9579 * Code for interface org.openbmc.Process 9580 * ------------------------------------------------------------------------ 9581 */ 9582 9583 /** 9584 * SECTION:Process 9585 * @title: Process 9586 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface 9587 * 9588 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface in C. 9589 */ 9590 9591 /* ---- Introspection data for org.openbmc.Process ---- */ 9592 9593 static const _ExtendedGDBusMethodInfo _process_method_info_stop = 9594 { 9595 { 9596 -1, 9597 (gchar *) "stop", 9598 NULL, 9599 NULL, 9600 NULL 9601 }, 9602 "handle-stop", 9603 FALSE 9604 }; 9605 9606 static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] = 9607 { 9608 &_process_method_info_stop, 9609 NULL 9610 }; 9611 9612 static const _ExtendedGDBusInterfaceInfo _process_interface_info = 9613 { 9614 { 9615 -1, 9616 (gchar *) "org.openbmc.Process", 9617 (GDBusMethodInfo **) &_process_method_info_pointers, 9618 NULL, 9619 NULL, 9620 NULL 9621 }, 9622 "process", 9623 }; 9624 9625 9626 /** 9627 * process_interface_info: 9628 * 9629 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface. 9630 * 9631 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 9632 */ 9633 GDBusInterfaceInfo * 9634 process_interface_info (void) 9635 { 9636 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct; 9637 } 9638 9639 /** 9640 * process_override_properties: 9641 * @klass: The class structure for a #GObject<!-- -->-derived class. 9642 * @property_id_begin: The property id to assign to the first overridden property. 9643 * 9644 * Overrides all #GObject properties in the #Process interface for a concrete class. 9645 * The properties are overridden in the order they are defined. 9646 * 9647 * Returns: The last property id. 9648 */ 9649 guint 9650 process_override_properties (GObjectClass *klass, guint property_id_begin) 9651 { 9652 return property_id_begin - 1; 9653 } 9654 9655 9656 9657 /** 9658 * Process: 9659 * 9660 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. 9661 */ 9662 9663 /** 9664 * ProcessIface: 9665 * @parent_iface: The parent interface. 9666 * @handle_stop: Handler for the #Process::handle-stop signal. 9667 * 9668 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. 9669 */ 9670 9671 typedef ProcessIface ProcessInterface; 9672 G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT); 9673 9674 static void 9675 process_default_init (ProcessIface *iface) 9676 { 9677 /* GObject signals for incoming D-Bus method calls: */ 9678 /** 9679 * Process::handle-stop: 9680 * @object: A #Process. 9681 * @invocation: A #GDBusMethodInvocation. 9682 * 9683 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method. 9684 * 9685 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call process_complete_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 9686 * 9687 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 9688 */ 9689 g_signal_new ("handle-stop", 9690 G_TYPE_FROM_INTERFACE (iface), 9691 G_SIGNAL_RUN_LAST, 9692 G_STRUCT_OFFSET (ProcessIface, handle_stop), 9693 g_signal_accumulator_true_handled, 9694 NULL, 9695 g_cclosure_marshal_generic, 9696 G_TYPE_BOOLEAN, 9697 1, 9698 G_TYPE_DBUS_METHOD_INVOCATION); 9699 9700 } 9701 9702 /** 9703 * process_call_stop: 9704 * @proxy: A #ProcessProxy. 9705 * @cancellable: (allow-none): A #GCancellable or %NULL. 9706 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 9707 * @user_data: User data to pass to @callback. 9708 * 9709 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. 9710 * 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. 9711 * You can then call process_call_stop_finish() to get the result of the operation. 9712 * 9713 * See process_call_stop_sync() for the synchronous, blocking version of this method. 9714 */ 9715 void 9716 process_call_stop ( 9717 Process *proxy, 9718 GCancellable *cancellable, 9719 GAsyncReadyCallback callback, 9720 gpointer user_data) 9721 { 9722 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 9723 "stop", 9724 g_variant_new ("()"), 9725 G_DBUS_CALL_FLAGS_NONE, 9726 -1, 9727 cancellable, 9728 callback, 9729 user_data); 9730 } 9731 9732 /** 9733 * process_call_stop_finish: 9734 * @proxy: A #ProcessProxy. 9735 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop(). 9736 * @error: Return location for error or %NULL. 9737 * 9738 * Finishes an operation started with process_call_stop(). 9739 * 9740 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 9741 */ 9742 gboolean 9743 process_call_stop_finish ( 9744 Process *proxy, 9745 GAsyncResult *res, 9746 GError **error) 9747 { 9748 GVariant *_ret; 9749 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 9750 if (_ret == NULL) 9751 goto _out; 9752 g_variant_get (_ret, 9753 "()"); 9754 g_variant_unref (_ret); 9755 _out: 9756 return _ret != NULL; 9757 } 9758 9759 /** 9760 * process_call_stop_sync: 9761 * @proxy: A #ProcessProxy. 9762 * @cancellable: (allow-none): A #GCancellable or %NULL. 9763 * @error: Return location for error or %NULL. 9764 * 9765 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 9766 * 9767 * See process_call_stop() for the asynchronous version of this method. 9768 * 9769 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 9770 */ 9771 gboolean 9772 process_call_stop_sync ( 9773 Process *proxy, 9774 GCancellable *cancellable, 9775 GError **error) 9776 { 9777 GVariant *_ret; 9778 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 9779 "stop", 9780 g_variant_new ("()"), 9781 G_DBUS_CALL_FLAGS_NONE, 9782 -1, 9783 cancellable, 9784 error); 9785 if (_ret == NULL) 9786 goto _out; 9787 g_variant_get (_ret, 9788 "()"); 9789 g_variant_unref (_ret); 9790 _out: 9791 return _ret != NULL; 9792 } 9793 9794 /** 9795 * process_complete_stop: 9796 * @object: A #Process. 9797 * @invocation: (transfer full): A #GDBusMethodInvocation. 9798 * 9799 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 9800 * 9801 * This method will free @invocation, you cannot use it afterwards. 9802 */ 9803 void 9804 process_complete_stop ( 9805 Process *object, 9806 GDBusMethodInvocation *invocation) 9807 { 9808 g_dbus_method_invocation_return_value (invocation, 9809 g_variant_new ("()")); 9810 } 9811 9812 /* ------------------------------------------------------------------------ */ 9813 9814 /** 9815 * ProcessProxy: 9816 * 9817 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API. 9818 */ 9819 9820 /** 9821 * ProcessProxyClass: 9822 * @parent_class: The parent class. 9823 * 9824 * Class structure for #ProcessProxy. 9825 */ 9826 9827 struct _ProcessProxyPrivate 9828 { 9829 GData *qdata; 9830 }; 9831 9832 static void process_proxy_iface_init (ProcessIface *iface); 9833 9834 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 9835 G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, 9836 G_ADD_PRIVATE (ProcessProxy) 9837 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); 9838 9839 #else 9840 G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY, 9841 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init)); 9842 9843 #endif 9844 static void 9845 process_proxy_finalize (GObject *object) 9846 { 9847 ProcessProxy *proxy = PROCESS_PROXY (object); 9848 g_datalist_clear (&proxy->priv->qdata); 9849 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object); 9850 } 9851 9852 static void 9853 process_proxy_get_property (GObject *object, 9854 guint prop_id, 9855 GValue *value, 9856 GParamSpec *pspec G_GNUC_UNUSED) 9857 { 9858 } 9859 9860 static void 9861 process_proxy_set_property (GObject *object, 9862 guint prop_id, 9863 const GValue *value, 9864 GParamSpec *pspec G_GNUC_UNUSED) 9865 { 9866 } 9867 9868 static void 9869 process_proxy_g_signal (GDBusProxy *proxy, 9870 const gchar *sender_name G_GNUC_UNUSED, 9871 const gchar *signal_name, 9872 GVariant *parameters) 9873 { 9874 _ExtendedGDBusSignalInfo *info; 9875 GVariantIter iter; 9876 GVariant *child; 9877 GValue *paramv; 9878 guint num_params; 9879 guint n; 9880 guint signal_id; 9881 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name); 9882 if (info == NULL) 9883 return; 9884 num_params = g_variant_n_children (parameters); 9885 paramv = g_new0 (GValue, num_params + 1); 9886 g_value_init (¶mv[0], TYPE_PROCESS); 9887 g_value_set_object (¶mv[0], proxy); 9888 g_variant_iter_init (&iter, parameters); 9889 n = 1; 9890 while ((child = g_variant_iter_next_value (&iter)) != NULL) 9891 { 9892 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 9893 if (arg_info->use_gvariant) 9894 { 9895 g_value_init (¶mv[n], G_TYPE_VARIANT); 9896 g_value_set_variant (¶mv[n], child); 9897 n++; 9898 } 9899 else 9900 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 9901 g_variant_unref (child); 9902 } 9903 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); 9904 g_signal_emitv (paramv, signal_id, 0, NULL); 9905 for (n = 0; n < num_params + 1; n++) 9906 g_value_unset (¶mv[n]); 9907 g_free (paramv); 9908 } 9909 9910 static void 9911 process_proxy_g_properties_changed (GDBusProxy *_proxy, 9912 GVariant *changed_properties, 9913 const gchar *const *invalidated_properties) 9914 { 9915 ProcessProxy *proxy = PROCESS_PROXY (_proxy); 9916 guint n; 9917 const gchar *key; 9918 GVariantIter *iter; 9919 _ExtendedGDBusPropertyInfo *info; 9920 g_variant_get (changed_properties, "a{sv}", &iter); 9921 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 9922 { 9923 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key); 9924 g_datalist_remove_data (&proxy->priv->qdata, key); 9925 if (info != NULL) 9926 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 9927 } 9928 g_variant_iter_free (iter); 9929 for (n = 0; invalidated_properties[n] != NULL; n++) 9930 { 9931 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]); 9932 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 9933 if (info != NULL) 9934 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 9935 } 9936 } 9937 9938 static void 9939 process_proxy_init (ProcessProxy *proxy) 9940 { 9941 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 9942 proxy->priv = process_proxy_get_instance_private (proxy); 9943 #else 9944 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate); 9945 #endif 9946 9947 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ()); 9948 } 9949 9950 static void 9951 process_proxy_class_init (ProcessProxyClass *klass) 9952 { 9953 GObjectClass *gobject_class; 9954 GDBusProxyClass *proxy_class; 9955 9956 gobject_class = G_OBJECT_CLASS (klass); 9957 gobject_class->finalize = process_proxy_finalize; 9958 gobject_class->get_property = process_proxy_get_property; 9959 gobject_class->set_property = process_proxy_set_property; 9960 9961 proxy_class = G_DBUS_PROXY_CLASS (klass); 9962 proxy_class->g_signal = process_proxy_g_signal; 9963 proxy_class->g_properties_changed = process_proxy_g_properties_changed; 9964 9965 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 9966 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate)); 9967 #endif 9968 } 9969 9970 static void 9971 process_proxy_iface_init (ProcessIface *iface) 9972 { 9973 } 9974 9975 /** 9976 * process_proxy_new: 9977 * @connection: A #GDBusConnection. 9978 * @flags: Flags from the #GDBusProxyFlags enumeration. 9979 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 9980 * @object_path: An object path. 9981 * @cancellable: (allow-none): A #GCancellable or %NULL. 9982 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 9983 * @user_data: User data to pass to @callback. 9984 * 9985 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new() for more details. 9986 * 9987 * 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. 9988 * You can then call process_proxy_new_finish() to get the result of the operation. 9989 * 9990 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor. 9991 */ 9992 void 9993 process_proxy_new ( 9994 GDBusConnection *connection, 9995 GDBusProxyFlags flags, 9996 const gchar *name, 9997 const gchar *object_path, 9998 GCancellable *cancellable, 9999 GAsyncReadyCallback callback, 10000 gpointer user_data) 10001 { 10002 g_async_initable_new_async (TYPE_PROCESS_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL); 10003 } 10004 10005 /** 10006 * process_proxy_new_finish: 10007 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new(). 10008 * @error: Return location for error or %NULL 10009 * 10010 * Finishes an operation started with process_proxy_new(). 10011 * 10012 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. 10013 */ 10014 Process * 10015 process_proxy_new_finish ( 10016 GAsyncResult *res, 10017 GError **error) 10018 { 10019 GObject *ret; 10020 GObject *source_object; 10021 source_object = g_async_result_get_source_object (res); 10022 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 10023 g_object_unref (source_object); 10024 if (ret != NULL) 10025 return PROCESS (ret); 10026 else 10027 return NULL; 10028 } 10029 10030 /** 10031 * process_proxy_new_sync: 10032 * @connection: A #GDBusConnection. 10033 * @flags: Flags from the #GDBusProxyFlags enumeration. 10034 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 10035 * @object_path: An object path. 10036 * @cancellable: (allow-none): A #GCancellable or %NULL. 10037 * @error: Return location for error or %NULL 10038 * 10039 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new_sync() for more details. 10040 * 10041 * The calling thread is blocked until a reply is received. 10042 * 10043 * See process_proxy_new() for the asynchronous version of this constructor. 10044 * 10045 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. 10046 */ 10047 Process * 10048 process_proxy_new_sync ( 10049 GDBusConnection *connection, 10050 GDBusProxyFlags flags, 10051 const gchar *name, 10052 const gchar *object_path, 10053 GCancellable *cancellable, 10054 GError **error) 10055 { 10056 GInitable *ret; 10057 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL); 10058 if (ret != NULL) 10059 return PROCESS (ret); 10060 else 10061 return NULL; 10062 } 10063 10064 10065 /** 10066 * process_proxy_new_for_bus: 10067 * @bus_type: A #GBusType. 10068 * @flags: Flags from the #GDBusProxyFlags enumeration. 10069 * @name: A bus name (well-known or unique). 10070 * @object_path: An object path. 10071 * @cancellable: (allow-none): A #GCancellable or %NULL. 10072 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 10073 * @user_data: User data to pass to @callback. 10074 * 10075 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 10076 * 10077 * 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. 10078 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation. 10079 * 10080 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 10081 */ 10082 void 10083 process_proxy_new_for_bus ( 10084 GBusType bus_type, 10085 GDBusProxyFlags flags, 10086 const gchar *name, 10087 const gchar *object_path, 10088 GCancellable *cancellable, 10089 GAsyncReadyCallback callback, 10090 gpointer user_data) 10091 { 10092 g_async_initable_new_async (TYPE_PROCESS_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL); 10093 } 10094 10095 /** 10096 * process_proxy_new_for_bus_finish: 10097 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus(). 10098 * @error: Return location for error or %NULL 10099 * 10100 * Finishes an operation started with process_proxy_new_for_bus(). 10101 * 10102 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. 10103 */ 10104 Process * 10105 process_proxy_new_for_bus_finish ( 10106 GAsyncResult *res, 10107 GError **error) 10108 { 10109 GObject *ret; 10110 GObject *source_object; 10111 source_object = g_async_result_get_source_object (res); 10112 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 10113 g_object_unref (source_object); 10114 if (ret != NULL) 10115 return PROCESS (ret); 10116 else 10117 return NULL; 10118 } 10119 10120 /** 10121 * process_proxy_new_for_bus_sync: 10122 * @bus_type: A #GBusType. 10123 * @flags: Flags from the #GDBusProxyFlags enumeration. 10124 * @name: A bus name (well-known or unique). 10125 * @object_path: An object path. 10126 * @cancellable: (allow-none): A #GCancellable or %NULL. 10127 * @error: Return location for error or %NULL 10128 * 10129 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 10130 * 10131 * The calling thread is blocked until a reply is received. 10132 * 10133 * See process_proxy_new_for_bus() for the asynchronous version of this constructor. 10134 * 10135 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set. 10136 */ 10137 Process * 10138 process_proxy_new_for_bus_sync ( 10139 GBusType bus_type, 10140 GDBusProxyFlags flags, 10141 const gchar *name, 10142 const gchar *object_path, 10143 GCancellable *cancellable, 10144 GError **error) 10145 { 10146 GInitable *ret; 10147 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL); 10148 if (ret != NULL) 10149 return PROCESS (ret); 10150 else 10151 return NULL; 10152 } 10153 10154 10155 /* ------------------------------------------------------------------------ */ 10156 10157 /** 10158 * ProcessSkeleton: 10159 * 10160 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API. 10161 */ 10162 10163 /** 10164 * ProcessSkeletonClass: 10165 * @parent_class: The parent class. 10166 * 10167 * Class structure for #ProcessSkeleton. 10168 */ 10169 10170 struct _ProcessSkeletonPrivate 10171 { 10172 GValue *properties; 10173 GList *changed_properties; 10174 GSource *changed_properties_idle_source; 10175 GMainContext *context; 10176 GMutex lock; 10177 }; 10178 10179 static void 10180 _process_skeleton_handle_method_call ( 10181 GDBusConnection *connection G_GNUC_UNUSED, 10182 const gchar *sender G_GNUC_UNUSED, 10183 const gchar *object_path G_GNUC_UNUSED, 10184 const gchar *interface_name, 10185 const gchar *method_name, 10186 GVariant *parameters, 10187 GDBusMethodInvocation *invocation, 10188 gpointer user_data) 10189 { 10190 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); 10191 _ExtendedGDBusMethodInfo *info; 10192 GVariantIter iter; 10193 GVariant *child; 10194 GValue *paramv; 10195 guint num_params; 10196 guint num_extra; 10197 guint n; 10198 guint signal_id; 10199 GValue return_value = G_VALUE_INIT; 10200 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 10201 g_assert (info != NULL); 10202 num_params = g_variant_n_children (parameters); 10203 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 10204 n = 0; 10205 g_value_init (¶mv[n], TYPE_PROCESS); 10206 g_value_set_object (¶mv[n++], skeleton); 10207 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 10208 g_value_set_object (¶mv[n++], invocation); 10209 if (info->pass_fdlist) 10210 { 10211 #ifdef G_OS_UNIX 10212 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 10213 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 10214 #else 10215 g_assert_not_reached (); 10216 #endif 10217 } 10218 g_variant_iter_init (&iter, parameters); 10219 while ((child = g_variant_iter_next_value (&iter)) != NULL) 10220 { 10221 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 10222 if (arg_info->use_gvariant) 10223 { 10224 g_value_init (¶mv[n], G_TYPE_VARIANT); 10225 g_value_set_variant (¶mv[n], child); 10226 n++; 10227 } 10228 else 10229 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 10230 g_variant_unref (child); 10231 } 10232 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS); 10233 g_value_init (&return_value, G_TYPE_BOOLEAN); 10234 g_signal_emitv (paramv, signal_id, 0, &return_value); 10235 if (!g_value_get_boolean (&return_value)) 10236 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); 10237 g_value_unset (&return_value); 10238 for (n = 0; n < num_params + num_extra; n++) 10239 g_value_unset (¶mv[n]); 10240 g_free (paramv); 10241 } 10242 10243 static GVariant * 10244 _process_skeleton_handle_get_property ( 10245 GDBusConnection *connection G_GNUC_UNUSED, 10246 const gchar *sender G_GNUC_UNUSED, 10247 const gchar *object_path G_GNUC_UNUSED, 10248 const gchar *interface_name G_GNUC_UNUSED, 10249 const gchar *property_name, 10250 GError **error, 10251 gpointer user_data) 10252 { 10253 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); 10254 GValue value = G_VALUE_INIT; 10255 GParamSpec *pspec; 10256 _ExtendedGDBusPropertyInfo *info; 10257 GVariant *ret; 10258 ret = NULL; 10259 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); 10260 g_assert (info != NULL); 10261 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 10262 if (pspec == NULL) 10263 { 10264 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 10265 } 10266 else 10267 { 10268 g_value_init (&value, pspec->value_type); 10269 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 10270 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 10271 g_value_unset (&value); 10272 } 10273 return ret; 10274 } 10275 10276 static gboolean 10277 _process_skeleton_handle_set_property ( 10278 GDBusConnection *connection G_GNUC_UNUSED, 10279 const gchar *sender G_GNUC_UNUSED, 10280 const gchar *object_path G_GNUC_UNUSED, 10281 const gchar *interface_name G_GNUC_UNUSED, 10282 const gchar *property_name, 10283 GVariant *variant, 10284 GError **error, 10285 gpointer user_data) 10286 { 10287 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data); 10288 GValue value = G_VALUE_INIT; 10289 GParamSpec *pspec; 10290 _ExtendedGDBusPropertyInfo *info; 10291 gboolean ret; 10292 ret = FALSE; 10293 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name); 10294 g_assert (info != NULL); 10295 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 10296 if (pspec == NULL) 10297 { 10298 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 10299 } 10300 else 10301 { 10302 if (info->use_gvariant) 10303 g_value_set_variant (&value, variant); 10304 else 10305 g_dbus_gvariant_to_gvalue (variant, &value); 10306 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 10307 g_value_unset (&value); 10308 ret = TRUE; 10309 } 10310 return ret; 10311 } 10312 10313 static const GDBusInterfaceVTable _process_skeleton_vtable = 10314 { 10315 _process_skeleton_handle_method_call, 10316 _process_skeleton_handle_get_property, 10317 _process_skeleton_handle_set_property, 10318 {NULL} 10319 }; 10320 10321 static GDBusInterfaceInfo * 10322 process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 10323 { 10324 return process_interface_info (); 10325 } 10326 10327 static GDBusInterfaceVTable * 10328 process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 10329 { 10330 return (GDBusInterfaceVTable *) &_process_skeleton_vtable; 10331 } 10332 10333 static GVariant * 10334 process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 10335 { 10336 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton); 10337 10338 GVariantBuilder builder; 10339 guint n; 10340 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 10341 if (_process_interface_info.parent_struct.properties == NULL) 10342 goto out; 10343 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++) 10344 { 10345 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n]; 10346 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 10347 { 10348 GVariant *value; 10349 value = _process_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Process", info->name, NULL, skeleton); 10350 if (value != NULL) 10351 { 10352 g_variant_take_ref (value); 10353 g_variant_builder_add (&builder, "{sv}", info->name, value); 10354 g_variant_unref (value); 10355 } 10356 } 10357 } 10358 out: 10359 return g_variant_builder_end (&builder); 10360 } 10361 10362 static void 10363 process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 10364 { 10365 } 10366 10367 static void process_skeleton_iface_init (ProcessIface *iface); 10368 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 10369 G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 10370 G_ADD_PRIVATE (ProcessSkeleton) 10371 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); 10372 10373 #else 10374 G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 10375 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init)); 10376 10377 #endif 10378 static void 10379 process_skeleton_finalize (GObject *object) 10380 { 10381 ProcessSkeleton *skeleton = PROCESS_SKELETON (object); 10382 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 10383 if (skeleton->priv->changed_properties_idle_source != NULL) 10384 g_source_destroy (skeleton->priv->changed_properties_idle_source); 10385 g_main_context_unref (skeleton->priv->context); 10386 g_mutex_clear (&skeleton->priv->lock); 10387 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object); 10388 } 10389 10390 static void 10391 process_skeleton_init (ProcessSkeleton *skeleton) 10392 { 10393 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 10394 skeleton->priv = process_skeleton_get_instance_private (skeleton); 10395 #else 10396 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate); 10397 #endif 10398 10399 g_mutex_init (&skeleton->priv->lock); 10400 skeleton->priv->context = g_main_context_ref_thread_default (); 10401 } 10402 10403 static void 10404 process_skeleton_class_init (ProcessSkeletonClass *klass) 10405 { 10406 GObjectClass *gobject_class; 10407 GDBusInterfaceSkeletonClass *skeleton_class; 10408 10409 gobject_class = G_OBJECT_CLASS (klass); 10410 gobject_class->finalize = process_skeleton_finalize; 10411 10412 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 10413 skeleton_class->get_info = process_skeleton_dbus_interface_get_info; 10414 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties; 10415 skeleton_class->flush = process_skeleton_dbus_interface_flush; 10416 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable; 10417 10418 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 10419 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate)); 10420 #endif 10421 } 10422 10423 static void 10424 process_skeleton_iface_init (ProcessIface *iface) 10425 { 10426 } 10427 10428 /** 10429 * process_skeleton_new: 10430 * 10431 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. 10432 * 10433 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object. 10434 */ 10435 Process * 10436 process_skeleton_new (void) 10437 { 10438 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL)); 10439 } 10440 10441 /* ------------------------------------------------------------------------ 10442 * Code for interface org.openbmc.SharedResource 10443 * ------------------------------------------------------------------------ 10444 */ 10445 10446 /** 10447 * SECTION:SharedResource 10448 * @title: SharedResource 10449 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface 10450 * 10451 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface in C. 10452 */ 10453 10454 /* ---- Introspection data for org.openbmc.SharedResource ---- */ 10455 10456 static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name = 10457 { 10458 { 10459 -1, 10460 (gchar *) "name", 10461 (gchar *) "s", 10462 NULL 10463 }, 10464 FALSE 10465 }; 10466 10467 static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] = 10468 { 10469 &_shared_resource_method_info_lock_IN_ARG_name, 10470 NULL 10471 }; 10472 10473 static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock = 10474 { 10475 { 10476 -1, 10477 (gchar *) "lock", 10478 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers, 10479 NULL, 10480 NULL 10481 }, 10482 "handle-lock", 10483 FALSE 10484 }; 10485 10486 static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock = 10487 { 10488 { 10489 -1, 10490 (gchar *) "unlock", 10491 NULL, 10492 NULL, 10493 NULL 10494 }, 10495 "handle-unlock", 10496 FALSE 10497 }; 10498 10499 static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock = 10500 { 10501 { 10502 -1, 10503 (gchar *) "lock", 10504 (gchar *) "b", 10505 NULL 10506 }, 10507 FALSE 10508 }; 10509 10510 static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name = 10511 { 10512 { 10513 -1, 10514 (gchar *) "name", 10515 (gchar *) "s", 10516 NULL 10517 }, 10518 FALSE 10519 }; 10520 10521 static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] = 10522 { 10523 &_shared_resource_method_info_is_locked_OUT_ARG_lock, 10524 &_shared_resource_method_info_is_locked_OUT_ARG_name, 10525 NULL 10526 }; 10527 10528 static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked = 10529 { 10530 { 10531 -1, 10532 (gchar *) "isLocked", 10533 NULL, 10534 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers, 10535 NULL 10536 }, 10537 "handle-is-locked", 10538 FALSE 10539 }; 10540 10541 static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] = 10542 { 10543 &_shared_resource_method_info_lock, 10544 &_shared_resource_method_info_unlock, 10545 &_shared_resource_method_info_is_locked, 10546 NULL 10547 }; 10548 10549 static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock = 10550 { 10551 { 10552 -1, 10553 (gchar *) "lock", 10554 (gchar *) "b", 10555 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 10556 NULL 10557 }, 10558 "lock", 10559 FALSE 10560 }; 10561 10562 static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name = 10563 { 10564 { 10565 -1, 10566 (gchar *) "name", 10567 (gchar *) "s", 10568 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 10569 NULL 10570 }, 10571 "name", 10572 FALSE 10573 }; 10574 10575 static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] = 10576 { 10577 &_shared_resource_property_info_lock, 10578 &_shared_resource_property_info_name, 10579 NULL 10580 }; 10581 10582 static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info = 10583 { 10584 { 10585 -1, 10586 (gchar *) "org.openbmc.SharedResource", 10587 (GDBusMethodInfo **) &_shared_resource_method_info_pointers, 10588 NULL, 10589 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers, 10590 NULL 10591 }, 10592 "shared-resource", 10593 }; 10594 10595 10596 /** 10597 * shared_resource_interface_info: 10598 * 10599 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface. 10600 * 10601 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 10602 */ 10603 GDBusInterfaceInfo * 10604 shared_resource_interface_info (void) 10605 { 10606 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct; 10607 } 10608 10609 /** 10610 * shared_resource_override_properties: 10611 * @klass: The class structure for a #GObject<!-- -->-derived class. 10612 * @property_id_begin: The property id to assign to the first overridden property. 10613 * 10614 * Overrides all #GObject properties in the #SharedResource interface for a concrete class. 10615 * The properties are overridden in the order they are defined. 10616 * 10617 * Returns: The last property id. 10618 */ 10619 guint 10620 shared_resource_override_properties (GObjectClass *klass, guint property_id_begin) 10621 { 10622 g_object_class_override_property (klass, property_id_begin++, "lock"); 10623 g_object_class_override_property (klass, property_id_begin++, "name"); 10624 return property_id_begin - 1; 10625 } 10626 10627 10628 10629 /** 10630 * SharedResource: 10631 * 10632 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. 10633 */ 10634 10635 /** 10636 * SharedResourceIface: 10637 * @parent_iface: The parent interface. 10638 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal. 10639 * @handle_lock: Handler for the #SharedResource::handle-lock signal. 10640 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal. 10641 * @get_lock: Getter for the #SharedResource:lock property. 10642 * @get_name: Getter for the #SharedResource:name property. 10643 * 10644 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. 10645 */ 10646 10647 typedef SharedResourceIface SharedResourceInterface; 10648 G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT); 10649 10650 static void 10651 shared_resource_default_init (SharedResourceIface *iface) 10652 { 10653 /* GObject signals for incoming D-Bus method calls: */ 10654 /** 10655 * SharedResource::handle-lock: 10656 * @object: A #SharedResource. 10657 * @invocation: A #GDBusMethodInvocation. 10658 * @arg_name: Argument passed by remote caller. 10659 * 10660 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method. 10661 * 10662 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_lock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 10663 * 10664 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 10665 */ 10666 g_signal_new ("handle-lock", 10667 G_TYPE_FROM_INTERFACE (iface), 10668 G_SIGNAL_RUN_LAST, 10669 G_STRUCT_OFFSET (SharedResourceIface, handle_lock), 10670 g_signal_accumulator_true_handled, 10671 NULL, 10672 g_cclosure_marshal_generic, 10673 G_TYPE_BOOLEAN, 10674 2, 10675 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); 10676 10677 /** 10678 * SharedResource::handle-unlock: 10679 * @object: A #SharedResource. 10680 * @invocation: A #GDBusMethodInvocation. 10681 * 10682 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method. 10683 * 10684 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_unlock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 10685 * 10686 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 10687 */ 10688 g_signal_new ("handle-unlock", 10689 G_TYPE_FROM_INTERFACE (iface), 10690 G_SIGNAL_RUN_LAST, 10691 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock), 10692 g_signal_accumulator_true_handled, 10693 NULL, 10694 g_cclosure_marshal_generic, 10695 G_TYPE_BOOLEAN, 10696 1, 10697 G_TYPE_DBUS_METHOD_INVOCATION); 10698 10699 /** 10700 * SharedResource::handle-is-locked: 10701 * @object: A #SharedResource. 10702 * @invocation: A #GDBusMethodInvocation. 10703 * 10704 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method. 10705 * 10706 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_is_locked() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 10707 * 10708 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 10709 */ 10710 g_signal_new ("handle-is-locked", 10711 G_TYPE_FROM_INTERFACE (iface), 10712 G_SIGNAL_RUN_LAST, 10713 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked), 10714 g_signal_accumulator_true_handled, 10715 NULL, 10716 g_cclosure_marshal_generic, 10717 G_TYPE_BOOLEAN, 10718 1, 10719 G_TYPE_DBUS_METHOD_INVOCATION); 10720 10721 /* GObject properties for D-Bus properties: */ 10722 /** 10723 * SharedResource:lock: 10724 * 10725 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>. 10726 * 10727 * 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. 10728 */ 10729 g_object_interface_install_property (iface, 10730 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 10731 /** 10732 * SharedResource:name: 10733 * 10734 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>. 10735 * 10736 * 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. 10737 */ 10738 g_object_interface_install_property (iface, 10739 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 10740 } 10741 10742 /** 10743 * shared_resource_get_lock: (skip) 10744 * @object: A #SharedResource. 10745 * 10746 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property. 10747 * 10748 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 10749 * 10750 * Returns: The property value. 10751 */ 10752 gboolean 10753 shared_resource_get_lock (SharedResource *object) 10754 { 10755 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object); 10756 } 10757 10758 /** 10759 * shared_resource_set_lock: (skip) 10760 * @object: A #SharedResource. 10761 * @value: The value to set. 10762 * 10763 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value. 10764 * 10765 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 10766 */ 10767 void 10768 shared_resource_set_lock (SharedResource *object, gboolean value) 10769 { 10770 g_object_set (G_OBJECT (object), "lock", value, NULL); 10771 } 10772 10773 /** 10774 * shared_resource_get_name: (skip) 10775 * @object: A #SharedResource. 10776 * 10777 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property. 10778 * 10779 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 10780 * 10781 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use shared_resource_dup_name() if on another thread.</warning> 10782 * 10783 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 10784 */ 10785 const gchar * 10786 shared_resource_get_name (SharedResource *object) 10787 { 10788 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object); 10789 } 10790 10791 /** 10792 * shared_resource_dup_name: (skip) 10793 * @object: A #SharedResource. 10794 * 10795 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property. 10796 * 10797 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 10798 * 10799 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 10800 */ 10801 gchar * 10802 shared_resource_dup_name (SharedResource *object) 10803 { 10804 gchar *value; 10805 g_object_get (G_OBJECT (object), "name", &value, NULL); 10806 return value; 10807 } 10808 10809 /** 10810 * shared_resource_set_name: (skip) 10811 * @object: A #SharedResource. 10812 * @value: The value to set. 10813 * 10814 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value. 10815 * 10816 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 10817 */ 10818 void 10819 shared_resource_set_name (SharedResource *object, const gchar *value) 10820 { 10821 g_object_set (G_OBJECT (object), "name", value, NULL); 10822 } 10823 10824 /** 10825 * shared_resource_call_lock: 10826 * @proxy: A #SharedResourceProxy. 10827 * @arg_name: Argument to pass with the method invocation. 10828 * @cancellable: (allow-none): A #GCancellable or %NULL. 10829 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 10830 * @user_data: User data to pass to @callback. 10831 * 10832 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. 10833 * 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. 10834 * You can then call shared_resource_call_lock_finish() to get the result of the operation. 10835 * 10836 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method. 10837 */ 10838 void 10839 shared_resource_call_lock ( 10840 SharedResource *proxy, 10841 const gchar *arg_name, 10842 GCancellable *cancellable, 10843 GAsyncReadyCallback callback, 10844 gpointer user_data) 10845 { 10846 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 10847 "lock", 10848 g_variant_new ("(s)", 10849 arg_name), 10850 G_DBUS_CALL_FLAGS_NONE, 10851 -1, 10852 cancellable, 10853 callback, 10854 user_data); 10855 } 10856 10857 /** 10858 * shared_resource_call_lock_finish: 10859 * @proxy: A #SharedResourceProxy. 10860 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock(). 10861 * @error: Return location for error or %NULL. 10862 * 10863 * Finishes an operation started with shared_resource_call_lock(). 10864 * 10865 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 10866 */ 10867 gboolean 10868 shared_resource_call_lock_finish ( 10869 SharedResource *proxy, 10870 GAsyncResult *res, 10871 GError **error) 10872 { 10873 GVariant *_ret; 10874 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 10875 if (_ret == NULL) 10876 goto _out; 10877 g_variant_get (_ret, 10878 "()"); 10879 g_variant_unref (_ret); 10880 _out: 10881 return _ret != NULL; 10882 } 10883 10884 /** 10885 * shared_resource_call_lock_sync: 10886 * @proxy: A #SharedResourceProxy. 10887 * @arg_name: Argument to pass with the method invocation. 10888 * @cancellable: (allow-none): A #GCancellable or %NULL. 10889 * @error: Return location for error or %NULL. 10890 * 10891 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 10892 * 10893 * See shared_resource_call_lock() for the asynchronous version of this method. 10894 * 10895 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 10896 */ 10897 gboolean 10898 shared_resource_call_lock_sync ( 10899 SharedResource *proxy, 10900 const gchar *arg_name, 10901 GCancellable *cancellable, 10902 GError **error) 10903 { 10904 GVariant *_ret; 10905 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 10906 "lock", 10907 g_variant_new ("(s)", 10908 arg_name), 10909 G_DBUS_CALL_FLAGS_NONE, 10910 -1, 10911 cancellable, 10912 error); 10913 if (_ret == NULL) 10914 goto _out; 10915 g_variant_get (_ret, 10916 "()"); 10917 g_variant_unref (_ret); 10918 _out: 10919 return _ret != NULL; 10920 } 10921 10922 /** 10923 * shared_resource_call_unlock: 10924 * @proxy: A #SharedResourceProxy. 10925 * @cancellable: (allow-none): A #GCancellable or %NULL. 10926 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 10927 * @user_data: User data to pass to @callback. 10928 * 10929 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. 10930 * 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. 10931 * You can then call shared_resource_call_unlock_finish() to get the result of the operation. 10932 * 10933 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method. 10934 */ 10935 void 10936 shared_resource_call_unlock ( 10937 SharedResource *proxy, 10938 GCancellable *cancellable, 10939 GAsyncReadyCallback callback, 10940 gpointer user_data) 10941 { 10942 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 10943 "unlock", 10944 g_variant_new ("()"), 10945 G_DBUS_CALL_FLAGS_NONE, 10946 -1, 10947 cancellable, 10948 callback, 10949 user_data); 10950 } 10951 10952 /** 10953 * shared_resource_call_unlock_finish: 10954 * @proxy: A #SharedResourceProxy. 10955 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock(). 10956 * @error: Return location for error or %NULL. 10957 * 10958 * Finishes an operation started with shared_resource_call_unlock(). 10959 * 10960 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 10961 */ 10962 gboolean 10963 shared_resource_call_unlock_finish ( 10964 SharedResource *proxy, 10965 GAsyncResult *res, 10966 GError **error) 10967 { 10968 GVariant *_ret; 10969 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 10970 if (_ret == NULL) 10971 goto _out; 10972 g_variant_get (_ret, 10973 "()"); 10974 g_variant_unref (_ret); 10975 _out: 10976 return _ret != NULL; 10977 } 10978 10979 /** 10980 * shared_resource_call_unlock_sync: 10981 * @proxy: A #SharedResourceProxy. 10982 * @cancellable: (allow-none): A #GCancellable or %NULL. 10983 * @error: Return location for error or %NULL. 10984 * 10985 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 10986 * 10987 * See shared_resource_call_unlock() for the asynchronous version of this method. 10988 * 10989 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 10990 */ 10991 gboolean 10992 shared_resource_call_unlock_sync ( 10993 SharedResource *proxy, 10994 GCancellable *cancellable, 10995 GError **error) 10996 { 10997 GVariant *_ret; 10998 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 10999 "unlock", 11000 g_variant_new ("()"), 11001 G_DBUS_CALL_FLAGS_NONE, 11002 -1, 11003 cancellable, 11004 error); 11005 if (_ret == NULL) 11006 goto _out; 11007 g_variant_get (_ret, 11008 "()"); 11009 g_variant_unref (_ret); 11010 _out: 11011 return _ret != NULL; 11012 } 11013 11014 /** 11015 * shared_resource_call_is_locked: 11016 * @proxy: A #SharedResourceProxy. 11017 * @cancellable: (allow-none): A #GCancellable or %NULL. 11018 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 11019 * @user_data: User data to pass to @callback. 11020 * 11021 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. 11022 * 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. 11023 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation. 11024 * 11025 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method. 11026 */ 11027 void 11028 shared_resource_call_is_locked ( 11029 SharedResource *proxy, 11030 GCancellable *cancellable, 11031 GAsyncReadyCallback callback, 11032 gpointer user_data) 11033 { 11034 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 11035 "isLocked", 11036 g_variant_new ("()"), 11037 G_DBUS_CALL_FLAGS_NONE, 11038 -1, 11039 cancellable, 11040 callback, 11041 user_data); 11042 } 11043 11044 /** 11045 * shared_resource_call_is_locked_finish: 11046 * @proxy: A #SharedResourceProxy. 11047 * @out_lock: (out): Return location for return parameter or %NULL to ignore. 11048 * @out_name: (out): Return location for return parameter or %NULL to ignore. 11049 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked(). 11050 * @error: Return location for error or %NULL. 11051 * 11052 * Finishes an operation started with shared_resource_call_is_locked(). 11053 * 11054 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 11055 */ 11056 gboolean 11057 shared_resource_call_is_locked_finish ( 11058 SharedResource *proxy, 11059 gboolean *out_lock, 11060 gchar **out_name, 11061 GAsyncResult *res, 11062 GError **error) 11063 { 11064 GVariant *_ret; 11065 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 11066 if (_ret == NULL) 11067 goto _out; 11068 g_variant_get (_ret, 11069 "(bs)", 11070 out_lock, 11071 out_name); 11072 g_variant_unref (_ret); 11073 _out: 11074 return _ret != NULL; 11075 } 11076 11077 /** 11078 * shared_resource_call_is_locked_sync: 11079 * @proxy: A #SharedResourceProxy. 11080 * @out_lock: (out): Return location for return parameter or %NULL to ignore. 11081 * @out_name: (out): Return location for return parameter or %NULL to ignore. 11082 * @cancellable: (allow-none): A #GCancellable or %NULL. 11083 * @error: Return location for error or %NULL. 11084 * 11085 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 11086 * 11087 * See shared_resource_call_is_locked() for the asynchronous version of this method. 11088 * 11089 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 11090 */ 11091 gboolean 11092 shared_resource_call_is_locked_sync ( 11093 SharedResource *proxy, 11094 gboolean *out_lock, 11095 gchar **out_name, 11096 GCancellable *cancellable, 11097 GError **error) 11098 { 11099 GVariant *_ret; 11100 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 11101 "isLocked", 11102 g_variant_new ("()"), 11103 G_DBUS_CALL_FLAGS_NONE, 11104 -1, 11105 cancellable, 11106 error); 11107 if (_ret == NULL) 11108 goto _out; 11109 g_variant_get (_ret, 11110 "(bs)", 11111 out_lock, 11112 out_name); 11113 g_variant_unref (_ret); 11114 _out: 11115 return _ret != NULL; 11116 } 11117 11118 /** 11119 * shared_resource_complete_lock: 11120 * @object: A #SharedResource. 11121 * @invocation: (transfer full): A #GDBusMethodInvocation. 11122 * 11123 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 11124 * 11125 * This method will free @invocation, you cannot use it afterwards. 11126 */ 11127 void 11128 shared_resource_complete_lock ( 11129 SharedResource *object, 11130 GDBusMethodInvocation *invocation) 11131 { 11132 g_dbus_method_invocation_return_value (invocation, 11133 g_variant_new ("()")); 11134 } 11135 11136 /** 11137 * shared_resource_complete_unlock: 11138 * @object: A #SharedResource. 11139 * @invocation: (transfer full): A #GDBusMethodInvocation. 11140 * 11141 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 11142 * 11143 * This method will free @invocation, you cannot use it afterwards. 11144 */ 11145 void 11146 shared_resource_complete_unlock ( 11147 SharedResource *object, 11148 GDBusMethodInvocation *invocation) 11149 { 11150 g_dbus_method_invocation_return_value (invocation, 11151 g_variant_new ("()")); 11152 } 11153 11154 /** 11155 * shared_resource_complete_is_locked: 11156 * @object: A #SharedResource. 11157 * @invocation: (transfer full): A #GDBusMethodInvocation. 11158 * @lock: Parameter to return. 11159 * @name: Parameter to return. 11160 * 11161 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 11162 * 11163 * This method will free @invocation, you cannot use it afterwards. 11164 */ 11165 void 11166 shared_resource_complete_is_locked ( 11167 SharedResource *object, 11168 GDBusMethodInvocation *invocation, 11169 gboolean lock, 11170 const gchar *name) 11171 { 11172 g_dbus_method_invocation_return_value (invocation, 11173 g_variant_new ("(bs)", 11174 lock, 11175 name)); 11176 } 11177 11178 /* ------------------------------------------------------------------------ */ 11179 11180 /** 11181 * SharedResourceProxy: 11182 * 11183 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API. 11184 */ 11185 11186 /** 11187 * SharedResourceProxyClass: 11188 * @parent_class: The parent class. 11189 * 11190 * Class structure for #SharedResourceProxy. 11191 */ 11192 11193 struct _SharedResourceProxyPrivate 11194 { 11195 GData *qdata; 11196 }; 11197 11198 static void shared_resource_proxy_iface_init (SharedResourceIface *iface); 11199 11200 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 11201 G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY, 11202 G_ADD_PRIVATE (SharedResourceProxy) 11203 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init)); 11204 11205 #else 11206 G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY, 11207 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init)); 11208 11209 #endif 11210 static void 11211 shared_resource_proxy_finalize (GObject *object) 11212 { 11213 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); 11214 g_datalist_clear (&proxy->priv->qdata); 11215 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object); 11216 } 11217 11218 static void 11219 shared_resource_proxy_get_property (GObject *object, 11220 guint prop_id, 11221 GValue *value, 11222 GParamSpec *pspec G_GNUC_UNUSED) 11223 { 11224 const _ExtendedGDBusPropertyInfo *info; 11225 GVariant *variant; 11226 g_assert (prop_id != 0 && prop_id - 1 < 2); 11227 info = _shared_resource_property_info_pointers[prop_id - 1]; 11228 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 11229 if (info->use_gvariant) 11230 { 11231 g_value_set_variant (value, variant); 11232 } 11233 else 11234 { 11235 if (variant != NULL) 11236 g_dbus_gvariant_to_gvalue (variant, value); 11237 } 11238 if (variant != NULL) 11239 g_variant_unref (variant); 11240 } 11241 11242 static void 11243 shared_resource_proxy_set_property_cb (GDBusProxy *proxy, 11244 GAsyncResult *res, 11245 gpointer user_data) 11246 { 11247 const _ExtendedGDBusPropertyInfo *info = user_data; 11248 GError *error; 11249 GVariant *_ret; 11250 error = NULL; 11251 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 11252 if (!_ret) 11253 { 11254 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)", 11255 info->parent_struct.name, 11256 error->message, g_quark_to_string (error->domain), error->code); 11257 g_error_free (error); 11258 } 11259 else 11260 { 11261 g_variant_unref (_ret); 11262 } 11263 } 11264 11265 static void 11266 shared_resource_proxy_set_property (GObject *object, 11267 guint prop_id, 11268 const GValue *value, 11269 GParamSpec *pspec G_GNUC_UNUSED) 11270 { 11271 const _ExtendedGDBusPropertyInfo *info; 11272 GVariant *variant; 11273 g_assert (prop_id != 0 && prop_id - 1 < 2); 11274 info = _shared_resource_property_info_pointers[prop_id - 1]; 11275 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 11276 g_dbus_proxy_call (G_DBUS_PROXY (object), 11277 "org.freedesktop.DBus.Properties.Set", 11278 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant), 11279 G_DBUS_CALL_FLAGS_NONE, 11280 -1, 11281 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 11282 g_variant_unref (variant); 11283 } 11284 11285 static void 11286 shared_resource_proxy_g_signal (GDBusProxy *proxy, 11287 const gchar *sender_name G_GNUC_UNUSED, 11288 const gchar *signal_name, 11289 GVariant *parameters) 11290 { 11291 _ExtendedGDBusSignalInfo *info; 11292 GVariantIter iter; 11293 GVariant *child; 11294 GValue *paramv; 11295 guint num_params; 11296 guint n; 11297 guint signal_id; 11298 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name); 11299 if (info == NULL) 11300 return; 11301 num_params = g_variant_n_children (parameters); 11302 paramv = g_new0 (GValue, num_params + 1); 11303 g_value_init (¶mv[0], TYPE_SHARED_RESOURCE); 11304 g_value_set_object (¶mv[0], proxy); 11305 g_variant_iter_init (&iter, parameters); 11306 n = 1; 11307 while ((child = g_variant_iter_next_value (&iter)) != NULL) 11308 { 11309 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 11310 if (arg_info->use_gvariant) 11311 { 11312 g_value_init (¶mv[n], G_TYPE_VARIANT); 11313 g_value_set_variant (¶mv[n], child); 11314 n++; 11315 } 11316 else 11317 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 11318 g_variant_unref (child); 11319 } 11320 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE); 11321 g_signal_emitv (paramv, signal_id, 0, NULL); 11322 for (n = 0; n < num_params + 1; n++) 11323 g_value_unset (¶mv[n]); 11324 g_free (paramv); 11325 } 11326 11327 static void 11328 shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy, 11329 GVariant *changed_properties, 11330 const gchar *const *invalidated_properties) 11331 { 11332 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy); 11333 guint n; 11334 const gchar *key; 11335 GVariantIter *iter; 11336 _ExtendedGDBusPropertyInfo *info; 11337 g_variant_get (changed_properties, "a{sv}", &iter); 11338 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 11339 { 11340 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key); 11341 g_datalist_remove_data (&proxy->priv->qdata, key); 11342 if (info != NULL) 11343 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 11344 } 11345 g_variant_iter_free (iter); 11346 for (n = 0; invalidated_properties[n] != NULL; n++) 11347 { 11348 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]); 11349 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 11350 if (info != NULL) 11351 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 11352 } 11353 } 11354 11355 static gboolean 11356 shared_resource_proxy_get_lock (SharedResource *object) 11357 { 11358 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); 11359 GVariant *variant; 11360 gboolean value = 0; 11361 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock"); 11362 if (variant != NULL) 11363 { 11364 value = g_variant_get_boolean (variant); 11365 g_variant_unref (variant); 11366 } 11367 return value; 11368 } 11369 11370 static const gchar * 11371 shared_resource_proxy_get_name (SharedResource *object) 11372 { 11373 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object); 11374 GVariant *variant; 11375 const gchar *value = NULL; 11376 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name"); 11377 if (variant != NULL) 11378 { 11379 value = g_variant_get_string (variant, NULL); 11380 g_variant_unref (variant); 11381 } 11382 return value; 11383 } 11384 11385 static void 11386 shared_resource_proxy_init (SharedResourceProxy *proxy) 11387 { 11388 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 11389 proxy->priv = shared_resource_proxy_get_instance_private (proxy); 11390 #else 11391 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate); 11392 #endif 11393 11394 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ()); 11395 } 11396 11397 static void 11398 shared_resource_proxy_class_init (SharedResourceProxyClass *klass) 11399 { 11400 GObjectClass *gobject_class; 11401 GDBusProxyClass *proxy_class; 11402 11403 gobject_class = G_OBJECT_CLASS (klass); 11404 gobject_class->finalize = shared_resource_proxy_finalize; 11405 gobject_class->get_property = shared_resource_proxy_get_property; 11406 gobject_class->set_property = shared_resource_proxy_set_property; 11407 11408 proxy_class = G_DBUS_PROXY_CLASS (klass); 11409 proxy_class->g_signal = shared_resource_proxy_g_signal; 11410 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed; 11411 11412 shared_resource_override_properties (gobject_class, 1); 11413 11414 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 11415 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate)); 11416 #endif 11417 } 11418 11419 static void 11420 shared_resource_proxy_iface_init (SharedResourceIface *iface) 11421 { 11422 iface->get_lock = shared_resource_proxy_get_lock; 11423 iface->get_name = shared_resource_proxy_get_name; 11424 } 11425 11426 /** 11427 * shared_resource_proxy_new: 11428 * @connection: A #GDBusConnection. 11429 * @flags: Flags from the #GDBusProxyFlags enumeration. 11430 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 11431 * @object_path: An object path. 11432 * @cancellable: (allow-none): A #GCancellable or %NULL. 11433 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 11434 * @user_data: User data to pass to @callback. 11435 * 11436 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new() for more details. 11437 * 11438 * 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. 11439 * You can then call shared_resource_proxy_new_finish() to get the result of the operation. 11440 * 11441 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor. 11442 */ 11443 void 11444 shared_resource_proxy_new ( 11445 GDBusConnection *connection, 11446 GDBusProxyFlags flags, 11447 const gchar *name, 11448 const gchar *object_path, 11449 GCancellable *cancellable, 11450 GAsyncReadyCallback callback, 11451 gpointer user_data) 11452 { 11453 g_async_initable_new_async (TYPE_SHARED_RESOURCE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL); 11454 } 11455 11456 /** 11457 * shared_resource_proxy_new_finish: 11458 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new(). 11459 * @error: Return location for error or %NULL 11460 * 11461 * Finishes an operation started with shared_resource_proxy_new(). 11462 * 11463 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. 11464 */ 11465 SharedResource * 11466 shared_resource_proxy_new_finish ( 11467 GAsyncResult *res, 11468 GError **error) 11469 { 11470 GObject *ret; 11471 GObject *source_object; 11472 source_object = g_async_result_get_source_object (res); 11473 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 11474 g_object_unref (source_object); 11475 if (ret != NULL) 11476 return SHARED_RESOURCE (ret); 11477 else 11478 return NULL; 11479 } 11480 11481 /** 11482 * shared_resource_proxy_new_sync: 11483 * @connection: A #GDBusConnection. 11484 * @flags: Flags from the #GDBusProxyFlags enumeration. 11485 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 11486 * @object_path: An object path. 11487 * @cancellable: (allow-none): A #GCancellable or %NULL. 11488 * @error: Return location for error or %NULL 11489 * 11490 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new_sync() for more details. 11491 * 11492 * The calling thread is blocked until a reply is received. 11493 * 11494 * See shared_resource_proxy_new() for the asynchronous version of this constructor. 11495 * 11496 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. 11497 */ 11498 SharedResource * 11499 shared_resource_proxy_new_sync ( 11500 GDBusConnection *connection, 11501 GDBusProxyFlags flags, 11502 const gchar *name, 11503 const gchar *object_path, 11504 GCancellable *cancellable, 11505 GError **error) 11506 { 11507 GInitable *ret; 11508 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL); 11509 if (ret != NULL) 11510 return SHARED_RESOURCE (ret); 11511 else 11512 return NULL; 11513 } 11514 11515 11516 /** 11517 * shared_resource_proxy_new_for_bus: 11518 * @bus_type: A #GBusType. 11519 * @flags: Flags from the #GDBusProxyFlags enumeration. 11520 * @name: A bus name (well-known or unique). 11521 * @object_path: An object path. 11522 * @cancellable: (allow-none): A #GCancellable or %NULL. 11523 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 11524 * @user_data: User data to pass to @callback. 11525 * 11526 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 11527 * 11528 * 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. 11529 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation. 11530 * 11531 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 11532 */ 11533 void 11534 shared_resource_proxy_new_for_bus ( 11535 GBusType bus_type, 11536 GDBusProxyFlags flags, 11537 const gchar *name, 11538 const gchar *object_path, 11539 GCancellable *cancellable, 11540 GAsyncReadyCallback callback, 11541 gpointer user_data) 11542 { 11543 g_async_initable_new_async (TYPE_SHARED_RESOURCE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL); 11544 } 11545 11546 /** 11547 * shared_resource_proxy_new_for_bus_finish: 11548 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus(). 11549 * @error: Return location for error or %NULL 11550 * 11551 * Finishes an operation started with shared_resource_proxy_new_for_bus(). 11552 * 11553 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. 11554 */ 11555 SharedResource * 11556 shared_resource_proxy_new_for_bus_finish ( 11557 GAsyncResult *res, 11558 GError **error) 11559 { 11560 GObject *ret; 11561 GObject *source_object; 11562 source_object = g_async_result_get_source_object (res); 11563 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 11564 g_object_unref (source_object); 11565 if (ret != NULL) 11566 return SHARED_RESOURCE (ret); 11567 else 11568 return NULL; 11569 } 11570 11571 /** 11572 * shared_resource_proxy_new_for_bus_sync: 11573 * @bus_type: A #GBusType. 11574 * @flags: Flags from the #GDBusProxyFlags enumeration. 11575 * @name: A bus name (well-known or unique). 11576 * @object_path: An object path. 11577 * @cancellable: (allow-none): A #GCancellable or %NULL. 11578 * @error: Return location for error or %NULL 11579 * 11580 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 11581 * 11582 * The calling thread is blocked until a reply is received. 11583 * 11584 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor. 11585 * 11586 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set. 11587 */ 11588 SharedResource * 11589 shared_resource_proxy_new_for_bus_sync ( 11590 GBusType bus_type, 11591 GDBusProxyFlags flags, 11592 const gchar *name, 11593 const gchar *object_path, 11594 GCancellable *cancellable, 11595 GError **error) 11596 { 11597 GInitable *ret; 11598 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL); 11599 if (ret != NULL) 11600 return SHARED_RESOURCE (ret); 11601 else 11602 return NULL; 11603 } 11604 11605 11606 /* ------------------------------------------------------------------------ */ 11607 11608 /** 11609 * SharedResourceSkeleton: 11610 * 11611 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API. 11612 */ 11613 11614 /** 11615 * SharedResourceSkeletonClass: 11616 * @parent_class: The parent class. 11617 * 11618 * Class structure for #SharedResourceSkeleton. 11619 */ 11620 11621 struct _SharedResourceSkeletonPrivate 11622 { 11623 GValue *properties; 11624 GList *changed_properties; 11625 GSource *changed_properties_idle_source; 11626 GMainContext *context; 11627 GMutex lock; 11628 }; 11629 11630 static void 11631 _shared_resource_skeleton_handle_method_call ( 11632 GDBusConnection *connection G_GNUC_UNUSED, 11633 const gchar *sender G_GNUC_UNUSED, 11634 const gchar *object_path G_GNUC_UNUSED, 11635 const gchar *interface_name, 11636 const gchar *method_name, 11637 GVariant *parameters, 11638 GDBusMethodInvocation *invocation, 11639 gpointer user_data) 11640 { 11641 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); 11642 _ExtendedGDBusMethodInfo *info; 11643 GVariantIter iter; 11644 GVariant *child; 11645 GValue *paramv; 11646 guint num_params; 11647 guint num_extra; 11648 guint n; 11649 guint signal_id; 11650 GValue return_value = G_VALUE_INIT; 11651 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 11652 g_assert (info != NULL); 11653 num_params = g_variant_n_children (parameters); 11654 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 11655 n = 0; 11656 g_value_init (¶mv[n], TYPE_SHARED_RESOURCE); 11657 g_value_set_object (¶mv[n++], skeleton); 11658 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 11659 g_value_set_object (¶mv[n++], invocation); 11660 if (info->pass_fdlist) 11661 { 11662 #ifdef G_OS_UNIX 11663 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 11664 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 11665 #else 11666 g_assert_not_reached (); 11667 #endif 11668 } 11669 g_variant_iter_init (&iter, parameters); 11670 while ((child = g_variant_iter_next_value (&iter)) != NULL) 11671 { 11672 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 11673 if (arg_info->use_gvariant) 11674 { 11675 g_value_init (¶mv[n], G_TYPE_VARIANT); 11676 g_value_set_variant (¶mv[n], child); 11677 n++; 11678 } 11679 else 11680 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 11681 g_variant_unref (child); 11682 } 11683 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE); 11684 g_value_init (&return_value, G_TYPE_BOOLEAN); 11685 g_signal_emitv (paramv, signal_id, 0, &return_value); 11686 if (!g_value_get_boolean (&return_value)) 11687 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); 11688 g_value_unset (&return_value); 11689 for (n = 0; n < num_params + num_extra; n++) 11690 g_value_unset (¶mv[n]); 11691 g_free (paramv); 11692 } 11693 11694 static GVariant * 11695 _shared_resource_skeleton_handle_get_property ( 11696 GDBusConnection *connection G_GNUC_UNUSED, 11697 const gchar *sender G_GNUC_UNUSED, 11698 const gchar *object_path G_GNUC_UNUSED, 11699 const gchar *interface_name G_GNUC_UNUSED, 11700 const gchar *property_name, 11701 GError **error, 11702 gpointer user_data) 11703 { 11704 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); 11705 GValue value = G_VALUE_INIT; 11706 GParamSpec *pspec; 11707 _ExtendedGDBusPropertyInfo *info; 11708 GVariant *ret; 11709 ret = NULL; 11710 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name); 11711 g_assert (info != NULL); 11712 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 11713 if (pspec == NULL) 11714 { 11715 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 11716 } 11717 else 11718 { 11719 g_value_init (&value, pspec->value_type); 11720 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 11721 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 11722 g_value_unset (&value); 11723 } 11724 return ret; 11725 } 11726 11727 static gboolean 11728 _shared_resource_skeleton_handle_set_property ( 11729 GDBusConnection *connection G_GNUC_UNUSED, 11730 const gchar *sender G_GNUC_UNUSED, 11731 const gchar *object_path G_GNUC_UNUSED, 11732 const gchar *interface_name G_GNUC_UNUSED, 11733 const gchar *property_name, 11734 GVariant *variant, 11735 GError **error, 11736 gpointer user_data) 11737 { 11738 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); 11739 GValue value = G_VALUE_INIT; 11740 GParamSpec *pspec; 11741 _ExtendedGDBusPropertyInfo *info; 11742 gboolean ret; 11743 ret = FALSE; 11744 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name); 11745 g_assert (info != NULL); 11746 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 11747 if (pspec == NULL) 11748 { 11749 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 11750 } 11751 else 11752 { 11753 if (info->use_gvariant) 11754 g_value_set_variant (&value, variant); 11755 else 11756 g_dbus_gvariant_to_gvalue (variant, &value); 11757 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 11758 g_value_unset (&value); 11759 ret = TRUE; 11760 } 11761 return ret; 11762 } 11763 11764 static const GDBusInterfaceVTable _shared_resource_skeleton_vtable = 11765 { 11766 _shared_resource_skeleton_handle_method_call, 11767 _shared_resource_skeleton_handle_get_property, 11768 _shared_resource_skeleton_handle_set_property, 11769 {NULL} 11770 }; 11771 11772 static GDBusInterfaceInfo * 11773 shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 11774 { 11775 return shared_resource_interface_info (); 11776 } 11777 11778 static GDBusInterfaceVTable * 11779 shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 11780 { 11781 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable; 11782 } 11783 11784 static GVariant * 11785 shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 11786 { 11787 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton); 11788 11789 GVariantBuilder builder; 11790 guint n; 11791 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 11792 if (_shared_resource_interface_info.parent_struct.properties == NULL) 11793 goto out; 11794 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++) 11795 { 11796 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n]; 11797 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 11798 { 11799 GVariant *value; 11800 value = _shared_resource_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SharedResource", info->name, NULL, skeleton); 11801 if (value != NULL) 11802 { 11803 g_variant_take_ref (value); 11804 g_variant_builder_add (&builder, "{sv}", info->name, value); 11805 g_variant_unref (value); 11806 } 11807 } 11808 } 11809 out: 11810 return g_variant_builder_end (&builder); 11811 } 11812 11813 static gboolean _shared_resource_emit_changed (gpointer user_data); 11814 11815 static void 11816 shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 11817 { 11818 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton); 11819 gboolean emit_changed = FALSE; 11820 11821 g_mutex_lock (&skeleton->priv->lock); 11822 if (skeleton->priv->changed_properties_idle_source != NULL) 11823 { 11824 g_source_destroy (skeleton->priv->changed_properties_idle_source); 11825 skeleton->priv->changed_properties_idle_source = NULL; 11826 emit_changed = TRUE; 11827 } 11828 g_mutex_unlock (&skeleton->priv->lock); 11829 11830 if (emit_changed) 11831 _shared_resource_emit_changed (skeleton); 11832 } 11833 11834 static void shared_resource_skeleton_iface_init (SharedResourceIface *iface); 11835 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 11836 G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 11837 G_ADD_PRIVATE (SharedResourceSkeleton) 11838 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init)); 11839 11840 #else 11841 G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 11842 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init)); 11843 11844 #endif 11845 static void 11846 shared_resource_skeleton_finalize (GObject *object) 11847 { 11848 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); 11849 guint n; 11850 for (n = 0; n < 2; n++) 11851 g_value_unset (&skeleton->priv->properties[n]); 11852 g_free (skeleton->priv->properties); 11853 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 11854 if (skeleton->priv->changed_properties_idle_source != NULL) 11855 g_source_destroy (skeleton->priv->changed_properties_idle_source); 11856 g_main_context_unref (skeleton->priv->context); 11857 g_mutex_clear (&skeleton->priv->lock); 11858 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object); 11859 } 11860 11861 static void 11862 shared_resource_skeleton_get_property (GObject *object, 11863 guint prop_id, 11864 GValue *value, 11865 GParamSpec *pspec G_GNUC_UNUSED) 11866 { 11867 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); 11868 g_assert (prop_id != 0 && prop_id - 1 < 2); 11869 g_mutex_lock (&skeleton->priv->lock); 11870 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 11871 g_mutex_unlock (&skeleton->priv->lock); 11872 } 11873 11874 static gboolean 11875 _shared_resource_emit_changed (gpointer user_data) 11876 { 11877 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data); 11878 GList *l; 11879 GVariantBuilder builder; 11880 GVariantBuilder invalidated_builder; 11881 guint num_changes; 11882 11883 g_mutex_lock (&skeleton->priv->lock); 11884 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 11885 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 11886 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 11887 { 11888 ChangedProperty *cp = l->data; 11889 GVariant *variant; 11890 const GValue *cur_value; 11891 11892 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 11893 if (!_g_value_equal (cur_value, &cp->orig_value)) 11894 { 11895 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 11896 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 11897 g_variant_unref (variant); 11898 num_changes++; 11899 } 11900 } 11901 if (num_changes > 0) 11902 { 11903 GList *connections, *ll; 11904 GVariant *signal_variant; 11905 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource", 11906 &builder, &invalidated_builder)); 11907 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 11908 for (ll = connections; ll != NULL; ll = ll->next) 11909 { 11910 GDBusConnection *connection = ll->data; 11911 11912 g_dbus_connection_emit_signal (connection, 11913 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 11914 "org.freedesktop.DBus.Properties", 11915 "PropertiesChanged", 11916 signal_variant, 11917 NULL); 11918 } 11919 g_variant_unref (signal_variant); 11920 g_list_free_full (connections, g_object_unref); 11921 } 11922 else 11923 { 11924 g_variant_builder_clear (&builder); 11925 g_variant_builder_clear (&invalidated_builder); 11926 } 11927 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 11928 skeleton->priv->changed_properties = NULL; 11929 skeleton->priv->changed_properties_idle_source = NULL; 11930 g_mutex_unlock (&skeleton->priv->lock); 11931 return FALSE; 11932 } 11933 11934 static void 11935 _shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 11936 { 11937 ChangedProperty *cp; 11938 GList *l; 11939 cp = NULL; 11940 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 11941 { 11942 ChangedProperty *i_cp = l->data; 11943 if (i_cp->info == info) 11944 { 11945 cp = i_cp; 11946 break; 11947 } 11948 } 11949 if (cp == NULL) 11950 { 11951 cp = g_new0 (ChangedProperty, 1); 11952 cp->prop_id = prop_id; 11953 cp->info = info; 11954 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 11955 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 11956 g_value_copy (orig_value, &cp->orig_value); 11957 } 11958 } 11959 11960 static void 11961 shared_resource_skeleton_notify (GObject *object, 11962 GParamSpec *pspec G_GNUC_UNUSED) 11963 { 11964 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); 11965 g_mutex_lock (&skeleton->priv->lock); 11966 if (skeleton->priv->changed_properties != NULL && 11967 skeleton->priv->changed_properties_idle_source == NULL) 11968 { 11969 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 11970 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 11971 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 11972 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _shared_resource_emit_changed"); 11973 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 11974 g_source_unref (skeleton->priv->changed_properties_idle_source); 11975 } 11976 g_mutex_unlock (&skeleton->priv->lock); 11977 } 11978 11979 static void 11980 shared_resource_skeleton_set_property (GObject *object, 11981 guint prop_id, 11982 const GValue *value, 11983 GParamSpec *pspec) 11984 { 11985 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); 11986 g_assert (prop_id != 0 && prop_id - 1 < 2); 11987 g_mutex_lock (&skeleton->priv->lock); 11988 g_object_freeze_notify (object); 11989 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 11990 { 11991 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 11992 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 11993 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 11994 g_object_notify_by_pspec (object, pspec); 11995 } 11996 g_mutex_unlock (&skeleton->priv->lock); 11997 g_object_thaw_notify (object); 11998 } 11999 12000 static void 12001 shared_resource_skeleton_init (SharedResourceSkeleton *skeleton) 12002 { 12003 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 12004 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton); 12005 #else 12006 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate); 12007 #endif 12008 12009 g_mutex_init (&skeleton->priv->lock); 12010 skeleton->priv->context = g_main_context_ref_thread_default (); 12011 skeleton->priv->properties = g_new0 (GValue, 2); 12012 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); 12013 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); 12014 } 12015 12016 static gboolean 12017 shared_resource_skeleton_get_lock (SharedResource *object) 12018 { 12019 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); 12020 gboolean value; 12021 g_mutex_lock (&skeleton->priv->lock); 12022 value = g_value_get_boolean (&(skeleton->priv->properties[0])); 12023 g_mutex_unlock (&skeleton->priv->lock); 12024 return value; 12025 } 12026 12027 static const gchar * 12028 shared_resource_skeleton_get_name (SharedResource *object) 12029 { 12030 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object); 12031 const gchar *value; 12032 g_mutex_lock (&skeleton->priv->lock); 12033 value = g_value_get_string (&(skeleton->priv->properties[1])); 12034 g_mutex_unlock (&skeleton->priv->lock); 12035 return value; 12036 } 12037 12038 static void 12039 shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass) 12040 { 12041 GObjectClass *gobject_class; 12042 GDBusInterfaceSkeletonClass *skeleton_class; 12043 12044 gobject_class = G_OBJECT_CLASS (klass); 12045 gobject_class->finalize = shared_resource_skeleton_finalize; 12046 gobject_class->get_property = shared_resource_skeleton_get_property; 12047 gobject_class->set_property = shared_resource_skeleton_set_property; 12048 gobject_class->notify = shared_resource_skeleton_notify; 12049 12050 12051 shared_resource_override_properties (gobject_class, 1); 12052 12053 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 12054 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info; 12055 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties; 12056 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush; 12057 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable; 12058 12059 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 12060 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate)); 12061 #endif 12062 } 12063 12064 static void 12065 shared_resource_skeleton_iface_init (SharedResourceIface *iface) 12066 { 12067 iface->get_lock = shared_resource_skeleton_get_lock; 12068 iface->get_name = shared_resource_skeleton_get_name; 12069 } 12070 12071 /** 12072 * shared_resource_skeleton_new: 12073 * 12074 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. 12075 * 12076 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object. 12077 */ 12078 SharedResource * 12079 shared_resource_skeleton_new (void) 12080 { 12081 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL)); 12082 } 12083 12084 /* ------------------------------------------------------------------------ 12085 * Code for interface org.openbmc.Control 12086 * ------------------------------------------------------------------------ 12087 */ 12088 12089 /** 12090 * SECTION:Control 12091 * @title: Control 12092 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface 12093 * 12094 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface in C. 12095 */ 12096 12097 /* ---- Introspection data for org.openbmc.Control ---- */ 12098 12099 static const _ExtendedGDBusMethodInfo _control_method_info_init = 12100 { 12101 { 12102 -1, 12103 (gchar *) "init", 12104 NULL, 12105 NULL, 12106 NULL 12107 }, 12108 "handle-init", 12109 FALSE 12110 }; 12111 12112 static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] = 12113 { 12114 &_control_method_info_init, 12115 NULL 12116 }; 12117 12118 static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name = 12119 { 12120 { 12121 -1, 12122 (gchar *) "bus_name", 12123 (gchar *) "s", 12124 NULL 12125 }, 12126 FALSE 12127 }; 12128 12129 static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] = 12130 { 12131 &_control_signal_info_heartbeat_ARG_bus_name, 12132 NULL 12133 }; 12134 12135 static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat = 12136 { 12137 { 12138 -1, 12139 (gchar *) "Heartbeat", 12140 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers, 12141 NULL 12142 }, 12143 "heartbeat" 12144 }; 12145 12146 static const _ExtendedGDBusSignalInfo _control_signal_info_started = 12147 { 12148 { 12149 -1, 12150 (gchar *) "Started", 12151 NULL, 12152 NULL 12153 }, 12154 "started" 12155 }; 12156 12157 static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] = 12158 { 12159 &_control_signal_info_heartbeat, 12160 &_control_signal_info_started, 12161 NULL 12162 }; 12163 12164 static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval = 12165 { 12166 { 12167 -1, 12168 (gchar *) "poll_interval", 12169 (gchar *) "i", 12170 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 12171 NULL 12172 }, 12173 "poll-interval", 12174 FALSE 12175 }; 12176 12177 static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat = 12178 { 12179 { 12180 -1, 12181 (gchar *) "heatbeat", 12182 (gchar *) "i", 12183 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 12184 NULL 12185 }, 12186 "heatbeat", 12187 FALSE 12188 }; 12189 12190 static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] = 12191 { 12192 &_control_property_info_poll_interval, 12193 &_control_property_info_heatbeat, 12194 NULL 12195 }; 12196 12197 static const _ExtendedGDBusInterfaceInfo _control_interface_info = 12198 { 12199 { 12200 -1, 12201 (gchar *) "org.openbmc.Control", 12202 (GDBusMethodInfo **) &_control_method_info_pointers, 12203 (GDBusSignalInfo **) &_control_signal_info_pointers, 12204 (GDBusPropertyInfo **) &_control_property_info_pointers, 12205 NULL 12206 }, 12207 "control", 12208 }; 12209 12210 12211 /** 12212 * control_interface_info: 12213 * 12214 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface. 12215 * 12216 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 12217 */ 12218 GDBusInterfaceInfo * 12219 control_interface_info (void) 12220 { 12221 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct; 12222 } 12223 12224 /** 12225 * control_override_properties: 12226 * @klass: The class structure for a #GObject<!-- -->-derived class. 12227 * @property_id_begin: The property id to assign to the first overridden property. 12228 * 12229 * Overrides all #GObject properties in the #Control interface for a concrete class. 12230 * The properties are overridden in the order they are defined. 12231 * 12232 * Returns: The last property id. 12233 */ 12234 guint 12235 control_override_properties (GObjectClass *klass, guint property_id_begin) 12236 { 12237 g_object_class_override_property (klass, property_id_begin++, "poll-interval"); 12238 g_object_class_override_property (klass, property_id_begin++, "heatbeat"); 12239 return property_id_begin - 1; 12240 } 12241 12242 12243 12244 /** 12245 * Control: 12246 * 12247 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. 12248 */ 12249 12250 /** 12251 * ControlIface: 12252 * @parent_iface: The parent interface. 12253 * @handle_init: Handler for the #Control::handle-init signal. 12254 * @get_heatbeat: Getter for the #Control:heatbeat property. 12255 * @get_poll_interval: Getter for the #Control:poll-interval property. 12256 * @heartbeat: Handler for the #Control::heartbeat signal. 12257 * @started: Handler for the #Control::started signal. 12258 * 12259 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. 12260 */ 12261 12262 typedef ControlIface ControlInterface; 12263 G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT); 12264 12265 static void 12266 control_default_init (ControlIface *iface) 12267 { 12268 /* GObject signals for incoming D-Bus method calls: */ 12269 /** 12270 * Control::handle-init: 12271 * @object: A #Control. 12272 * @invocation: A #GDBusMethodInvocation. 12273 * 12274 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. 12275 * 12276 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 12277 * 12278 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 12279 */ 12280 g_signal_new ("handle-init", 12281 G_TYPE_FROM_INTERFACE (iface), 12282 G_SIGNAL_RUN_LAST, 12283 G_STRUCT_OFFSET (ControlIface, handle_init), 12284 g_signal_accumulator_true_handled, 12285 NULL, 12286 g_cclosure_marshal_generic, 12287 G_TYPE_BOOLEAN, 12288 1, 12289 G_TYPE_DBUS_METHOD_INVOCATION); 12290 12291 /* GObject signals for received D-Bus signals: */ 12292 /** 12293 * Control::heartbeat: 12294 * @object: A #Control. 12295 * @arg_bus_name: Argument. 12296 * 12297 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> is received. 12298 * 12299 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 12300 */ 12301 g_signal_new ("heartbeat", 12302 G_TYPE_FROM_INTERFACE (iface), 12303 G_SIGNAL_RUN_LAST, 12304 G_STRUCT_OFFSET (ControlIface, heartbeat), 12305 NULL, 12306 NULL, 12307 g_cclosure_marshal_generic, 12308 G_TYPE_NONE, 12309 1, G_TYPE_STRING); 12310 12311 /** 12312 * Control::started: 12313 * @object: A #Control. 12314 * 12315 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> is received. 12316 * 12317 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 12318 */ 12319 g_signal_new ("started", 12320 G_TYPE_FROM_INTERFACE (iface), 12321 G_SIGNAL_RUN_LAST, 12322 G_STRUCT_OFFSET (ControlIface, started), 12323 NULL, 12324 NULL, 12325 g_cclosure_marshal_generic, 12326 G_TYPE_NONE, 12327 0); 12328 12329 /* GObject properties for D-Bus properties: */ 12330 /** 12331 * Control:poll-interval: 12332 * 12333 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>. 12334 * 12335 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 12336 */ 12337 g_object_interface_install_property (iface, 12338 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 12339 /** 12340 * Control:heatbeat: 12341 * 12342 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>. 12343 * 12344 * 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. 12345 */ 12346 g_object_interface_install_property (iface, 12347 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 12348 } 12349 12350 /** 12351 * control_get_poll_interval: (skip) 12352 * @object: A #Control. 12353 * 12354 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property. 12355 * 12356 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 12357 * 12358 * Returns: The property value. 12359 */ 12360 gint 12361 control_get_poll_interval (Control *object) 12362 { 12363 return CONTROL_GET_IFACE (object)->get_poll_interval (object); 12364 } 12365 12366 /** 12367 * control_set_poll_interval: (skip) 12368 * @object: A #Control. 12369 * @value: The value to set. 12370 * 12371 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value. 12372 * 12373 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 12374 */ 12375 void 12376 control_set_poll_interval (Control *object, gint value) 12377 { 12378 g_object_set (G_OBJECT (object), "poll-interval", value, NULL); 12379 } 12380 12381 /** 12382 * control_get_heatbeat: (skip) 12383 * @object: A #Control. 12384 * 12385 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property. 12386 * 12387 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 12388 * 12389 * Returns: The property value. 12390 */ 12391 gint 12392 control_get_heatbeat (Control *object) 12393 { 12394 return CONTROL_GET_IFACE (object)->get_heatbeat (object); 12395 } 12396 12397 /** 12398 * control_set_heatbeat: (skip) 12399 * @object: A #Control. 12400 * @value: The value to set. 12401 * 12402 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value. 12403 * 12404 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 12405 */ 12406 void 12407 control_set_heatbeat (Control *object, gint value) 12408 { 12409 g_object_set (G_OBJECT (object), "heatbeat", value, NULL); 12410 } 12411 12412 /** 12413 * control_emit_heartbeat: 12414 * @object: A #Control. 12415 * @arg_bus_name: Argument to pass with the signal. 12416 * 12417 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal. 12418 */ 12419 void 12420 control_emit_heartbeat ( 12421 Control *object, 12422 const gchar *arg_bus_name) 12423 { 12424 g_signal_emit_by_name (object, "heartbeat", arg_bus_name); 12425 } 12426 12427 /** 12428 * control_emit_started: 12429 * @object: A #Control. 12430 * 12431 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal. 12432 */ 12433 void 12434 control_emit_started ( 12435 Control *object) 12436 { 12437 g_signal_emit_by_name (object, "started"); 12438 } 12439 12440 /** 12441 * control_call_init: 12442 * @proxy: A #ControlProxy. 12443 * @cancellable: (allow-none): A #GCancellable or %NULL. 12444 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 12445 * @user_data: User data to pass to @callback. 12446 * 12447 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. 12448 * 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. 12449 * You can then call control_call_init_finish() to get the result of the operation. 12450 * 12451 * See control_call_init_sync() for the synchronous, blocking version of this method. 12452 */ 12453 void 12454 control_call_init ( 12455 Control *proxy, 12456 GCancellable *cancellable, 12457 GAsyncReadyCallback callback, 12458 gpointer user_data) 12459 { 12460 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 12461 "init", 12462 g_variant_new ("()"), 12463 G_DBUS_CALL_FLAGS_NONE, 12464 -1, 12465 cancellable, 12466 callback, 12467 user_data); 12468 } 12469 12470 /** 12471 * control_call_init_finish: 12472 * @proxy: A #ControlProxy. 12473 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init(). 12474 * @error: Return location for error or %NULL. 12475 * 12476 * Finishes an operation started with control_call_init(). 12477 * 12478 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 12479 */ 12480 gboolean 12481 control_call_init_finish ( 12482 Control *proxy, 12483 GAsyncResult *res, 12484 GError **error) 12485 { 12486 GVariant *_ret; 12487 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 12488 if (_ret == NULL) 12489 goto _out; 12490 g_variant_get (_ret, 12491 "()"); 12492 g_variant_unref (_ret); 12493 _out: 12494 return _ret != NULL; 12495 } 12496 12497 /** 12498 * control_call_init_sync: 12499 * @proxy: A #ControlProxy. 12500 * @cancellable: (allow-none): A #GCancellable or %NULL. 12501 * @error: Return location for error or %NULL. 12502 * 12503 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 12504 * 12505 * See control_call_init() for the asynchronous version of this method. 12506 * 12507 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 12508 */ 12509 gboolean 12510 control_call_init_sync ( 12511 Control *proxy, 12512 GCancellable *cancellable, 12513 GError **error) 12514 { 12515 GVariant *_ret; 12516 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 12517 "init", 12518 g_variant_new ("()"), 12519 G_DBUS_CALL_FLAGS_NONE, 12520 -1, 12521 cancellable, 12522 error); 12523 if (_ret == NULL) 12524 goto _out; 12525 g_variant_get (_ret, 12526 "()"); 12527 g_variant_unref (_ret); 12528 _out: 12529 return _ret != NULL; 12530 } 12531 12532 /** 12533 * control_complete_init: 12534 * @object: A #Control. 12535 * @invocation: (transfer full): A #GDBusMethodInvocation. 12536 * 12537 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 12538 * 12539 * This method will free @invocation, you cannot use it afterwards. 12540 */ 12541 void 12542 control_complete_init ( 12543 Control *object, 12544 GDBusMethodInvocation *invocation) 12545 { 12546 g_dbus_method_invocation_return_value (invocation, 12547 g_variant_new ("()")); 12548 } 12549 12550 /* ------------------------------------------------------------------------ */ 12551 12552 /** 12553 * ControlProxy: 12554 * 12555 * The #ControlProxy structure contains only private data and should only be accessed using the provided API. 12556 */ 12557 12558 /** 12559 * ControlProxyClass: 12560 * @parent_class: The parent class. 12561 * 12562 * Class structure for #ControlProxy. 12563 */ 12564 12565 struct _ControlProxyPrivate 12566 { 12567 GData *qdata; 12568 }; 12569 12570 static void control_proxy_iface_init (ControlIface *iface); 12571 12572 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 12573 G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, 12574 G_ADD_PRIVATE (ControlProxy) 12575 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); 12576 12577 #else 12578 G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY, 12579 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init)); 12580 12581 #endif 12582 static void 12583 control_proxy_finalize (GObject *object) 12584 { 12585 ControlProxy *proxy = CONTROL_PROXY (object); 12586 g_datalist_clear (&proxy->priv->qdata); 12587 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object); 12588 } 12589 12590 static void 12591 control_proxy_get_property (GObject *object, 12592 guint prop_id, 12593 GValue *value, 12594 GParamSpec *pspec G_GNUC_UNUSED) 12595 { 12596 const _ExtendedGDBusPropertyInfo *info; 12597 GVariant *variant; 12598 g_assert (prop_id != 0 && prop_id - 1 < 2); 12599 info = _control_property_info_pointers[prop_id - 1]; 12600 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 12601 if (info->use_gvariant) 12602 { 12603 g_value_set_variant (value, variant); 12604 } 12605 else 12606 { 12607 if (variant != NULL) 12608 g_dbus_gvariant_to_gvalue (variant, value); 12609 } 12610 if (variant != NULL) 12611 g_variant_unref (variant); 12612 } 12613 12614 static void 12615 control_proxy_set_property_cb (GDBusProxy *proxy, 12616 GAsyncResult *res, 12617 gpointer user_data) 12618 { 12619 const _ExtendedGDBusPropertyInfo *info = user_data; 12620 GError *error; 12621 GVariant *_ret; 12622 error = NULL; 12623 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 12624 if (!_ret) 12625 { 12626 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)", 12627 info->parent_struct.name, 12628 error->message, g_quark_to_string (error->domain), error->code); 12629 g_error_free (error); 12630 } 12631 else 12632 { 12633 g_variant_unref (_ret); 12634 } 12635 } 12636 12637 static void 12638 control_proxy_set_property (GObject *object, 12639 guint prop_id, 12640 const GValue *value, 12641 GParamSpec *pspec G_GNUC_UNUSED) 12642 { 12643 const _ExtendedGDBusPropertyInfo *info; 12644 GVariant *variant; 12645 g_assert (prop_id != 0 && prop_id - 1 < 2); 12646 info = _control_property_info_pointers[prop_id - 1]; 12647 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 12648 g_dbus_proxy_call (G_DBUS_PROXY (object), 12649 "org.freedesktop.DBus.Properties.Set", 12650 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant), 12651 G_DBUS_CALL_FLAGS_NONE, 12652 -1, 12653 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 12654 g_variant_unref (variant); 12655 } 12656 12657 static void 12658 control_proxy_g_signal (GDBusProxy *proxy, 12659 const gchar *sender_name G_GNUC_UNUSED, 12660 const gchar *signal_name, 12661 GVariant *parameters) 12662 { 12663 _ExtendedGDBusSignalInfo *info; 12664 GVariantIter iter; 12665 GVariant *child; 12666 GValue *paramv; 12667 guint num_params; 12668 guint n; 12669 guint signal_id; 12670 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name); 12671 if (info == NULL) 12672 return; 12673 num_params = g_variant_n_children (parameters); 12674 paramv = g_new0 (GValue, num_params + 1); 12675 g_value_init (¶mv[0], TYPE_CONTROL); 12676 g_value_set_object (¶mv[0], proxy); 12677 g_variant_iter_init (&iter, parameters); 12678 n = 1; 12679 while ((child = g_variant_iter_next_value (&iter)) != NULL) 12680 { 12681 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 12682 if (arg_info->use_gvariant) 12683 { 12684 g_value_init (¶mv[n], G_TYPE_VARIANT); 12685 g_value_set_variant (¶mv[n], child); 12686 n++; 12687 } 12688 else 12689 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 12690 g_variant_unref (child); 12691 } 12692 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); 12693 g_signal_emitv (paramv, signal_id, 0, NULL); 12694 for (n = 0; n < num_params + 1; n++) 12695 g_value_unset (¶mv[n]); 12696 g_free (paramv); 12697 } 12698 12699 static void 12700 control_proxy_g_properties_changed (GDBusProxy *_proxy, 12701 GVariant *changed_properties, 12702 const gchar *const *invalidated_properties) 12703 { 12704 ControlProxy *proxy = CONTROL_PROXY (_proxy); 12705 guint n; 12706 const gchar *key; 12707 GVariantIter *iter; 12708 _ExtendedGDBusPropertyInfo *info; 12709 g_variant_get (changed_properties, "a{sv}", &iter); 12710 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 12711 { 12712 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key); 12713 g_datalist_remove_data (&proxy->priv->qdata, key); 12714 if (info != NULL) 12715 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 12716 } 12717 g_variant_iter_free (iter); 12718 for (n = 0; invalidated_properties[n] != NULL; n++) 12719 { 12720 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]); 12721 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 12722 if (info != NULL) 12723 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 12724 } 12725 } 12726 12727 static gint 12728 control_proxy_get_poll_interval (Control *object) 12729 { 12730 ControlProxy *proxy = CONTROL_PROXY (object); 12731 GVariant *variant; 12732 gint value = 0; 12733 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); 12734 if (variant != NULL) 12735 { 12736 value = g_variant_get_int32 (variant); 12737 g_variant_unref (variant); 12738 } 12739 return value; 12740 } 12741 12742 static gint 12743 control_proxy_get_heatbeat (Control *object) 12744 { 12745 ControlProxy *proxy = CONTROL_PROXY (object); 12746 GVariant *variant; 12747 gint value = 0; 12748 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat"); 12749 if (variant != NULL) 12750 { 12751 value = g_variant_get_int32 (variant); 12752 g_variant_unref (variant); 12753 } 12754 return value; 12755 } 12756 12757 static void 12758 control_proxy_init (ControlProxy *proxy) 12759 { 12760 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 12761 proxy->priv = control_proxy_get_instance_private (proxy); 12762 #else 12763 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate); 12764 #endif 12765 12766 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ()); 12767 } 12768 12769 static void 12770 control_proxy_class_init (ControlProxyClass *klass) 12771 { 12772 GObjectClass *gobject_class; 12773 GDBusProxyClass *proxy_class; 12774 12775 gobject_class = G_OBJECT_CLASS (klass); 12776 gobject_class->finalize = control_proxy_finalize; 12777 gobject_class->get_property = control_proxy_get_property; 12778 gobject_class->set_property = control_proxy_set_property; 12779 12780 proxy_class = G_DBUS_PROXY_CLASS (klass); 12781 proxy_class->g_signal = control_proxy_g_signal; 12782 proxy_class->g_properties_changed = control_proxy_g_properties_changed; 12783 12784 control_override_properties (gobject_class, 1); 12785 12786 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 12787 g_type_class_add_private (klass, sizeof (ControlProxyPrivate)); 12788 #endif 12789 } 12790 12791 static void 12792 control_proxy_iface_init (ControlIface *iface) 12793 { 12794 iface->get_poll_interval = control_proxy_get_poll_interval; 12795 iface->get_heatbeat = control_proxy_get_heatbeat; 12796 } 12797 12798 /** 12799 * control_proxy_new: 12800 * @connection: A #GDBusConnection. 12801 * @flags: Flags from the #GDBusProxyFlags enumeration. 12802 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 12803 * @object_path: An object path. 12804 * @cancellable: (allow-none): A #GCancellable or %NULL. 12805 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 12806 * @user_data: User data to pass to @callback. 12807 * 12808 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new() for more details. 12809 * 12810 * 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. 12811 * You can then call control_proxy_new_finish() to get the result of the operation. 12812 * 12813 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor. 12814 */ 12815 void 12816 control_proxy_new ( 12817 GDBusConnection *connection, 12818 GDBusProxyFlags flags, 12819 const gchar *name, 12820 const gchar *object_path, 12821 GCancellable *cancellable, 12822 GAsyncReadyCallback callback, 12823 gpointer user_data) 12824 { 12825 g_async_initable_new_async (TYPE_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL); 12826 } 12827 12828 /** 12829 * control_proxy_new_finish: 12830 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new(). 12831 * @error: Return location for error or %NULL 12832 * 12833 * Finishes an operation started with control_proxy_new(). 12834 * 12835 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. 12836 */ 12837 Control * 12838 control_proxy_new_finish ( 12839 GAsyncResult *res, 12840 GError **error) 12841 { 12842 GObject *ret; 12843 GObject *source_object; 12844 source_object = g_async_result_get_source_object (res); 12845 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 12846 g_object_unref (source_object); 12847 if (ret != NULL) 12848 return CONTROL (ret); 12849 else 12850 return NULL; 12851 } 12852 12853 /** 12854 * control_proxy_new_sync: 12855 * @connection: A #GDBusConnection. 12856 * @flags: Flags from the #GDBusProxyFlags enumeration. 12857 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 12858 * @object_path: An object path. 12859 * @cancellable: (allow-none): A #GCancellable or %NULL. 12860 * @error: Return location for error or %NULL 12861 * 12862 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new_sync() for more details. 12863 * 12864 * The calling thread is blocked until a reply is received. 12865 * 12866 * See control_proxy_new() for the asynchronous version of this constructor. 12867 * 12868 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. 12869 */ 12870 Control * 12871 control_proxy_new_sync ( 12872 GDBusConnection *connection, 12873 GDBusProxyFlags flags, 12874 const gchar *name, 12875 const gchar *object_path, 12876 GCancellable *cancellable, 12877 GError **error) 12878 { 12879 GInitable *ret; 12880 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL); 12881 if (ret != NULL) 12882 return CONTROL (ret); 12883 else 12884 return NULL; 12885 } 12886 12887 12888 /** 12889 * control_proxy_new_for_bus: 12890 * @bus_type: A #GBusType. 12891 * @flags: Flags from the #GDBusProxyFlags enumeration. 12892 * @name: A bus name (well-known or unique). 12893 * @object_path: An object path. 12894 * @cancellable: (allow-none): A #GCancellable or %NULL. 12895 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 12896 * @user_data: User data to pass to @callback. 12897 * 12898 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 12899 * 12900 * 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. 12901 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation. 12902 * 12903 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 12904 */ 12905 void 12906 control_proxy_new_for_bus ( 12907 GBusType bus_type, 12908 GDBusProxyFlags flags, 12909 const gchar *name, 12910 const gchar *object_path, 12911 GCancellable *cancellable, 12912 GAsyncReadyCallback callback, 12913 gpointer user_data) 12914 { 12915 g_async_initable_new_async (TYPE_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL); 12916 } 12917 12918 /** 12919 * control_proxy_new_for_bus_finish: 12920 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus(). 12921 * @error: Return location for error or %NULL 12922 * 12923 * Finishes an operation started with control_proxy_new_for_bus(). 12924 * 12925 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. 12926 */ 12927 Control * 12928 control_proxy_new_for_bus_finish ( 12929 GAsyncResult *res, 12930 GError **error) 12931 { 12932 GObject *ret; 12933 GObject *source_object; 12934 source_object = g_async_result_get_source_object (res); 12935 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 12936 g_object_unref (source_object); 12937 if (ret != NULL) 12938 return CONTROL (ret); 12939 else 12940 return NULL; 12941 } 12942 12943 /** 12944 * control_proxy_new_for_bus_sync: 12945 * @bus_type: A #GBusType. 12946 * @flags: Flags from the #GDBusProxyFlags enumeration. 12947 * @name: A bus name (well-known or unique). 12948 * @object_path: An object path. 12949 * @cancellable: (allow-none): A #GCancellable or %NULL. 12950 * @error: Return location for error or %NULL 12951 * 12952 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 12953 * 12954 * The calling thread is blocked until a reply is received. 12955 * 12956 * See control_proxy_new_for_bus() for the asynchronous version of this constructor. 12957 * 12958 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set. 12959 */ 12960 Control * 12961 control_proxy_new_for_bus_sync ( 12962 GBusType bus_type, 12963 GDBusProxyFlags flags, 12964 const gchar *name, 12965 const gchar *object_path, 12966 GCancellable *cancellable, 12967 GError **error) 12968 { 12969 GInitable *ret; 12970 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL); 12971 if (ret != NULL) 12972 return CONTROL (ret); 12973 else 12974 return NULL; 12975 } 12976 12977 12978 /* ------------------------------------------------------------------------ */ 12979 12980 /** 12981 * ControlSkeleton: 12982 * 12983 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API. 12984 */ 12985 12986 /** 12987 * ControlSkeletonClass: 12988 * @parent_class: The parent class. 12989 * 12990 * Class structure for #ControlSkeleton. 12991 */ 12992 12993 struct _ControlSkeletonPrivate 12994 { 12995 GValue *properties; 12996 GList *changed_properties; 12997 GSource *changed_properties_idle_source; 12998 GMainContext *context; 12999 GMutex lock; 13000 }; 13001 13002 static void 13003 _control_skeleton_handle_method_call ( 13004 GDBusConnection *connection G_GNUC_UNUSED, 13005 const gchar *sender G_GNUC_UNUSED, 13006 const gchar *object_path G_GNUC_UNUSED, 13007 const gchar *interface_name, 13008 const gchar *method_name, 13009 GVariant *parameters, 13010 GDBusMethodInvocation *invocation, 13011 gpointer user_data) 13012 { 13013 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); 13014 _ExtendedGDBusMethodInfo *info; 13015 GVariantIter iter; 13016 GVariant *child; 13017 GValue *paramv; 13018 guint num_params; 13019 guint num_extra; 13020 guint n; 13021 guint signal_id; 13022 GValue return_value = G_VALUE_INIT; 13023 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 13024 g_assert (info != NULL); 13025 num_params = g_variant_n_children (parameters); 13026 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 13027 n = 0; 13028 g_value_init (¶mv[n], TYPE_CONTROL); 13029 g_value_set_object (¶mv[n++], skeleton); 13030 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 13031 g_value_set_object (¶mv[n++], invocation); 13032 if (info->pass_fdlist) 13033 { 13034 #ifdef G_OS_UNIX 13035 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 13036 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 13037 #else 13038 g_assert_not_reached (); 13039 #endif 13040 } 13041 g_variant_iter_init (&iter, parameters); 13042 while ((child = g_variant_iter_next_value (&iter)) != NULL) 13043 { 13044 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 13045 if (arg_info->use_gvariant) 13046 { 13047 g_value_init (¶mv[n], G_TYPE_VARIANT); 13048 g_value_set_variant (¶mv[n], child); 13049 n++; 13050 } 13051 else 13052 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 13053 g_variant_unref (child); 13054 } 13055 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL); 13056 g_value_init (&return_value, G_TYPE_BOOLEAN); 13057 g_signal_emitv (paramv, signal_id, 0, &return_value); 13058 if (!g_value_get_boolean (&return_value)) 13059 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); 13060 g_value_unset (&return_value); 13061 for (n = 0; n < num_params + num_extra; n++) 13062 g_value_unset (¶mv[n]); 13063 g_free (paramv); 13064 } 13065 13066 static GVariant * 13067 _control_skeleton_handle_get_property ( 13068 GDBusConnection *connection G_GNUC_UNUSED, 13069 const gchar *sender G_GNUC_UNUSED, 13070 const gchar *object_path G_GNUC_UNUSED, 13071 const gchar *interface_name G_GNUC_UNUSED, 13072 const gchar *property_name, 13073 GError **error, 13074 gpointer user_data) 13075 { 13076 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); 13077 GValue value = G_VALUE_INIT; 13078 GParamSpec *pspec; 13079 _ExtendedGDBusPropertyInfo *info; 13080 GVariant *ret; 13081 ret = NULL; 13082 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); 13083 g_assert (info != NULL); 13084 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 13085 if (pspec == NULL) 13086 { 13087 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 13088 } 13089 else 13090 { 13091 g_value_init (&value, pspec->value_type); 13092 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 13093 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 13094 g_value_unset (&value); 13095 } 13096 return ret; 13097 } 13098 13099 static gboolean 13100 _control_skeleton_handle_set_property ( 13101 GDBusConnection *connection G_GNUC_UNUSED, 13102 const gchar *sender G_GNUC_UNUSED, 13103 const gchar *object_path G_GNUC_UNUSED, 13104 const gchar *interface_name G_GNUC_UNUSED, 13105 const gchar *property_name, 13106 GVariant *variant, 13107 GError **error, 13108 gpointer user_data) 13109 { 13110 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); 13111 GValue value = G_VALUE_INIT; 13112 GParamSpec *pspec; 13113 _ExtendedGDBusPropertyInfo *info; 13114 gboolean ret; 13115 ret = FALSE; 13116 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name); 13117 g_assert (info != NULL); 13118 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 13119 if (pspec == NULL) 13120 { 13121 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 13122 } 13123 else 13124 { 13125 if (info->use_gvariant) 13126 g_value_set_variant (&value, variant); 13127 else 13128 g_dbus_gvariant_to_gvalue (variant, &value); 13129 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 13130 g_value_unset (&value); 13131 ret = TRUE; 13132 } 13133 return ret; 13134 } 13135 13136 static const GDBusInterfaceVTable _control_skeleton_vtable = 13137 { 13138 _control_skeleton_handle_method_call, 13139 _control_skeleton_handle_get_property, 13140 _control_skeleton_handle_set_property, 13141 {NULL} 13142 }; 13143 13144 static GDBusInterfaceInfo * 13145 control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 13146 { 13147 return control_interface_info (); 13148 } 13149 13150 static GDBusInterfaceVTable * 13151 control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 13152 { 13153 return (GDBusInterfaceVTable *) &_control_skeleton_vtable; 13154 } 13155 13156 static GVariant * 13157 control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 13158 { 13159 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); 13160 13161 GVariantBuilder builder; 13162 guint n; 13163 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 13164 if (_control_interface_info.parent_struct.properties == NULL) 13165 goto out; 13166 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++) 13167 { 13168 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n]; 13169 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 13170 { 13171 GVariant *value; 13172 value = _control_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", info->name, NULL, skeleton); 13173 if (value != NULL) 13174 { 13175 g_variant_take_ref (value); 13176 g_variant_builder_add (&builder, "{sv}", info->name, value); 13177 g_variant_unref (value); 13178 } 13179 } 13180 } 13181 out: 13182 return g_variant_builder_end (&builder); 13183 } 13184 13185 static gboolean _control_emit_changed (gpointer user_data); 13186 13187 static void 13188 control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 13189 { 13190 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton); 13191 gboolean emit_changed = FALSE; 13192 13193 g_mutex_lock (&skeleton->priv->lock); 13194 if (skeleton->priv->changed_properties_idle_source != NULL) 13195 { 13196 g_source_destroy (skeleton->priv->changed_properties_idle_source); 13197 skeleton->priv->changed_properties_idle_source = NULL; 13198 emit_changed = TRUE; 13199 } 13200 g_mutex_unlock (&skeleton->priv->lock); 13201 13202 if (emit_changed) 13203 _control_emit_changed (skeleton); 13204 } 13205 13206 static void 13207 _control_on_signal_heartbeat ( 13208 Control *object, 13209 const gchar *arg_bus_name) 13210 { 13211 ControlSkeleton *skeleton = CONTROL_SKELETON (object); 13212 13213 GList *connections, *l; 13214 GVariant *signal_variant; 13215 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 13216 13217 signal_variant = g_variant_ref_sink (g_variant_new ("(s)", 13218 arg_bus_name)); 13219 for (l = connections; l != NULL; l = l->next) 13220 { 13221 GDBusConnection *connection = l->data; 13222 g_dbus_connection_emit_signal (connection, 13223 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat", 13224 signal_variant, NULL); 13225 } 13226 g_variant_unref (signal_variant); 13227 g_list_free_full (connections, g_object_unref); 13228 } 13229 13230 static void 13231 _control_on_signal_started ( 13232 Control *object) 13233 { 13234 ControlSkeleton *skeleton = CONTROL_SKELETON (object); 13235 13236 GList *connections, *l; 13237 GVariant *signal_variant; 13238 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 13239 13240 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 13241 for (l = connections; l != NULL; l = l->next) 13242 { 13243 GDBusConnection *connection = l->data; 13244 g_dbus_connection_emit_signal (connection, 13245 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started", 13246 signal_variant, NULL); 13247 } 13248 g_variant_unref (signal_variant); 13249 g_list_free_full (connections, g_object_unref); 13250 } 13251 13252 static void control_skeleton_iface_init (ControlIface *iface); 13253 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 13254 G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 13255 G_ADD_PRIVATE (ControlSkeleton) 13256 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); 13257 13258 #else 13259 G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 13260 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init)); 13261 13262 #endif 13263 static void 13264 control_skeleton_finalize (GObject *object) 13265 { 13266 ControlSkeleton *skeleton = CONTROL_SKELETON (object); 13267 guint n; 13268 for (n = 0; n < 2; n++) 13269 g_value_unset (&skeleton->priv->properties[n]); 13270 g_free (skeleton->priv->properties); 13271 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 13272 if (skeleton->priv->changed_properties_idle_source != NULL) 13273 g_source_destroy (skeleton->priv->changed_properties_idle_source); 13274 g_main_context_unref (skeleton->priv->context); 13275 g_mutex_clear (&skeleton->priv->lock); 13276 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object); 13277 } 13278 13279 static void 13280 control_skeleton_get_property (GObject *object, 13281 guint prop_id, 13282 GValue *value, 13283 GParamSpec *pspec G_GNUC_UNUSED) 13284 { 13285 ControlSkeleton *skeleton = CONTROL_SKELETON (object); 13286 g_assert (prop_id != 0 && prop_id - 1 < 2); 13287 g_mutex_lock (&skeleton->priv->lock); 13288 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 13289 g_mutex_unlock (&skeleton->priv->lock); 13290 } 13291 13292 static gboolean 13293 _control_emit_changed (gpointer user_data) 13294 { 13295 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data); 13296 GList *l; 13297 GVariantBuilder builder; 13298 GVariantBuilder invalidated_builder; 13299 guint num_changes; 13300 13301 g_mutex_lock (&skeleton->priv->lock); 13302 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 13303 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 13304 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 13305 { 13306 ChangedProperty *cp = l->data; 13307 GVariant *variant; 13308 const GValue *cur_value; 13309 13310 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 13311 if (!_g_value_equal (cur_value, &cp->orig_value)) 13312 { 13313 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 13314 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 13315 g_variant_unref (variant); 13316 num_changes++; 13317 } 13318 } 13319 if (num_changes > 0) 13320 { 13321 GList *connections, *ll; 13322 GVariant *signal_variant; 13323 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control", 13324 &builder, &invalidated_builder)); 13325 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 13326 for (ll = connections; ll != NULL; ll = ll->next) 13327 { 13328 GDBusConnection *connection = ll->data; 13329 13330 g_dbus_connection_emit_signal (connection, 13331 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 13332 "org.freedesktop.DBus.Properties", 13333 "PropertiesChanged", 13334 signal_variant, 13335 NULL); 13336 } 13337 g_variant_unref (signal_variant); 13338 g_list_free_full (connections, g_object_unref); 13339 } 13340 else 13341 { 13342 g_variant_builder_clear (&builder); 13343 g_variant_builder_clear (&invalidated_builder); 13344 } 13345 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 13346 skeleton->priv->changed_properties = NULL; 13347 skeleton->priv->changed_properties_idle_source = NULL; 13348 g_mutex_unlock (&skeleton->priv->lock); 13349 return FALSE; 13350 } 13351 13352 static void 13353 _control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 13354 { 13355 ChangedProperty *cp; 13356 GList *l; 13357 cp = NULL; 13358 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 13359 { 13360 ChangedProperty *i_cp = l->data; 13361 if (i_cp->info == info) 13362 { 13363 cp = i_cp; 13364 break; 13365 } 13366 } 13367 if (cp == NULL) 13368 { 13369 cp = g_new0 (ChangedProperty, 1); 13370 cp->prop_id = prop_id; 13371 cp->info = info; 13372 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 13373 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 13374 g_value_copy (orig_value, &cp->orig_value); 13375 } 13376 } 13377 13378 static void 13379 control_skeleton_notify (GObject *object, 13380 GParamSpec *pspec G_GNUC_UNUSED) 13381 { 13382 ControlSkeleton *skeleton = CONTROL_SKELETON (object); 13383 g_mutex_lock (&skeleton->priv->lock); 13384 if (skeleton->priv->changed_properties != NULL && 13385 skeleton->priv->changed_properties_idle_source == NULL) 13386 { 13387 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 13388 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 13389 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 13390 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_emit_changed"); 13391 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 13392 g_source_unref (skeleton->priv->changed_properties_idle_source); 13393 } 13394 g_mutex_unlock (&skeleton->priv->lock); 13395 } 13396 13397 static void 13398 control_skeleton_set_property (GObject *object, 13399 guint prop_id, 13400 const GValue *value, 13401 GParamSpec *pspec) 13402 { 13403 ControlSkeleton *skeleton = CONTROL_SKELETON (object); 13404 g_assert (prop_id != 0 && prop_id - 1 < 2); 13405 g_mutex_lock (&skeleton->priv->lock); 13406 g_object_freeze_notify (object); 13407 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 13408 { 13409 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 13410 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 13411 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 13412 g_object_notify_by_pspec (object, pspec); 13413 } 13414 g_mutex_unlock (&skeleton->priv->lock); 13415 g_object_thaw_notify (object); 13416 } 13417 13418 static void 13419 control_skeleton_init (ControlSkeleton *skeleton) 13420 { 13421 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 13422 skeleton->priv = control_skeleton_get_instance_private (skeleton); 13423 #else 13424 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate); 13425 #endif 13426 13427 g_mutex_init (&skeleton->priv->lock); 13428 skeleton->priv->context = g_main_context_ref_thread_default (); 13429 skeleton->priv->properties = g_new0 (GValue, 2); 13430 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); 13431 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); 13432 } 13433 13434 static gint 13435 control_skeleton_get_poll_interval (Control *object) 13436 { 13437 ControlSkeleton *skeleton = CONTROL_SKELETON (object); 13438 gint value; 13439 g_mutex_lock (&skeleton->priv->lock); 13440 value = g_value_get_int (&(skeleton->priv->properties[0])); 13441 g_mutex_unlock (&skeleton->priv->lock); 13442 return value; 13443 } 13444 13445 static gint 13446 control_skeleton_get_heatbeat (Control *object) 13447 { 13448 ControlSkeleton *skeleton = CONTROL_SKELETON (object); 13449 gint value; 13450 g_mutex_lock (&skeleton->priv->lock); 13451 value = g_value_get_int (&(skeleton->priv->properties[1])); 13452 g_mutex_unlock (&skeleton->priv->lock); 13453 return value; 13454 } 13455 13456 static void 13457 control_skeleton_class_init (ControlSkeletonClass *klass) 13458 { 13459 GObjectClass *gobject_class; 13460 GDBusInterfaceSkeletonClass *skeleton_class; 13461 13462 gobject_class = G_OBJECT_CLASS (klass); 13463 gobject_class->finalize = control_skeleton_finalize; 13464 gobject_class->get_property = control_skeleton_get_property; 13465 gobject_class->set_property = control_skeleton_set_property; 13466 gobject_class->notify = control_skeleton_notify; 13467 13468 13469 control_override_properties (gobject_class, 1); 13470 13471 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 13472 skeleton_class->get_info = control_skeleton_dbus_interface_get_info; 13473 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties; 13474 skeleton_class->flush = control_skeleton_dbus_interface_flush; 13475 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable; 13476 13477 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 13478 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate)); 13479 #endif 13480 } 13481 13482 static void 13483 control_skeleton_iface_init (ControlIface *iface) 13484 { 13485 iface->heartbeat = _control_on_signal_heartbeat; 13486 iface->started = _control_on_signal_started; 13487 iface->get_poll_interval = control_skeleton_get_poll_interval; 13488 iface->get_heatbeat = control_skeleton_get_heatbeat; 13489 } 13490 13491 /** 13492 * control_skeleton_new: 13493 * 13494 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. 13495 * 13496 * Returns: (transfer full) (type ControlSkeleton): The skeleton object. 13497 */ 13498 Control * 13499 control_skeleton_new (void) 13500 { 13501 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL)); 13502 } 13503 13504 /* ------------------------------------------------------------------------ 13505 * Code for interface org.openbmc.control.Bmc 13506 * ------------------------------------------------------------------------ 13507 */ 13508 13509 /** 13510 * SECTION:ControlBmc 13511 * @title: ControlBmc 13512 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface 13513 * 13514 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface in C. 13515 */ 13516 13517 /* ---- Introspection data for org.openbmc.control.Bmc ---- */ 13518 13519 static const _ExtendedGDBusMethodInfo _control_bmc_method_info_cold_reset = 13520 { 13521 { 13522 -1, 13523 (gchar *) "coldReset", 13524 NULL, 13525 NULL, 13526 NULL 13527 }, 13528 "handle-cold-reset", 13529 FALSE 13530 }; 13531 13532 static const _ExtendedGDBusMethodInfo _control_bmc_method_info_warm_reset = 13533 { 13534 { 13535 -1, 13536 (gchar *) "warmReset", 13537 NULL, 13538 NULL, 13539 NULL 13540 }, 13541 "handle-warm-reset", 13542 FALSE 13543 }; 13544 13545 static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] = 13546 { 13547 &_control_bmc_method_info_cold_reset, 13548 &_control_bmc_method_info_warm_reset, 13549 NULL 13550 }; 13551 13552 static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info = 13553 { 13554 { 13555 -1, 13556 (gchar *) "org.openbmc.control.Bmc", 13557 (GDBusMethodInfo **) &_control_bmc_method_info_pointers, 13558 NULL, 13559 NULL, 13560 NULL 13561 }, 13562 "control-bmc", 13563 }; 13564 13565 13566 /** 13567 * control_bmc_interface_info: 13568 * 13569 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface. 13570 * 13571 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 13572 */ 13573 GDBusInterfaceInfo * 13574 control_bmc_interface_info (void) 13575 { 13576 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct; 13577 } 13578 13579 /** 13580 * control_bmc_override_properties: 13581 * @klass: The class structure for a #GObject<!-- -->-derived class. 13582 * @property_id_begin: The property id to assign to the first overridden property. 13583 * 13584 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class. 13585 * The properties are overridden in the order they are defined. 13586 * 13587 * Returns: The last property id. 13588 */ 13589 guint 13590 control_bmc_override_properties (GObjectClass *klass, guint property_id_begin) 13591 { 13592 return property_id_begin - 1; 13593 } 13594 13595 13596 13597 /** 13598 * ControlBmc: 13599 * 13600 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. 13601 */ 13602 13603 /** 13604 * ControlBmcIface: 13605 * @parent_iface: The parent interface. 13606 * @handle_cold_reset: Handler for the #ControlBmc::handle-cold-reset signal. 13607 * @handle_warm_reset: Handler for the #ControlBmc::handle-warm-reset signal. 13608 * 13609 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. 13610 */ 13611 13612 typedef ControlBmcIface ControlBmcInterface; 13613 G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT); 13614 13615 static void 13616 control_bmc_default_init (ControlBmcIface *iface) 13617 { 13618 /* GObject signals for incoming D-Bus method calls: */ 13619 /** 13620 * ControlBmc::handle-cold-reset: 13621 * @object: A #ControlBmc. 13622 * @invocation: A #GDBusMethodInvocation. 13623 * 13624 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method. 13625 * 13626 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_bmc_complete_cold_reset() 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. 13627 * 13628 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 13629 */ 13630 g_signal_new ("handle-cold-reset", 13631 G_TYPE_FROM_INTERFACE (iface), 13632 G_SIGNAL_RUN_LAST, 13633 G_STRUCT_OFFSET (ControlBmcIface, handle_cold_reset), 13634 g_signal_accumulator_true_handled, 13635 NULL, 13636 g_cclosure_marshal_generic, 13637 G_TYPE_BOOLEAN, 13638 1, 13639 G_TYPE_DBUS_METHOD_INVOCATION); 13640 13641 /** 13642 * ControlBmc::handle-warm-reset: 13643 * @object: A #ControlBmc. 13644 * @invocation: A #GDBusMethodInvocation. 13645 * 13646 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method. 13647 * 13648 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_bmc_complete_warm_reset() 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. 13649 * 13650 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 13651 */ 13652 g_signal_new ("handle-warm-reset", 13653 G_TYPE_FROM_INTERFACE (iface), 13654 G_SIGNAL_RUN_LAST, 13655 G_STRUCT_OFFSET (ControlBmcIface, handle_warm_reset), 13656 g_signal_accumulator_true_handled, 13657 NULL, 13658 g_cclosure_marshal_generic, 13659 G_TYPE_BOOLEAN, 13660 1, 13661 G_TYPE_DBUS_METHOD_INVOCATION); 13662 13663 } 13664 13665 /** 13666 * control_bmc_call_cold_reset: 13667 * @proxy: A #ControlBmcProxy. 13668 * @cancellable: (allow-none): A #GCancellable or %NULL. 13669 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 13670 * @user_data: User data to pass to @callback. 13671 * 13672 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method on @proxy. 13673 * 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. 13674 * You can then call control_bmc_call_cold_reset_finish() to get the result of the operation. 13675 * 13676 * See control_bmc_call_cold_reset_sync() for the synchronous, blocking version of this method. 13677 */ 13678 void 13679 control_bmc_call_cold_reset ( 13680 ControlBmc *proxy, 13681 GCancellable *cancellable, 13682 GAsyncReadyCallback callback, 13683 gpointer user_data) 13684 { 13685 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 13686 "coldReset", 13687 g_variant_new ("()"), 13688 G_DBUS_CALL_FLAGS_NONE, 13689 -1, 13690 cancellable, 13691 callback, 13692 user_data); 13693 } 13694 13695 /** 13696 * control_bmc_call_cold_reset_finish: 13697 * @proxy: A #ControlBmcProxy. 13698 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_cold_reset(). 13699 * @error: Return location for error or %NULL. 13700 * 13701 * Finishes an operation started with control_bmc_call_cold_reset(). 13702 * 13703 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 13704 */ 13705 gboolean 13706 control_bmc_call_cold_reset_finish ( 13707 ControlBmc *proxy, 13708 GAsyncResult *res, 13709 GError **error) 13710 { 13711 GVariant *_ret; 13712 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 13713 if (_ret == NULL) 13714 goto _out; 13715 g_variant_get (_ret, 13716 "()"); 13717 g_variant_unref (_ret); 13718 _out: 13719 return _ret != NULL; 13720 } 13721 13722 /** 13723 * control_bmc_call_cold_reset_sync: 13724 * @proxy: A #ControlBmcProxy. 13725 * @cancellable: (allow-none): A #GCancellable or %NULL. 13726 * @error: Return location for error or %NULL. 13727 * 13728 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 13729 * 13730 * See control_bmc_call_cold_reset() for the asynchronous version of this method. 13731 * 13732 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 13733 */ 13734 gboolean 13735 control_bmc_call_cold_reset_sync ( 13736 ControlBmc *proxy, 13737 GCancellable *cancellable, 13738 GError **error) 13739 { 13740 GVariant *_ret; 13741 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 13742 "coldReset", 13743 g_variant_new ("()"), 13744 G_DBUS_CALL_FLAGS_NONE, 13745 -1, 13746 cancellable, 13747 error); 13748 if (_ret == NULL) 13749 goto _out; 13750 g_variant_get (_ret, 13751 "()"); 13752 g_variant_unref (_ret); 13753 _out: 13754 return _ret != NULL; 13755 } 13756 13757 /** 13758 * control_bmc_call_warm_reset: 13759 * @proxy: A #ControlBmcProxy. 13760 * @cancellable: (allow-none): A #GCancellable or %NULL. 13761 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 13762 * @user_data: User data to pass to @callback. 13763 * 13764 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method on @proxy. 13765 * 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. 13766 * You can then call control_bmc_call_warm_reset_finish() to get the result of the operation. 13767 * 13768 * See control_bmc_call_warm_reset_sync() for the synchronous, blocking version of this method. 13769 */ 13770 void 13771 control_bmc_call_warm_reset ( 13772 ControlBmc *proxy, 13773 GCancellable *cancellable, 13774 GAsyncReadyCallback callback, 13775 gpointer user_data) 13776 { 13777 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 13778 "warmReset", 13779 g_variant_new ("()"), 13780 G_DBUS_CALL_FLAGS_NONE, 13781 -1, 13782 cancellable, 13783 callback, 13784 user_data); 13785 } 13786 13787 /** 13788 * control_bmc_call_warm_reset_finish: 13789 * @proxy: A #ControlBmcProxy. 13790 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_warm_reset(). 13791 * @error: Return location for error or %NULL. 13792 * 13793 * Finishes an operation started with control_bmc_call_warm_reset(). 13794 * 13795 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 13796 */ 13797 gboolean 13798 control_bmc_call_warm_reset_finish ( 13799 ControlBmc *proxy, 13800 GAsyncResult *res, 13801 GError **error) 13802 { 13803 GVariant *_ret; 13804 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 13805 if (_ret == NULL) 13806 goto _out; 13807 g_variant_get (_ret, 13808 "()"); 13809 g_variant_unref (_ret); 13810 _out: 13811 return _ret != NULL; 13812 } 13813 13814 /** 13815 * control_bmc_call_warm_reset_sync: 13816 * @proxy: A #ControlBmcProxy. 13817 * @cancellable: (allow-none): A #GCancellable or %NULL. 13818 * @error: Return location for error or %NULL. 13819 * 13820 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 13821 * 13822 * See control_bmc_call_warm_reset() for the asynchronous version of this method. 13823 * 13824 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 13825 */ 13826 gboolean 13827 control_bmc_call_warm_reset_sync ( 13828 ControlBmc *proxy, 13829 GCancellable *cancellable, 13830 GError **error) 13831 { 13832 GVariant *_ret; 13833 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 13834 "warmReset", 13835 g_variant_new ("()"), 13836 G_DBUS_CALL_FLAGS_NONE, 13837 -1, 13838 cancellable, 13839 error); 13840 if (_ret == NULL) 13841 goto _out; 13842 g_variant_get (_ret, 13843 "()"); 13844 g_variant_unref (_ret); 13845 _out: 13846 return _ret != NULL; 13847 } 13848 13849 /** 13850 * control_bmc_complete_cold_reset: 13851 * @object: A #ControlBmc. 13852 * @invocation: (transfer full): A #GDBusMethodInvocation. 13853 * 13854 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</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. 13855 * 13856 * This method will free @invocation, you cannot use it afterwards. 13857 */ 13858 void 13859 control_bmc_complete_cold_reset ( 13860 ControlBmc *object, 13861 GDBusMethodInvocation *invocation) 13862 { 13863 g_dbus_method_invocation_return_value (invocation, 13864 g_variant_new ("()")); 13865 } 13866 13867 /** 13868 * control_bmc_complete_warm_reset: 13869 * @object: A #ControlBmc. 13870 * @invocation: (transfer full): A #GDBusMethodInvocation. 13871 * 13872 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</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. 13873 * 13874 * This method will free @invocation, you cannot use it afterwards. 13875 */ 13876 void 13877 control_bmc_complete_warm_reset ( 13878 ControlBmc *object, 13879 GDBusMethodInvocation *invocation) 13880 { 13881 g_dbus_method_invocation_return_value (invocation, 13882 g_variant_new ("()")); 13883 } 13884 13885 /* ------------------------------------------------------------------------ */ 13886 13887 /** 13888 * ControlBmcProxy: 13889 * 13890 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API. 13891 */ 13892 13893 /** 13894 * ControlBmcProxyClass: 13895 * @parent_class: The parent class. 13896 * 13897 * Class structure for #ControlBmcProxy. 13898 */ 13899 13900 struct _ControlBmcProxyPrivate 13901 { 13902 GData *qdata; 13903 }; 13904 13905 static void control_bmc_proxy_iface_init (ControlBmcIface *iface); 13906 13907 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 13908 G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, 13909 G_ADD_PRIVATE (ControlBmcProxy) 13910 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); 13911 13912 #else 13913 G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY, 13914 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init)); 13915 13916 #endif 13917 static void 13918 control_bmc_proxy_finalize (GObject *object) 13919 { 13920 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object); 13921 g_datalist_clear (&proxy->priv->qdata); 13922 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object); 13923 } 13924 13925 static void 13926 control_bmc_proxy_get_property (GObject *object, 13927 guint prop_id, 13928 GValue *value, 13929 GParamSpec *pspec G_GNUC_UNUSED) 13930 { 13931 } 13932 13933 static void 13934 control_bmc_proxy_set_property (GObject *object, 13935 guint prop_id, 13936 const GValue *value, 13937 GParamSpec *pspec G_GNUC_UNUSED) 13938 { 13939 } 13940 13941 static void 13942 control_bmc_proxy_g_signal (GDBusProxy *proxy, 13943 const gchar *sender_name G_GNUC_UNUSED, 13944 const gchar *signal_name, 13945 GVariant *parameters) 13946 { 13947 _ExtendedGDBusSignalInfo *info; 13948 GVariantIter iter; 13949 GVariant *child; 13950 GValue *paramv; 13951 guint num_params; 13952 guint n; 13953 guint signal_id; 13954 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name); 13955 if (info == NULL) 13956 return; 13957 num_params = g_variant_n_children (parameters); 13958 paramv = g_new0 (GValue, num_params + 1); 13959 g_value_init (¶mv[0], TYPE_CONTROL_BMC); 13960 g_value_set_object (¶mv[0], proxy); 13961 g_variant_iter_init (&iter, parameters); 13962 n = 1; 13963 while ((child = g_variant_iter_next_value (&iter)) != NULL) 13964 { 13965 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 13966 if (arg_info->use_gvariant) 13967 { 13968 g_value_init (¶mv[n], G_TYPE_VARIANT); 13969 g_value_set_variant (¶mv[n], child); 13970 n++; 13971 } 13972 else 13973 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 13974 g_variant_unref (child); 13975 } 13976 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); 13977 g_signal_emitv (paramv, signal_id, 0, NULL); 13978 for (n = 0; n < num_params + 1; n++) 13979 g_value_unset (¶mv[n]); 13980 g_free (paramv); 13981 } 13982 13983 static void 13984 control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy, 13985 GVariant *changed_properties, 13986 const gchar *const *invalidated_properties) 13987 { 13988 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy); 13989 guint n; 13990 const gchar *key; 13991 GVariantIter *iter; 13992 _ExtendedGDBusPropertyInfo *info; 13993 g_variant_get (changed_properties, "a{sv}", &iter); 13994 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 13995 { 13996 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key); 13997 g_datalist_remove_data (&proxy->priv->qdata, key); 13998 if (info != NULL) 13999 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 14000 } 14001 g_variant_iter_free (iter); 14002 for (n = 0; invalidated_properties[n] != NULL; n++) 14003 { 14004 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]); 14005 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 14006 if (info != NULL) 14007 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 14008 } 14009 } 14010 14011 static void 14012 control_bmc_proxy_init (ControlBmcProxy *proxy) 14013 { 14014 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 14015 proxy->priv = control_bmc_proxy_get_instance_private (proxy); 14016 #else 14017 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate); 14018 #endif 14019 14020 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ()); 14021 } 14022 14023 static void 14024 control_bmc_proxy_class_init (ControlBmcProxyClass *klass) 14025 { 14026 GObjectClass *gobject_class; 14027 GDBusProxyClass *proxy_class; 14028 14029 gobject_class = G_OBJECT_CLASS (klass); 14030 gobject_class->finalize = control_bmc_proxy_finalize; 14031 gobject_class->get_property = control_bmc_proxy_get_property; 14032 gobject_class->set_property = control_bmc_proxy_set_property; 14033 14034 proxy_class = G_DBUS_PROXY_CLASS (klass); 14035 proxy_class->g_signal = control_bmc_proxy_g_signal; 14036 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed; 14037 14038 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 14039 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate)); 14040 #endif 14041 } 14042 14043 static void 14044 control_bmc_proxy_iface_init (ControlBmcIface *iface) 14045 { 14046 } 14047 14048 /** 14049 * control_bmc_proxy_new: 14050 * @connection: A #GDBusConnection. 14051 * @flags: Flags from the #GDBusProxyFlags enumeration. 14052 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 14053 * @object_path: An object path. 14054 * @cancellable: (allow-none): A #GCancellable or %NULL. 14055 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 14056 * @user_data: User data to pass to @callback. 14057 * 14058 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new() for more details. 14059 * 14060 * 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. 14061 * You can then call control_bmc_proxy_new_finish() to get the result of the operation. 14062 * 14063 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor. 14064 */ 14065 void 14066 control_bmc_proxy_new ( 14067 GDBusConnection *connection, 14068 GDBusProxyFlags flags, 14069 const gchar *name, 14070 const gchar *object_path, 14071 GCancellable *cancellable, 14072 GAsyncReadyCallback callback, 14073 gpointer user_data) 14074 { 14075 g_async_initable_new_async (TYPE_CONTROL_BMC_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL); 14076 } 14077 14078 /** 14079 * control_bmc_proxy_new_finish: 14080 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new(). 14081 * @error: Return location for error or %NULL 14082 * 14083 * Finishes an operation started with control_bmc_proxy_new(). 14084 * 14085 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. 14086 */ 14087 ControlBmc * 14088 control_bmc_proxy_new_finish ( 14089 GAsyncResult *res, 14090 GError **error) 14091 { 14092 GObject *ret; 14093 GObject *source_object; 14094 source_object = g_async_result_get_source_object (res); 14095 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 14096 g_object_unref (source_object); 14097 if (ret != NULL) 14098 return CONTROL_BMC (ret); 14099 else 14100 return NULL; 14101 } 14102 14103 /** 14104 * control_bmc_proxy_new_sync: 14105 * @connection: A #GDBusConnection. 14106 * @flags: Flags from the #GDBusProxyFlags enumeration. 14107 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 14108 * @object_path: An object path. 14109 * @cancellable: (allow-none): A #GCancellable or %NULL. 14110 * @error: Return location for error or %NULL 14111 * 14112 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new_sync() for more details. 14113 * 14114 * The calling thread is blocked until a reply is received. 14115 * 14116 * See control_bmc_proxy_new() for the asynchronous version of this constructor. 14117 * 14118 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. 14119 */ 14120 ControlBmc * 14121 control_bmc_proxy_new_sync ( 14122 GDBusConnection *connection, 14123 GDBusProxyFlags flags, 14124 const gchar *name, 14125 const gchar *object_path, 14126 GCancellable *cancellable, 14127 GError **error) 14128 { 14129 GInitable *ret; 14130 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL); 14131 if (ret != NULL) 14132 return CONTROL_BMC (ret); 14133 else 14134 return NULL; 14135 } 14136 14137 14138 /** 14139 * control_bmc_proxy_new_for_bus: 14140 * @bus_type: A #GBusType. 14141 * @flags: Flags from the #GDBusProxyFlags enumeration. 14142 * @name: A bus name (well-known or unique). 14143 * @object_path: An object path. 14144 * @cancellable: (allow-none): A #GCancellable or %NULL. 14145 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 14146 * @user_data: User data to pass to @callback. 14147 * 14148 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 14149 * 14150 * 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. 14151 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation. 14152 * 14153 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 14154 */ 14155 void 14156 control_bmc_proxy_new_for_bus ( 14157 GBusType bus_type, 14158 GDBusProxyFlags flags, 14159 const gchar *name, 14160 const gchar *object_path, 14161 GCancellable *cancellable, 14162 GAsyncReadyCallback callback, 14163 gpointer user_data) 14164 { 14165 g_async_initable_new_async (TYPE_CONTROL_BMC_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL); 14166 } 14167 14168 /** 14169 * control_bmc_proxy_new_for_bus_finish: 14170 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus(). 14171 * @error: Return location for error or %NULL 14172 * 14173 * Finishes an operation started with control_bmc_proxy_new_for_bus(). 14174 * 14175 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. 14176 */ 14177 ControlBmc * 14178 control_bmc_proxy_new_for_bus_finish ( 14179 GAsyncResult *res, 14180 GError **error) 14181 { 14182 GObject *ret; 14183 GObject *source_object; 14184 source_object = g_async_result_get_source_object (res); 14185 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 14186 g_object_unref (source_object); 14187 if (ret != NULL) 14188 return CONTROL_BMC (ret); 14189 else 14190 return NULL; 14191 } 14192 14193 /** 14194 * control_bmc_proxy_new_for_bus_sync: 14195 * @bus_type: A #GBusType. 14196 * @flags: Flags from the #GDBusProxyFlags enumeration. 14197 * @name: A bus name (well-known or unique). 14198 * @object_path: An object path. 14199 * @cancellable: (allow-none): A #GCancellable or %NULL. 14200 * @error: Return location for error or %NULL 14201 * 14202 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 14203 * 14204 * The calling thread is blocked until a reply is received. 14205 * 14206 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor. 14207 * 14208 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set. 14209 */ 14210 ControlBmc * 14211 control_bmc_proxy_new_for_bus_sync ( 14212 GBusType bus_type, 14213 GDBusProxyFlags flags, 14214 const gchar *name, 14215 const gchar *object_path, 14216 GCancellable *cancellable, 14217 GError **error) 14218 { 14219 GInitable *ret; 14220 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL); 14221 if (ret != NULL) 14222 return CONTROL_BMC (ret); 14223 else 14224 return NULL; 14225 } 14226 14227 14228 /* ------------------------------------------------------------------------ */ 14229 14230 /** 14231 * ControlBmcSkeleton: 14232 * 14233 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API. 14234 */ 14235 14236 /** 14237 * ControlBmcSkeletonClass: 14238 * @parent_class: The parent class. 14239 * 14240 * Class structure for #ControlBmcSkeleton. 14241 */ 14242 14243 struct _ControlBmcSkeletonPrivate 14244 { 14245 GValue *properties; 14246 GList *changed_properties; 14247 GSource *changed_properties_idle_source; 14248 GMainContext *context; 14249 GMutex lock; 14250 }; 14251 14252 static void 14253 _control_bmc_skeleton_handle_method_call ( 14254 GDBusConnection *connection G_GNUC_UNUSED, 14255 const gchar *sender G_GNUC_UNUSED, 14256 const gchar *object_path G_GNUC_UNUSED, 14257 const gchar *interface_name, 14258 const gchar *method_name, 14259 GVariant *parameters, 14260 GDBusMethodInvocation *invocation, 14261 gpointer user_data) 14262 { 14263 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); 14264 _ExtendedGDBusMethodInfo *info; 14265 GVariantIter iter; 14266 GVariant *child; 14267 GValue *paramv; 14268 guint num_params; 14269 guint num_extra; 14270 guint n; 14271 guint signal_id; 14272 GValue return_value = G_VALUE_INIT; 14273 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 14274 g_assert (info != NULL); 14275 num_params = g_variant_n_children (parameters); 14276 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 14277 n = 0; 14278 g_value_init (¶mv[n], TYPE_CONTROL_BMC); 14279 g_value_set_object (¶mv[n++], skeleton); 14280 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 14281 g_value_set_object (¶mv[n++], invocation); 14282 if (info->pass_fdlist) 14283 { 14284 #ifdef G_OS_UNIX 14285 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 14286 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 14287 #else 14288 g_assert_not_reached (); 14289 #endif 14290 } 14291 g_variant_iter_init (&iter, parameters); 14292 while ((child = g_variant_iter_next_value (&iter)) != NULL) 14293 { 14294 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 14295 if (arg_info->use_gvariant) 14296 { 14297 g_value_init (¶mv[n], G_TYPE_VARIANT); 14298 g_value_set_variant (¶mv[n], child); 14299 n++; 14300 } 14301 else 14302 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 14303 g_variant_unref (child); 14304 } 14305 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC); 14306 g_value_init (&return_value, G_TYPE_BOOLEAN); 14307 g_signal_emitv (paramv, signal_id, 0, &return_value); 14308 if (!g_value_get_boolean (&return_value)) 14309 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); 14310 g_value_unset (&return_value); 14311 for (n = 0; n < num_params + num_extra; n++) 14312 g_value_unset (¶mv[n]); 14313 g_free (paramv); 14314 } 14315 14316 static GVariant * 14317 _control_bmc_skeleton_handle_get_property ( 14318 GDBusConnection *connection G_GNUC_UNUSED, 14319 const gchar *sender G_GNUC_UNUSED, 14320 const gchar *object_path G_GNUC_UNUSED, 14321 const gchar *interface_name G_GNUC_UNUSED, 14322 const gchar *property_name, 14323 GError **error, 14324 gpointer user_data) 14325 { 14326 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); 14327 GValue value = G_VALUE_INIT; 14328 GParamSpec *pspec; 14329 _ExtendedGDBusPropertyInfo *info; 14330 GVariant *ret; 14331 ret = NULL; 14332 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); 14333 g_assert (info != NULL); 14334 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 14335 if (pspec == NULL) 14336 { 14337 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 14338 } 14339 else 14340 { 14341 g_value_init (&value, pspec->value_type); 14342 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 14343 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 14344 g_value_unset (&value); 14345 } 14346 return ret; 14347 } 14348 14349 static gboolean 14350 _control_bmc_skeleton_handle_set_property ( 14351 GDBusConnection *connection G_GNUC_UNUSED, 14352 const gchar *sender G_GNUC_UNUSED, 14353 const gchar *object_path G_GNUC_UNUSED, 14354 const gchar *interface_name G_GNUC_UNUSED, 14355 const gchar *property_name, 14356 GVariant *variant, 14357 GError **error, 14358 gpointer user_data) 14359 { 14360 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data); 14361 GValue value = G_VALUE_INIT; 14362 GParamSpec *pspec; 14363 _ExtendedGDBusPropertyInfo *info; 14364 gboolean ret; 14365 ret = FALSE; 14366 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name); 14367 g_assert (info != NULL); 14368 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 14369 if (pspec == NULL) 14370 { 14371 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 14372 } 14373 else 14374 { 14375 if (info->use_gvariant) 14376 g_value_set_variant (&value, variant); 14377 else 14378 g_dbus_gvariant_to_gvalue (variant, &value); 14379 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 14380 g_value_unset (&value); 14381 ret = TRUE; 14382 } 14383 return ret; 14384 } 14385 14386 static const GDBusInterfaceVTable _control_bmc_skeleton_vtable = 14387 { 14388 _control_bmc_skeleton_handle_method_call, 14389 _control_bmc_skeleton_handle_get_property, 14390 _control_bmc_skeleton_handle_set_property, 14391 {NULL} 14392 }; 14393 14394 static GDBusInterfaceInfo * 14395 control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 14396 { 14397 return control_bmc_interface_info (); 14398 } 14399 14400 static GDBusInterfaceVTable * 14401 control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 14402 { 14403 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable; 14404 } 14405 14406 static GVariant * 14407 control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 14408 { 14409 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton); 14410 14411 GVariantBuilder builder; 14412 guint n; 14413 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 14414 if (_control_bmc_interface_info.parent_struct.properties == NULL) 14415 goto out; 14416 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++) 14417 { 14418 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n]; 14419 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 14420 { 14421 GVariant *value; 14422 value = _control_bmc_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Bmc", info->name, NULL, skeleton); 14423 if (value != NULL) 14424 { 14425 g_variant_take_ref (value); 14426 g_variant_builder_add (&builder, "{sv}", info->name, value); 14427 g_variant_unref (value); 14428 } 14429 } 14430 } 14431 out: 14432 return g_variant_builder_end (&builder); 14433 } 14434 14435 static void 14436 control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 14437 { 14438 } 14439 14440 static void control_bmc_skeleton_iface_init (ControlBmcIface *iface); 14441 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 14442 G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 14443 G_ADD_PRIVATE (ControlBmcSkeleton) 14444 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); 14445 14446 #else 14447 G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 14448 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init)); 14449 14450 #endif 14451 static void 14452 control_bmc_skeleton_finalize (GObject *object) 14453 { 14454 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object); 14455 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 14456 if (skeleton->priv->changed_properties_idle_source != NULL) 14457 g_source_destroy (skeleton->priv->changed_properties_idle_source); 14458 g_main_context_unref (skeleton->priv->context); 14459 g_mutex_clear (&skeleton->priv->lock); 14460 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object); 14461 } 14462 14463 static void 14464 control_bmc_skeleton_init (ControlBmcSkeleton *skeleton) 14465 { 14466 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 14467 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton); 14468 #else 14469 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate); 14470 #endif 14471 14472 g_mutex_init (&skeleton->priv->lock); 14473 skeleton->priv->context = g_main_context_ref_thread_default (); 14474 } 14475 14476 static void 14477 control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass) 14478 { 14479 GObjectClass *gobject_class; 14480 GDBusInterfaceSkeletonClass *skeleton_class; 14481 14482 gobject_class = G_OBJECT_CLASS (klass); 14483 gobject_class->finalize = control_bmc_skeleton_finalize; 14484 14485 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 14486 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info; 14487 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties; 14488 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush; 14489 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable; 14490 14491 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 14492 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate)); 14493 #endif 14494 } 14495 14496 static void 14497 control_bmc_skeleton_iface_init (ControlBmcIface *iface) 14498 { 14499 } 14500 14501 /** 14502 * control_bmc_skeleton_new: 14503 * 14504 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. 14505 * 14506 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object. 14507 */ 14508 ControlBmc * 14509 control_bmc_skeleton_new (void) 14510 { 14511 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL)); 14512 } 14513 14514 /* ------------------------------------------------------------------------ 14515 * Code for interface org.openbmc.control.Host 14516 * ------------------------------------------------------------------------ 14517 */ 14518 14519 /** 14520 * SECTION:ControlHost 14521 * @title: ControlHost 14522 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface 14523 * 14524 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface in C. 14525 */ 14526 14527 /* ---- Introspection data for org.openbmc.control.Host ---- */ 14528 14529 static const _ExtendedGDBusMethodInfo _control_host_method_info_boot = 14530 { 14531 { 14532 -1, 14533 (gchar *) "boot", 14534 NULL, 14535 NULL, 14536 NULL 14537 }, 14538 "handle-boot", 14539 FALSE 14540 }; 14541 14542 static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown = 14543 { 14544 { 14545 -1, 14546 (gchar *) "shutdown", 14547 NULL, 14548 NULL, 14549 NULL 14550 }, 14551 "handle-shutdown", 14552 FALSE 14553 }; 14554 14555 static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot = 14556 { 14557 { 14558 -1, 14559 (gchar *) "reboot", 14560 NULL, 14561 NULL, 14562 NULL 14563 }, 14564 "handle-reboot", 14565 FALSE 14566 }; 14567 14568 static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] = 14569 { 14570 &_control_host_method_info_boot, 14571 &_control_host_method_info_shutdown, 14572 &_control_host_method_info_reboot, 14573 NULL 14574 }; 14575 14576 static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted = 14577 { 14578 { 14579 -1, 14580 (gchar *) "Booted", 14581 NULL, 14582 NULL 14583 }, 14584 "booted" 14585 }; 14586 14587 static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] = 14588 { 14589 &_control_host_signal_info_booted, 14590 NULL 14591 }; 14592 14593 static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode = 14594 { 14595 { 14596 -1, 14597 (gchar *) "debug_mode", 14598 (gchar *) "i", 14599 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 14600 NULL 14601 }, 14602 "debug-mode", 14603 FALSE 14604 }; 14605 14606 static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side = 14607 { 14608 { 14609 -1, 14610 (gchar *) "flash_side", 14611 (gchar *) "s", 14612 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 14613 NULL 14614 }, 14615 "flash-side", 14616 FALSE 14617 }; 14618 14619 static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] = 14620 { 14621 &_control_host_property_info_debug_mode, 14622 &_control_host_property_info_flash_side, 14623 NULL 14624 }; 14625 14626 static const _ExtendedGDBusInterfaceInfo _control_host_interface_info = 14627 { 14628 { 14629 -1, 14630 (gchar *) "org.openbmc.control.Host", 14631 (GDBusMethodInfo **) &_control_host_method_info_pointers, 14632 (GDBusSignalInfo **) &_control_host_signal_info_pointers, 14633 (GDBusPropertyInfo **) &_control_host_property_info_pointers, 14634 NULL 14635 }, 14636 "control-host", 14637 }; 14638 14639 14640 /** 14641 * control_host_interface_info: 14642 * 14643 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface. 14644 * 14645 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 14646 */ 14647 GDBusInterfaceInfo * 14648 control_host_interface_info (void) 14649 { 14650 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct; 14651 } 14652 14653 /** 14654 * control_host_override_properties: 14655 * @klass: The class structure for a #GObject<!-- -->-derived class. 14656 * @property_id_begin: The property id to assign to the first overridden property. 14657 * 14658 * Overrides all #GObject properties in the #ControlHost interface for a concrete class. 14659 * The properties are overridden in the order they are defined. 14660 * 14661 * Returns: The last property id. 14662 */ 14663 guint 14664 control_host_override_properties (GObjectClass *klass, guint property_id_begin) 14665 { 14666 g_object_class_override_property (klass, property_id_begin++, "debug-mode"); 14667 g_object_class_override_property (klass, property_id_begin++, "flash-side"); 14668 return property_id_begin - 1; 14669 } 14670 14671 14672 14673 /** 14674 * ControlHost: 14675 * 14676 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. 14677 */ 14678 14679 /** 14680 * ControlHostIface: 14681 * @parent_iface: The parent interface. 14682 * @handle_boot: Handler for the #ControlHost::handle-boot signal. 14683 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal. 14684 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal. 14685 * @get_debug_mode: Getter for the #ControlHost:debug-mode property. 14686 * @get_flash_side: Getter for the #ControlHost:flash-side property. 14687 * @booted: Handler for the #ControlHost::booted signal. 14688 * 14689 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. 14690 */ 14691 14692 typedef ControlHostIface ControlHostInterface; 14693 G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT); 14694 14695 static void 14696 control_host_default_init (ControlHostIface *iface) 14697 { 14698 /* GObject signals for incoming D-Bus method calls: */ 14699 /** 14700 * ControlHost::handle-boot: 14701 * @object: A #ControlHost. 14702 * @invocation: A #GDBusMethodInvocation. 14703 * 14704 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method. 14705 * 14706 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_host_complete_boot() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 14707 * 14708 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 14709 */ 14710 g_signal_new ("handle-boot", 14711 G_TYPE_FROM_INTERFACE (iface), 14712 G_SIGNAL_RUN_LAST, 14713 G_STRUCT_OFFSET (ControlHostIface, handle_boot), 14714 g_signal_accumulator_true_handled, 14715 NULL, 14716 g_cclosure_marshal_generic, 14717 G_TYPE_BOOLEAN, 14718 1, 14719 G_TYPE_DBUS_METHOD_INVOCATION); 14720 14721 /** 14722 * ControlHost::handle-shutdown: 14723 * @object: A #ControlHost. 14724 * @invocation: A #GDBusMethodInvocation. 14725 * 14726 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method. 14727 * 14728 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_host_complete_shutdown() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 14729 * 14730 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 14731 */ 14732 g_signal_new ("handle-shutdown", 14733 G_TYPE_FROM_INTERFACE (iface), 14734 G_SIGNAL_RUN_LAST, 14735 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown), 14736 g_signal_accumulator_true_handled, 14737 NULL, 14738 g_cclosure_marshal_generic, 14739 G_TYPE_BOOLEAN, 14740 1, 14741 G_TYPE_DBUS_METHOD_INVOCATION); 14742 14743 /** 14744 * ControlHost::handle-reboot: 14745 * @object: A #ControlHost. 14746 * @invocation: A #GDBusMethodInvocation. 14747 * 14748 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method. 14749 * 14750 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_host_complete_reboot() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 14751 * 14752 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 14753 */ 14754 g_signal_new ("handle-reboot", 14755 G_TYPE_FROM_INTERFACE (iface), 14756 G_SIGNAL_RUN_LAST, 14757 G_STRUCT_OFFSET (ControlHostIface, handle_reboot), 14758 g_signal_accumulator_true_handled, 14759 NULL, 14760 g_cclosure_marshal_generic, 14761 G_TYPE_BOOLEAN, 14762 1, 14763 G_TYPE_DBUS_METHOD_INVOCATION); 14764 14765 /* GObject signals for received D-Bus signals: */ 14766 /** 14767 * ControlHost::booted: 14768 * @object: A #ControlHost. 14769 * 14770 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> is received. 14771 * 14772 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 14773 */ 14774 g_signal_new ("booted", 14775 G_TYPE_FROM_INTERFACE (iface), 14776 G_SIGNAL_RUN_LAST, 14777 G_STRUCT_OFFSET (ControlHostIface, booted), 14778 NULL, 14779 NULL, 14780 g_cclosure_marshal_generic, 14781 G_TYPE_NONE, 14782 0); 14783 14784 /* GObject properties for D-Bus properties: */ 14785 /** 14786 * ControlHost:debug-mode: 14787 * 14788 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>. 14789 * 14790 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 14791 */ 14792 g_object_interface_install_property (iface, 14793 g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 14794 /** 14795 * ControlHost:flash-side: 14796 * 14797 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>. 14798 * 14799 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 14800 */ 14801 g_object_interface_install_property (iface, 14802 g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 14803 } 14804 14805 /** 14806 * control_host_get_debug_mode: (skip) 14807 * @object: A #ControlHost. 14808 * 14809 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property. 14810 * 14811 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 14812 * 14813 * Returns: The property value. 14814 */ 14815 gint 14816 control_host_get_debug_mode (ControlHost *object) 14817 { 14818 return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object); 14819 } 14820 14821 /** 14822 * control_host_set_debug_mode: (skip) 14823 * @object: A #ControlHost. 14824 * @value: The value to set. 14825 * 14826 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value. 14827 * 14828 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 14829 */ 14830 void 14831 control_host_set_debug_mode (ControlHost *object, gint value) 14832 { 14833 g_object_set (G_OBJECT (object), "debug-mode", value, NULL); 14834 } 14835 14836 /** 14837 * control_host_get_flash_side: (skip) 14838 * @object: A #ControlHost. 14839 * 14840 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property. 14841 * 14842 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 14843 * 14844 * <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 control_host_dup_flash_side() if on another thread.</warning> 14845 * 14846 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 14847 */ 14848 const gchar * 14849 control_host_get_flash_side (ControlHost *object) 14850 { 14851 return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object); 14852 } 14853 14854 /** 14855 * control_host_dup_flash_side: (skip) 14856 * @object: A #ControlHost. 14857 * 14858 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property. 14859 * 14860 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 14861 * 14862 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 14863 */ 14864 gchar * 14865 control_host_dup_flash_side (ControlHost *object) 14866 { 14867 gchar *value; 14868 g_object_get (G_OBJECT (object), "flash-side", &value, NULL); 14869 return value; 14870 } 14871 14872 /** 14873 * control_host_set_flash_side: (skip) 14874 * @object: A #ControlHost. 14875 * @value: The value to set. 14876 * 14877 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value. 14878 * 14879 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 14880 */ 14881 void 14882 control_host_set_flash_side (ControlHost *object, const gchar *value) 14883 { 14884 g_object_set (G_OBJECT (object), "flash-side", value, NULL); 14885 } 14886 14887 /** 14888 * control_host_emit_booted: 14889 * @object: A #ControlHost. 14890 * 14891 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal. 14892 */ 14893 void 14894 control_host_emit_booted ( 14895 ControlHost *object) 14896 { 14897 g_signal_emit_by_name (object, "booted"); 14898 } 14899 14900 /** 14901 * control_host_call_boot: 14902 * @proxy: A #ControlHostProxy. 14903 * @cancellable: (allow-none): A #GCancellable or %NULL. 14904 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 14905 * @user_data: User data to pass to @callback. 14906 * 14907 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. 14908 * 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. 14909 * You can then call control_host_call_boot_finish() to get the result of the operation. 14910 * 14911 * See control_host_call_boot_sync() for the synchronous, blocking version of this method. 14912 */ 14913 void 14914 control_host_call_boot ( 14915 ControlHost *proxy, 14916 GCancellable *cancellable, 14917 GAsyncReadyCallback callback, 14918 gpointer user_data) 14919 { 14920 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 14921 "boot", 14922 g_variant_new ("()"), 14923 G_DBUS_CALL_FLAGS_NONE, 14924 -1, 14925 cancellable, 14926 callback, 14927 user_data); 14928 } 14929 14930 /** 14931 * control_host_call_boot_finish: 14932 * @proxy: A #ControlHostProxy. 14933 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot(). 14934 * @error: Return location for error or %NULL. 14935 * 14936 * Finishes an operation started with control_host_call_boot(). 14937 * 14938 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 14939 */ 14940 gboolean 14941 control_host_call_boot_finish ( 14942 ControlHost *proxy, 14943 GAsyncResult *res, 14944 GError **error) 14945 { 14946 GVariant *_ret; 14947 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 14948 if (_ret == NULL) 14949 goto _out; 14950 g_variant_get (_ret, 14951 "()"); 14952 g_variant_unref (_ret); 14953 _out: 14954 return _ret != NULL; 14955 } 14956 14957 /** 14958 * control_host_call_boot_sync: 14959 * @proxy: A #ControlHostProxy. 14960 * @cancellable: (allow-none): A #GCancellable or %NULL. 14961 * @error: Return location for error or %NULL. 14962 * 14963 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 14964 * 14965 * See control_host_call_boot() for the asynchronous version of this method. 14966 * 14967 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 14968 */ 14969 gboolean 14970 control_host_call_boot_sync ( 14971 ControlHost *proxy, 14972 GCancellable *cancellable, 14973 GError **error) 14974 { 14975 GVariant *_ret; 14976 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 14977 "boot", 14978 g_variant_new ("()"), 14979 G_DBUS_CALL_FLAGS_NONE, 14980 -1, 14981 cancellable, 14982 error); 14983 if (_ret == NULL) 14984 goto _out; 14985 g_variant_get (_ret, 14986 "()"); 14987 g_variant_unref (_ret); 14988 _out: 14989 return _ret != NULL; 14990 } 14991 14992 /** 14993 * control_host_call_shutdown: 14994 * @proxy: A #ControlHostProxy. 14995 * @cancellable: (allow-none): A #GCancellable or %NULL. 14996 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 14997 * @user_data: User data to pass to @callback. 14998 * 14999 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. 15000 * 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. 15001 * You can then call control_host_call_shutdown_finish() to get the result of the operation. 15002 * 15003 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method. 15004 */ 15005 void 15006 control_host_call_shutdown ( 15007 ControlHost *proxy, 15008 GCancellable *cancellable, 15009 GAsyncReadyCallback callback, 15010 gpointer user_data) 15011 { 15012 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 15013 "shutdown", 15014 g_variant_new ("()"), 15015 G_DBUS_CALL_FLAGS_NONE, 15016 -1, 15017 cancellable, 15018 callback, 15019 user_data); 15020 } 15021 15022 /** 15023 * control_host_call_shutdown_finish: 15024 * @proxy: A #ControlHostProxy. 15025 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown(). 15026 * @error: Return location for error or %NULL. 15027 * 15028 * Finishes an operation started with control_host_call_shutdown(). 15029 * 15030 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 15031 */ 15032 gboolean 15033 control_host_call_shutdown_finish ( 15034 ControlHost *proxy, 15035 GAsyncResult *res, 15036 GError **error) 15037 { 15038 GVariant *_ret; 15039 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 15040 if (_ret == NULL) 15041 goto _out; 15042 g_variant_get (_ret, 15043 "()"); 15044 g_variant_unref (_ret); 15045 _out: 15046 return _ret != NULL; 15047 } 15048 15049 /** 15050 * control_host_call_shutdown_sync: 15051 * @proxy: A #ControlHostProxy. 15052 * @cancellable: (allow-none): A #GCancellable or %NULL. 15053 * @error: Return location for error or %NULL. 15054 * 15055 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 15056 * 15057 * See control_host_call_shutdown() for the asynchronous version of this method. 15058 * 15059 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 15060 */ 15061 gboolean 15062 control_host_call_shutdown_sync ( 15063 ControlHost *proxy, 15064 GCancellable *cancellable, 15065 GError **error) 15066 { 15067 GVariant *_ret; 15068 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 15069 "shutdown", 15070 g_variant_new ("()"), 15071 G_DBUS_CALL_FLAGS_NONE, 15072 -1, 15073 cancellable, 15074 error); 15075 if (_ret == NULL) 15076 goto _out; 15077 g_variant_get (_ret, 15078 "()"); 15079 g_variant_unref (_ret); 15080 _out: 15081 return _ret != NULL; 15082 } 15083 15084 /** 15085 * control_host_call_reboot: 15086 * @proxy: A #ControlHostProxy. 15087 * @cancellable: (allow-none): A #GCancellable or %NULL. 15088 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 15089 * @user_data: User data to pass to @callback. 15090 * 15091 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. 15092 * 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. 15093 * You can then call control_host_call_reboot_finish() to get the result of the operation. 15094 * 15095 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method. 15096 */ 15097 void 15098 control_host_call_reboot ( 15099 ControlHost *proxy, 15100 GCancellable *cancellable, 15101 GAsyncReadyCallback callback, 15102 gpointer user_data) 15103 { 15104 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 15105 "reboot", 15106 g_variant_new ("()"), 15107 G_DBUS_CALL_FLAGS_NONE, 15108 -1, 15109 cancellable, 15110 callback, 15111 user_data); 15112 } 15113 15114 /** 15115 * control_host_call_reboot_finish: 15116 * @proxy: A #ControlHostProxy. 15117 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot(). 15118 * @error: Return location for error or %NULL. 15119 * 15120 * Finishes an operation started with control_host_call_reboot(). 15121 * 15122 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 15123 */ 15124 gboolean 15125 control_host_call_reboot_finish ( 15126 ControlHost *proxy, 15127 GAsyncResult *res, 15128 GError **error) 15129 { 15130 GVariant *_ret; 15131 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 15132 if (_ret == NULL) 15133 goto _out; 15134 g_variant_get (_ret, 15135 "()"); 15136 g_variant_unref (_ret); 15137 _out: 15138 return _ret != NULL; 15139 } 15140 15141 /** 15142 * control_host_call_reboot_sync: 15143 * @proxy: A #ControlHostProxy. 15144 * @cancellable: (allow-none): A #GCancellable or %NULL. 15145 * @error: Return location for error or %NULL. 15146 * 15147 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 15148 * 15149 * See control_host_call_reboot() for the asynchronous version of this method. 15150 * 15151 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 15152 */ 15153 gboolean 15154 control_host_call_reboot_sync ( 15155 ControlHost *proxy, 15156 GCancellable *cancellable, 15157 GError **error) 15158 { 15159 GVariant *_ret; 15160 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 15161 "reboot", 15162 g_variant_new ("()"), 15163 G_DBUS_CALL_FLAGS_NONE, 15164 -1, 15165 cancellable, 15166 error); 15167 if (_ret == NULL) 15168 goto _out; 15169 g_variant_get (_ret, 15170 "()"); 15171 g_variant_unref (_ret); 15172 _out: 15173 return _ret != NULL; 15174 } 15175 15176 /** 15177 * control_host_complete_boot: 15178 * @object: A #ControlHost. 15179 * @invocation: (transfer full): A #GDBusMethodInvocation. 15180 * 15181 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 15182 * 15183 * This method will free @invocation, you cannot use it afterwards. 15184 */ 15185 void 15186 control_host_complete_boot ( 15187 ControlHost *object, 15188 GDBusMethodInvocation *invocation) 15189 { 15190 g_dbus_method_invocation_return_value (invocation, 15191 g_variant_new ("()")); 15192 } 15193 15194 /** 15195 * control_host_complete_shutdown: 15196 * @object: A #ControlHost. 15197 * @invocation: (transfer full): A #GDBusMethodInvocation. 15198 * 15199 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 15200 * 15201 * This method will free @invocation, you cannot use it afterwards. 15202 */ 15203 void 15204 control_host_complete_shutdown ( 15205 ControlHost *object, 15206 GDBusMethodInvocation *invocation) 15207 { 15208 g_dbus_method_invocation_return_value (invocation, 15209 g_variant_new ("()")); 15210 } 15211 15212 /** 15213 * control_host_complete_reboot: 15214 * @object: A #ControlHost. 15215 * @invocation: (transfer full): A #GDBusMethodInvocation. 15216 * 15217 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 15218 * 15219 * This method will free @invocation, you cannot use it afterwards. 15220 */ 15221 void 15222 control_host_complete_reboot ( 15223 ControlHost *object, 15224 GDBusMethodInvocation *invocation) 15225 { 15226 g_dbus_method_invocation_return_value (invocation, 15227 g_variant_new ("()")); 15228 } 15229 15230 /* ------------------------------------------------------------------------ */ 15231 15232 /** 15233 * ControlHostProxy: 15234 * 15235 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API. 15236 */ 15237 15238 /** 15239 * ControlHostProxyClass: 15240 * @parent_class: The parent class. 15241 * 15242 * Class structure for #ControlHostProxy. 15243 */ 15244 15245 struct _ControlHostProxyPrivate 15246 { 15247 GData *qdata; 15248 }; 15249 15250 static void control_host_proxy_iface_init (ControlHostIface *iface); 15251 15252 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 15253 G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, 15254 G_ADD_PRIVATE (ControlHostProxy) 15255 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); 15256 15257 #else 15258 G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY, 15259 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init)); 15260 15261 #endif 15262 static void 15263 control_host_proxy_finalize (GObject *object) 15264 { 15265 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); 15266 g_datalist_clear (&proxy->priv->qdata); 15267 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object); 15268 } 15269 15270 static void 15271 control_host_proxy_get_property (GObject *object, 15272 guint prop_id, 15273 GValue *value, 15274 GParamSpec *pspec G_GNUC_UNUSED) 15275 { 15276 const _ExtendedGDBusPropertyInfo *info; 15277 GVariant *variant; 15278 g_assert (prop_id != 0 && prop_id - 1 < 2); 15279 info = _control_host_property_info_pointers[prop_id - 1]; 15280 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 15281 if (info->use_gvariant) 15282 { 15283 g_value_set_variant (value, variant); 15284 } 15285 else 15286 { 15287 if (variant != NULL) 15288 g_dbus_gvariant_to_gvalue (variant, value); 15289 } 15290 if (variant != NULL) 15291 g_variant_unref (variant); 15292 } 15293 15294 static void 15295 control_host_proxy_set_property_cb (GDBusProxy *proxy, 15296 GAsyncResult *res, 15297 gpointer user_data) 15298 { 15299 const _ExtendedGDBusPropertyInfo *info = user_data; 15300 GError *error; 15301 GVariant *_ret; 15302 error = NULL; 15303 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 15304 if (!_ret) 15305 { 15306 g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)", 15307 info->parent_struct.name, 15308 error->message, g_quark_to_string (error->domain), error->code); 15309 g_error_free (error); 15310 } 15311 else 15312 { 15313 g_variant_unref (_ret); 15314 } 15315 } 15316 15317 static void 15318 control_host_proxy_set_property (GObject *object, 15319 guint prop_id, 15320 const GValue *value, 15321 GParamSpec *pspec G_GNUC_UNUSED) 15322 { 15323 const _ExtendedGDBusPropertyInfo *info; 15324 GVariant *variant; 15325 g_assert (prop_id != 0 && prop_id - 1 < 2); 15326 info = _control_host_property_info_pointers[prop_id - 1]; 15327 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 15328 g_dbus_proxy_call (G_DBUS_PROXY (object), 15329 "org.freedesktop.DBus.Properties.Set", 15330 g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant), 15331 G_DBUS_CALL_FLAGS_NONE, 15332 -1, 15333 NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 15334 g_variant_unref (variant); 15335 } 15336 15337 static void 15338 control_host_proxy_g_signal (GDBusProxy *proxy, 15339 const gchar *sender_name G_GNUC_UNUSED, 15340 const gchar *signal_name, 15341 GVariant *parameters) 15342 { 15343 _ExtendedGDBusSignalInfo *info; 15344 GVariantIter iter; 15345 GVariant *child; 15346 GValue *paramv; 15347 guint num_params; 15348 guint n; 15349 guint signal_id; 15350 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name); 15351 if (info == NULL) 15352 return; 15353 num_params = g_variant_n_children (parameters); 15354 paramv = g_new0 (GValue, num_params + 1); 15355 g_value_init (¶mv[0], TYPE_CONTROL_HOST); 15356 g_value_set_object (¶mv[0], proxy); 15357 g_variant_iter_init (&iter, parameters); 15358 n = 1; 15359 while ((child = g_variant_iter_next_value (&iter)) != NULL) 15360 { 15361 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 15362 if (arg_info->use_gvariant) 15363 { 15364 g_value_init (¶mv[n], G_TYPE_VARIANT); 15365 g_value_set_variant (¶mv[n], child); 15366 n++; 15367 } 15368 else 15369 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 15370 g_variant_unref (child); 15371 } 15372 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); 15373 g_signal_emitv (paramv, signal_id, 0, NULL); 15374 for (n = 0; n < num_params + 1; n++) 15375 g_value_unset (¶mv[n]); 15376 g_free (paramv); 15377 } 15378 15379 static void 15380 control_host_proxy_g_properties_changed (GDBusProxy *_proxy, 15381 GVariant *changed_properties, 15382 const gchar *const *invalidated_properties) 15383 { 15384 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy); 15385 guint n; 15386 const gchar *key; 15387 GVariantIter *iter; 15388 _ExtendedGDBusPropertyInfo *info; 15389 g_variant_get (changed_properties, "a{sv}", &iter); 15390 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 15391 { 15392 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key); 15393 g_datalist_remove_data (&proxy->priv->qdata, key); 15394 if (info != NULL) 15395 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 15396 } 15397 g_variant_iter_free (iter); 15398 for (n = 0; invalidated_properties[n] != NULL; n++) 15399 { 15400 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]); 15401 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 15402 if (info != NULL) 15403 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 15404 } 15405 } 15406 15407 static gint 15408 control_host_proxy_get_debug_mode (ControlHost *object) 15409 { 15410 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); 15411 GVariant *variant; 15412 gint value = 0; 15413 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode"); 15414 if (variant != NULL) 15415 { 15416 value = g_variant_get_int32 (variant); 15417 g_variant_unref (variant); 15418 } 15419 return value; 15420 } 15421 15422 static const gchar * 15423 control_host_proxy_get_flash_side (ControlHost *object) 15424 { 15425 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object); 15426 GVariant *variant; 15427 const gchar *value = NULL; 15428 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side"); 15429 if (variant != NULL) 15430 { 15431 value = g_variant_get_string (variant, NULL); 15432 g_variant_unref (variant); 15433 } 15434 return value; 15435 } 15436 15437 static void 15438 control_host_proxy_init (ControlHostProxy *proxy) 15439 { 15440 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 15441 proxy->priv = control_host_proxy_get_instance_private (proxy); 15442 #else 15443 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate); 15444 #endif 15445 15446 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ()); 15447 } 15448 15449 static void 15450 control_host_proxy_class_init (ControlHostProxyClass *klass) 15451 { 15452 GObjectClass *gobject_class; 15453 GDBusProxyClass *proxy_class; 15454 15455 gobject_class = G_OBJECT_CLASS (klass); 15456 gobject_class->finalize = control_host_proxy_finalize; 15457 gobject_class->get_property = control_host_proxy_get_property; 15458 gobject_class->set_property = control_host_proxy_set_property; 15459 15460 proxy_class = G_DBUS_PROXY_CLASS (klass); 15461 proxy_class->g_signal = control_host_proxy_g_signal; 15462 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed; 15463 15464 control_host_override_properties (gobject_class, 1); 15465 15466 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 15467 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate)); 15468 #endif 15469 } 15470 15471 static void 15472 control_host_proxy_iface_init (ControlHostIface *iface) 15473 { 15474 iface->get_debug_mode = control_host_proxy_get_debug_mode; 15475 iface->get_flash_side = control_host_proxy_get_flash_side; 15476 } 15477 15478 /** 15479 * control_host_proxy_new: 15480 * @connection: A #GDBusConnection. 15481 * @flags: Flags from the #GDBusProxyFlags enumeration. 15482 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 15483 * @object_path: An object path. 15484 * @cancellable: (allow-none): A #GCancellable or %NULL. 15485 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 15486 * @user_data: User data to pass to @callback. 15487 * 15488 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new() for more details. 15489 * 15490 * 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. 15491 * You can then call control_host_proxy_new_finish() to get the result of the operation. 15492 * 15493 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor. 15494 */ 15495 void 15496 control_host_proxy_new ( 15497 GDBusConnection *connection, 15498 GDBusProxyFlags flags, 15499 const gchar *name, 15500 const gchar *object_path, 15501 GCancellable *cancellable, 15502 GAsyncReadyCallback callback, 15503 gpointer user_data) 15504 { 15505 g_async_initable_new_async (TYPE_CONTROL_HOST_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL); 15506 } 15507 15508 /** 15509 * control_host_proxy_new_finish: 15510 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new(). 15511 * @error: Return location for error or %NULL 15512 * 15513 * Finishes an operation started with control_host_proxy_new(). 15514 * 15515 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. 15516 */ 15517 ControlHost * 15518 control_host_proxy_new_finish ( 15519 GAsyncResult *res, 15520 GError **error) 15521 { 15522 GObject *ret; 15523 GObject *source_object; 15524 source_object = g_async_result_get_source_object (res); 15525 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 15526 g_object_unref (source_object); 15527 if (ret != NULL) 15528 return CONTROL_HOST (ret); 15529 else 15530 return NULL; 15531 } 15532 15533 /** 15534 * control_host_proxy_new_sync: 15535 * @connection: A #GDBusConnection. 15536 * @flags: Flags from the #GDBusProxyFlags enumeration. 15537 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 15538 * @object_path: An object path. 15539 * @cancellable: (allow-none): A #GCancellable or %NULL. 15540 * @error: Return location for error or %NULL 15541 * 15542 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new_sync() for more details. 15543 * 15544 * The calling thread is blocked until a reply is received. 15545 * 15546 * See control_host_proxy_new() for the asynchronous version of this constructor. 15547 * 15548 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. 15549 */ 15550 ControlHost * 15551 control_host_proxy_new_sync ( 15552 GDBusConnection *connection, 15553 GDBusProxyFlags flags, 15554 const gchar *name, 15555 const gchar *object_path, 15556 GCancellable *cancellable, 15557 GError **error) 15558 { 15559 GInitable *ret; 15560 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL); 15561 if (ret != NULL) 15562 return CONTROL_HOST (ret); 15563 else 15564 return NULL; 15565 } 15566 15567 15568 /** 15569 * control_host_proxy_new_for_bus: 15570 * @bus_type: A #GBusType. 15571 * @flags: Flags from the #GDBusProxyFlags enumeration. 15572 * @name: A bus name (well-known or unique). 15573 * @object_path: An object path. 15574 * @cancellable: (allow-none): A #GCancellable or %NULL. 15575 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 15576 * @user_data: User data to pass to @callback. 15577 * 15578 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 15579 * 15580 * 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. 15581 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation. 15582 * 15583 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 15584 */ 15585 void 15586 control_host_proxy_new_for_bus ( 15587 GBusType bus_type, 15588 GDBusProxyFlags flags, 15589 const gchar *name, 15590 const gchar *object_path, 15591 GCancellable *cancellable, 15592 GAsyncReadyCallback callback, 15593 gpointer user_data) 15594 { 15595 g_async_initable_new_async (TYPE_CONTROL_HOST_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL); 15596 } 15597 15598 /** 15599 * control_host_proxy_new_for_bus_finish: 15600 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus(). 15601 * @error: Return location for error or %NULL 15602 * 15603 * Finishes an operation started with control_host_proxy_new_for_bus(). 15604 * 15605 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. 15606 */ 15607 ControlHost * 15608 control_host_proxy_new_for_bus_finish ( 15609 GAsyncResult *res, 15610 GError **error) 15611 { 15612 GObject *ret; 15613 GObject *source_object; 15614 source_object = g_async_result_get_source_object (res); 15615 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 15616 g_object_unref (source_object); 15617 if (ret != NULL) 15618 return CONTROL_HOST (ret); 15619 else 15620 return NULL; 15621 } 15622 15623 /** 15624 * control_host_proxy_new_for_bus_sync: 15625 * @bus_type: A #GBusType. 15626 * @flags: Flags from the #GDBusProxyFlags enumeration. 15627 * @name: A bus name (well-known or unique). 15628 * @object_path: An object path. 15629 * @cancellable: (allow-none): A #GCancellable or %NULL. 15630 * @error: Return location for error or %NULL 15631 * 15632 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 15633 * 15634 * The calling thread is blocked until a reply is received. 15635 * 15636 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor. 15637 * 15638 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set. 15639 */ 15640 ControlHost * 15641 control_host_proxy_new_for_bus_sync ( 15642 GBusType bus_type, 15643 GDBusProxyFlags flags, 15644 const gchar *name, 15645 const gchar *object_path, 15646 GCancellable *cancellable, 15647 GError **error) 15648 { 15649 GInitable *ret; 15650 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL); 15651 if (ret != NULL) 15652 return CONTROL_HOST (ret); 15653 else 15654 return NULL; 15655 } 15656 15657 15658 /* ------------------------------------------------------------------------ */ 15659 15660 /** 15661 * ControlHostSkeleton: 15662 * 15663 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API. 15664 */ 15665 15666 /** 15667 * ControlHostSkeletonClass: 15668 * @parent_class: The parent class. 15669 * 15670 * Class structure for #ControlHostSkeleton. 15671 */ 15672 15673 struct _ControlHostSkeletonPrivate 15674 { 15675 GValue *properties; 15676 GList *changed_properties; 15677 GSource *changed_properties_idle_source; 15678 GMainContext *context; 15679 GMutex lock; 15680 }; 15681 15682 static void 15683 _control_host_skeleton_handle_method_call ( 15684 GDBusConnection *connection G_GNUC_UNUSED, 15685 const gchar *sender G_GNUC_UNUSED, 15686 const gchar *object_path G_GNUC_UNUSED, 15687 const gchar *interface_name, 15688 const gchar *method_name, 15689 GVariant *parameters, 15690 GDBusMethodInvocation *invocation, 15691 gpointer user_data) 15692 { 15693 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); 15694 _ExtendedGDBusMethodInfo *info; 15695 GVariantIter iter; 15696 GVariant *child; 15697 GValue *paramv; 15698 guint num_params; 15699 guint num_extra; 15700 guint n; 15701 guint signal_id; 15702 GValue return_value = G_VALUE_INIT; 15703 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 15704 g_assert (info != NULL); 15705 num_params = g_variant_n_children (parameters); 15706 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 15707 n = 0; 15708 g_value_init (¶mv[n], TYPE_CONTROL_HOST); 15709 g_value_set_object (¶mv[n++], skeleton); 15710 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 15711 g_value_set_object (¶mv[n++], invocation); 15712 if (info->pass_fdlist) 15713 { 15714 #ifdef G_OS_UNIX 15715 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 15716 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 15717 #else 15718 g_assert_not_reached (); 15719 #endif 15720 } 15721 g_variant_iter_init (&iter, parameters); 15722 while ((child = g_variant_iter_next_value (&iter)) != NULL) 15723 { 15724 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 15725 if (arg_info->use_gvariant) 15726 { 15727 g_value_init (¶mv[n], G_TYPE_VARIANT); 15728 g_value_set_variant (¶mv[n], child); 15729 n++; 15730 } 15731 else 15732 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 15733 g_variant_unref (child); 15734 } 15735 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST); 15736 g_value_init (&return_value, G_TYPE_BOOLEAN); 15737 g_signal_emitv (paramv, signal_id, 0, &return_value); 15738 if (!g_value_get_boolean (&return_value)) 15739 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); 15740 g_value_unset (&return_value); 15741 for (n = 0; n < num_params + num_extra; n++) 15742 g_value_unset (¶mv[n]); 15743 g_free (paramv); 15744 } 15745 15746 static GVariant * 15747 _control_host_skeleton_handle_get_property ( 15748 GDBusConnection *connection G_GNUC_UNUSED, 15749 const gchar *sender G_GNUC_UNUSED, 15750 const gchar *object_path G_GNUC_UNUSED, 15751 const gchar *interface_name G_GNUC_UNUSED, 15752 const gchar *property_name, 15753 GError **error, 15754 gpointer user_data) 15755 { 15756 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); 15757 GValue value = G_VALUE_INIT; 15758 GParamSpec *pspec; 15759 _ExtendedGDBusPropertyInfo *info; 15760 GVariant *ret; 15761 ret = NULL; 15762 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); 15763 g_assert (info != NULL); 15764 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 15765 if (pspec == NULL) 15766 { 15767 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 15768 } 15769 else 15770 { 15771 g_value_init (&value, pspec->value_type); 15772 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 15773 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 15774 g_value_unset (&value); 15775 } 15776 return ret; 15777 } 15778 15779 static gboolean 15780 _control_host_skeleton_handle_set_property ( 15781 GDBusConnection *connection G_GNUC_UNUSED, 15782 const gchar *sender G_GNUC_UNUSED, 15783 const gchar *object_path G_GNUC_UNUSED, 15784 const gchar *interface_name G_GNUC_UNUSED, 15785 const gchar *property_name, 15786 GVariant *variant, 15787 GError **error, 15788 gpointer user_data) 15789 { 15790 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); 15791 GValue value = G_VALUE_INIT; 15792 GParamSpec *pspec; 15793 _ExtendedGDBusPropertyInfo *info; 15794 gboolean ret; 15795 ret = FALSE; 15796 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name); 15797 g_assert (info != NULL); 15798 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 15799 if (pspec == NULL) 15800 { 15801 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 15802 } 15803 else 15804 { 15805 if (info->use_gvariant) 15806 g_value_set_variant (&value, variant); 15807 else 15808 g_dbus_gvariant_to_gvalue (variant, &value); 15809 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 15810 g_value_unset (&value); 15811 ret = TRUE; 15812 } 15813 return ret; 15814 } 15815 15816 static const GDBusInterfaceVTable _control_host_skeleton_vtable = 15817 { 15818 _control_host_skeleton_handle_method_call, 15819 _control_host_skeleton_handle_get_property, 15820 _control_host_skeleton_handle_set_property, 15821 {NULL} 15822 }; 15823 15824 static GDBusInterfaceInfo * 15825 control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 15826 { 15827 return control_host_interface_info (); 15828 } 15829 15830 static GDBusInterfaceVTable * 15831 control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 15832 { 15833 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable; 15834 } 15835 15836 static GVariant * 15837 control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 15838 { 15839 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton); 15840 15841 GVariantBuilder builder; 15842 guint n; 15843 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 15844 if (_control_host_interface_info.parent_struct.properties == NULL) 15845 goto out; 15846 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++) 15847 { 15848 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n]; 15849 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 15850 { 15851 GVariant *value; 15852 value = _control_host_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", info->name, NULL, skeleton); 15853 if (value != NULL) 15854 { 15855 g_variant_take_ref (value); 15856 g_variant_builder_add (&builder, "{sv}", info->name, value); 15857 g_variant_unref (value); 15858 } 15859 } 15860 } 15861 out: 15862 return g_variant_builder_end (&builder); 15863 } 15864 15865 static gboolean _control_host_emit_changed (gpointer user_data); 15866 15867 static void 15868 control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 15869 { 15870 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton); 15871 gboolean emit_changed = FALSE; 15872 15873 g_mutex_lock (&skeleton->priv->lock); 15874 if (skeleton->priv->changed_properties_idle_source != NULL) 15875 { 15876 g_source_destroy (skeleton->priv->changed_properties_idle_source); 15877 skeleton->priv->changed_properties_idle_source = NULL; 15878 emit_changed = TRUE; 15879 } 15880 g_mutex_unlock (&skeleton->priv->lock); 15881 15882 if (emit_changed) 15883 _control_host_emit_changed (skeleton); 15884 } 15885 15886 static void 15887 _control_host_on_signal_booted ( 15888 ControlHost *object) 15889 { 15890 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); 15891 15892 GList *connections, *l; 15893 GVariant *signal_variant; 15894 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 15895 15896 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 15897 for (l = connections; l != NULL; l = l->next) 15898 { 15899 GDBusConnection *connection = l->data; 15900 g_dbus_connection_emit_signal (connection, 15901 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted", 15902 signal_variant, NULL); 15903 } 15904 g_variant_unref (signal_variant); 15905 g_list_free_full (connections, g_object_unref); 15906 } 15907 15908 static void control_host_skeleton_iface_init (ControlHostIface *iface); 15909 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 15910 G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 15911 G_ADD_PRIVATE (ControlHostSkeleton) 15912 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); 15913 15914 #else 15915 G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 15916 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init)); 15917 15918 #endif 15919 static void 15920 control_host_skeleton_finalize (GObject *object) 15921 { 15922 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); 15923 guint n; 15924 for (n = 0; n < 2; n++) 15925 g_value_unset (&skeleton->priv->properties[n]); 15926 g_free (skeleton->priv->properties); 15927 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 15928 if (skeleton->priv->changed_properties_idle_source != NULL) 15929 g_source_destroy (skeleton->priv->changed_properties_idle_source); 15930 g_main_context_unref (skeleton->priv->context); 15931 g_mutex_clear (&skeleton->priv->lock); 15932 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object); 15933 } 15934 15935 static void 15936 control_host_skeleton_get_property (GObject *object, 15937 guint prop_id, 15938 GValue *value, 15939 GParamSpec *pspec G_GNUC_UNUSED) 15940 { 15941 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); 15942 g_assert (prop_id != 0 && prop_id - 1 < 2); 15943 g_mutex_lock (&skeleton->priv->lock); 15944 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 15945 g_mutex_unlock (&skeleton->priv->lock); 15946 } 15947 15948 static gboolean 15949 _control_host_emit_changed (gpointer user_data) 15950 { 15951 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data); 15952 GList *l; 15953 GVariantBuilder builder; 15954 GVariantBuilder invalidated_builder; 15955 guint num_changes; 15956 15957 g_mutex_lock (&skeleton->priv->lock); 15958 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 15959 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 15960 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 15961 { 15962 ChangedProperty *cp = l->data; 15963 GVariant *variant; 15964 const GValue *cur_value; 15965 15966 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 15967 if (!_g_value_equal (cur_value, &cp->orig_value)) 15968 { 15969 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 15970 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 15971 g_variant_unref (variant); 15972 num_changes++; 15973 } 15974 } 15975 if (num_changes > 0) 15976 { 15977 GList *connections, *ll; 15978 GVariant *signal_variant; 15979 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host", 15980 &builder, &invalidated_builder)); 15981 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 15982 for (ll = connections; ll != NULL; ll = ll->next) 15983 { 15984 GDBusConnection *connection = ll->data; 15985 15986 g_dbus_connection_emit_signal (connection, 15987 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 15988 "org.freedesktop.DBus.Properties", 15989 "PropertiesChanged", 15990 signal_variant, 15991 NULL); 15992 } 15993 g_variant_unref (signal_variant); 15994 g_list_free_full (connections, g_object_unref); 15995 } 15996 else 15997 { 15998 g_variant_builder_clear (&builder); 15999 g_variant_builder_clear (&invalidated_builder); 16000 } 16001 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 16002 skeleton->priv->changed_properties = NULL; 16003 skeleton->priv->changed_properties_idle_source = NULL; 16004 g_mutex_unlock (&skeleton->priv->lock); 16005 return FALSE; 16006 } 16007 16008 static void 16009 _control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 16010 { 16011 ChangedProperty *cp; 16012 GList *l; 16013 cp = NULL; 16014 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 16015 { 16016 ChangedProperty *i_cp = l->data; 16017 if (i_cp->info == info) 16018 { 16019 cp = i_cp; 16020 break; 16021 } 16022 } 16023 if (cp == NULL) 16024 { 16025 cp = g_new0 (ChangedProperty, 1); 16026 cp->prop_id = prop_id; 16027 cp->info = info; 16028 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 16029 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 16030 g_value_copy (orig_value, &cp->orig_value); 16031 } 16032 } 16033 16034 static void 16035 control_host_skeleton_notify (GObject *object, 16036 GParamSpec *pspec G_GNUC_UNUSED) 16037 { 16038 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); 16039 g_mutex_lock (&skeleton->priv->lock); 16040 if (skeleton->priv->changed_properties != NULL && 16041 skeleton->priv->changed_properties_idle_source == NULL) 16042 { 16043 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 16044 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 16045 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 16046 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_host_emit_changed"); 16047 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 16048 g_source_unref (skeleton->priv->changed_properties_idle_source); 16049 } 16050 g_mutex_unlock (&skeleton->priv->lock); 16051 } 16052 16053 static void 16054 control_host_skeleton_set_property (GObject *object, 16055 guint prop_id, 16056 const GValue *value, 16057 GParamSpec *pspec) 16058 { 16059 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); 16060 g_assert (prop_id != 0 && prop_id - 1 < 2); 16061 g_mutex_lock (&skeleton->priv->lock); 16062 g_object_freeze_notify (object); 16063 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 16064 { 16065 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 16066 _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 16067 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 16068 g_object_notify_by_pspec (object, pspec); 16069 } 16070 g_mutex_unlock (&skeleton->priv->lock); 16071 g_object_thaw_notify (object); 16072 } 16073 16074 static void 16075 control_host_skeleton_init (ControlHostSkeleton *skeleton) 16076 { 16077 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 16078 skeleton->priv = control_host_skeleton_get_instance_private (skeleton); 16079 #else 16080 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate); 16081 #endif 16082 16083 g_mutex_init (&skeleton->priv->lock); 16084 skeleton->priv->context = g_main_context_ref_thread_default (); 16085 skeleton->priv->properties = g_new0 (GValue, 2); 16086 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); 16087 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); 16088 } 16089 16090 static gint 16091 control_host_skeleton_get_debug_mode (ControlHost *object) 16092 { 16093 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); 16094 gint value; 16095 g_mutex_lock (&skeleton->priv->lock); 16096 value = g_value_get_int (&(skeleton->priv->properties[0])); 16097 g_mutex_unlock (&skeleton->priv->lock); 16098 return value; 16099 } 16100 16101 static const gchar * 16102 control_host_skeleton_get_flash_side (ControlHost *object) 16103 { 16104 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object); 16105 const gchar *value; 16106 g_mutex_lock (&skeleton->priv->lock); 16107 value = g_value_get_string (&(skeleton->priv->properties[1])); 16108 g_mutex_unlock (&skeleton->priv->lock); 16109 return value; 16110 } 16111 16112 static void 16113 control_host_skeleton_class_init (ControlHostSkeletonClass *klass) 16114 { 16115 GObjectClass *gobject_class; 16116 GDBusInterfaceSkeletonClass *skeleton_class; 16117 16118 gobject_class = G_OBJECT_CLASS (klass); 16119 gobject_class->finalize = control_host_skeleton_finalize; 16120 gobject_class->get_property = control_host_skeleton_get_property; 16121 gobject_class->set_property = control_host_skeleton_set_property; 16122 gobject_class->notify = control_host_skeleton_notify; 16123 16124 16125 control_host_override_properties (gobject_class, 1); 16126 16127 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 16128 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info; 16129 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties; 16130 skeleton_class->flush = control_host_skeleton_dbus_interface_flush; 16131 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable; 16132 16133 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 16134 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate)); 16135 #endif 16136 } 16137 16138 static void 16139 control_host_skeleton_iface_init (ControlHostIface *iface) 16140 { 16141 iface->booted = _control_host_on_signal_booted; 16142 iface->get_debug_mode = control_host_skeleton_get_debug_mode; 16143 iface->get_flash_side = control_host_skeleton_get_flash_side; 16144 } 16145 16146 /** 16147 * control_host_skeleton_new: 16148 * 16149 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. 16150 * 16151 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object. 16152 */ 16153 ControlHost * 16154 control_host_skeleton_new (void) 16155 { 16156 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL)); 16157 } 16158 16159 /* ------------------------------------------------------------------------ 16160 * Code for interface org.openbmc.control.Power 16161 * ------------------------------------------------------------------------ 16162 */ 16163 16164 /** 16165 * SECTION:ControlPower 16166 * @title: ControlPower 16167 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface 16168 * 16169 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface in C. 16170 */ 16171 16172 /* ---- Introspection data for org.openbmc.control.Power ---- */ 16173 16174 static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state = 16175 { 16176 { 16177 -1, 16178 (gchar *) "state", 16179 (gchar *) "i", 16180 NULL 16181 }, 16182 FALSE 16183 }; 16184 16185 static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] = 16186 { 16187 &_control_power_method_info_set_power_state_IN_ARG_state, 16188 NULL 16189 }; 16190 16191 static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state = 16192 { 16193 { 16194 -1, 16195 (gchar *) "setPowerState", 16196 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers, 16197 NULL, 16198 NULL 16199 }, 16200 "handle-set-power-state", 16201 FALSE 16202 }; 16203 16204 static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state = 16205 { 16206 { 16207 -1, 16208 (gchar *) "state", 16209 (gchar *) "i", 16210 NULL 16211 }, 16212 FALSE 16213 }; 16214 16215 static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] = 16216 { 16217 &_control_power_method_info_get_power_state_OUT_ARG_state, 16218 NULL 16219 }; 16220 16221 static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state = 16222 { 16223 { 16224 -1, 16225 (gchar *) "getPowerState", 16226 NULL, 16227 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers, 16228 NULL 16229 }, 16230 "handle-get-power-state", 16231 FALSE 16232 }; 16233 16234 static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] = 16235 { 16236 &_control_power_method_info_set_power_state, 16237 &_control_power_method_info_get_power_state, 16238 NULL 16239 }; 16240 16241 static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good = 16242 { 16243 { 16244 -1, 16245 (gchar *) "PowerGood", 16246 NULL, 16247 NULL 16248 }, 16249 "power-good" 16250 }; 16251 16252 static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost = 16253 { 16254 { 16255 -1, 16256 (gchar *) "PowerLost", 16257 NULL, 16258 NULL 16259 }, 16260 "power-lost" 16261 }; 16262 16263 static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] = 16264 { 16265 &_control_power_signal_info_power_good, 16266 &_control_power_signal_info_power_lost, 16267 NULL 16268 }; 16269 16270 static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood = 16271 { 16272 { 16273 -1, 16274 (gchar *) "pgood", 16275 (gchar *) "i", 16276 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 16277 NULL 16278 }, 16279 "pgood", 16280 FALSE 16281 }; 16282 16283 static const _ExtendedGDBusPropertyInfo _control_power_property_info_state = 16284 { 16285 { 16286 -1, 16287 (gchar *) "state", 16288 (gchar *) "i", 16289 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 16290 NULL 16291 }, 16292 "state", 16293 FALSE 16294 }; 16295 16296 static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout = 16297 { 16298 { 16299 -1, 16300 (gchar *) "pgood_timeout", 16301 (gchar *) "i", 16302 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 16303 NULL 16304 }, 16305 "pgood-timeout", 16306 FALSE 16307 }; 16308 16309 static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] = 16310 { 16311 &_control_power_property_info_pgood, 16312 &_control_power_property_info_state, 16313 &_control_power_property_info_pgood_timeout, 16314 NULL 16315 }; 16316 16317 static const _ExtendedGDBusInterfaceInfo _control_power_interface_info = 16318 { 16319 { 16320 -1, 16321 (gchar *) "org.openbmc.control.Power", 16322 (GDBusMethodInfo **) &_control_power_method_info_pointers, 16323 (GDBusSignalInfo **) &_control_power_signal_info_pointers, 16324 (GDBusPropertyInfo **) &_control_power_property_info_pointers, 16325 NULL 16326 }, 16327 "control-power", 16328 }; 16329 16330 16331 /** 16332 * control_power_interface_info: 16333 * 16334 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface. 16335 * 16336 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 16337 */ 16338 GDBusInterfaceInfo * 16339 control_power_interface_info (void) 16340 { 16341 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct; 16342 } 16343 16344 /** 16345 * control_power_override_properties: 16346 * @klass: The class structure for a #GObject<!-- -->-derived class. 16347 * @property_id_begin: The property id to assign to the first overridden property. 16348 * 16349 * Overrides all #GObject properties in the #ControlPower interface for a concrete class. 16350 * The properties are overridden in the order they are defined. 16351 * 16352 * Returns: The last property id. 16353 */ 16354 guint 16355 control_power_override_properties (GObjectClass *klass, guint property_id_begin) 16356 { 16357 g_object_class_override_property (klass, property_id_begin++, "pgood"); 16358 g_object_class_override_property (klass, property_id_begin++, "state"); 16359 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout"); 16360 return property_id_begin - 1; 16361 } 16362 16363 16364 16365 /** 16366 * ControlPower: 16367 * 16368 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. 16369 */ 16370 16371 /** 16372 * ControlPowerIface: 16373 * @parent_iface: The parent interface. 16374 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal. 16375 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal. 16376 * @get_pgood: Getter for the #ControlPower:pgood property. 16377 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property. 16378 * @get_state: Getter for the #ControlPower:state property. 16379 * @power_good: Handler for the #ControlPower::power-good signal. 16380 * @power_lost: Handler for the #ControlPower::power-lost signal. 16381 * 16382 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. 16383 */ 16384 16385 typedef ControlPowerIface ControlPowerInterface; 16386 G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT); 16387 16388 static void 16389 control_power_default_init (ControlPowerIface *iface) 16390 { 16391 /* GObject signals for incoming D-Bus method calls: */ 16392 /** 16393 * ControlPower::handle-set-power-state: 16394 * @object: A #ControlPower. 16395 * @invocation: A #GDBusMethodInvocation. 16396 * @arg_state: Argument passed by remote caller. 16397 * 16398 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method. 16399 * 16400 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_power_complete_set_power_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 16401 * 16402 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 16403 */ 16404 g_signal_new ("handle-set-power-state", 16405 G_TYPE_FROM_INTERFACE (iface), 16406 G_SIGNAL_RUN_LAST, 16407 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state), 16408 g_signal_accumulator_true_handled, 16409 NULL, 16410 g_cclosure_marshal_generic, 16411 G_TYPE_BOOLEAN, 16412 2, 16413 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); 16414 16415 /** 16416 * ControlPower::handle-get-power-state: 16417 * @object: A #ControlPower. 16418 * @invocation: A #GDBusMethodInvocation. 16419 * 16420 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method. 16421 * 16422 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_power_complete_get_power_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 16423 * 16424 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 16425 */ 16426 g_signal_new ("handle-get-power-state", 16427 G_TYPE_FROM_INTERFACE (iface), 16428 G_SIGNAL_RUN_LAST, 16429 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state), 16430 g_signal_accumulator_true_handled, 16431 NULL, 16432 g_cclosure_marshal_generic, 16433 G_TYPE_BOOLEAN, 16434 1, 16435 G_TYPE_DBUS_METHOD_INVOCATION); 16436 16437 /* GObject signals for received D-Bus signals: */ 16438 /** 16439 * ControlPower::power-good: 16440 * @object: A #ControlPower. 16441 * 16442 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> is received. 16443 * 16444 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 16445 */ 16446 g_signal_new ("power-good", 16447 G_TYPE_FROM_INTERFACE (iface), 16448 G_SIGNAL_RUN_LAST, 16449 G_STRUCT_OFFSET (ControlPowerIface, power_good), 16450 NULL, 16451 NULL, 16452 g_cclosure_marshal_generic, 16453 G_TYPE_NONE, 16454 0); 16455 16456 /** 16457 * ControlPower::power-lost: 16458 * @object: A #ControlPower. 16459 * 16460 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> is received. 16461 * 16462 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 16463 */ 16464 g_signal_new ("power-lost", 16465 G_TYPE_FROM_INTERFACE (iface), 16466 G_SIGNAL_RUN_LAST, 16467 G_STRUCT_OFFSET (ControlPowerIface, power_lost), 16468 NULL, 16469 NULL, 16470 g_cclosure_marshal_generic, 16471 G_TYPE_NONE, 16472 0); 16473 16474 /* GObject properties for D-Bus properties: */ 16475 /** 16476 * ControlPower:pgood: 16477 * 16478 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>. 16479 * 16480 * 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. 16481 */ 16482 g_object_interface_install_property (iface, 16483 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 16484 /** 16485 * ControlPower:state: 16486 * 16487 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>. 16488 * 16489 * 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. 16490 */ 16491 g_object_interface_install_property (iface, 16492 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 16493 /** 16494 * ControlPower:pgood-timeout: 16495 * 16496 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>. 16497 * 16498 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 16499 */ 16500 g_object_interface_install_property (iface, 16501 g_param_spec_int ("pgood-timeout", "pgood_timeout", "pgood_timeout", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 16502 } 16503 16504 /** 16505 * control_power_get_pgood: (skip) 16506 * @object: A #ControlPower. 16507 * 16508 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property. 16509 * 16510 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 16511 * 16512 * Returns: The property value. 16513 */ 16514 gint 16515 control_power_get_pgood (ControlPower *object) 16516 { 16517 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object); 16518 } 16519 16520 /** 16521 * control_power_set_pgood: (skip) 16522 * @object: A #ControlPower. 16523 * @value: The value to set. 16524 * 16525 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value. 16526 * 16527 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 16528 */ 16529 void 16530 control_power_set_pgood (ControlPower *object, gint value) 16531 { 16532 g_object_set (G_OBJECT (object), "pgood", value, NULL); 16533 } 16534 16535 /** 16536 * control_power_get_state: (skip) 16537 * @object: A #ControlPower. 16538 * 16539 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property. 16540 * 16541 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 16542 * 16543 * Returns: The property value. 16544 */ 16545 gint 16546 control_power_get_state (ControlPower *object) 16547 { 16548 return CONTROL_POWER_GET_IFACE (object)->get_state (object); 16549 } 16550 16551 /** 16552 * control_power_set_state: (skip) 16553 * @object: A #ControlPower. 16554 * @value: The value to set. 16555 * 16556 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value. 16557 * 16558 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 16559 */ 16560 void 16561 control_power_set_state (ControlPower *object, gint value) 16562 { 16563 g_object_set (G_OBJECT (object), "state", value, NULL); 16564 } 16565 16566 /** 16567 * control_power_get_pgood_timeout: (skip) 16568 * @object: A #ControlPower. 16569 * 16570 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property. 16571 * 16572 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 16573 * 16574 * Returns: The property value. 16575 */ 16576 gint 16577 control_power_get_pgood_timeout (ControlPower *object) 16578 { 16579 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object); 16580 } 16581 16582 /** 16583 * control_power_set_pgood_timeout: (skip) 16584 * @object: A #ControlPower. 16585 * @value: The value to set. 16586 * 16587 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value. 16588 * 16589 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 16590 */ 16591 void 16592 control_power_set_pgood_timeout (ControlPower *object, gint value) 16593 { 16594 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL); 16595 } 16596 16597 /** 16598 * control_power_emit_power_good: 16599 * @object: A #ControlPower. 16600 * 16601 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal. 16602 */ 16603 void 16604 control_power_emit_power_good ( 16605 ControlPower *object) 16606 { 16607 g_signal_emit_by_name (object, "power-good"); 16608 } 16609 16610 /** 16611 * control_power_emit_power_lost: 16612 * @object: A #ControlPower. 16613 * 16614 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal. 16615 */ 16616 void 16617 control_power_emit_power_lost ( 16618 ControlPower *object) 16619 { 16620 g_signal_emit_by_name (object, "power-lost"); 16621 } 16622 16623 /** 16624 * control_power_call_set_power_state: 16625 * @proxy: A #ControlPowerProxy. 16626 * @arg_state: Argument to pass with the method invocation. 16627 * @cancellable: (allow-none): A #GCancellable or %NULL. 16628 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 16629 * @user_data: User data to pass to @callback. 16630 * 16631 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. 16632 * 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. 16633 * You can then call control_power_call_set_power_state_finish() to get the result of the operation. 16634 * 16635 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method. 16636 */ 16637 void 16638 control_power_call_set_power_state ( 16639 ControlPower *proxy, 16640 gint arg_state, 16641 GCancellable *cancellable, 16642 GAsyncReadyCallback callback, 16643 gpointer user_data) 16644 { 16645 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 16646 "setPowerState", 16647 g_variant_new ("(i)", 16648 arg_state), 16649 G_DBUS_CALL_FLAGS_NONE, 16650 -1, 16651 cancellable, 16652 callback, 16653 user_data); 16654 } 16655 16656 /** 16657 * control_power_call_set_power_state_finish: 16658 * @proxy: A #ControlPowerProxy. 16659 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state(). 16660 * @error: Return location for error or %NULL. 16661 * 16662 * Finishes an operation started with control_power_call_set_power_state(). 16663 * 16664 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 16665 */ 16666 gboolean 16667 control_power_call_set_power_state_finish ( 16668 ControlPower *proxy, 16669 GAsyncResult *res, 16670 GError **error) 16671 { 16672 GVariant *_ret; 16673 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 16674 if (_ret == NULL) 16675 goto _out; 16676 g_variant_get (_ret, 16677 "()"); 16678 g_variant_unref (_ret); 16679 _out: 16680 return _ret != NULL; 16681 } 16682 16683 /** 16684 * control_power_call_set_power_state_sync: 16685 * @proxy: A #ControlPowerProxy. 16686 * @arg_state: Argument to pass with the method invocation. 16687 * @cancellable: (allow-none): A #GCancellable or %NULL. 16688 * @error: Return location for error or %NULL. 16689 * 16690 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 16691 * 16692 * See control_power_call_set_power_state() for the asynchronous version of this method. 16693 * 16694 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 16695 */ 16696 gboolean 16697 control_power_call_set_power_state_sync ( 16698 ControlPower *proxy, 16699 gint arg_state, 16700 GCancellable *cancellable, 16701 GError **error) 16702 { 16703 GVariant *_ret; 16704 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 16705 "setPowerState", 16706 g_variant_new ("(i)", 16707 arg_state), 16708 G_DBUS_CALL_FLAGS_NONE, 16709 -1, 16710 cancellable, 16711 error); 16712 if (_ret == NULL) 16713 goto _out; 16714 g_variant_get (_ret, 16715 "()"); 16716 g_variant_unref (_ret); 16717 _out: 16718 return _ret != NULL; 16719 } 16720 16721 /** 16722 * control_power_call_get_power_state: 16723 * @proxy: A #ControlPowerProxy. 16724 * @cancellable: (allow-none): A #GCancellable or %NULL. 16725 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 16726 * @user_data: User data to pass to @callback. 16727 * 16728 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. 16729 * 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. 16730 * You can then call control_power_call_get_power_state_finish() to get the result of the operation. 16731 * 16732 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method. 16733 */ 16734 void 16735 control_power_call_get_power_state ( 16736 ControlPower *proxy, 16737 GCancellable *cancellable, 16738 GAsyncReadyCallback callback, 16739 gpointer user_data) 16740 { 16741 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 16742 "getPowerState", 16743 g_variant_new ("()"), 16744 G_DBUS_CALL_FLAGS_NONE, 16745 -1, 16746 cancellable, 16747 callback, 16748 user_data); 16749 } 16750 16751 /** 16752 * control_power_call_get_power_state_finish: 16753 * @proxy: A #ControlPowerProxy. 16754 * @out_state: (out): Return location for return parameter or %NULL to ignore. 16755 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state(). 16756 * @error: Return location for error or %NULL. 16757 * 16758 * Finishes an operation started with control_power_call_get_power_state(). 16759 * 16760 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 16761 */ 16762 gboolean 16763 control_power_call_get_power_state_finish ( 16764 ControlPower *proxy, 16765 gint *out_state, 16766 GAsyncResult *res, 16767 GError **error) 16768 { 16769 GVariant *_ret; 16770 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 16771 if (_ret == NULL) 16772 goto _out; 16773 g_variant_get (_ret, 16774 "(i)", 16775 out_state); 16776 g_variant_unref (_ret); 16777 _out: 16778 return _ret != NULL; 16779 } 16780 16781 /** 16782 * control_power_call_get_power_state_sync: 16783 * @proxy: A #ControlPowerProxy. 16784 * @out_state: (out): Return location for return parameter or %NULL to ignore. 16785 * @cancellable: (allow-none): A #GCancellable or %NULL. 16786 * @error: Return location for error or %NULL. 16787 * 16788 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 16789 * 16790 * See control_power_call_get_power_state() for the asynchronous version of this method. 16791 * 16792 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 16793 */ 16794 gboolean 16795 control_power_call_get_power_state_sync ( 16796 ControlPower *proxy, 16797 gint *out_state, 16798 GCancellable *cancellable, 16799 GError **error) 16800 { 16801 GVariant *_ret; 16802 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 16803 "getPowerState", 16804 g_variant_new ("()"), 16805 G_DBUS_CALL_FLAGS_NONE, 16806 -1, 16807 cancellable, 16808 error); 16809 if (_ret == NULL) 16810 goto _out; 16811 g_variant_get (_ret, 16812 "(i)", 16813 out_state); 16814 g_variant_unref (_ret); 16815 _out: 16816 return _ret != NULL; 16817 } 16818 16819 /** 16820 * control_power_complete_set_power_state: 16821 * @object: A #ControlPower. 16822 * @invocation: (transfer full): A #GDBusMethodInvocation. 16823 * 16824 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 16825 * 16826 * This method will free @invocation, you cannot use it afterwards. 16827 */ 16828 void 16829 control_power_complete_set_power_state ( 16830 ControlPower *object, 16831 GDBusMethodInvocation *invocation) 16832 { 16833 g_dbus_method_invocation_return_value (invocation, 16834 g_variant_new ("()")); 16835 } 16836 16837 /** 16838 * control_power_complete_get_power_state: 16839 * @object: A #ControlPower. 16840 * @invocation: (transfer full): A #GDBusMethodInvocation. 16841 * @state: Parameter to return. 16842 * 16843 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 16844 * 16845 * This method will free @invocation, you cannot use it afterwards. 16846 */ 16847 void 16848 control_power_complete_get_power_state ( 16849 ControlPower *object, 16850 GDBusMethodInvocation *invocation, 16851 gint state) 16852 { 16853 g_dbus_method_invocation_return_value (invocation, 16854 g_variant_new ("(i)", 16855 state)); 16856 } 16857 16858 /* ------------------------------------------------------------------------ */ 16859 16860 /** 16861 * ControlPowerProxy: 16862 * 16863 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API. 16864 */ 16865 16866 /** 16867 * ControlPowerProxyClass: 16868 * @parent_class: The parent class. 16869 * 16870 * Class structure for #ControlPowerProxy. 16871 */ 16872 16873 struct _ControlPowerProxyPrivate 16874 { 16875 GData *qdata; 16876 }; 16877 16878 static void control_power_proxy_iface_init (ControlPowerIface *iface); 16879 16880 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 16881 G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, 16882 G_ADD_PRIVATE (ControlPowerProxy) 16883 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); 16884 16885 #else 16886 G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY, 16887 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init)); 16888 16889 #endif 16890 static void 16891 control_power_proxy_finalize (GObject *object) 16892 { 16893 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); 16894 g_datalist_clear (&proxy->priv->qdata); 16895 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object); 16896 } 16897 16898 static void 16899 control_power_proxy_get_property (GObject *object, 16900 guint prop_id, 16901 GValue *value, 16902 GParamSpec *pspec G_GNUC_UNUSED) 16903 { 16904 const _ExtendedGDBusPropertyInfo *info; 16905 GVariant *variant; 16906 g_assert (prop_id != 0 && prop_id - 1 < 3); 16907 info = _control_power_property_info_pointers[prop_id - 1]; 16908 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 16909 if (info->use_gvariant) 16910 { 16911 g_value_set_variant (value, variant); 16912 } 16913 else 16914 { 16915 if (variant != NULL) 16916 g_dbus_gvariant_to_gvalue (variant, value); 16917 } 16918 if (variant != NULL) 16919 g_variant_unref (variant); 16920 } 16921 16922 static void 16923 control_power_proxy_set_property_cb (GDBusProxy *proxy, 16924 GAsyncResult *res, 16925 gpointer user_data) 16926 { 16927 const _ExtendedGDBusPropertyInfo *info = user_data; 16928 GError *error; 16929 GVariant *_ret; 16930 error = NULL; 16931 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 16932 if (!_ret) 16933 { 16934 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)", 16935 info->parent_struct.name, 16936 error->message, g_quark_to_string (error->domain), error->code); 16937 g_error_free (error); 16938 } 16939 else 16940 { 16941 g_variant_unref (_ret); 16942 } 16943 } 16944 16945 static void 16946 control_power_proxy_set_property (GObject *object, 16947 guint prop_id, 16948 const GValue *value, 16949 GParamSpec *pspec G_GNUC_UNUSED) 16950 { 16951 const _ExtendedGDBusPropertyInfo *info; 16952 GVariant *variant; 16953 g_assert (prop_id != 0 && prop_id - 1 < 3); 16954 info = _control_power_property_info_pointers[prop_id - 1]; 16955 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 16956 g_dbus_proxy_call (G_DBUS_PROXY (object), 16957 "org.freedesktop.DBus.Properties.Set", 16958 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant), 16959 G_DBUS_CALL_FLAGS_NONE, 16960 -1, 16961 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 16962 g_variant_unref (variant); 16963 } 16964 16965 static void 16966 control_power_proxy_g_signal (GDBusProxy *proxy, 16967 const gchar *sender_name G_GNUC_UNUSED, 16968 const gchar *signal_name, 16969 GVariant *parameters) 16970 { 16971 _ExtendedGDBusSignalInfo *info; 16972 GVariantIter iter; 16973 GVariant *child; 16974 GValue *paramv; 16975 guint num_params; 16976 guint n; 16977 guint signal_id; 16978 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name); 16979 if (info == NULL) 16980 return; 16981 num_params = g_variant_n_children (parameters); 16982 paramv = g_new0 (GValue, num_params + 1); 16983 g_value_init (¶mv[0], TYPE_CONTROL_POWER); 16984 g_value_set_object (¶mv[0], proxy); 16985 g_variant_iter_init (&iter, parameters); 16986 n = 1; 16987 while ((child = g_variant_iter_next_value (&iter)) != NULL) 16988 { 16989 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 16990 if (arg_info->use_gvariant) 16991 { 16992 g_value_init (¶mv[n], G_TYPE_VARIANT); 16993 g_value_set_variant (¶mv[n], child); 16994 n++; 16995 } 16996 else 16997 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 16998 g_variant_unref (child); 16999 } 17000 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); 17001 g_signal_emitv (paramv, signal_id, 0, NULL); 17002 for (n = 0; n < num_params + 1; n++) 17003 g_value_unset (¶mv[n]); 17004 g_free (paramv); 17005 } 17006 17007 static void 17008 control_power_proxy_g_properties_changed (GDBusProxy *_proxy, 17009 GVariant *changed_properties, 17010 const gchar *const *invalidated_properties) 17011 { 17012 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy); 17013 guint n; 17014 const gchar *key; 17015 GVariantIter *iter; 17016 _ExtendedGDBusPropertyInfo *info; 17017 g_variant_get (changed_properties, "a{sv}", &iter); 17018 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 17019 { 17020 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key); 17021 g_datalist_remove_data (&proxy->priv->qdata, key); 17022 if (info != NULL) 17023 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 17024 } 17025 g_variant_iter_free (iter); 17026 for (n = 0; invalidated_properties[n] != NULL; n++) 17027 { 17028 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]); 17029 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 17030 if (info != NULL) 17031 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 17032 } 17033 } 17034 17035 static gint 17036 control_power_proxy_get_pgood (ControlPower *object) 17037 { 17038 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); 17039 GVariant *variant; 17040 gint value = 0; 17041 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood"); 17042 if (variant != NULL) 17043 { 17044 value = g_variant_get_int32 (variant); 17045 g_variant_unref (variant); 17046 } 17047 return value; 17048 } 17049 17050 static gint 17051 control_power_proxy_get_state (ControlPower *object) 17052 { 17053 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); 17054 GVariant *variant; 17055 gint value = 0; 17056 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); 17057 if (variant != NULL) 17058 { 17059 value = g_variant_get_int32 (variant); 17060 g_variant_unref (variant); 17061 } 17062 return value; 17063 } 17064 17065 static gint 17066 control_power_proxy_get_pgood_timeout (ControlPower *object) 17067 { 17068 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object); 17069 GVariant *variant; 17070 gint value = 0; 17071 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout"); 17072 if (variant != NULL) 17073 { 17074 value = g_variant_get_int32 (variant); 17075 g_variant_unref (variant); 17076 } 17077 return value; 17078 } 17079 17080 static void 17081 control_power_proxy_init (ControlPowerProxy *proxy) 17082 { 17083 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 17084 proxy->priv = control_power_proxy_get_instance_private (proxy); 17085 #else 17086 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate); 17087 #endif 17088 17089 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ()); 17090 } 17091 17092 static void 17093 control_power_proxy_class_init (ControlPowerProxyClass *klass) 17094 { 17095 GObjectClass *gobject_class; 17096 GDBusProxyClass *proxy_class; 17097 17098 gobject_class = G_OBJECT_CLASS (klass); 17099 gobject_class->finalize = control_power_proxy_finalize; 17100 gobject_class->get_property = control_power_proxy_get_property; 17101 gobject_class->set_property = control_power_proxy_set_property; 17102 17103 proxy_class = G_DBUS_PROXY_CLASS (klass); 17104 proxy_class->g_signal = control_power_proxy_g_signal; 17105 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed; 17106 17107 control_power_override_properties (gobject_class, 1); 17108 17109 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 17110 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate)); 17111 #endif 17112 } 17113 17114 static void 17115 control_power_proxy_iface_init (ControlPowerIface *iface) 17116 { 17117 iface->get_pgood = control_power_proxy_get_pgood; 17118 iface->get_state = control_power_proxy_get_state; 17119 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout; 17120 } 17121 17122 /** 17123 * control_power_proxy_new: 17124 * @connection: A #GDBusConnection. 17125 * @flags: Flags from the #GDBusProxyFlags enumeration. 17126 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 17127 * @object_path: An object path. 17128 * @cancellable: (allow-none): A #GCancellable or %NULL. 17129 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 17130 * @user_data: User data to pass to @callback. 17131 * 17132 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new() for more details. 17133 * 17134 * 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. 17135 * You can then call control_power_proxy_new_finish() to get the result of the operation. 17136 * 17137 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor. 17138 */ 17139 void 17140 control_power_proxy_new ( 17141 GDBusConnection *connection, 17142 GDBusProxyFlags flags, 17143 const gchar *name, 17144 const gchar *object_path, 17145 GCancellable *cancellable, 17146 GAsyncReadyCallback callback, 17147 gpointer user_data) 17148 { 17149 g_async_initable_new_async (TYPE_CONTROL_POWER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL); 17150 } 17151 17152 /** 17153 * control_power_proxy_new_finish: 17154 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new(). 17155 * @error: Return location for error or %NULL 17156 * 17157 * Finishes an operation started with control_power_proxy_new(). 17158 * 17159 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. 17160 */ 17161 ControlPower * 17162 control_power_proxy_new_finish ( 17163 GAsyncResult *res, 17164 GError **error) 17165 { 17166 GObject *ret; 17167 GObject *source_object; 17168 source_object = g_async_result_get_source_object (res); 17169 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 17170 g_object_unref (source_object); 17171 if (ret != NULL) 17172 return CONTROL_POWER (ret); 17173 else 17174 return NULL; 17175 } 17176 17177 /** 17178 * control_power_proxy_new_sync: 17179 * @connection: A #GDBusConnection. 17180 * @flags: Flags from the #GDBusProxyFlags enumeration. 17181 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 17182 * @object_path: An object path. 17183 * @cancellable: (allow-none): A #GCancellable or %NULL. 17184 * @error: Return location for error or %NULL 17185 * 17186 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new_sync() for more details. 17187 * 17188 * The calling thread is blocked until a reply is received. 17189 * 17190 * See control_power_proxy_new() for the asynchronous version of this constructor. 17191 * 17192 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. 17193 */ 17194 ControlPower * 17195 control_power_proxy_new_sync ( 17196 GDBusConnection *connection, 17197 GDBusProxyFlags flags, 17198 const gchar *name, 17199 const gchar *object_path, 17200 GCancellable *cancellable, 17201 GError **error) 17202 { 17203 GInitable *ret; 17204 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL); 17205 if (ret != NULL) 17206 return CONTROL_POWER (ret); 17207 else 17208 return NULL; 17209 } 17210 17211 17212 /** 17213 * control_power_proxy_new_for_bus: 17214 * @bus_type: A #GBusType. 17215 * @flags: Flags from the #GDBusProxyFlags enumeration. 17216 * @name: A bus name (well-known or unique). 17217 * @object_path: An object path. 17218 * @cancellable: (allow-none): A #GCancellable or %NULL. 17219 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 17220 * @user_data: User data to pass to @callback. 17221 * 17222 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 17223 * 17224 * 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. 17225 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation. 17226 * 17227 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 17228 */ 17229 void 17230 control_power_proxy_new_for_bus ( 17231 GBusType bus_type, 17232 GDBusProxyFlags flags, 17233 const gchar *name, 17234 const gchar *object_path, 17235 GCancellable *cancellable, 17236 GAsyncReadyCallback callback, 17237 gpointer user_data) 17238 { 17239 g_async_initable_new_async (TYPE_CONTROL_POWER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL); 17240 } 17241 17242 /** 17243 * control_power_proxy_new_for_bus_finish: 17244 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus(). 17245 * @error: Return location for error or %NULL 17246 * 17247 * Finishes an operation started with control_power_proxy_new_for_bus(). 17248 * 17249 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. 17250 */ 17251 ControlPower * 17252 control_power_proxy_new_for_bus_finish ( 17253 GAsyncResult *res, 17254 GError **error) 17255 { 17256 GObject *ret; 17257 GObject *source_object; 17258 source_object = g_async_result_get_source_object (res); 17259 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 17260 g_object_unref (source_object); 17261 if (ret != NULL) 17262 return CONTROL_POWER (ret); 17263 else 17264 return NULL; 17265 } 17266 17267 /** 17268 * control_power_proxy_new_for_bus_sync: 17269 * @bus_type: A #GBusType. 17270 * @flags: Flags from the #GDBusProxyFlags enumeration. 17271 * @name: A bus name (well-known or unique). 17272 * @object_path: An object path. 17273 * @cancellable: (allow-none): A #GCancellable or %NULL. 17274 * @error: Return location for error or %NULL 17275 * 17276 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 17277 * 17278 * The calling thread is blocked until a reply is received. 17279 * 17280 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor. 17281 * 17282 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set. 17283 */ 17284 ControlPower * 17285 control_power_proxy_new_for_bus_sync ( 17286 GBusType bus_type, 17287 GDBusProxyFlags flags, 17288 const gchar *name, 17289 const gchar *object_path, 17290 GCancellable *cancellable, 17291 GError **error) 17292 { 17293 GInitable *ret; 17294 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL); 17295 if (ret != NULL) 17296 return CONTROL_POWER (ret); 17297 else 17298 return NULL; 17299 } 17300 17301 17302 /* ------------------------------------------------------------------------ */ 17303 17304 /** 17305 * ControlPowerSkeleton: 17306 * 17307 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API. 17308 */ 17309 17310 /** 17311 * ControlPowerSkeletonClass: 17312 * @parent_class: The parent class. 17313 * 17314 * Class structure for #ControlPowerSkeleton. 17315 */ 17316 17317 struct _ControlPowerSkeletonPrivate 17318 { 17319 GValue *properties; 17320 GList *changed_properties; 17321 GSource *changed_properties_idle_source; 17322 GMainContext *context; 17323 GMutex lock; 17324 }; 17325 17326 static void 17327 _control_power_skeleton_handle_method_call ( 17328 GDBusConnection *connection G_GNUC_UNUSED, 17329 const gchar *sender G_GNUC_UNUSED, 17330 const gchar *object_path G_GNUC_UNUSED, 17331 const gchar *interface_name, 17332 const gchar *method_name, 17333 GVariant *parameters, 17334 GDBusMethodInvocation *invocation, 17335 gpointer user_data) 17336 { 17337 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); 17338 _ExtendedGDBusMethodInfo *info; 17339 GVariantIter iter; 17340 GVariant *child; 17341 GValue *paramv; 17342 guint num_params; 17343 guint num_extra; 17344 guint n; 17345 guint signal_id; 17346 GValue return_value = G_VALUE_INIT; 17347 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 17348 g_assert (info != NULL); 17349 num_params = g_variant_n_children (parameters); 17350 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 17351 n = 0; 17352 g_value_init (¶mv[n], TYPE_CONTROL_POWER); 17353 g_value_set_object (¶mv[n++], skeleton); 17354 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 17355 g_value_set_object (¶mv[n++], invocation); 17356 if (info->pass_fdlist) 17357 { 17358 #ifdef G_OS_UNIX 17359 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 17360 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 17361 #else 17362 g_assert_not_reached (); 17363 #endif 17364 } 17365 g_variant_iter_init (&iter, parameters); 17366 while ((child = g_variant_iter_next_value (&iter)) != NULL) 17367 { 17368 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 17369 if (arg_info->use_gvariant) 17370 { 17371 g_value_init (¶mv[n], G_TYPE_VARIANT); 17372 g_value_set_variant (¶mv[n], child); 17373 n++; 17374 } 17375 else 17376 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 17377 g_variant_unref (child); 17378 } 17379 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER); 17380 g_value_init (&return_value, G_TYPE_BOOLEAN); 17381 g_signal_emitv (paramv, signal_id, 0, &return_value); 17382 if (!g_value_get_boolean (&return_value)) 17383 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); 17384 g_value_unset (&return_value); 17385 for (n = 0; n < num_params + num_extra; n++) 17386 g_value_unset (¶mv[n]); 17387 g_free (paramv); 17388 } 17389 17390 static GVariant * 17391 _control_power_skeleton_handle_get_property ( 17392 GDBusConnection *connection G_GNUC_UNUSED, 17393 const gchar *sender G_GNUC_UNUSED, 17394 const gchar *object_path G_GNUC_UNUSED, 17395 const gchar *interface_name G_GNUC_UNUSED, 17396 const gchar *property_name, 17397 GError **error, 17398 gpointer user_data) 17399 { 17400 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); 17401 GValue value = G_VALUE_INIT; 17402 GParamSpec *pspec; 17403 _ExtendedGDBusPropertyInfo *info; 17404 GVariant *ret; 17405 ret = NULL; 17406 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); 17407 g_assert (info != NULL); 17408 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 17409 if (pspec == NULL) 17410 { 17411 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 17412 } 17413 else 17414 { 17415 g_value_init (&value, pspec->value_type); 17416 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 17417 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 17418 g_value_unset (&value); 17419 } 17420 return ret; 17421 } 17422 17423 static gboolean 17424 _control_power_skeleton_handle_set_property ( 17425 GDBusConnection *connection G_GNUC_UNUSED, 17426 const gchar *sender G_GNUC_UNUSED, 17427 const gchar *object_path G_GNUC_UNUSED, 17428 const gchar *interface_name G_GNUC_UNUSED, 17429 const gchar *property_name, 17430 GVariant *variant, 17431 GError **error, 17432 gpointer user_data) 17433 { 17434 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); 17435 GValue value = G_VALUE_INIT; 17436 GParamSpec *pspec; 17437 _ExtendedGDBusPropertyInfo *info; 17438 gboolean ret; 17439 ret = FALSE; 17440 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name); 17441 g_assert (info != NULL); 17442 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 17443 if (pspec == NULL) 17444 { 17445 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 17446 } 17447 else 17448 { 17449 if (info->use_gvariant) 17450 g_value_set_variant (&value, variant); 17451 else 17452 g_dbus_gvariant_to_gvalue (variant, &value); 17453 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 17454 g_value_unset (&value); 17455 ret = TRUE; 17456 } 17457 return ret; 17458 } 17459 17460 static const GDBusInterfaceVTable _control_power_skeleton_vtable = 17461 { 17462 _control_power_skeleton_handle_method_call, 17463 _control_power_skeleton_handle_get_property, 17464 _control_power_skeleton_handle_set_property, 17465 {NULL} 17466 }; 17467 17468 static GDBusInterfaceInfo * 17469 control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 17470 { 17471 return control_power_interface_info (); 17472 } 17473 17474 static GDBusInterfaceVTable * 17475 control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 17476 { 17477 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable; 17478 } 17479 17480 static GVariant * 17481 control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 17482 { 17483 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); 17484 17485 GVariantBuilder builder; 17486 guint n; 17487 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 17488 if (_control_power_interface_info.parent_struct.properties == NULL) 17489 goto out; 17490 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++) 17491 { 17492 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n]; 17493 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 17494 { 17495 GVariant *value; 17496 value = _control_power_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", info->name, NULL, skeleton); 17497 if (value != NULL) 17498 { 17499 g_variant_take_ref (value); 17500 g_variant_builder_add (&builder, "{sv}", info->name, value); 17501 g_variant_unref (value); 17502 } 17503 } 17504 } 17505 out: 17506 return g_variant_builder_end (&builder); 17507 } 17508 17509 static gboolean _control_power_emit_changed (gpointer user_data); 17510 17511 static void 17512 control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 17513 { 17514 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton); 17515 gboolean emit_changed = FALSE; 17516 17517 g_mutex_lock (&skeleton->priv->lock); 17518 if (skeleton->priv->changed_properties_idle_source != NULL) 17519 { 17520 g_source_destroy (skeleton->priv->changed_properties_idle_source); 17521 skeleton->priv->changed_properties_idle_source = NULL; 17522 emit_changed = TRUE; 17523 } 17524 g_mutex_unlock (&skeleton->priv->lock); 17525 17526 if (emit_changed) 17527 _control_power_emit_changed (skeleton); 17528 } 17529 17530 static void 17531 _control_power_on_signal_power_good ( 17532 ControlPower *object) 17533 { 17534 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17535 17536 GList *connections, *l; 17537 GVariant *signal_variant; 17538 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 17539 17540 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 17541 for (l = connections; l != NULL; l = l->next) 17542 { 17543 GDBusConnection *connection = l->data; 17544 g_dbus_connection_emit_signal (connection, 17545 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood", 17546 signal_variant, NULL); 17547 } 17548 g_variant_unref (signal_variant); 17549 g_list_free_full (connections, g_object_unref); 17550 } 17551 17552 static void 17553 _control_power_on_signal_power_lost ( 17554 ControlPower *object) 17555 { 17556 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17557 17558 GList *connections, *l; 17559 GVariant *signal_variant; 17560 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 17561 17562 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 17563 for (l = connections; l != NULL; l = l->next) 17564 { 17565 GDBusConnection *connection = l->data; 17566 g_dbus_connection_emit_signal (connection, 17567 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost", 17568 signal_variant, NULL); 17569 } 17570 g_variant_unref (signal_variant); 17571 g_list_free_full (connections, g_object_unref); 17572 } 17573 17574 static void control_power_skeleton_iface_init (ControlPowerIface *iface); 17575 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 17576 G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 17577 G_ADD_PRIVATE (ControlPowerSkeleton) 17578 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); 17579 17580 #else 17581 G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 17582 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init)); 17583 17584 #endif 17585 static void 17586 control_power_skeleton_finalize (GObject *object) 17587 { 17588 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17589 guint n; 17590 for (n = 0; n < 3; n++) 17591 g_value_unset (&skeleton->priv->properties[n]); 17592 g_free (skeleton->priv->properties); 17593 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 17594 if (skeleton->priv->changed_properties_idle_source != NULL) 17595 g_source_destroy (skeleton->priv->changed_properties_idle_source); 17596 g_main_context_unref (skeleton->priv->context); 17597 g_mutex_clear (&skeleton->priv->lock); 17598 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object); 17599 } 17600 17601 static void 17602 control_power_skeleton_get_property (GObject *object, 17603 guint prop_id, 17604 GValue *value, 17605 GParamSpec *pspec G_GNUC_UNUSED) 17606 { 17607 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17608 g_assert (prop_id != 0 && prop_id - 1 < 3); 17609 g_mutex_lock (&skeleton->priv->lock); 17610 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 17611 g_mutex_unlock (&skeleton->priv->lock); 17612 } 17613 17614 static gboolean 17615 _control_power_emit_changed (gpointer user_data) 17616 { 17617 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data); 17618 GList *l; 17619 GVariantBuilder builder; 17620 GVariantBuilder invalidated_builder; 17621 guint num_changes; 17622 17623 g_mutex_lock (&skeleton->priv->lock); 17624 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 17625 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 17626 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 17627 { 17628 ChangedProperty *cp = l->data; 17629 GVariant *variant; 17630 const GValue *cur_value; 17631 17632 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 17633 if (!_g_value_equal (cur_value, &cp->orig_value)) 17634 { 17635 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 17636 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 17637 g_variant_unref (variant); 17638 num_changes++; 17639 } 17640 } 17641 if (num_changes > 0) 17642 { 17643 GList *connections, *ll; 17644 GVariant *signal_variant; 17645 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power", 17646 &builder, &invalidated_builder)); 17647 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 17648 for (ll = connections; ll != NULL; ll = ll->next) 17649 { 17650 GDBusConnection *connection = ll->data; 17651 17652 g_dbus_connection_emit_signal (connection, 17653 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 17654 "org.freedesktop.DBus.Properties", 17655 "PropertiesChanged", 17656 signal_variant, 17657 NULL); 17658 } 17659 g_variant_unref (signal_variant); 17660 g_list_free_full (connections, g_object_unref); 17661 } 17662 else 17663 { 17664 g_variant_builder_clear (&builder); 17665 g_variant_builder_clear (&invalidated_builder); 17666 } 17667 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 17668 skeleton->priv->changed_properties = NULL; 17669 skeleton->priv->changed_properties_idle_source = NULL; 17670 g_mutex_unlock (&skeleton->priv->lock); 17671 return FALSE; 17672 } 17673 17674 static void 17675 _control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 17676 { 17677 ChangedProperty *cp; 17678 GList *l; 17679 cp = NULL; 17680 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 17681 { 17682 ChangedProperty *i_cp = l->data; 17683 if (i_cp->info == info) 17684 { 17685 cp = i_cp; 17686 break; 17687 } 17688 } 17689 if (cp == NULL) 17690 { 17691 cp = g_new0 (ChangedProperty, 1); 17692 cp->prop_id = prop_id; 17693 cp->info = info; 17694 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 17695 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 17696 g_value_copy (orig_value, &cp->orig_value); 17697 } 17698 } 17699 17700 static void 17701 control_power_skeleton_notify (GObject *object, 17702 GParamSpec *pspec G_GNUC_UNUSED) 17703 { 17704 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17705 g_mutex_lock (&skeleton->priv->lock); 17706 if (skeleton->priv->changed_properties != NULL && 17707 skeleton->priv->changed_properties_idle_source == NULL) 17708 { 17709 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 17710 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 17711 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 17712 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_power_emit_changed"); 17713 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 17714 g_source_unref (skeleton->priv->changed_properties_idle_source); 17715 } 17716 g_mutex_unlock (&skeleton->priv->lock); 17717 } 17718 17719 static void 17720 control_power_skeleton_set_property (GObject *object, 17721 guint prop_id, 17722 const GValue *value, 17723 GParamSpec *pspec) 17724 { 17725 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17726 g_assert (prop_id != 0 && prop_id - 1 < 3); 17727 g_mutex_lock (&skeleton->priv->lock); 17728 g_object_freeze_notify (object); 17729 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 17730 { 17731 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 17732 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 17733 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 17734 g_object_notify_by_pspec (object, pspec); 17735 } 17736 g_mutex_unlock (&skeleton->priv->lock); 17737 g_object_thaw_notify (object); 17738 } 17739 17740 static void 17741 control_power_skeleton_init (ControlPowerSkeleton *skeleton) 17742 { 17743 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 17744 skeleton->priv = control_power_skeleton_get_instance_private (skeleton); 17745 #else 17746 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate); 17747 #endif 17748 17749 g_mutex_init (&skeleton->priv->lock); 17750 skeleton->priv->context = g_main_context_ref_thread_default (); 17751 skeleton->priv->properties = g_new0 (GValue, 3); 17752 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); 17753 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); 17754 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); 17755 } 17756 17757 static gint 17758 control_power_skeleton_get_pgood (ControlPower *object) 17759 { 17760 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17761 gint value; 17762 g_mutex_lock (&skeleton->priv->lock); 17763 value = g_value_get_int (&(skeleton->priv->properties[0])); 17764 g_mutex_unlock (&skeleton->priv->lock); 17765 return value; 17766 } 17767 17768 static gint 17769 control_power_skeleton_get_state (ControlPower *object) 17770 { 17771 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17772 gint value; 17773 g_mutex_lock (&skeleton->priv->lock); 17774 value = g_value_get_int (&(skeleton->priv->properties[1])); 17775 g_mutex_unlock (&skeleton->priv->lock); 17776 return value; 17777 } 17778 17779 static gint 17780 control_power_skeleton_get_pgood_timeout (ControlPower *object) 17781 { 17782 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object); 17783 gint value; 17784 g_mutex_lock (&skeleton->priv->lock); 17785 value = g_value_get_int (&(skeleton->priv->properties[2])); 17786 g_mutex_unlock (&skeleton->priv->lock); 17787 return value; 17788 } 17789 17790 static void 17791 control_power_skeleton_class_init (ControlPowerSkeletonClass *klass) 17792 { 17793 GObjectClass *gobject_class; 17794 GDBusInterfaceSkeletonClass *skeleton_class; 17795 17796 gobject_class = G_OBJECT_CLASS (klass); 17797 gobject_class->finalize = control_power_skeleton_finalize; 17798 gobject_class->get_property = control_power_skeleton_get_property; 17799 gobject_class->set_property = control_power_skeleton_set_property; 17800 gobject_class->notify = control_power_skeleton_notify; 17801 17802 17803 control_power_override_properties (gobject_class, 1); 17804 17805 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 17806 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info; 17807 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties; 17808 skeleton_class->flush = control_power_skeleton_dbus_interface_flush; 17809 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable; 17810 17811 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 17812 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate)); 17813 #endif 17814 } 17815 17816 static void 17817 control_power_skeleton_iface_init (ControlPowerIface *iface) 17818 { 17819 iface->power_good = _control_power_on_signal_power_good; 17820 iface->power_lost = _control_power_on_signal_power_lost; 17821 iface->get_pgood = control_power_skeleton_get_pgood; 17822 iface->get_state = control_power_skeleton_get_state; 17823 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout; 17824 } 17825 17826 /** 17827 * control_power_skeleton_new: 17828 * 17829 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. 17830 * 17831 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object. 17832 */ 17833 ControlPower * 17834 control_power_skeleton_new (void) 17835 { 17836 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL)); 17837 } 17838 17839 /* ------------------------------------------------------------------------ 17840 * Code for interface org.openbmc.control.Checkstop 17841 * ------------------------------------------------------------------------ 17842 */ 17843 17844 /** 17845 * SECTION:ControlCheckstop 17846 * @title: ControlCheckstop 17847 * @short_description: Generated C code for the org.openbmc.control.Checkstop D-Bus interface 17848 * 17849 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> D-Bus interface in C. 17850 */ 17851 17852 /* ---- Introspection data for org.openbmc.control.Checkstop ---- */ 17853 17854 static const _ExtendedGDBusInterfaceInfo _control_checkstop_interface_info = 17855 { 17856 { 17857 -1, 17858 (gchar *) "org.openbmc.control.Checkstop", 17859 NULL, 17860 NULL, 17861 NULL, 17862 NULL 17863 }, 17864 "control-checkstop", 17865 }; 17866 17867 17868 /** 17869 * control_checkstop_interface_info: 17870 * 17871 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> D-Bus interface. 17872 * 17873 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 17874 */ 17875 GDBusInterfaceInfo * 17876 control_checkstop_interface_info (void) 17877 { 17878 return (GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct; 17879 } 17880 17881 /** 17882 * control_checkstop_override_properties: 17883 * @klass: The class structure for a #GObject<!-- -->-derived class. 17884 * @property_id_begin: The property id to assign to the first overridden property. 17885 * 17886 * Overrides all #GObject properties in the #ControlCheckstop interface for a concrete class. 17887 * The properties are overridden in the order they are defined. 17888 * 17889 * Returns: The last property id. 17890 */ 17891 guint 17892 control_checkstop_override_properties (GObjectClass *klass, guint property_id_begin) 17893 { 17894 return property_id_begin - 1; 17895 } 17896 17897 17898 17899 /** 17900 * ControlCheckstop: 17901 * 17902 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. 17903 */ 17904 17905 /** 17906 * ControlCheckstopIface: 17907 * @parent_iface: The parent interface. 17908 * 17909 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. 17910 */ 17911 17912 typedef ControlCheckstopIface ControlCheckstopInterface; 17913 G_DEFINE_INTERFACE (ControlCheckstop, control_checkstop, G_TYPE_OBJECT); 17914 17915 static void 17916 control_checkstop_default_init (ControlCheckstopIface *iface) 17917 { 17918 } 17919 17920 /* ------------------------------------------------------------------------ */ 17921 17922 /** 17923 * ControlCheckstopProxy: 17924 * 17925 * The #ControlCheckstopProxy structure contains only private data and should only be accessed using the provided API. 17926 */ 17927 17928 /** 17929 * ControlCheckstopProxyClass: 17930 * @parent_class: The parent class. 17931 * 17932 * Class structure for #ControlCheckstopProxy. 17933 */ 17934 17935 struct _ControlCheckstopProxyPrivate 17936 { 17937 GData *qdata; 17938 }; 17939 17940 static void control_checkstop_proxy_iface_init (ControlCheckstopIface *iface); 17941 17942 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 17943 G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY, 17944 G_ADD_PRIVATE (ControlCheckstopProxy) 17945 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init)); 17946 17947 #else 17948 G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY, 17949 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init)); 17950 17951 #endif 17952 static void 17953 control_checkstop_proxy_finalize (GObject *object) 17954 { 17955 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (object); 17956 g_datalist_clear (&proxy->priv->qdata); 17957 G_OBJECT_CLASS (control_checkstop_proxy_parent_class)->finalize (object); 17958 } 17959 17960 static void 17961 control_checkstop_proxy_get_property (GObject *object, 17962 guint prop_id, 17963 GValue *value, 17964 GParamSpec *pspec G_GNUC_UNUSED) 17965 { 17966 } 17967 17968 static void 17969 control_checkstop_proxy_set_property (GObject *object, 17970 guint prop_id, 17971 const GValue *value, 17972 GParamSpec *pspec G_GNUC_UNUSED) 17973 { 17974 } 17975 17976 static void 17977 control_checkstop_proxy_g_signal (GDBusProxy *proxy, 17978 const gchar *sender_name G_GNUC_UNUSED, 17979 const gchar *signal_name, 17980 GVariant *parameters) 17981 { 17982 _ExtendedGDBusSignalInfo *info; 17983 GVariantIter iter; 17984 GVariant *child; 17985 GValue *paramv; 17986 guint num_params; 17987 guint n; 17988 guint signal_id; 17989 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, signal_name); 17990 if (info == NULL) 17991 return; 17992 num_params = g_variant_n_children (parameters); 17993 paramv = g_new0 (GValue, num_params + 1); 17994 g_value_init (¶mv[0], TYPE_CONTROL_CHECKSTOP); 17995 g_value_set_object (¶mv[0], proxy); 17996 g_variant_iter_init (&iter, parameters); 17997 n = 1; 17998 while ((child = g_variant_iter_next_value (&iter)) != NULL) 17999 { 18000 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 18001 if (arg_info->use_gvariant) 18002 { 18003 g_value_init (¶mv[n], G_TYPE_VARIANT); 18004 g_value_set_variant (¶mv[n], child); 18005 n++; 18006 } 18007 else 18008 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 18009 g_variant_unref (child); 18010 } 18011 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP); 18012 g_signal_emitv (paramv, signal_id, 0, NULL); 18013 for (n = 0; n < num_params + 1; n++) 18014 g_value_unset (¶mv[n]); 18015 g_free (paramv); 18016 } 18017 18018 static void 18019 control_checkstop_proxy_g_properties_changed (GDBusProxy *_proxy, 18020 GVariant *changed_properties, 18021 const gchar *const *invalidated_properties) 18022 { 18023 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (_proxy); 18024 guint n; 18025 const gchar *key; 18026 GVariantIter *iter; 18027 _ExtendedGDBusPropertyInfo *info; 18028 g_variant_get (changed_properties, "a{sv}", &iter); 18029 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 18030 { 18031 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, key); 18032 g_datalist_remove_data (&proxy->priv->qdata, key); 18033 if (info != NULL) 18034 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 18035 } 18036 g_variant_iter_free (iter); 18037 for (n = 0; invalidated_properties[n] != NULL; n++) 18038 { 18039 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, invalidated_properties[n]); 18040 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 18041 if (info != NULL) 18042 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 18043 } 18044 } 18045 18046 static void 18047 control_checkstop_proxy_init (ControlCheckstopProxy *proxy) 18048 { 18049 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 18050 proxy->priv = control_checkstop_proxy_get_instance_private (proxy); 18051 #else 18052 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_CHECKSTOP_PROXY, ControlCheckstopProxyPrivate); 18053 #endif 18054 18055 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_checkstop_interface_info ()); 18056 } 18057 18058 static void 18059 control_checkstop_proxy_class_init (ControlCheckstopProxyClass *klass) 18060 { 18061 GObjectClass *gobject_class; 18062 GDBusProxyClass *proxy_class; 18063 18064 gobject_class = G_OBJECT_CLASS (klass); 18065 gobject_class->finalize = control_checkstop_proxy_finalize; 18066 gobject_class->get_property = control_checkstop_proxy_get_property; 18067 gobject_class->set_property = control_checkstop_proxy_set_property; 18068 18069 proxy_class = G_DBUS_PROXY_CLASS (klass); 18070 proxy_class->g_signal = control_checkstop_proxy_g_signal; 18071 proxy_class->g_properties_changed = control_checkstop_proxy_g_properties_changed; 18072 18073 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 18074 g_type_class_add_private (klass, sizeof (ControlCheckstopProxyPrivate)); 18075 #endif 18076 } 18077 18078 static void 18079 control_checkstop_proxy_iface_init (ControlCheckstopIface *iface) 18080 { 18081 } 18082 18083 /** 18084 * control_checkstop_proxy_new: 18085 * @connection: A #GDBusConnection. 18086 * @flags: Flags from the #GDBusProxyFlags enumeration. 18087 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 18088 * @object_path: An object path. 18089 * @cancellable: (allow-none): A #GCancellable or %NULL. 18090 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 18091 * @user_data: User data to pass to @callback. 18092 * 18093 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. See g_dbus_proxy_new() for more details. 18094 * 18095 * 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. 18096 * You can then call control_checkstop_proxy_new_finish() to get the result of the operation. 18097 * 18098 * See control_checkstop_proxy_new_sync() for the synchronous, blocking version of this constructor. 18099 */ 18100 void 18101 control_checkstop_proxy_new ( 18102 GDBusConnection *connection, 18103 GDBusProxyFlags flags, 18104 const gchar *name, 18105 const gchar *object_path, 18106 GCancellable *cancellable, 18107 GAsyncReadyCallback callback, 18108 gpointer user_data) 18109 { 18110 g_async_initable_new_async (TYPE_CONTROL_CHECKSTOP_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL); 18111 } 18112 18113 /** 18114 * control_checkstop_proxy_new_finish: 18115 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new(). 18116 * @error: Return location for error or %NULL 18117 * 18118 * Finishes an operation started with control_checkstop_proxy_new(). 18119 * 18120 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set. 18121 */ 18122 ControlCheckstop * 18123 control_checkstop_proxy_new_finish ( 18124 GAsyncResult *res, 18125 GError **error) 18126 { 18127 GObject *ret; 18128 GObject *source_object; 18129 source_object = g_async_result_get_source_object (res); 18130 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 18131 g_object_unref (source_object); 18132 if (ret != NULL) 18133 return CONTROL_CHECKSTOP (ret); 18134 else 18135 return NULL; 18136 } 18137 18138 /** 18139 * control_checkstop_proxy_new_sync: 18140 * @connection: A #GDBusConnection. 18141 * @flags: Flags from the #GDBusProxyFlags enumeration. 18142 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 18143 * @object_path: An object path. 18144 * @cancellable: (allow-none): A #GCancellable or %NULL. 18145 * @error: Return location for error or %NULL 18146 * 18147 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. See g_dbus_proxy_new_sync() for more details. 18148 * 18149 * The calling thread is blocked until a reply is received. 18150 * 18151 * See control_checkstop_proxy_new() for the asynchronous version of this constructor. 18152 * 18153 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set. 18154 */ 18155 ControlCheckstop * 18156 control_checkstop_proxy_new_sync ( 18157 GDBusConnection *connection, 18158 GDBusProxyFlags flags, 18159 const gchar *name, 18160 const gchar *object_path, 18161 GCancellable *cancellable, 18162 GError **error) 18163 { 18164 GInitable *ret; 18165 ret = g_initable_new (TYPE_CONTROL_CHECKSTOP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL); 18166 if (ret != NULL) 18167 return CONTROL_CHECKSTOP (ret); 18168 else 18169 return NULL; 18170 } 18171 18172 18173 /** 18174 * control_checkstop_proxy_new_for_bus: 18175 * @bus_type: A #GBusType. 18176 * @flags: Flags from the #GDBusProxyFlags enumeration. 18177 * @name: A bus name (well-known or unique). 18178 * @object_path: An object path. 18179 * @cancellable: (allow-none): A #GCancellable or %NULL. 18180 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 18181 * @user_data: User data to pass to @callback. 18182 * 18183 * Like control_checkstop_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 18184 * 18185 * 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. 18186 * You can then call control_checkstop_proxy_new_for_bus_finish() to get the result of the operation. 18187 * 18188 * See control_checkstop_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 18189 */ 18190 void 18191 control_checkstop_proxy_new_for_bus ( 18192 GBusType bus_type, 18193 GDBusProxyFlags flags, 18194 const gchar *name, 18195 const gchar *object_path, 18196 GCancellable *cancellable, 18197 GAsyncReadyCallback callback, 18198 gpointer user_data) 18199 { 18200 g_async_initable_new_async (TYPE_CONTROL_CHECKSTOP_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL); 18201 } 18202 18203 /** 18204 * control_checkstop_proxy_new_for_bus_finish: 18205 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new_for_bus(). 18206 * @error: Return location for error or %NULL 18207 * 18208 * Finishes an operation started with control_checkstop_proxy_new_for_bus(). 18209 * 18210 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set. 18211 */ 18212 ControlCheckstop * 18213 control_checkstop_proxy_new_for_bus_finish ( 18214 GAsyncResult *res, 18215 GError **error) 18216 { 18217 GObject *ret; 18218 GObject *source_object; 18219 source_object = g_async_result_get_source_object (res); 18220 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 18221 g_object_unref (source_object); 18222 if (ret != NULL) 18223 return CONTROL_CHECKSTOP (ret); 18224 else 18225 return NULL; 18226 } 18227 18228 /** 18229 * control_checkstop_proxy_new_for_bus_sync: 18230 * @bus_type: A #GBusType. 18231 * @flags: Flags from the #GDBusProxyFlags enumeration. 18232 * @name: A bus name (well-known or unique). 18233 * @object_path: An object path. 18234 * @cancellable: (allow-none): A #GCancellable or %NULL. 18235 * @error: Return location for error or %NULL 18236 * 18237 * Like control_checkstop_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 18238 * 18239 * The calling thread is blocked until a reply is received. 18240 * 18241 * See control_checkstop_proxy_new_for_bus() for the asynchronous version of this constructor. 18242 * 18243 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set. 18244 */ 18245 ControlCheckstop * 18246 control_checkstop_proxy_new_for_bus_sync ( 18247 GBusType bus_type, 18248 GDBusProxyFlags flags, 18249 const gchar *name, 18250 const gchar *object_path, 18251 GCancellable *cancellable, 18252 GError **error) 18253 { 18254 GInitable *ret; 18255 ret = g_initable_new (TYPE_CONTROL_CHECKSTOP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL); 18256 if (ret != NULL) 18257 return CONTROL_CHECKSTOP (ret); 18258 else 18259 return NULL; 18260 } 18261 18262 18263 /* ------------------------------------------------------------------------ */ 18264 18265 /** 18266 * ControlCheckstopSkeleton: 18267 * 18268 * The #ControlCheckstopSkeleton structure contains only private data and should only be accessed using the provided API. 18269 */ 18270 18271 /** 18272 * ControlCheckstopSkeletonClass: 18273 * @parent_class: The parent class. 18274 * 18275 * Class structure for #ControlCheckstopSkeleton. 18276 */ 18277 18278 struct _ControlCheckstopSkeletonPrivate 18279 { 18280 GValue *properties; 18281 GList *changed_properties; 18282 GSource *changed_properties_idle_source; 18283 GMainContext *context; 18284 GMutex lock; 18285 }; 18286 18287 static void 18288 _control_checkstop_skeleton_handle_method_call ( 18289 GDBusConnection *connection G_GNUC_UNUSED, 18290 const gchar *sender G_GNUC_UNUSED, 18291 const gchar *object_path G_GNUC_UNUSED, 18292 const gchar *interface_name, 18293 const gchar *method_name, 18294 GVariant *parameters, 18295 GDBusMethodInvocation *invocation, 18296 gpointer user_data) 18297 { 18298 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data); 18299 _ExtendedGDBusMethodInfo *info; 18300 GVariantIter iter; 18301 GVariant *child; 18302 GValue *paramv; 18303 guint num_params; 18304 guint num_extra; 18305 guint n; 18306 guint signal_id; 18307 GValue return_value = G_VALUE_INIT; 18308 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 18309 g_assert (info != NULL); 18310 num_params = g_variant_n_children (parameters); 18311 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 18312 n = 0; 18313 g_value_init (¶mv[n], TYPE_CONTROL_CHECKSTOP); 18314 g_value_set_object (¶mv[n++], skeleton); 18315 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 18316 g_value_set_object (¶mv[n++], invocation); 18317 if (info->pass_fdlist) 18318 { 18319 #ifdef G_OS_UNIX 18320 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 18321 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 18322 #else 18323 g_assert_not_reached (); 18324 #endif 18325 } 18326 g_variant_iter_init (&iter, parameters); 18327 while ((child = g_variant_iter_next_value (&iter)) != NULL) 18328 { 18329 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 18330 if (arg_info->use_gvariant) 18331 { 18332 g_value_init (¶mv[n], G_TYPE_VARIANT); 18333 g_value_set_variant (¶mv[n], child); 18334 n++; 18335 } 18336 else 18337 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 18338 g_variant_unref (child); 18339 } 18340 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP); 18341 g_value_init (&return_value, G_TYPE_BOOLEAN); 18342 g_signal_emitv (paramv, signal_id, 0, &return_value); 18343 if (!g_value_get_boolean (&return_value)) 18344 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); 18345 g_value_unset (&return_value); 18346 for (n = 0; n < num_params + num_extra; n++) 18347 g_value_unset (¶mv[n]); 18348 g_free (paramv); 18349 } 18350 18351 static GVariant * 18352 _control_checkstop_skeleton_handle_get_property ( 18353 GDBusConnection *connection G_GNUC_UNUSED, 18354 const gchar *sender G_GNUC_UNUSED, 18355 const gchar *object_path G_GNUC_UNUSED, 18356 const gchar *interface_name G_GNUC_UNUSED, 18357 const gchar *property_name, 18358 GError **error, 18359 gpointer user_data) 18360 { 18361 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data); 18362 GValue value = G_VALUE_INIT; 18363 GParamSpec *pspec; 18364 _ExtendedGDBusPropertyInfo *info; 18365 GVariant *ret; 18366 ret = NULL; 18367 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name); 18368 g_assert (info != NULL); 18369 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 18370 if (pspec == NULL) 18371 { 18372 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 18373 } 18374 else 18375 { 18376 g_value_init (&value, pspec->value_type); 18377 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 18378 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 18379 g_value_unset (&value); 18380 } 18381 return ret; 18382 } 18383 18384 static gboolean 18385 _control_checkstop_skeleton_handle_set_property ( 18386 GDBusConnection *connection G_GNUC_UNUSED, 18387 const gchar *sender G_GNUC_UNUSED, 18388 const gchar *object_path G_GNUC_UNUSED, 18389 const gchar *interface_name G_GNUC_UNUSED, 18390 const gchar *property_name, 18391 GVariant *variant, 18392 GError **error, 18393 gpointer user_data) 18394 { 18395 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data); 18396 GValue value = G_VALUE_INIT; 18397 GParamSpec *pspec; 18398 _ExtendedGDBusPropertyInfo *info; 18399 gboolean ret; 18400 ret = FALSE; 18401 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name); 18402 g_assert (info != NULL); 18403 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 18404 if (pspec == NULL) 18405 { 18406 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 18407 } 18408 else 18409 { 18410 if (info->use_gvariant) 18411 g_value_set_variant (&value, variant); 18412 else 18413 g_dbus_gvariant_to_gvalue (variant, &value); 18414 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 18415 g_value_unset (&value); 18416 ret = TRUE; 18417 } 18418 return ret; 18419 } 18420 18421 static const GDBusInterfaceVTable _control_checkstop_skeleton_vtable = 18422 { 18423 _control_checkstop_skeleton_handle_method_call, 18424 _control_checkstop_skeleton_handle_get_property, 18425 _control_checkstop_skeleton_handle_set_property, 18426 {NULL} 18427 }; 18428 18429 static GDBusInterfaceInfo * 18430 control_checkstop_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 18431 { 18432 return control_checkstop_interface_info (); 18433 } 18434 18435 static GDBusInterfaceVTable * 18436 control_checkstop_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 18437 { 18438 return (GDBusInterfaceVTable *) &_control_checkstop_skeleton_vtable; 18439 } 18440 18441 static GVariant * 18442 control_checkstop_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 18443 { 18444 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (_skeleton); 18445 18446 GVariantBuilder builder; 18447 guint n; 18448 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 18449 if (_control_checkstop_interface_info.parent_struct.properties == NULL) 18450 goto out; 18451 for (n = 0; _control_checkstop_interface_info.parent_struct.properties[n] != NULL; n++) 18452 { 18453 GDBusPropertyInfo *info = _control_checkstop_interface_info.parent_struct.properties[n]; 18454 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 18455 { 18456 GVariant *value; 18457 value = _control_checkstop_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Checkstop", info->name, NULL, skeleton); 18458 if (value != NULL) 18459 { 18460 g_variant_take_ref (value); 18461 g_variant_builder_add (&builder, "{sv}", info->name, value); 18462 g_variant_unref (value); 18463 } 18464 } 18465 } 18466 out: 18467 return g_variant_builder_end (&builder); 18468 } 18469 18470 static void 18471 control_checkstop_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 18472 { 18473 } 18474 18475 static void control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface); 18476 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 18477 G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 18478 G_ADD_PRIVATE (ControlCheckstopSkeleton) 18479 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init)); 18480 18481 #else 18482 G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 18483 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init)); 18484 18485 #endif 18486 static void 18487 control_checkstop_skeleton_finalize (GObject *object) 18488 { 18489 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (object); 18490 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 18491 if (skeleton->priv->changed_properties_idle_source != NULL) 18492 g_source_destroy (skeleton->priv->changed_properties_idle_source); 18493 g_main_context_unref (skeleton->priv->context); 18494 g_mutex_clear (&skeleton->priv->lock); 18495 G_OBJECT_CLASS (control_checkstop_skeleton_parent_class)->finalize (object); 18496 } 18497 18498 static void 18499 control_checkstop_skeleton_init (ControlCheckstopSkeleton *skeleton) 18500 { 18501 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 18502 skeleton->priv = control_checkstop_skeleton_get_instance_private (skeleton); 18503 #else 18504 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_CHECKSTOP_SKELETON, ControlCheckstopSkeletonPrivate); 18505 #endif 18506 18507 g_mutex_init (&skeleton->priv->lock); 18508 skeleton->priv->context = g_main_context_ref_thread_default (); 18509 } 18510 18511 static void 18512 control_checkstop_skeleton_class_init (ControlCheckstopSkeletonClass *klass) 18513 { 18514 GObjectClass *gobject_class; 18515 GDBusInterfaceSkeletonClass *skeleton_class; 18516 18517 gobject_class = G_OBJECT_CLASS (klass); 18518 gobject_class->finalize = control_checkstop_skeleton_finalize; 18519 18520 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 18521 skeleton_class->get_info = control_checkstop_skeleton_dbus_interface_get_info; 18522 skeleton_class->get_properties = control_checkstop_skeleton_dbus_interface_get_properties; 18523 skeleton_class->flush = control_checkstop_skeleton_dbus_interface_flush; 18524 skeleton_class->get_vtable = control_checkstop_skeleton_dbus_interface_get_vtable; 18525 18526 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 18527 g_type_class_add_private (klass, sizeof (ControlCheckstopSkeletonPrivate)); 18528 #endif 18529 } 18530 18531 static void 18532 control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface) 18533 { 18534 } 18535 18536 /** 18537 * control_checkstop_skeleton_new: 18538 * 18539 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. 18540 * 18541 * Returns: (transfer full) (type ControlCheckstopSkeleton): The skeleton object. 18542 */ 18543 ControlCheckstop * 18544 control_checkstop_skeleton_new (void) 18545 { 18546 return CONTROL_CHECKSTOP (g_object_new (TYPE_CONTROL_CHECKSTOP_SKELETON, NULL)); 18547 } 18548 18549 /* ------------------------------------------------------------------------ 18550 * Code for interface org.openbmc.Watchdog 18551 * ------------------------------------------------------------------------ 18552 */ 18553 18554 /** 18555 * SECTION:Watchdog 18556 * @title: Watchdog 18557 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface 18558 * 18559 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface in C. 18560 */ 18561 18562 /* ---- Introspection data for org.openbmc.Watchdog ---- */ 18563 18564 static const _ExtendedGDBusMethodInfo _watchdog_method_info_start = 18565 { 18566 { 18567 -1, 18568 (gchar *) "start", 18569 NULL, 18570 NULL, 18571 NULL 18572 }, 18573 "handle-start", 18574 FALSE 18575 }; 18576 18577 static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke = 18578 { 18579 { 18580 -1, 18581 (gchar *) "poke", 18582 NULL, 18583 NULL, 18584 NULL 18585 }, 18586 "handle-poke", 18587 FALSE 18588 }; 18589 18590 static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop = 18591 { 18592 { 18593 -1, 18594 (gchar *) "stop", 18595 NULL, 18596 NULL, 18597 NULL 18598 }, 18599 "handle-stop", 18600 FALSE 18601 }; 18602 18603 static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval = 18604 { 18605 { 18606 -1, 18607 (gchar *) "interval", 18608 (gchar *) "i", 18609 NULL 18610 }, 18611 FALSE 18612 }; 18613 18614 static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] = 18615 { 18616 &_watchdog_method_info_set_IN_ARG_interval, 18617 NULL 18618 }; 18619 18620 static const _ExtendedGDBusMethodInfo _watchdog_method_info_set = 18621 { 18622 { 18623 -1, 18624 (gchar *) "set", 18625 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers, 18626 NULL, 18627 NULL 18628 }, 18629 "handle-set", 18630 FALSE 18631 }; 18632 18633 static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] = 18634 { 18635 &_watchdog_method_info_start, 18636 &_watchdog_method_info_poke, 18637 &_watchdog_method_info_stop, 18638 &_watchdog_method_info_set, 18639 NULL 18640 }; 18641 18642 static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error = 18643 { 18644 { 18645 -1, 18646 (gchar *) "WatchdogError", 18647 NULL, 18648 NULL 18649 }, 18650 "watchdog-error" 18651 }; 18652 18653 static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] = 18654 { 18655 &_watchdog_signal_info_watchdog_error, 18656 NULL 18657 }; 18658 18659 static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog = 18660 { 18661 { 18662 -1, 18663 (gchar *) "watchdog", 18664 (gchar *) "i", 18665 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 18666 NULL 18667 }, 18668 "watchdog", 18669 FALSE 18670 }; 18671 18672 static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval = 18673 { 18674 { 18675 -1, 18676 (gchar *) "poll_interval", 18677 (gchar *) "i", 18678 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, 18679 NULL 18680 }, 18681 "poll-interval", 18682 FALSE 18683 }; 18684 18685 static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] = 18686 { 18687 &_watchdog_property_info_watchdog, 18688 &_watchdog_property_info_poll_interval, 18689 NULL 18690 }; 18691 18692 static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info = 18693 { 18694 { 18695 -1, 18696 (gchar *) "org.openbmc.Watchdog", 18697 (GDBusMethodInfo **) &_watchdog_method_info_pointers, 18698 (GDBusSignalInfo **) &_watchdog_signal_info_pointers, 18699 (GDBusPropertyInfo **) &_watchdog_property_info_pointers, 18700 NULL 18701 }, 18702 "watchdog", 18703 }; 18704 18705 18706 /** 18707 * watchdog_interface_info: 18708 * 18709 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface. 18710 * 18711 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 18712 */ 18713 GDBusInterfaceInfo * 18714 watchdog_interface_info (void) 18715 { 18716 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct; 18717 } 18718 18719 /** 18720 * watchdog_override_properties: 18721 * @klass: The class structure for a #GObject<!-- -->-derived class. 18722 * @property_id_begin: The property id to assign to the first overridden property. 18723 * 18724 * Overrides all #GObject properties in the #Watchdog interface for a concrete class. 18725 * The properties are overridden in the order they are defined. 18726 * 18727 * Returns: The last property id. 18728 */ 18729 guint 18730 watchdog_override_properties (GObjectClass *klass, guint property_id_begin) 18731 { 18732 g_object_class_override_property (klass, property_id_begin++, "watchdog"); 18733 g_object_class_override_property (klass, property_id_begin++, "poll-interval"); 18734 return property_id_begin - 1; 18735 } 18736 18737 18738 18739 /** 18740 * Watchdog: 18741 * 18742 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. 18743 */ 18744 18745 /** 18746 * WatchdogIface: 18747 * @parent_iface: The parent interface. 18748 * @handle_poke: Handler for the #Watchdog::handle-poke signal. 18749 * @handle_set: Handler for the #Watchdog::handle-set signal. 18750 * @handle_start: Handler for the #Watchdog::handle-start signal. 18751 * @handle_stop: Handler for the #Watchdog::handle-stop signal. 18752 * @get_poll_interval: Getter for the #Watchdog:poll-interval property. 18753 * @get_watchdog: Getter for the #Watchdog:watchdog property. 18754 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal. 18755 * 18756 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. 18757 */ 18758 18759 typedef WatchdogIface WatchdogInterface; 18760 G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT); 18761 18762 static void 18763 watchdog_default_init (WatchdogIface *iface) 18764 { 18765 /* GObject signals for incoming D-Bus method calls: */ 18766 /** 18767 * Watchdog::handle-start: 18768 * @object: A #Watchdog. 18769 * @invocation: A #GDBusMethodInvocation. 18770 * 18771 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. 18772 * 18773 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_start() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 18774 * 18775 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 18776 */ 18777 g_signal_new ("handle-start", 18778 G_TYPE_FROM_INTERFACE (iface), 18779 G_SIGNAL_RUN_LAST, 18780 G_STRUCT_OFFSET (WatchdogIface, handle_start), 18781 g_signal_accumulator_true_handled, 18782 NULL, 18783 g_cclosure_marshal_generic, 18784 G_TYPE_BOOLEAN, 18785 1, 18786 G_TYPE_DBUS_METHOD_INVOCATION); 18787 18788 /** 18789 * Watchdog::handle-poke: 18790 * @object: A #Watchdog. 18791 * @invocation: A #GDBusMethodInvocation. 18792 * 18793 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. 18794 * 18795 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_poke() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 18796 * 18797 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 18798 */ 18799 g_signal_new ("handle-poke", 18800 G_TYPE_FROM_INTERFACE (iface), 18801 G_SIGNAL_RUN_LAST, 18802 G_STRUCT_OFFSET (WatchdogIface, handle_poke), 18803 g_signal_accumulator_true_handled, 18804 NULL, 18805 g_cclosure_marshal_generic, 18806 G_TYPE_BOOLEAN, 18807 1, 18808 G_TYPE_DBUS_METHOD_INVOCATION); 18809 18810 /** 18811 * Watchdog::handle-stop: 18812 * @object: A #Watchdog. 18813 * @invocation: A #GDBusMethodInvocation. 18814 * 18815 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. 18816 * 18817 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 18818 * 18819 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 18820 */ 18821 g_signal_new ("handle-stop", 18822 G_TYPE_FROM_INTERFACE (iface), 18823 G_SIGNAL_RUN_LAST, 18824 G_STRUCT_OFFSET (WatchdogIface, handle_stop), 18825 g_signal_accumulator_true_handled, 18826 NULL, 18827 g_cclosure_marshal_generic, 18828 G_TYPE_BOOLEAN, 18829 1, 18830 G_TYPE_DBUS_METHOD_INVOCATION); 18831 18832 /** 18833 * Watchdog::handle-set: 18834 * @object: A #Watchdog. 18835 * @invocation: A #GDBusMethodInvocation. 18836 * @arg_interval: Argument passed by remote caller. 18837 * 18838 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method. 18839 * 18840 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_set() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 18841 * 18842 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 18843 */ 18844 g_signal_new ("handle-set", 18845 G_TYPE_FROM_INTERFACE (iface), 18846 G_SIGNAL_RUN_LAST, 18847 G_STRUCT_OFFSET (WatchdogIface, handle_set), 18848 g_signal_accumulator_true_handled, 18849 NULL, 18850 g_cclosure_marshal_generic, 18851 G_TYPE_BOOLEAN, 18852 2, 18853 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); 18854 18855 /* GObject signals for received D-Bus signals: */ 18856 /** 18857 * Watchdog::watchdog-error: 18858 * @object: A #Watchdog. 18859 * 18860 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> is received. 18861 * 18862 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 18863 */ 18864 g_signal_new ("watchdog-error", 18865 G_TYPE_FROM_INTERFACE (iface), 18866 G_SIGNAL_RUN_LAST, 18867 G_STRUCT_OFFSET (WatchdogIface, watchdog_error), 18868 NULL, 18869 NULL, 18870 g_cclosure_marshal_generic, 18871 G_TYPE_NONE, 18872 0); 18873 18874 /* GObject properties for D-Bus properties: */ 18875 /** 18876 * Watchdog:watchdog: 18877 * 18878 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>. 18879 * 18880 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 18881 */ 18882 g_object_interface_install_property (iface, 18883 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 18884 /** 18885 * Watchdog:poll-interval: 18886 * 18887 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>. 18888 * 18889 * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. 18890 */ 18891 g_object_interface_install_property (iface, 18892 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 18893 } 18894 18895 /** 18896 * watchdog_get_watchdog: (skip) 18897 * @object: A #Watchdog. 18898 * 18899 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property. 18900 * 18901 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 18902 * 18903 * Returns: The property value. 18904 */ 18905 gint 18906 watchdog_get_watchdog (Watchdog *object) 18907 { 18908 return WATCHDOG_GET_IFACE (object)->get_watchdog (object); 18909 } 18910 18911 /** 18912 * watchdog_set_watchdog: (skip) 18913 * @object: A #Watchdog. 18914 * @value: The value to set. 18915 * 18916 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value. 18917 * 18918 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 18919 */ 18920 void 18921 watchdog_set_watchdog (Watchdog *object, gint value) 18922 { 18923 g_object_set (G_OBJECT (object), "watchdog", value, NULL); 18924 } 18925 18926 /** 18927 * watchdog_get_poll_interval: (skip) 18928 * @object: A #Watchdog. 18929 * 18930 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property. 18931 * 18932 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 18933 * 18934 * Returns: The property value. 18935 */ 18936 gint 18937 watchdog_get_poll_interval (Watchdog *object) 18938 { 18939 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object); 18940 } 18941 18942 /** 18943 * watchdog_set_poll_interval: (skip) 18944 * @object: A #Watchdog. 18945 * @value: The value to set. 18946 * 18947 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value. 18948 * 18949 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. 18950 */ 18951 void 18952 watchdog_set_poll_interval (Watchdog *object, gint value) 18953 { 18954 g_object_set (G_OBJECT (object), "poll-interval", value, NULL); 18955 } 18956 18957 /** 18958 * watchdog_emit_watchdog_error: 18959 * @object: A #Watchdog. 18960 * 18961 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal. 18962 */ 18963 void 18964 watchdog_emit_watchdog_error ( 18965 Watchdog *object) 18966 { 18967 g_signal_emit_by_name (object, "watchdog-error"); 18968 } 18969 18970 /** 18971 * watchdog_call_start: 18972 * @proxy: A #WatchdogProxy. 18973 * @cancellable: (allow-none): A #GCancellable or %NULL. 18974 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 18975 * @user_data: User data to pass to @callback. 18976 * 18977 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. 18978 * 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. 18979 * You can then call watchdog_call_start_finish() to get the result of the operation. 18980 * 18981 * See watchdog_call_start_sync() for the synchronous, blocking version of this method. 18982 */ 18983 void 18984 watchdog_call_start ( 18985 Watchdog *proxy, 18986 GCancellable *cancellable, 18987 GAsyncReadyCallback callback, 18988 gpointer user_data) 18989 { 18990 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 18991 "start", 18992 g_variant_new ("()"), 18993 G_DBUS_CALL_FLAGS_NONE, 18994 -1, 18995 cancellable, 18996 callback, 18997 user_data); 18998 } 18999 19000 /** 19001 * watchdog_call_start_finish: 19002 * @proxy: A #WatchdogProxy. 19003 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start(). 19004 * @error: Return location for error or %NULL. 19005 * 19006 * Finishes an operation started with watchdog_call_start(). 19007 * 19008 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 19009 */ 19010 gboolean 19011 watchdog_call_start_finish ( 19012 Watchdog *proxy, 19013 GAsyncResult *res, 19014 GError **error) 19015 { 19016 GVariant *_ret; 19017 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 19018 if (_ret == NULL) 19019 goto _out; 19020 g_variant_get (_ret, 19021 "()"); 19022 g_variant_unref (_ret); 19023 _out: 19024 return _ret != NULL; 19025 } 19026 19027 /** 19028 * watchdog_call_start_sync: 19029 * @proxy: A #WatchdogProxy. 19030 * @cancellable: (allow-none): A #GCancellable or %NULL. 19031 * @error: Return location for error or %NULL. 19032 * 19033 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 19034 * 19035 * See watchdog_call_start() for the asynchronous version of this method. 19036 * 19037 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 19038 */ 19039 gboolean 19040 watchdog_call_start_sync ( 19041 Watchdog *proxy, 19042 GCancellable *cancellable, 19043 GError **error) 19044 { 19045 GVariant *_ret; 19046 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 19047 "start", 19048 g_variant_new ("()"), 19049 G_DBUS_CALL_FLAGS_NONE, 19050 -1, 19051 cancellable, 19052 error); 19053 if (_ret == NULL) 19054 goto _out; 19055 g_variant_get (_ret, 19056 "()"); 19057 g_variant_unref (_ret); 19058 _out: 19059 return _ret != NULL; 19060 } 19061 19062 /** 19063 * watchdog_call_poke: 19064 * @proxy: A #WatchdogProxy. 19065 * @cancellable: (allow-none): A #GCancellable or %NULL. 19066 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 19067 * @user_data: User data to pass to @callback. 19068 * 19069 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. 19070 * 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. 19071 * You can then call watchdog_call_poke_finish() to get the result of the operation. 19072 * 19073 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method. 19074 */ 19075 void 19076 watchdog_call_poke ( 19077 Watchdog *proxy, 19078 GCancellable *cancellable, 19079 GAsyncReadyCallback callback, 19080 gpointer user_data) 19081 { 19082 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 19083 "poke", 19084 g_variant_new ("()"), 19085 G_DBUS_CALL_FLAGS_NONE, 19086 -1, 19087 cancellable, 19088 callback, 19089 user_data); 19090 } 19091 19092 /** 19093 * watchdog_call_poke_finish: 19094 * @proxy: A #WatchdogProxy. 19095 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke(). 19096 * @error: Return location for error or %NULL. 19097 * 19098 * Finishes an operation started with watchdog_call_poke(). 19099 * 19100 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 19101 */ 19102 gboolean 19103 watchdog_call_poke_finish ( 19104 Watchdog *proxy, 19105 GAsyncResult *res, 19106 GError **error) 19107 { 19108 GVariant *_ret; 19109 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 19110 if (_ret == NULL) 19111 goto _out; 19112 g_variant_get (_ret, 19113 "()"); 19114 g_variant_unref (_ret); 19115 _out: 19116 return _ret != NULL; 19117 } 19118 19119 /** 19120 * watchdog_call_poke_sync: 19121 * @proxy: A #WatchdogProxy. 19122 * @cancellable: (allow-none): A #GCancellable or %NULL. 19123 * @error: Return location for error or %NULL. 19124 * 19125 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 19126 * 19127 * See watchdog_call_poke() for the asynchronous version of this method. 19128 * 19129 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 19130 */ 19131 gboolean 19132 watchdog_call_poke_sync ( 19133 Watchdog *proxy, 19134 GCancellable *cancellable, 19135 GError **error) 19136 { 19137 GVariant *_ret; 19138 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 19139 "poke", 19140 g_variant_new ("()"), 19141 G_DBUS_CALL_FLAGS_NONE, 19142 -1, 19143 cancellable, 19144 error); 19145 if (_ret == NULL) 19146 goto _out; 19147 g_variant_get (_ret, 19148 "()"); 19149 g_variant_unref (_ret); 19150 _out: 19151 return _ret != NULL; 19152 } 19153 19154 /** 19155 * watchdog_call_stop: 19156 * @proxy: A #WatchdogProxy. 19157 * @cancellable: (allow-none): A #GCancellable or %NULL. 19158 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 19159 * @user_data: User data to pass to @callback. 19160 * 19161 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. 19162 * 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. 19163 * You can then call watchdog_call_stop_finish() to get the result of the operation. 19164 * 19165 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method. 19166 */ 19167 void 19168 watchdog_call_stop ( 19169 Watchdog *proxy, 19170 GCancellable *cancellable, 19171 GAsyncReadyCallback callback, 19172 gpointer user_data) 19173 { 19174 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 19175 "stop", 19176 g_variant_new ("()"), 19177 G_DBUS_CALL_FLAGS_NONE, 19178 -1, 19179 cancellable, 19180 callback, 19181 user_data); 19182 } 19183 19184 /** 19185 * watchdog_call_stop_finish: 19186 * @proxy: A #WatchdogProxy. 19187 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop(). 19188 * @error: Return location for error or %NULL. 19189 * 19190 * Finishes an operation started with watchdog_call_stop(). 19191 * 19192 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 19193 */ 19194 gboolean 19195 watchdog_call_stop_finish ( 19196 Watchdog *proxy, 19197 GAsyncResult *res, 19198 GError **error) 19199 { 19200 GVariant *_ret; 19201 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 19202 if (_ret == NULL) 19203 goto _out; 19204 g_variant_get (_ret, 19205 "()"); 19206 g_variant_unref (_ret); 19207 _out: 19208 return _ret != NULL; 19209 } 19210 19211 /** 19212 * watchdog_call_stop_sync: 19213 * @proxy: A #WatchdogProxy. 19214 * @cancellable: (allow-none): A #GCancellable or %NULL. 19215 * @error: Return location for error or %NULL. 19216 * 19217 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 19218 * 19219 * See watchdog_call_stop() for the asynchronous version of this method. 19220 * 19221 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 19222 */ 19223 gboolean 19224 watchdog_call_stop_sync ( 19225 Watchdog *proxy, 19226 GCancellable *cancellable, 19227 GError **error) 19228 { 19229 GVariant *_ret; 19230 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 19231 "stop", 19232 g_variant_new ("()"), 19233 G_DBUS_CALL_FLAGS_NONE, 19234 -1, 19235 cancellable, 19236 error); 19237 if (_ret == NULL) 19238 goto _out; 19239 g_variant_get (_ret, 19240 "()"); 19241 g_variant_unref (_ret); 19242 _out: 19243 return _ret != NULL; 19244 } 19245 19246 /** 19247 * watchdog_call_set: 19248 * @proxy: A #WatchdogProxy. 19249 * @arg_interval: Argument to pass with the method invocation. 19250 * @cancellable: (allow-none): A #GCancellable or %NULL. 19251 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 19252 * @user_data: User data to pass to @callback. 19253 * 19254 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy. 19255 * 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. 19256 * You can then call watchdog_call_set_finish() to get the result of the operation. 19257 * 19258 * See watchdog_call_set_sync() for the synchronous, blocking version of this method. 19259 */ 19260 void 19261 watchdog_call_set ( 19262 Watchdog *proxy, 19263 gint arg_interval, 19264 GCancellable *cancellable, 19265 GAsyncReadyCallback callback, 19266 gpointer user_data) 19267 { 19268 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 19269 "set", 19270 g_variant_new ("(i)", 19271 arg_interval), 19272 G_DBUS_CALL_FLAGS_NONE, 19273 -1, 19274 cancellable, 19275 callback, 19276 user_data); 19277 } 19278 19279 /** 19280 * watchdog_call_set_finish: 19281 * @proxy: A #WatchdogProxy. 19282 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set(). 19283 * @error: Return location for error or %NULL. 19284 * 19285 * Finishes an operation started with watchdog_call_set(). 19286 * 19287 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 19288 */ 19289 gboolean 19290 watchdog_call_set_finish ( 19291 Watchdog *proxy, 19292 GAsyncResult *res, 19293 GError **error) 19294 { 19295 GVariant *_ret; 19296 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 19297 if (_ret == NULL) 19298 goto _out; 19299 g_variant_get (_ret, 19300 "()"); 19301 g_variant_unref (_ret); 19302 _out: 19303 return _ret != NULL; 19304 } 19305 19306 /** 19307 * watchdog_call_set_sync: 19308 * @proxy: A #WatchdogProxy. 19309 * @arg_interval: Argument to pass with the method invocation. 19310 * @cancellable: (allow-none): A #GCancellable or %NULL. 19311 * @error: Return location for error or %NULL. 19312 * 19313 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 19314 * 19315 * See watchdog_call_set() for the asynchronous version of this method. 19316 * 19317 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 19318 */ 19319 gboolean 19320 watchdog_call_set_sync ( 19321 Watchdog *proxy, 19322 gint arg_interval, 19323 GCancellable *cancellable, 19324 GError **error) 19325 { 19326 GVariant *_ret; 19327 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 19328 "set", 19329 g_variant_new ("(i)", 19330 arg_interval), 19331 G_DBUS_CALL_FLAGS_NONE, 19332 -1, 19333 cancellable, 19334 error); 19335 if (_ret == NULL) 19336 goto _out; 19337 g_variant_get (_ret, 19338 "()"); 19339 g_variant_unref (_ret); 19340 _out: 19341 return _ret != NULL; 19342 } 19343 19344 /** 19345 * watchdog_complete_start: 19346 * @object: A #Watchdog. 19347 * @invocation: (transfer full): A #GDBusMethodInvocation. 19348 * 19349 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 19350 * 19351 * This method will free @invocation, you cannot use it afterwards. 19352 */ 19353 void 19354 watchdog_complete_start ( 19355 Watchdog *object, 19356 GDBusMethodInvocation *invocation) 19357 { 19358 g_dbus_method_invocation_return_value (invocation, 19359 g_variant_new ("()")); 19360 } 19361 19362 /** 19363 * watchdog_complete_poke: 19364 * @object: A #Watchdog. 19365 * @invocation: (transfer full): A #GDBusMethodInvocation. 19366 * 19367 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 19368 * 19369 * This method will free @invocation, you cannot use it afterwards. 19370 */ 19371 void 19372 watchdog_complete_poke ( 19373 Watchdog *object, 19374 GDBusMethodInvocation *invocation) 19375 { 19376 g_dbus_method_invocation_return_value (invocation, 19377 g_variant_new ("()")); 19378 } 19379 19380 /** 19381 * watchdog_complete_stop: 19382 * @object: A #Watchdog. 19383 * @invocation: (transfer full): A #GDBusMethodInvocation. 19384 * 19385 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 19386 * 19387 * This method will free @invocation, you cannot use it afterwards. 19388 */ 19389 void 19390 watchdog_complete_stop ( 19391 Watchdog *object, 19392 GDBusMethodInvocation *invocation) 19393 { 19394 g_dbus_method_invocation_return_value (invocation, 19395 g_variant_new ("()")); 19396 } 19397 19398 /** 19399 * watchdog_complete_set: 19400 * @object: A #Watchdog. 19401 * @invocation: (transfer full): A #GDBusMethodInvocation. 19402 * 19403 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 19404 * 19405 * This method will free @invocation, you cannot use it afterwards. 19406 */ 19407 void 19408 watchdog_complete_set ( 19409 Watchdog *object, 19410 GDBusMethodInvocation *invocation) 19411 { 19412 g_dbus_method_invocation_return_value (invocation, 19413 g_variant_new ("()")); 19414 } 19415 19416 /* ------------------------------------------------------------------------ */ 19417 19418 /** 19419 * WatchdogProxy: 19420 * 19421 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API. 19422 */ 19423 19424 /** 19425 * WatchdogProxyClass: 19426 * @parent_class: The parent class. 19427 * 19428 * Class structure for #WatchdogProxy. 19429 */ 19430 19431 struct _WatchdogProxyPrivate 19432 { 19433 GData *qdata; 19434 }; 19435 19436 static void watchdog_proxy_iface_init (WatchdogIface *iface); 19437 19438 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 19439 G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, 19440 G_ADD_PRIVATE (WatchdogProxy) 19441 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); 19442 19443 #else 19444 G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, 19445 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); 19446 19447 #endif 19448 static void 19449 watchdog_proxy_finalize (GObject *object) 19450 { 19451 WatchdogProxy *proxy = WATCHDOG_PROXY (object); 19452 g_datalist_clear (&proxy->priv->qdata); 19453 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object); 19454 } 19455 19456 static void 19457 watchdog_proxy_get_property (GObject *object, 19458 guint prop_id, 19459 GValue *value, 19460 GParamSpec *pspec G_GNUC_UNUSED) 19461 { 19462 const _ExtendedGDBusPropertyInfo *info; 19463 GVariant *variant; 19464 g_assert (prop_id != 0 && prop_id - 1 < 2); 19465 info = _watchdog_property_info_pointers[prop_id - 1]; 19466 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 19467 if (info->use_gvariant) 19468 { 19469 g_value_set_variant (value, variant); 19470 } 19471 else 19472 { 19473 if (variant != NULL) 19474 g_dbus_gvariant_to_gvalue (variant, value); 19475 } 19476 if (variant != NULL) 19477 g_variant_unref (variant); 19478 } 19479 19480 static void 19481 watchdog_proxy_set_property_cb (GDBusProxy *proxy, 19482 GAsyncResult *res, 19483 gpointer user_data) 19484 { 19485 const _ExtendedGDBusPropertyInfo *info = user_data; 19486 GError *error; 19487 GVariant *_ret; 19488 error = NULL; 19489 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 19490 if (!_ret) 19491 { 19492 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)", 19493 info->parent_struct.name, 19494 error->message, g_quark_to_string (error->domain), error->code); 19495 g_error_free (error); 19496 } 19497 else 19498 { 19499 g_variant_unref (_ret); 19500 } 19501 } 19502 19503 static void 19504 watchdog_proxy_set_property (GObject *object, 19505 guint prop_id, 19506 const GValue *value, 19507 GParamSpec *pspec G_GNUC_UNUSED) 19508 { 19509 const _ExtendedGDBusPropertyInfo *info; 19510 GVariant *variant; 19511 g_assert (prop_id != 0 && prop_id - 1 < 2); 19512 info = _watchdog_property_info_pointers[prop_id - 1]; 19513 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 19514 g_dbus_proxy_call (G_DBUS_PROXY (object), 19515 "org.freedesktop.DBus.Properties.Set", 19516 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant), 19517 G_DBUS_CALL_FLAGS_NONE, 19518 -1, 19519 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 19520 g_variant_unref (variant); 19521 } 19522 19523 static void 19524 watchdog_proxy_g_signal (GDBusProxy *proxy, 19525 const gchar *sender_name G_GNUC_UNUSED, 19526 const gchar *signal_name, 19527 GVariant *parameters) 19528 { 19529 _ExtendedGDBusSignalInfo *info; 19530 GVariantIter iter; 19531 GVariant *child; 19532 GValue *paramv; 19533 guint num_params; 19534 guint n; 19535 guint signal_id; 19536 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name); 19537 if (info == NULL) 19538 return; 19539 num_params = g_variant_n_children (parameters); 19540 paramv = g_new0 (GValue, num_params + 1); 19541 g_value_init (¶mv[0], TYPE_WATCHDOG); 19542 g_value_set_object (¶mv[0], proxy); 19543 g_variant_iter_init (&iter, parameters); 19544 n = 1; 19545 while ((child = g_variant_iter_next_value (&iter)) != NULL) 19546 { 19547 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 19548 if (arg_info->use_gvariant) 19549 { 19550 g_value_init (¶mv[n], G_TYPE_VARIANT); 19551 g_value_set_variant (¶mv[n], child); 19552 n++; 19553 } 19554 else 19555 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 19556 g_variant_unref (child); 19557 } 19558 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); 19559 g_signal_emitv (paramv, signal_id, 0, NULL); 19560 for (n = 0; n < num_params + 1; n++) 19561 g_value_unset (¶mv[n]); 19562 g_free (paramv); 19563 } 19564 19565 static void 19566 watchdog_proxy_g_properties_changed (GDBusProxy *_proxy, 19567 GVariant *changed_properties, 19568 const gchar *const *invalidated_properties) 19569 { 19570 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy); 19571 guint n; 19572 const gchar *key; 19573 GVariantIter *iter; 19574 _ExtendedGDBusPropertyInfo *info; 19575 g_variant_get (changed_properties, "a{sv}", &iter); 19576 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 19577 { 19578 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key); 19579 g_datalist_remove_data (&proxy->priv->qdata, key); 19580 if (info != NULL) 19581 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 19582 } 19583 g_variant_iter_free (iter); 19584 for (n = 0; invalidated_properties[n] != NULL; n++) 19585 { 19586 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]); 19587 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 19588 if (info != NULL) 19589 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 19590 } 19591 } 19592 19593 static gint 19594 watchdog_proxy_get_watchdog (Watchdog *object) 19595 { 19596 WatchdogProxy *proxy = WATCHDOG_PROXY (object); 19597 GVariant *variant; 19598 gint value = 0; 19599 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog"); 19600 if (variant != NULL) 19601 { 19602 value = g_variant_get_int32 (variant); 19603 g_variant_unref (variant); 19604 } 19605 return value; 19606 } 19607 19608 static gint 19609 watchdog_proxy_get_poll_interval (Watchdog *object) 19610 { 19611 WatchdogProxy *proxy = WATCHDOG_PROXY (object); 19612 GVariant *variant; 19613 gint value = 0; 19614 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); 19615 if (variant != NULL) 19616 { 19617 value = g_variant_get_int32 (variant); 19618 g_variant_unref (variant); 19619 } 19620 return value; 19621 } 19622 19623 static void 19624 watchdog_proxy_init (WatchdogProxy *proxy) 19625 { 19626 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 19627 proxy->priv = watchdog_proxy_get_instance_private (proxy); 19628 #else 19629 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate); 19630 #endif 19631 19632 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ()); 19633 } 19634 19635 static void 19636 watchdog_proxy_class_init (WatchdogProxyClass *klass) 19637 { 19638 GObjectClass *gobject_class; 19639 GDBusProxyClass *proxy_class; 19640 19641 gobject_class = G_OBJECT_CLASS (klass); 19642 gobject_class->finalize = watchdog_proxy_finalize; 19643 gobject_class->get_property = watchdog_proxy_get_property; 19644 gobject_class->set_property = watchdog_proxy_set_property; 19645 19646 proxy_class = G_DBUS_PROXY_CLASS (klass); 19647 proxy_class->g_signal = watchdog_proxy_g_signal; 19648 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed; 19649 19650 watchdog_override_properties (gobject_class, 1); 19651 19652 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 19653 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate)); 19654 #endif 19655 } 19656 19657 static void 19658 watchdog_proxy_iface_init (WatchdogIface *iface) 19659 { 19660 iface->get_watchdog = watchdog_proxy_get_watchdog; 19661 iface->get_poll_interval = watchdog_proxy_get_poll_interval; 19662 } 19663 19664 /** 19665 * watchdog_proxy_new: 19666 * @connection: A #GDBusConnection. 19667 * @flags: Flags from the #GDBusProxyFlags enumeration. 19668 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 19669 * @object_path: An object path. 19670 * @cancellable: (allow-none): A #GCancellable or %NULL. 19671 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 19672 * @user_data: User data to pass to @callback. 19673 * 19674 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new() for more details. 19675 * 19676 * 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. 19677 * You can then call watchdog_proxy_new_finish() to get the result of the operation. 19678 * 19679 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor. 19680 */ 19681 void 19682 watchdog_proxy_new ( 19683 GDBusConnection *connection, 19684 GDBusProxyFlags flags, 19685 const gchar *name, 19686 const gchar *object_path, 19687 GCancellable *cancellable, 19688 GAsyncReadyCallback callback, 19689 gpointer user_data) 19690 { 19691 g_async_initable_new_async (TYPE_WATCHDOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL); 19692 } 19693 19694 /** 19695 * watchdog_proxy_new_finish: 19696 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new(). 19697 * @error: Return location for error or %NULL 19698 * 19699 * Finishes an operation started with watchdog_proxy_new(). 19700 * 19701 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. 19702 */ 19703 Watchdog * 19704 watchdog_proxy_new_finish ( 19705 GAsyncResult *res, 19706 GError **error) 19707 { 19708 GObject *ret; 19709 GObject *source_object; 19710 source_object = g_async_result_get_source_object (res); 19711 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 19712 g_object_unref (source_object); 19713 if (ret != NULL) 19714 return WATCHDOG (ret); 19715 else 19716 return NULL; 19717 } 19718 19719 /** 19720 * watchdog_proxy_new_sync: 19721 * @connection: A #GDBusConnection. 19722 * @flags: Flags from the #GDBusProxyFlags enumeration. 19723 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 19724 * @object_path: An object path. 19725 * @cancellable: (allow-none): A #GCancellable or %NULL. 19726 * @error: Return location for error or %NULL 19727 * 19728 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new_sync() for more details. 19729 * 19730 * The calling thread is blocked until a reply is received. 19731 * 19732 * See watchdog_proxy_new() for the asynchronous version of this constructor. 19733 * 19734 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. 19735 */ 19736 Watchdog * 19737 watchdog_proxy_new_sync ( 19738 GDBusConnection *connection, 19739 GDBusProxyFlags flags, 19740 const gchar *name, 19741 const gchar *object_path, 19742 GCancellable *cancellable, 19743 GError **error) 19744 { 19745 GInitable *ret; 19746 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL); 19747 if (ret != NULL) 19748 return WATCHDOG (ret); 19749 else 19750 return NULL; 19751 } 19752 19753 19754 /** 19755 * watchdog_proxy_new_for_bus: 19756 * @bus_type: A #GBusType. 19757 * @flags: Flags from the #GDBusProxyFlags enumeration. 19758 * @name: A bus name (well-known or unique). 19759 * @object_path: An object path. 19760 * @cancellable: (allow-none): A #GCancellable or %NULL. 19761 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 19762 * @user_data: User data to pass to @callback. 19763 * 19764 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 19765 * 19766 * 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. 19767 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation. 19768 * 19769 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 19770 */ 19771 void 19772 watchdog_proxy_new_for_bus ( 19773 GBusType bus_type, 19774 GDBusProxyFlags flags, 19775 const gchar *name, 19776 const gchar *object_path, 19777 GCancellable *cancellable, 19778 GAsyncReadyCallback callback, 19779 gpointer user_data) 19780 { 19781 g_async_initable_new_async (TYPE_WATCHDOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL); 19782 } 19783 19784 /** 19785 * watchdog_proxy_new_for_bus_finish: 19786 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus(). 19787 * @error: Return location for error or %NULL 19788 * 19789 * Finishes an operation started with watchdog_proxy_new_for_bus(). 19790 * 19791 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. 19792 */ 19793 Watchdog * 19794 watchdog_proxy_new_for_bus_finish ( 19795 GAsyncResult *res, 19796 GError **error) 19797 { 19798 GObject *ret; 19799 GObject *source_object; 19800 source_object = g_async_result_get_source_object (res); 19801 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 19802 g_object_unref (source_object); 19803 if (ret != NULL) 19804 return WATCHDOG (ret); 19805 else 19806 return NULL; 19807 } 19808 19809 /** 19810 * watchdog_proxy_new_for_bus_sync: 19811 * @bus_type: A #GBusType. 19812 * @flags: Flags from the #GDBusProxyFlags enumeration. 19813 * @name: A bus name (well-known or unique). 19814 * @object_path: An object path. 19815 * @cancellable: (allow-none): A #GCancellable or %NULL. 19816 * @error: Return location for error or %NULL 19817 * 19818 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 19819 * 19820 * The calling thread is blocked until a reply is received. 19821 * 19822 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor. 19823 * 19824 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. 19825 */ 19826 Watchdog * 19827 watchdog_proxy_new_for_bus_sync ( 19828 GBusType bus_type, 19829 GDBusProxyFlags flags, 19830 const gchar *name, 19831 const gchar *object_path, 19832 GCancellable *cancellable, 19833 GError **error) 19834 { 19835 GInitable *ret; 19836 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL); 19837 if (ret != NULL) 19838 return WATCHDOG (ret); 19839 else 19840 return NULL; 19841 } 19842 19843 19844 /* ------------------------------------------------------------------------ */ 19845 19846 /** 19847 * WatchdogSkeleton: 19848 * 19849 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API. 19850 */ 19851 19852 /** 19853 * WatchdogSkeletonClass: 19854 * @parent_class: The parent class. 19855 * 19856 * Class structure for #WatchdogSkeleton. 19857 */ 19858 19859 struct _WatchdogSkeletonPrivate 19860 { 19861 GValue *properties; 19862 GList *changed_properties; 19863 GSource *changed_properties_idle_source; 19864 GMainContext *context; 19865 GMutex lock; 19866 }; 19867 19868 static void 19869 _watchdog_skeleton_handle_method_call ( 19870 GDBusConnection *connection G_GNUC_UNUSED, 19871 const gchar *sender G_GNUC_UNUSED, 19872 const gchar *object_path G_GNUC_UNUSED, 19873 const gchar *interface_name, 19874 const gchar *method_name, 19875 GVariant *parameters, 19876 GDBusMethodInvocation *invocation, 19877 gpointer user_data) 19878 { 19879 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); 19880 _ExtendedGDBusMethodInfo *info; 19881 GVariantIter iter; 19882 GVariant *child; 19883 GValue *paramv; 19884 guint num_params; 19885 guint num_extra; 19886 guint n; 19887 guint signal_id; 19888 GValue return_value = G_VALUE_INIT; 19889 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 19890 g_assert (info != NULL); 19891 num_params = g_variant_n_children (parameters); 19892 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 19893 n = 0; 19894 g_value_init (¶mv[n], TYPE_WATCHDOG); 19895 g_value_set_object (¶mv[n++], skeleton); 19896 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 19897 g_value_set_object (¶mv[n++], invocation); 19898 if (info->pass_fdlist) 19899 { 19900 #ifdef G_OS_UNIX 19901 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 19902 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 19903 #else 19904 g_assert_not_reached (); 19905 #endif 19906 } 19907 g_variant_iter_init (&iter, parameters); 19908 while ((child = g_variant_iter_next_value (&iter)) != NULL) 19909 { 19910 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 19911 if (arg_info->use_gvariant) 19912 { 19913 g_value_init (¶mv[n], G_TYPE_VARIANT); 19914 g_value_set_variant (¶mv[n], child); 19915 n++; 19916 } 19917 else 19918 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 19919 g_variant_unref (child); 19920 } 19921 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); 19922 g_value_init (&return_value, G_TYPE_BOOLEAN); 19923 g_signal_emitv (paramv, signal_id, 0, &return_value); 19924 if (!g_value_get_boolean (&return_value)) 19925 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); 19926 g_value_unset (&return_value); 19927 for (n = 0; n < num_params + num_extra; n++) 19928 g_value_unset (¶mv[n]); 19929 g_free (paramv); 19930 } 19931 19932 static GVariant * 19933 _watchdog_skeleton_handle_get_property ( 19934 GDBusConnection *connection G_GNUC_UNUSED, 19935 const gchar *sender G_GNUC_UNUSED, 19936 const gchar *object_path G_GNUC_UNUSED, 19937 const gchar *interface_name G_GNUC_UNUSED, 19938 const gchar *property_name, 19939 GError **error, 19940 gpointer user_data) 19941 { 19942 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); 19943 GValue value = G_VALUE_INIT; 19944 GParamSpec *pspec; 19945 _ExtendedGDBusPropertyInfo *info; 19946 GVariant *ret; 19947 ret = NULL; 19948 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); 19949 g_assert (info != NULL); 19950 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 19951 if (pspec == NULL) 19952 { 19953 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 19954 } 19955 else 19956 { 19957 g_value_init (&value, pspec->value_type); 19958 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 19959 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 19960 g_value_unset (&value); 19961 } 19962 return ret; 19963 } 19964 19965 static gboolean 19966 _watchdog_skeleton_handle_set_property ( 19967 GDBusConnection *connection G_GNUC_UNUSED, 19968 const gchar *sender G_GNUC_UNUSED, 19969 const gchar *object_path G_GNUC_UNUSED, 19970 const gchar *interface_name G_GNUC_UNUSED, 19971 const gchar *property_name, 19972 GVariant *variant, 19973 GError **error, 19974 gpointer user_data) 19975 { 19976 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); 19977 GValue value = G_VALUE_INIT; 19978 GParamSpec *pspec; 19979 _ExtendedGDBusPropertyInfo *info; 19980 gboolean ret; 19981 ret = FALSE; 19982 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); 19983 g_assert (info != NULL); 19984 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 19985 if (pspec == NULL) 19986 { 19987 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 19988 } 19989 else 19990 { 19991 if (info->use_gvariant) 19992 g_value_set_variant (&value, variant); 19993 else 19994 g_dbus_gvariant_to_gvalue (variant, &value); 19995 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 19996 g_value_unset (&value); 19997 ret = TRUE; 19998 } 19999 return ret; 20000 } 20001 20002 static const GDBusInterfaceVTable _watchdog_skeleton_vtable = 20003 { 20004 _watchdog_skeleton_handle_method_call, 20005 _watchdog_skeleton_handle_get_property, 20006 _watchdog_skeleton_handle_set_property, 20007 {NULL} 20008 }; 20009 20010 static GDBusInterfaceInfo * 20011 watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 20012 { 20013 return watchdog_interface_info (); 20014 } 20015 20016 static GDBusInterfaceVTable * 20017 watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 20018 { 20019 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable; 20020 } 20021 20022 static GVariant * 20023 watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 20024 { 20025 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); 20026 20027 GVariantBuilder builder; 20028 guint n; 20029 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 20030 if (_watchdog_interface_info.parent_struct.properties == NULL) 20031 goto out; 20032 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++) 20033 { 20034 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n]; 20035 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 20036 { 20037 GVariant *value; 20038 value = _watchdog_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", info->name, NULL, skeleton); 20039 if (value != NULL) 20040 { 20041 g_variant_take_ref (value); 20042 g_variant_builder_add (&builder, "{sv}", info->name, value); 20043 g_variant_unref (value); 20044 } 20045 } 20046 } 20047 out: 20048 return g_variant_builder_end (&builder); 20049 } 20050 20051 static gboolean _watchdog_emit_changed (gpointer user_data); 20052 20053 static void 20054 watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 20055 { 20056 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); 20057 gboolean emit_changed = FALSE; 20058 20059 g_mutex_lock (&skeleton->priv->lock); 20060 if (skeleton->priv->changed_properties_idle_source != NULL) 20061 { 20062 g_source_destroy (skeleton->priv->changed_properties_idle_source); 20063 skeleton->priv->changed_properties_idle_source = NULL; 20064 emit_changed = TRUE; 20065 } 20066 g_mutex_unlock (&skeleton->priv->lock); 20067 20068 if (emit_changed) 20069 _watchdog_emit_changed (skeleton); 20070 } 20071 20072 static void 20073 _watchdog_on_signal_watchdog_error ( 20074 Watchdog *object) 20075 { 20076 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); 20077 20078 GList *connections, *l; 20079 GVariant *signal_variant; 20080 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 20081 20082 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 20083 for (l = connections; l != NULL; l = l->next) 20084 { 20085 GDBusConnection *connection = l->data; 20086 g_dbus_connection_emit_signal (connection, 20087 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError", 20088 signal_variant, NULL); 20089 } 20090 g_variant_unref (signal_variant); 20091 g_list_free_full (connections, g_object_unref); 20092 } 20093 20094 static void watchdog_skeleton_iface_init (WatchdogIface *iface); 20095 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 20096 G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 20097 G_ADD_PRIVATE (WatchdogSkeleton) 20098 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); 20099 20100 #else 20101 G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 20102 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); 20103 20104 #endif 20105 static void 20106 watchdog_skeleton_finalize (GObject *object) 20107 { 20108 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); 20109 guint n; 20110 for (n = 0; n < 2; n++) 20111 g_value_unset (&skeleton->priv->properties[n]); 20112 g_free (skeleton->priv->properties); 20113 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 20114 if (skeleton->priv->changed_properties_idle_source != NULL) 20115 g_source_destroy (skeleton->priv->changed_properties_idle_source); 20116 g_main_context_unref (skeleton->priv->context); 20117 g_mutex_clear (&skeleton->priv->lock); 20118 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object); 20119 } 20120 20121 static void 20122 watchdog_skeleton_get_property (GObject *object, 20123 guint prop_id, 20124 GValue *value, 20125 GParamSpec *pspec G_GNUC_UNUSED) 20126 { 20127 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); 20128 g_assert (prop_id != 0 && prop_id - 1 < 2); 20129 g_mutex_lock (&skeleton->priv->lock); 20130 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 20131 g_mutex_unlock (&skeleton->priv->lock); 20132 } 20133 20134 static gboolean 20135 _watchdog_emit_changed (gpointer user_data) 20136 { 20137 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); 20138 GList *l; 20139 GVariantBuilder builder; 20140 GVariantBuilder invalidated_builder; 20141 guint num_changes; 20142 20143 g_mutex_lock (&skeleton->priv->lock); 20144 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 20145 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 20146 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 20147 { 20148 ChangedProperty *cp = l->data; 20149 GVariant *variant; 20150 const GValue *cur_value; 20151 20152 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 20153 if (!_g_value_equal (cur_value, &cp->orig_value)) 20154 { 20155 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 20156 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 20157 g_variant_unref (variant); 20158 num_changes++; 20159 } 20160 } 20161 if (num_changes > 0) 20162 { 20163 GList *connections, *ll; 20164 GVariant *signal_variant; 20165 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog", 20166 &builder, &invalidated_builder)); 20167 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 20168 for (ll = connections; ll != NULL; ll = ll->next) 20169 { 20170 GDBusConnection *connection = ll->data; 20171 20172 g_dbus_connection_emit_signal (connection, 20173 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 20174 "org.freedesktop.DBus.Properties", 20175 "PropertiesChanged", 20176 signal_variant, 20177 NULL); 20178 } 20179 g_variant_unref (signal_variant); 20180 g_list_free_full (connections, g_object_unref); 20181 } 20182 else 20183 { 20184 g_variant_builder_clear (&builder); 20185 g_variant_builder_clear (&invalidated_builder); 20186 } 20187 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 20188 skeleton->priv->changed_properties = NULL; 20189 skeleton->priv->changed_properties_idle_source = NULL; 20190 g_mutex_unlock (&skeleton->priv->lock); 20191 return FALSE; 20192 } 20193 20194 static void 20195 _watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 20196 { 20197 ChangedProperty *cp; 20198 GList *l; 20199 cp = NULL; 20200 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 20201 { 20202 ChangedProperty *i_cp = l->data; 20203 if (i_cp->info == info) 20204 { 20205 cp = i_cp; 20206 break; 20207 } 20208 } 20209 if (cp == NULL) 20210 { 20211 cp = g_new0 (ChangedProperty, 1); 20212 cp->prop_id = prop_id; 20213 cp->info = info; 20214 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 20215 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 20216 g_value_copy (orig_value, &cp->orig_value); 20217 } 20218 } 20219 20220 static void 20221 watchdog_skeleton_notify (GObject *object, 20222 GParamSpec *pspec G_GNUC_UNUSED) 20223 { 20224 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); 20225 g_mutex_lock (&skeleton->priv->lock); 20226 if (skeleton->priv->changed_properties != NULL && 20227 skeleton->priv->changed_properties_idle_source == NULL) 20228 { 20229 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 20230 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 20231 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 20232 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _watchdog_emit_changed"); 20233 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 20234 g_source_unref (skeleton->priv->changed_properties_idle_source); 20235 } 20236 g_mutex_unlock (&skeleton->priv->lock); 20237 } 20238 20239 static void 20240 watchdog_skeleton_set_property (GObject *object, 20241 guint prop_id, 20242 const GValue *value, 20243 GParamSpec *pspec) 20244 { 20245 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); 20246 g_assert (prop_id != 0 && prop_id - 1 < 2); 20247 g_mutex_lock (&skeleton->priv->lock); 20248 g_object_freeze_notify (object); 20249 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 20250 { 20251 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 20252 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 20253 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 20254 g_object_notify_by_pspec (object, pspec); 20255 } 20256 g_mutex_unlock (&skeleton->priv->lock); 20257 g_object_thaw_notify (object); 20258 } 20259 20260 static void 20261 watchdog_skeleton_init (WatchdogSkeleton *skeleton) 20262 { 20263 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 20264 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton); 20265 #else 20266 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate); 20267 #endif 20268 20269 g_mutex_init (&skeleton->priv->lock); 20270 skeleton->priv->context = g_main_context_ref_thread_default (); 20271 skeleton->priv->properties = g_new0 (GValue, 2); 20272 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); 20273 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); 20274 } 20275 20276 static gint 20277 watchdog_skeleton_get_watchdog (Watchdog *object) 20278 { 20279 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); 20280 gint value; 20281 g_mutex_lock (&skeleton->priv->lock); 20282 value = g_value_get_int (&(skeleton->priv->properties[0])); 20283 g_mutex_unlock (&skeleton->priv->lock); 20284 return value; 20285 } 20286 20287 static gint 20288 watchdog_skeleton_get_poll_interval (Watchdog *object) 20289 { 20290 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); 20291 gint value; 20292 g_mutex_lock (&skeleton->priv->lock); 20293 value = g_value_get_int (&(skeleton->priv->properties[1])); 20294 g_mutex_unlock (&skeleton->priv->lock); 20295 return value; 20296 } 20297 20298 static void 20299 watchdog_skeleton_class_init (WatchdogSkeletonClass *klass) 20300 { 20301 GObjectClass *gobject_class; 20302 GDBusInterfaceSkeletonClass *skeleton_class; 20303 20304 gobject_class = G_OBJECT_CLASS (klass); 20305 gobject_class->finalize = watchdog_skeleton_finalize; 20306 gobject_class->get_property = watchdog_skeleton_get_property; 20307 gobject_class->set_property = watchdog_skeleton_set_property; 20308 gobject_class->notify = watchdog_skeleton_notify; 20309 20310 20311 watchdog_override_properties (gobject_class, 1); 20312 20313 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 20314 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info; 20315 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties; 20316 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush; 20317 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable; 20318 20319 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 20320 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate)); 20321 #endif 20322 } 20323 20324 static void 20325 watchdog_skeleton_iface_init (WatchdogIface *iface) 20326 { 20327 iface->watchdog_error = _watchdog_on_signal_watchdog_error; 20328 iface->get_watchdog = watchdog_skeleton_get_watchdog; 20329 iface->get_poll_interval = watchdog_skeleton_get_poll_interval; 20330 } 20331 20332 /** 20333 * watchdog_skeleton_new: 20334 * 20335 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. 20336 * 20337 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object. 20338 */ 20339 Watchdog * 20340 watchdog_skeleton_new (void) 20341 { 20342 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL)); 20343 } 20344 20345 /* ------------------------------------------------------------------------ 20346 * Code for interface org.openbmc.EventLog 20347 * ------------------------------------------------------------------------ 20348 */ 20349 20350 /** 20351 * SECTION:EventLog 20352 * @title: EventLog 20353 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface 20354 * 20355 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface in C. 20356 */ 20357 20358 /* ---- Introspection data for org.openbmc.EventLog ---- */ 20359 20360 static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log = 20361 { 20362 { 20363 -1, 20364 (gchar *) "log", 20365 (gchar *) "a(s)", 20366 NULL 20367 }, 20368 FALSE 20369 }; 20370 20371 static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] = 20372 { 20373 &_event_log_method_info_get_event_log_OUT_ARG_log, 20374 NULL 20375 }; 20376 20377 static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log = 20378 { 20379 { 20380 -1, 20381 (gchar *) "getEventLog", 20382 NULL, 20383 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers, 20384 NULL 20385 }, 20386 "handle-get-event-log", 20387 FALSE 20388 }; 20389 20390 static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] = 20391 { 20392 &_event_log_method_info_get_event_log, 20393 NULL 20394 }; 20395 20396 static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority = 20397 { 20398 { 20399 -1, 20400 (gchar *) "priority", 20401 (gchar *) "i", 20402 NULL 20403 }, 20404 FALSE 20405 }; 20406 20407 static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message = 20408 { 20409 { 20410 -1, 20411 (gchar *) "message", 20412 (gchar *) "s", 20413 NULL 20414 }, 20415 FALSE 20416 }; 20417 20418 static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc = 20419 { 20420 { 20421 -1, 20422 (gchar *) "rc", 20423 (gchar *) "i", 20424 NULL 20425 }, 20426 FALSE 20427 }; 20428 20429 static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] = 20430 { 20431 &_event_log_signal_info_event_log_ARG_priority, 20432 &_event_log_signal_info_event_log_ARG_message, 20433 &_event_log_signal_info_event_log_ARG_rc, 20434 NULL 20435 }; 20436 20437 static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log = 20438 { 20439 { 20440 -1, 20441 (gchar *) "EventLog", 20442 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers, 20443 NULL 20444 }, 20445 "event-log" 20446 }; 20447 20448 static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] = 20449 { 20450 &_event_log_signal_info_event_log, 20451 NULL 20452 }; 20453 20454 static const _ExtendedGDBusInterfaceInfo _event_log_interface_info = 20455 { 20456 { 20457 -1, 20458 (gchar *) "org.openbmc.EventLog", 20459 (GDBusMethodInfo **) &_event_log_method_info_pointers, 20460 (GDBusSignalInfo **) &_event_log_signal_info_pointers, 20461 NULL, 20462 NULL 20463 }, 20464 "event-log", 20465 }; 20466 20467 20468 /** 20469 * event_log_interface_info: 20470 * 20471 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface. 20472 * 20473 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 20474 */ 20475 GDBusInterfaceInfo * 20476 event_log_interface_info (void) 20477 { 20478 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct; 20479 } 20480 20481 /** 20482 * event_log_override_properties: 20483 * @klass: The class structure for a #GObject<!-- -->-derived class. 20484 * @property_id_begin: The property id to assign to the first overridden property. 20485 * 20486 * Overrides all #GObject properties in the #EventLog interface for a concrete class. 20487 * The properties are overridden in the order they are defined. 20488 * 20489 * Returns: The last property id. 20490 */ 20491 guint 20492 event_log_override_properties (GObjectClass *klass, guint property_id_begin) 20493 { 20494 return property_id_begin - 1; 20495 } 20496 20497 20498 20499 /** 20500 * EventLog: 20501 * 20502 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. 20503 */ 20504 20505 /** 20506 * EventLogIface: 20507 * @parent_iface: The parent interface. 20508 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal. 20509 * @event_log: Handler for the #EventLog::event-log signal. 20510 * 20511 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. 20512 */ 20513 20514 typedef EventLogIface EventLogInterface; 20515 G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT); 20516 20517 static void 20518 event_log_default_init (EventLogIface *iface) 20519 { 20520 /* GObject signals for incoming D-Bus method calls: */ 20521 /** 20522 * EventLog::handle-get-event-log: 20523 * @object: A #EventLog. 20524 * @invocation: A #GDBusMethodInvocation. 20525 * 20526 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method. 20527 * 20528 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call event_log_complete_get_event_log() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 20529 * 20530 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 20531 */ 20532 g_signal_new ("handle-get-event-log", 20533 G_TYPE_FROM_INTERFACE (iface), 20534 G_SIGNAL_RUN_LAST, 20535 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log), 20536 g_signal_accumulator_true_handled, 20537 NULL, 20538 g_cclosure_marshal_generic, 20539 G_TYPE_BOOLEAN, 20540 1, 20541 G_TYPE_DBUS_METHOD_INVOCATION); 20542 20543 /* GObject signals for received D-Bus signals: */ 20544 /** 20545 * EventLog::event-log: 20546 * @object: A #EventLog. 20547 * @arg_priority: Argument. 20548 * @arg_message: Argument. 20549 * @arg_rc: Argument. 20550 * 20551 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> is received. 20552 * 20553 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 20554 */ 20555 g_signal_new ("event-log", 20556 G_TYPE_FROM_INTERFACE (iface), 20557 G_SIGNAL_RUN_LAST, 20558 G_STRUCT_OFFSET (EventLogIface, event_log), 20559 NULL, 20560 NULL, 20561 g_cclosure_marshal_generic, 20562 G_TYPE_NONE, 20563 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT); 20564 20565 } 20566 20567 /** 20568 * event_log_emit_event_log: 20569 * @object: A #EventLog. 20570 * @arg_priority: Argument to pass with the signal. 20571 * @arg_message: Argument to pass with the signal. 20572 * @arg_rc: Argument to pass with the signal. 20573 * 20574 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal. 20575 */ 20576 void 20577 event_log_emit_event_log ( 20578 EventLog *object, 20579 gint arg_priority, 20580 const gchar *arg_message, 20581 gint arg_rc) 20582 { 20583 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc); 20584 } 20585 20586 /** 20587 * event_log_call_get_event_log: 20588 * @proxy: A #EventLogProxy. 20589 * @cancellable: (allow-none): A #GCancellable or %NULL. 20590 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 20591 * @user_data: User data to pass to @callback. 20592 * 20593 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. 20594 * 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. 20595 * You can then call event_log_call_get_event_log_finish() to get the result of the operation. 20596 * 20597 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method. 20598 */ 20599 void 20600 event_log_call_get_event_log ( 20601 EventLog *proxy, 20602 GCancellable *cancellable, 20603 GAsyncReadyCallback callback, 20604 gpointer user_data) 20605 { 20606 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 20607 "getEventLog", 20608 g_variant_new ("()"), 20609 G_DBUS_CALL_FLAGS_NONE, 20610 -1, 20611 cancellable, 20612 callback, 20613 user_data); 20614 } 20615 20616 /** 20617 * event_log_call_get_event_log_finish: 20618 * @proxy: A #EventLogProxy. 20619 * @out_log: (out): Return location for return parameter or %NULL to ignore. 20620 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log(). 20621 * @error: Return location for error or %NULL. 20622 * 20623 * Finishes an operation started with event_log_call_get_event_log(). 20624 * 20625 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 20626 */ 20627 gboolean 20628 event_log_call_get_event_log_finish ( 20629 EventLog *proxy, 20630 GVariant **out_log, 20631 GAsyncResult *res, 20632 GError **error) 20633 { 20634 GVariant *_ret; 20635 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 20636 if (_ret == NULL) 20637 goto _out; 20638 g_variant_get (_ret, 20639 "(@a(s))", 20640 out_log); 20641 g_variant_unref (_ret); 20642 _out: 20643 return _ret != NULL; 20644 } 20645 20646 /** 20647 * event_log_call_get_event_log_sync: 20648 * @proxy: A #EventLogProxy. 20649 * @out_log: (out): Return location for return parameter or %NULL to ignore. 20650 * @cancellable: (allow-none): A #GCancellable or %NULL. 20651 * @error: Return location for error or %NULL. 20652 * 20653 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 20654 * 20655 * See event_log_call_get_event_log() for the asynchronous version of this method. 20656 * 20657 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 20658 */ 20659 gboolean 20660 event_log_call_get_event_log_sync ( 20661 EventLog *proxy, 20662 GVariant **out_log, 20663 GCancellable *cancellable, 20664 GError **error) 20665 { 20666 GVariant *_ret; 20667 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 20668 "getEventLog", 20669 g_variant_new ("()"), 20670 G_DBUS_CALL_FLAGS_NONE, 20671 -1, 20672 cancellable, 20673 error); 20674 if (_ret == NULL) 20675 goto _out; 20676 g_variant_get (_ret, 20677 "(@a(s))", 20678 out_log); 20679 g_variant_unref (_ret); 20680 _out: 20681 return _ret != NULL; 20682 } 20683 20684 /** 20685 * event_log_complete_get_event_log: 20686 * @object: A #EventLog. 20687 * @invocation: (transfer full): A #GDBusMethodInvocation. 20688 * @log: Parameter to return. 20689 * 20690 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 20691 * 20692 * This method will free @invocation, you cannot use it afterwards. 20693 */ 20694 void 20695 event_log_complete_get_event_log ( 20696 EventLog *object, 20697 GDBusMethodInvocation *invocation, 20698 GVariant *log) 20699 { 20700 g_dbus_method_invocation_return_value (invocation, 20701 g_variant_new ("(@a(s))", 20702 log)); 20703 } 20704 20705 /* ------------------------------------------------------------------------ */ 20706 20707 /** 20708 * EventLogProxy: 20709 * 20710 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API. 20711 */ 20712 20713 /** 20714 * EventLogProxyClass: 20715 * @parent_class: The parent class. 20716 * 20717 * Class structure for #EventLogProxy. 20718 */ 20719 20720 struct _EventLogProxyPrivate 20721 { 20722 GData *qdata; 20723 }; 20724 20725 static void event_log_proxy_iface_init (EventLogIface *iface); 20726 20727 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 20728 G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, 20729 G_ADD_PRIVATE (EventLogProxy) 20730 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); 20731 20732 #else 20733 G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY, 20734 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init)); 20735 20736 #endif 20737 static void 20738 event_log_proxy_finalize (GObject *object) 20739 { 20740 EventLogProxy *proxy = EVENT_LOG_PROXY (object); 20741 g_datalist_clear (&proxy->priv->qdata); 20742 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object); 20743 } 20744 20745 static void 20746 event_log_proxy_get_property (GObject *object, 20747 guint prop_id, 20748 GValue *value, 20749 GParamSpec *pspec G_GNUC_UNUSED) 20750 { 20751 } 20752 20753 static void 20754 event_log_proxy_set_property (GObject *object, 20755 guint prop_id, 20756 const GValue *value, 20757 GParamSpec *pspec G_GNUC_UNUSED) 20758 { 20759 } 20760 20761 static void 20762 event_log_proxy_g_signal (GDBusProxy *proxy, 20763 const gchar *sender_name G_GNUC_UNUSED, 20764 const gchar *signal_name, 20765 GVariant *parameters) 20766 { 20767 _ExtendedGDBusSignalInfo *info; 20768 GVariantIter iter; 20769 GVariant *child; 20770 GValue *paramv; 20771 guint num_params; 20772 guint n; 20773 guint signal_id; 20774 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name); 20775 if (info == NULL) 20776 return; 20777 num_params = g_variant_n_children (parameters); 20778 paramv = g_new0 (GValue, num_params + 1); 20779 g_value_init (¶mv[0], TYPE_EVENT_LOG); 20780 g_value_set_object (¶mv[0], proxy); 20781 g_variant_iter_init (&iter, parameters); 20782 n = 1; 20783 while ((child = g_variant_iter_next_value (&iter)) != NULL) 20784 { 20785 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 20786 if (arg_info->use_gvariant) 20787 { 20788 g_value_init (¶mv[n], G_TYPE_VARIANT); 20789 g_value_set_variant (¶mv[n], child); 20790 n++; 20791 } 20792 else 20793 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 20794 g_variant_unref (child); 20795 } 20796 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); 20797 g_signal_emitv (paramv, signal_id, 0, NULL); 20798 for (n = 0; n < num_params + 1; n++) 20799 g_value_unset (¶mv[n]); 20800 g_free (paramv); 20801 } 20802 20803 static void 20804 event_log_proxy_g_properties_changed (GDBusProxy *_proxy, 20805 GVariant *changed_properties, 20806 const gchar *const *invalidated_properties) 20807 { 20808 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy); 20809 guint n; 20810 const gchar *key; 20811 GVariantIter *iter; 20812 _ExtendedGDBusPropertyInfo *info; 20813 g_variant_get (changed_properties, "a{sv}", &iter); 20814 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 20815 { 20816 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key); 20817 g_datalist_remove_data (&proxy->priv->qdata, key); 20818 if (info != NULL) 20819 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 20820 } 20821 g_variant_iter_free (iter); 20822 for (n = 0; invalidated_properties[n] != NULL; n++) 20823 { 20824 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]); 20825 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 20826 if (info != NULL) 20827 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 20828 } 20829 } 20830 20831 static void 20832 event_log_proxy_init (EventLogProxy *proxy) 20833 { 20834 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 20835 proxy->priv = event_log_proxy_get_instance_private (proxy); 20836 #else 20837 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate); 20838 #endif 20839 20840 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ()); 20841 } 20842 20843 static void 20844 event_log_proxy_class_init (EventLogProxyClass *klass) 20845 { 20846 GObjectClass *gobject_class; 20847 GDBusProxyClass *proxy_class; 20848 20849 gobject_class = G_OBJECT_CLASS (klass); 20850 gobject_class->finalize = event_log_proxy_finalize; 20851 gobject_class->get_property = event_log_proxy_get_property; 20852 gobject_class->set_property = event_log_proxy_set_property; 20853 20854 proxy_class = G_DBUS_PROXY_CLASS (klass); 20855 proxy_class->g_signal = event_log_proxy_g_signal; 20856 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed; 20857 20858 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 20859 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate)); 20860 #endif 20861 } 20862 20863 static void 20864 event_log_proxy_iface_init (EventLogIface *iface) 20865 { 20866 } 20867 20868 /** 20869 * event_log_proxy_new: 20870 * @connection: A #GDBusConnection. 20871 * @flags: Flags from the #GDBusProxyFlags enumeration. 20872 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 20873 * @object_path: An object path. 20874 * @cancellable: (allow-none): A #GCancellable or %NULL. 20875 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 20876 * @user_data: User data to pass to @callback. 20877 * 20878 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new() for more details. 20879 * 20880 * 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. 20881 * You can then call event_log_proxy_new_finish() to get the result of the operation. 20882 * 20883 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor. 20884 */ 20885 void 20886 event_log_proxy_new ( 20887 GDBusConnection *connection, 20888 GDBusProxyFlags flags, 20889 const gchar *name, 20890 const gchar *object_path, 20891 GCancellable *cancellable, 20892 GAsyncReadyCallback callback, 20893 gpointer user_data) 20894 { 20895 g_async_initable_new_async (TYPE_EVENT_LOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL); 20896 } 20897 20898 /** 20899 * event_log_proxy_new_finish: 20900 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new(). 20901 * @error: Return location for error or %NULL 20902 * 20903 * Finishes an operation started with event_log_proxy_new(). 20904 * 20905 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. 20906 */ 20907 EventLog * 20908 event_log_proxy_new_finish ( 20909 GAsyncResult *res, 20910 GError **error) 20911 { 20912 GObject *ret; 20913 GObject *source_object; 20914 source_object = g_async_result_get_source_object (res); 20915 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 20916 g_object_unref (source_object); 20917 if (ret != NULL) 20918 return EVENT_LOG (ret); 20919 else 20920 return NULL; 20921 } 20922 20923 /** 20924 * event_log_proxy_new_sync: 20925 * @connection: A #GDBusConnection. 20926 * @flags: Flags from the #GDBusProxyFlags enumeration. 20927 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 20928 * @object_path: An object path. 20929 * @cancellable: (allow-none): A #GCancellable or %NULL. 20930 * @error: Return location for error or %NULL 20931 * 20932 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new_sync() for more details. 20933 * 20934 * The calling thread is blocked until a reply is received. 20935 * 20936 * See event_log_proxy_new() for the asynchronous version of this constructor. 20937 * 20938 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. 20939 */ 20940 EventLog * 20941 event_log_proxy_new_sync ( 20942 GDBusConnection *connection, 20943 GDBusProxyFlags flags, 20944 const gchar *name, 20945 const gchar *object_path, 20946 GCancellable *cancellable, 20947 GError **error) 20948 { 20949 GInitable *ret; 20950 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL); 20951 if (ret != NULL) 20952 return EVENT_LOG (ret); 20953 else 20954 return NULL; 20955 } 20956 20957 20958 /** 20959 * event_log_proxy_new_for_bus: 20960 * @bus_type: A #GBusType. 20961 * @flags: Flags from the #GDBusProxyFlags enumeration. 20962 * @name: A bus name (well-known or unique). 20963 * @object_path: An object path. 20964 * @cancellable: (allow-none): A #GCancellable or %NULL. 20965 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 20966 * @user_data: User data to pass to @callback. 20967 * 20968 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 20969 * 20970 * 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. 20971 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation. 20972 * 20973 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 20974 */ 20975 void 20976 event_log_proxy_new_for_bus ( 20977 GBusType bus_type, 20978 GDBusProxyFlags flags, 20979 const gchar *name, 20980 const gchar *object_path, 20981 GCancellable *cancellable, 20982 GAsyncReadyCallback callback, 20983 gpointer user_data) 20984 { 20985 g_async_initable_new_async (TYPE_EVENT_LOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL); 20986 } 20987 20988 /** 20989 * event_log_proxy_new_for_bus_finish: 20990 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus(). 20991 * @error: Return location for error or %NULL 20992 * 20993 * Finishes an operation started with event_log_proxy_new_for_bus(). 20994 * 20995 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. 20996 */ 20997 EventLog * 20998 event_log_proxy_new_for_bus_finish ( 20999 GAsyncResult *res, 21000 GError **error) 21001 { 21002 GObject *ret; 21003 GObject *source_object; 21004 source_object = g_async_result_get_source_object (res); 21005 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 21006 g_object_unref (source_object); 21007 if (ret != NULL) 21008 return EVENT_LOG (ret); 21009 else 21010 return NULL; 21011 } 21012 21013 /** 21014 * event_log_proxy_new_for_bus_sync: 21015 * @bus_type: A #GBusType. 21016 * @flags: Flags from the #GDBusProxyFlags enumeration. 21017 * @name: A bus name (well-known or unique). 21018 * @object_path: An object path. 21019 * @cancellable: (allow-none): A #GCancellable or %NULL. 21020 * @error: Return location for error or %NULL 21021 * 21022 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 21023 * 21024 * The calling thread is blocked until a reply is received. 21025 * 21026 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor. 21027 * 21028 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set. 21029 */ 21030 EventLog * 21031 event_log_proxy_new_for_bus_sync ( 21032 GBusType bus_type, 21033 GDBusProxyFlags flags, 21034 const gchar *name, 21035 const gchar *object_path, 21036 GCancellable *cancellable, 21037 GError **error) 21038 { 21039 GInitable *ret; 21040 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL); 21041 if (ret != NULL) 21042 return EVENT_LOG (ret); 21043 else 21044 return NULL; 21045 } 21046 21047 21048 /* ------------------------------------------------------------------------ */ 21049 21050 /** 21051 * EventLogSkeleton: 21052 * 21053 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API. 21054 */ 21055 21056 /** 21057 * EventLogSkeletonClass: 21058 * @parent_class: The parent class. 21059 * 21060 * Class structure for #EventLogSkeleton. 21061 */ 21062 21063 struct _EventLogSkeletonPrivate 21064 { 21065 GValue *properties; 21066 GList *changed_properties; 21067 GSource *changed_properties_idle_source; 21068 GMainContext *context; 21069 GMutex lock; 21070 }; 21071 21072 static void 21073 _event_log_skeleton_handle_method_call ( 21074 GDBusConnection *connection G_GNUC_UNUSED, 21075 const gchar *sender G_GNUC_UNUSED, 21076 const gchar *object_path G_GNUC_UNUSED, 21077 const gchar *interface_name, 21078 const gchar *method_name, 21079 GVariant *parameters, 21080 GDBusMethodInvocation *invocation, 21081 gpointer user_data) 21082 { 21083 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); 21084 _ExtendedGDBusMethodInfo *info; 21085 GVariantIter iter; 21086 GVariant *child; 21087 GValue *paramv; 21088 guint num_params; 21089 guint num_extra; 21090 guint n; 21091 guint signal_id; 21092 GValue return_value = G_VALUE_INIT; 21093 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 21094 g_assert (info != NULL); 21095 num_params = g_variant_n_children (parameters); 21096 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 21097 n = 0; 21098 g_value_init (¶mv[n], TYPE_EVENT_LOG); 21099 g_value_set_object (¶mv[n++], skeleton); 21100 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 21101 g_value_set_object (¶mv[n++], invocation); 21102 if (info->pass_fdlist) 21103 { 21104 #ifdef G_OS_UNIX 21105 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 21106 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 21107 #else 21108 g_assert_not_reached (); 21109 #endif 21110 } 21111 g_variant_iter_init (&iter, parameters); 21112 while ((child = g_variant_iter_next_value (&iter)) != NULL) 21113 { 21114 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 21115 if (arg_info->use_gvariant) 21116 { 21117 g_value_init (¶mv[n], G_TYPE_VARIANT); 21118 g_value_set_variant (¶mv[n], child); 21119 n++; 21120 } 21121 else 21122 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 21123 g_variant_unref (child); 21124 } 21125 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG); 21126 g_value_init (&return_value, G_TYPE_BOOLEAN); 21127 g_signal_emitv (paramv, signal_id, 0, &return_value); 21128 if (!g_value_get_boolean (&return_value)) 21129 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); 21130 g_value_unset (&return_value); 21131 for (n = 0; n < num_params + num_extra; n++) 21132 g_value_unset (¶mv[n]); 21133 g_free (paramv); 21134 } 21135 21136 static GVariant * 21137 _event_log_skeleton_handle_get_property ( 21138 GDBusConnection *connection G_GNUC_UNUSED, 21139 const gchar *sender G_GNUC_UNUSED, 21140 const gchar *object_path G_GNUC_UNUSED, 21141 const gchar *interface_name G_GNUC_UNUSED, 21142 const gchar *property_name, 21143 GError **error, 21144 gpointer user_data) 21145 { 21146 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); 21147 GValue value = G_VALUE_INIT; 21148 GParamSpec *pspec; 21149 _ExtendedGDBusPropertyInfo *info; 21150 GVariant *ret; 21151 ret = NULL; 21152 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); 21153 g_assert (info != NULL); 21154 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 21155 if (pspec == NULL) 21156 { 21157 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 21158 } 21159 else 21160 { 21161 g_value_init (&value, pspec->value_type); 21162 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 21163 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 21164 g_value_unset (&value); 21165 } 21166 return ret; 21167 } 21168 21169 static gboolean 21170 _event_log_skeleton_handle_set_property ( 21171 GDBusConnection *connection G_GNUC_UNUSED, 21172 const gchar *sender G_GNUC_UNUSED, 21173 const gchar *object_path G_GNUC_UNUSED, 21174 const gchar *interface_name G_GNUC_UNUSED, 21175 const gchar *property_name, 21176 GVariant *variant, 21177 GError **error, 21178 gpointer user_data) 21179 { 21180 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data); 21181 GValue value = G_VALUE_INIT; 21182 GParamSpec *pspec; 21183 _ExtendedGDBusPropertyInfo *info; 21184 gboolean ret; 21185 ret = FALSE; 21186 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name); 21187 g_assert (info != NULL); 21188 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 21189 if (pspec == NULL) 21190 { 21191 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 21192 } 21193 else 21194 { 21195 if (info->use_gvariant) 21196 g_value_set_variant (&value, variant); 21197 else 21198 g_dbus_gvariant_to_gvalue (variant, &value); 21199 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 21200 g_value_unset (&value); 21201 ret = TRUE; 21202 } 21203 return ret; 21204 } 21205 21206 static const GDBusInterfaceVTable _event_log_skeleton_vtable = 21207 { 21208 _event_log_skeleton_handle_method_call, 21209 _event_log_skeleton_handle_get_property, 21210 _event_log_skeleton_handle_set_property, 21211 {NULL} 21212 }; 21213 21214 static GDBusInterfaceInfo * 21215 event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 21216 { 21217 return event_log_interface_info (); 21218 } 21219 21220 static GDBusInterfaceVTable * 21221 event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 21222 { 21223 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable; 21224 } 21225 21226 static GVariant * 21227 event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 21228 { 21229 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton); 21230 21231 GVariantBuilder builder; 21232 guint n; 21233 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 21234 if (_event_log_interface_info.parent_struct.properties == NULL) 21235 goto out; 21236 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++) 21237 { 21238 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n]; 21239 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 21240 { 21241 GVariant *value; 21242 value = _event_log_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", info->name, NULL, skeleton); 21243 if (value != NULL) 21244 { 21245 g_variant_take_ref (value); 21246 g_variant_builder_add (&builder, "{sv}", info->name, value); 21247 g_variant_unref (value); 21248 } 21249 } 21250 } 21251 out: 21252 return g_variant_builder_end (&builder); 21253 } 21254 21255 static void 21256 event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 21257 { 21258 } 21259 21260 static void 21261 _event_log_on_signal_event_log ( 21262 EventLog *object, 21263 gint arg_priority, 21264 const gchar *arg_message, 21265 gint arg_rc) 21266 { 21267 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); 21268 21269 GList *connections, *l; 21270 GVariant *signal_variant; 21271 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 21272 21273 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)", 21274 arg_priority, 21275 arg_message, 21276 arg_rc)); 21277 for (l = connections; l != NULL; l = l->next) 21278 { 21279 GDBusConnection *connection = l->data; 21280 g_dbus_connection_emit_signal (connection, 21281 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog", 21282 signal_variant, NULL); 21283 } 21284 g_variant_unref (signal_variant); 21285 g_list_free_full (connections, g_object_unref); 21286 } 21287 21288 static void event_log_skeleton_iface_init (EventLogIface *iface); 21289 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 21290 G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 21291 G_ADD_PRIVATE (EventLogSkeleton) 21292 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); 21293 21294 #else 21295 G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 21296 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init)); 21297 21298 #endif 21299 static void 21300 event_log_skeleton_finalize (GObject *object) 21301 { 21302 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object); 21303 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 21304 if (skeleton->priv->changed_properties_idle_source != NULL) 21305 g_source_destroy (skeleton->priv->changed_properties_idle_source); 21306 g_main_context_unref (skeleton->priv->context); 21307 g_mutex_clear (&skeleton->priv->lock); 21308 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object); 21309 } 21310 21311 static void 21312 event_log_skeleton_init (EventLogSkeleton *skeleton) 21313 { 21314 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 21315 skeleton->priv = event_log_skeleton_get_instance_private (skeleton); 21316 #else 21317 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate); 21318 #endif 21319 21320 g_mutex_init (&skeleton->priv->lock); 21321 skeleton->priv->context = g_main_context_ref_thread_default (); 21322 } 21323 21324 static void 21325 event_log_skeleton_class_init (EventLogSkeletonClass *klass) 21326 { 21327 GObjectClass *gobject_class; 21328 GDBusInterfaceSkeletonClass *skeleton_class; 21329 21330 gobject_class = G_OBJECT_CLASS (klass); 21331 gobject_class->finalize = event_log_skeleton_finalize; 21332 21333 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 21334 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info; 21335 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties; 21336 skeleton_class->flush = event_log_skeleton_dbus_interface_flush; 21337 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable; 21338 21339 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 21340 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate)); 21341 #endif 21342 } 21343 21344 static void 21345 event_log_skeleton_iface_init (EventLogIface *iface) 21346 { 21347 iface->event_log = _event_log_on_signal_event_log; 21348 } 21349 21350 /** 21351 * event_log_skeleton_new: 21352 * 21353 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. 21354 * 21355 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object. 21356 */ 21357 EventLog * 21358 event_log_skeleton_new (void) 21359 { 21360 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL)); 21361 } 21362 21363 /* ------------------------------------------------------------------------ 21364 * Code for interface org.openbmc.Flash 21365 * ------------------------------------------------------------------------ 21366 */ 21367 21368 /** 21369 * SECTION:Flash 21370 * @title: Flash 21371 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface 21372 * 21373 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface in C. 21374 */ 21375 21376 /* ---- Introspection data for org.openbmc.Flash ---- */ 21377 21378 static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename = 21379 { 21380 { 21381 -1, 21382 (gchar *) "filename", 21383 (gchar *) "s", 21384 NULL 21385 }, 21386 FALSE 21387 }; 21388 21389 static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] = 21390 { 21391 &_flash_method_info_update_IN_ARG_filename, 21392 NULL 21393 }; 21394 21395 static const _ExtendedGDBusMethodInfo _flash_method_info_update = 21396 { 21397 { 21398 -1, 21399 (gchar *) "update", 21400 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers, 21401 NULL, 21402 NULL 21403 }, 21404 "handle-update", 21405 FALSE 21406 }; 21407 21408 static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message = 21409 { 21410 { 21411 -1, 21412 (gchar *) "message", 21413 (gchar *) "s", 21414 NULL 21415 }, 21416 FALSE 21417 }; 21418 21419 static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] = 21420 { 21421 &_flash_method_info_error_IN_ARG_message, 21422 NULL 21423 }; 21424 21425 static const _ExtendedGDBusMethodInfo _flash_method_info_error = 21426 { 21427 { 21428 -1, 21429 (gchar *) "error", 21430 (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers, 21431 NULL, 21432 NULL 21433 }, 21434 "handle-error", 21435 FALSE 21436 }; 21437 21438 static const _ExtendedGDBusMethodInfo _flash_method_info_done = 21439 { 21440 { 21441 -1, 21442 (gchar *) "done", 21443 NULL, 21444 NULL, 21445 NULL 21446 }, 21447 "handle-done", 21448 FALSE 21449 }; 21450 21451 static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url = 21452 { 21453 { 21454 -1, 21455 (gchar *) "url", 21456 (gchar *) "s", 21457 NULL 21458 }, 21459 FALSE 21460 }; 21461 21462 static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename = 21463 { 21464 { 21465 -1, 21466 (gchar *) "filename", 21467 (gchar *) "s", 21468 NULL 21469 }, 21470 FALSE 21471 }; 21472 21473 static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] = 21474 { 21475 &_flash_method_info_update_via_tftp_IN_ARG_url, 21476 &_flash_method_info_update_via_tftp_IN_ARG_filename, 21477 NULL 21478 }; 21479 21480 static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp = 21481 { 21482 { 21483 -1, 21484 (gchar *) "updateViaTftp", 21485 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers, 21486 NULL, 21487 NULL 21488 }, 21489 "handle-update-via-tftp", 21490 FALSE 21491 }; 21492 21493 static const _ExtendedGDBusMethodInfo _flash_method_info_init = 21494 { 21495 { 21496 -1, 21497 (gchar *) "init", 21498 NULL, 21499 NULL, 21500 NULL 21501 }, 21502 "handle-init", 21503 FALSE 21504 }; 21505 21506 static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] = 21507 { 21508 &_flash_method_info_update, 21509 &_flash_method_info_error, 21510 &_flash_method_info_done, 21511 &_flash_method_info_update_via_tftp, 21512 &_flash_method_info_init, 21513 NULL 21514 }; 21515 21516 static const _ExtendedGDBusSignalInfo _flash_signal_info_updated = 21517 { 21518 { 21519 -1, 21520 (gchar *) "Updated", 21521 NULL, 21522 NULL 21523 }, 21524 "updated" 21525 }; 21526 21527 static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url = 21528 { 21529 { 21530 -1, 21531 (gchar *) "url", 21532 (gchar *) "s", 21533 NULL 21534 }, 21535 FALSE 21536 }; 21537 21538 static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename = 21539 { 21540 { 21541 -1, 21542 (gchar *) "filename", 21543 (gchar *) "s", 21544 NULL 21545 }, 21546 FALSE 21547 }; 21548 21549 static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] = 21550 { 21551 &_flash_signal_info_download_ARG_url, 21552 &_flash_signal_info_download_ARG_filename, 21553 NULL 21554 }; 21555 21556 static const _ExtendedGDBusSignalInfo _flash_signal_info_download = 21557 { 21558 { 21559 -1, 21560 (gchar *) "Download", 21561 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers, 21562 NULL 21563 }, 21564 "download" 21565 }; 21566 21567 static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] = 21568 { 21569 &_flash_signal_info_updated, 21570 &_flash_signal_info_download, 21571 NULL 21572 }; 21573 21574 static const _ExtendedGDBusPropertyInfo _flash_property_info_filename = 21575 { 21576 { 21577 -1, 21578 (gchar *) "filename", 21579 (gchar *) "s", 21580 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 21581 NULL 21582 }, 21583 "filename", 21584 FALSE 21585 }; 21586 21587 static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path = 21588 { 21589 { 21590 -1, 21591 (gchar *) "flasher_path", 21592 (gchar *) "s", 21593 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 21594 NULL 21595 }, 21596 "flasher-path", 21597 FALSE 21598 }; 21599 21600 static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name = 21601 { 21602 { 21603 -1, 21604 (gchar *) "flasher_name", 21605 (gchar *) "s", 21606 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 21607 NULL 21608 }, 21609 "flasher-name", 21610 FALSE 21611 }; 21612 21613 static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance = 21614 { 21615 { 21616 -1, 21617 (gchar *) "flasher_instance", 21618 (gchar *) "s", 21619 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 21620 NULL 21621 }, 21622 "flasher-instance", 21623 FALSE 21624 }; 21625 21626 static const _ExtendedGDBusPropertyInfo _flash_property_info_status = 21627 { 21628 { 21629 -1, 21630 (gchar *) "status", 21631 (gchar *) "s", 21632 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 21633 NULL 21634 }, 21635 "status", 21636 FALSE 21637 }; 21638 21639 static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] = 21640 { 21641 &_flash_property_info_filename, 21642 &_flash_property_info_flasher_path, 21643 &_flash_property_info_flasher_name, 21644 &_flash_property_info_flasher_instance, 21645 &_flash_property_info_status, 21646 NULL 21647 }; 21648 21649 static const _ExtendedGDBusInterfaceInfo _flash_interface_info = 21650 { 21651 { 21652 -1, 21653 (gchar *) "org.openbmc.Flash", 21654 (GDBusMethodInfo **) &_flash_method_info_pointers, 21655 (GDBusSignalInfo **) &_flash_signal_info_pointers, 21656 (GDBusPropertyInfo **) &_flash_property_info_pointers, 21657 NULL 21658 }, 21659 "flash", 21660 }; 21661 21662 21663 /** 21664 * flash_interface_info: 21665 * 21666 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface. 21667 * 21668 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 21669 */ 21670 GDBusInterfaceInfo * 21671 flash_interface_info (void) 21672 { 21673 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct; 21674 } 21675 21676 /** 21677 * flash_override_properties: 21678 * @klass: The class structure for a #GObject<!-- -->-derived class. 21679 * @property_id_begin: The property id to assign to the first overridden property. 21680 * 21681 * Overrides all #GObject properties in the #Flash interface for a concrete class. 21682 * The properties are overridden in the order they are defined. 21683 * 21684 * Returns: The last property id. 21685 */ 21686 guint 21687 flash_override_properties (GObjectClass *klass, guint property_id_begin) 21688 { 21689 g_object_class_override_property (klass, property_id_begin++, "filename"); 21690 g_object_class_override_property (klass, property_id_begin++, "flasher-path"); 21691 g_object_class_override_property (klass, property_id_begin++, "flasher-name"); 21692 g_object_class_override_property (klass, property_id_begin++, "flasher-instance"); 21693 g_object_class_override_property (klass, property_id_begin++, "status"); 21694 return property_id_begin - 1; 21695 } 21696 21697 21698 21699 /** 21700 * Flash: 21701 * 21702 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. 21703 */ 21704 21705 /** 21706 * FlashIface: 21707 * @parent_iface: The parent interface. 21708 * @handle_done: Handler for the #Flash::handle-done signal. 21709 * @handle_error: Handler for the #Flash::handle-error signal. 21710 * @handle_init: Handler for the #Flash::handle-init signal. 21711 * @handle_update: Handler for the #Flash::handle-update signal. 21712 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal. 21713 * @get_filename: Getter for the #Flash:filename property. 21714 * @get_flasher_instance: Getter for the #Flash:flasher-instance property. 21715 * @get_flasher_name: Getter for the #Flash:flasher-name property. 21716 * @get_flasher_path: Getter for the #Flash:flasher-path property. 21717 * @get_status: Getter for the #Flash:status property. 21718 * @download: Handler for the #Flash::download signal. 21719 * @updated: Handler for the #Flash::updated signal. 21720 * 21721 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. 21722 */ 21723 21724 typedef FlashIface FlashInterface; 21725 G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT); 21726 21727 static void 21728 flash_default_init (FlashIface *iface) 21729 { 21730 /* GObject signals for incoming D-Bus method calls: */ 21731 /** 21732 * Flash::handle-update: 21733 * @object: A #Flash. 21734 * @invocation: A #GDBusMethodInvocation. 21735 * @arg_filename: Argument passed by remote caller. 21736 * 21737 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method. 21738 * 21739 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 21740 * 21741 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 21742 */ 21743 g_signal_new ("handle-update", 21744 G_TYPE_FROM_INTERFACE (iface), 21745 G_SIGNAL_RUN_LAST, 21746 G_STRUCT_OFFSET (FlashIface, handle_update), 21747 g_signal_accumulator_true_handled, 21748 NULL, 21749 g_cclosure_marshal_generic, 21750 G_TYPE_BOOLEAN, 21751 2, 21752 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); 21753 21754 /** 21755 * Flash::handle-error: 21756 * @object: A #Flash. 21757 * @invocation: A #GDBusMethodInvocation. 21758 * @arg_message: Argument passed by remote caller. 21759 * 21760 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method. 21761 * 21762 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_error() 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. 21763 * 21764 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 21765 */ 21766 g_signal_new ("handle-error", 21767 G_TYPE_FROM_INTERFACE (iface), 21768 G_SIGNAL_RUN_LAST, 21769 G_STRUCT_OFFSET (FlashIface, handle_error), 21770 g_signal_accumulator_true_handled, 21771 NULL, 21772 g_cclosure_marshal_generic, 21773 G_TYPE_BOOLEAN, 21774 2, 21775 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); 21776 21777 /** 21778 * Flash::handle-done: 21779 * @object: A #Flash. 21780 * @invocation: A #GDBusMethodInvocation. 21781 * 21782 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method. 21783 * 21784 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_done() 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. 21785 * 21786 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 21787 */ 21788 g_signal_new ("handle-done", 21789 G_TYPE_FROM_INTERFACE (iface), 21790 G_SIGNAL_RUN_LAST, 21791 G_STRUCT_OFFSET (FlashIface, handle_done), 21792 g_signal_accumulator_true_handled, 21793 NULL, 21794 g_cclosure_marshal_generic, 21795 G_TYPE_BOOLEAN, 21796 1, 21797 G_TYPE_DBUS_METHOD_INVOCATION); 21798 21799 /** 21800 * Flash::handle-update-via-tftp: 21801 * @object: A #Flash. 21802 * @invocation: A #GDBusMethodInvocation. 21803 * @arg_url: Argument passed by remote caller. 21804 * @arg_filename: Argument passed by remote caller. 21805 * 21806 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. 21807 * 21808 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_tftp() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 21809 * 21810 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 21811 */ 21812 g_signal_new ("handle-update-via-tftp", 21813 G_TYPE_FROM_INTERFACE (iface), 21814 G_SIGNAL_RUN_LAST, 21815 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp), 21816 g_signal_accumulator_true_handled, 21817 NULL, 21818 g_cclosure_marshal_generic, 21819 G_TYPE_BOOLEAN, 21820 3, 21821 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); 21822 21823 /** 21824 * Flash::handle-init: 21825 * @object: A #Flash. 21826 * @invocation: A #GDBusMethodInvocation. 21827 * 21828 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method. 21829 * 21830 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 21831 * 21832 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 21833 */ 21834 g_signal_new ("handle-init", 21835 G_TYPE_FROM_INTERFACE (iface), 21836 G_SIGNAL_RUN_LAST, 21837 G_STRUCT_OFFSET (FlashIface, handle_init), 21838 g_signal_accumulator_true_handled, 21839 NULL, 21840 g_cclosure_marshal_generic, 21841 G_TYPE_BOOLEAN, 21842 1, 21843 G_TYPE_DBUS_METHOD_INVOCATION); 21844 21845 /* GObject signals for received D-Bus signals: */ 21846 /** 21847 * Flash::updated: 21848 * @object: A #Flash. 21849 * 21850 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> is received. 21851 * 21852 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 21853 */ 21854 g_signal_new ("updated", 21855 G_TYPE_FROM_INTERFACE (iface), 21856 G_SIGNAL_RUN_LAST, 21857 G_STRUCT_OFFSET (FlashIface, updated), 21858 NULL, 21859 NULL, 21860 g_cclosure_marshal_generic, 21861 G_TYPE_NONE, 21862 0); 21863 21864 /** 21865 * Flash::download: 21866 * @object: A #Flash. 21867 * @arg_url: Argument. 21868 * @arg_filename: Argument. 21869 * 21870 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> is received. 21871 * 21872 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 21873 */ 21874 g_signal_new ("download", 21875 G_TYPE_FROM_INTERFACE (iface), 21876 G_SIGNAL_RUN_LAST, 21877 G_STRUCT_OFFSET (FlashIface, download), 21878 NULL, 21879 NULL, 21880 g_cclosure_marshal_generic, 21881 G_TYPE_NONE, 21882 2, G_TYPE_STRING, G_TYPE_STRING); 21883 21884 /* GObject properties for D-Bus properties: */ 21885 /** 21886 * Flash:filename: 21887 * 21888 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>. 21889 * 21890 * 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. 21891 */ 21892 g_object_interface_install_property (iface, 21893 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 21894 /** 21895 * Flash:flasher-path: 21896 * 21897 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>. 21898 * 21899 * 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. 21900 */ 21901 g_object_interface_install_property (iface, 21902 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 21903 /** 21904 * Flash:flasher-name: 21905 * 21906 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>. 21907 * 21908 * 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. 21909 */ 21910 g_object_interface_install_property (iface, 21911 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 21912 /** 21913 * Flash:flasher-instance: 21914 * 21915 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>. 21916 * 21917 * 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. 21918 */ 21919 g_object_interface_install_property (iface, 21920 g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 21921 /** 21922 * Flash:status: 21923 * 21924 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>. 21925 * 21926 * 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. 21927 */ 21928 g_object_interface_install_property (iface, 21929 g_param_spec_string ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 21930 } 21931 21932 /** 21933 * flash_get_filename: (skip) 21934 * @object: A #Flash. 21935 * 21936 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property. 21937 * 21938 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 21939 * 21940 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_filename() if on another thread.</warning> 21941 * 21942 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 21943 */ 21944 const gchar * 21945 flash_get_filename (Flash *object) 21946 { 21947 return FLASH_GET_IFACE (object)->get_filename (object); 21948 } 21949 21950 /** 21951 * flash_dup_filename: (skip) 21952 * @object: A #Flash. 21953 * 21954 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property. 21955 * 21956 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 21957 * 21958 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 21959 */ 21960 gchar * 21961 flash_dup_filename (Flash *object) 21962 { 21963 gchar *value; 21964 g_object_get (G_OBJECT (object), "filename", &value, NULL); 21965 return value; 21966 } 21967 21968 /** 21969 * flash_set_filename: (skip) 21970 * @object: A #Flash. 21971 * @value: The value to set. 21972 * 21973 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value. 21974 * 21975 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 21976 */ 21977 void 21978 flash_set_filename (Flash *object, const gchar *value) 21979 { 21980 g_object_set (G_OBJECT (object), "filename", value, NULL); 21981 } 21982 21983 /** 21984 * flash_get_flasher_path: (skip) 21985 * @object: A #Flash. 21986 * 21987 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property. 21988 * 21989 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 21990 * 21991 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_path() if on another thread.</warning> 21992 * 21993 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 21994 */ 21995 const gchar * 21996 flash_get_flasher_path (Flash *object) 21997 { 21998 return FLASH_GET_IFACE (object)->get_flasher_path (object); 21999 } 22000 22001 /** 22002 * flash_dup_flasher_path: (skip) 22003 * @object: A #Flash. 22004 * 22005 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property. 22006 * 22007 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 22008 * 22009 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 22010 */ 22011 gchar * 22012 flash_dup_flasher_path (Flash *object) 22013 { 22014 gchar *value; 22015 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL); 22016 return value; 22017 } 22018 22019 /** 22020 * flash_set_flasher_path: (skip) 22021 * @object: A #Flash. 22022 * @value: The value to set. 22023 * 22024 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value. 22025 * 22026 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 22027 */ 22028 void 22029 flash_set_flasher_path (Flash *object, const gchar *value) 22030 { 22031 g_object_set (G_OBJECT (object), "flasher-path", value, NULL); 22032 } 22033 22034 /** 22035 * flash_get_flasher_name: (skip) 22036 * @object: A #Flash. 22037 * 22038 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property. 22039 * 22040 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 22041 * 22042 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_name() if on another thread.</warning> 22043 * 22044 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 22045 */ 22046 const gchar * 22047 flash_get_flasher_name (Flash *object) 22048 { 22049 return FLASH_GET_IFACE (object)->get_flasher_name (object); 22050 } 22051 22052 /** 22053 * flash_dup_flasher_name: (skip) 22054 * @object: A #Flash. 22055 * 22056 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property. 22057 * 22058 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 22059 * 22060 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 22061 */ 22062 gchar * 22063 flash_dup_flasher_name (Flash *object) 22064 { 22065 gchar *value; 22066 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL); 22067 return value; 22068 } 22069 22070 /** 22071 * flash_set_flasher_name: (skip) 22072 * @object: A #Flash. 22073 * @value: The value to set. 22074 * 22075 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value. 22076 * 22077 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 22078 */ 22079 void 22080 flash_set_flasher_name (Flash *object, const gchar *value) 22081 { 22082 g_object_set (G_OBJECT (object), "flasher-name", value, NULL); 22083 } 22084 22085 /** 22086 * flash_get_flasher_instance: (skip) 22087 * @object: A #Flash. 22088 * 22089 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property. 22090 * 22091 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 22092 * 22093 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_instance() if on another thread.</warning> 22094 * 22095 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 22096 */ 22097 const gchar * 22098 flash_get_flasher_instance (Flash *object) 22099 { 22100 return FLASH_GET_IFACE (object)->get_flasher_instance (object); 22101 } 22102 22103 /** 22104 * flash_dup_flasher_instance: (skip) 22105 * @object: A #Flash. 22106 * 22107 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property. 22108 * 22109 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 22110 * 22111 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 22112 */ 22113 gchar * 22114 flash_dup_flasher_instance (Flash *object) 22115 { 22116 gchar *value; 22117 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL); 22118 return value; 22119 } 22120 22121 /** 22122 * flash_set_flasher_instance: (skip) 22123 * @object: A #Flash. 22124 * @value: The value to set. 22125 * 22126 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value. 22127 * 22128 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 22129 */ 22130 void 22131 flash_set_flasher_instance (Flash *object, const gchar *value) 22132 { 22133 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL); 22134 } 22135 22136 /** 22137 * flash_get_status: (skip) 22138 * @object: A #Flash. 22139 * 22140 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property. 22141 * 22142 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 22143 * 22144 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_status() if on another thread.</warning> 22145 * 22146 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 22147 */ 22148 const gchar * 22149 flash_get_status (Flash *object) 22150 { 22151 return FLASH_GET_IFACE (object)->get_status (object); 22152 } 22153 22154 /** 22155 * flash_dup_status: (skip) 22156 * @object: A #Flash. 22157 * 22158 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property. 22159 * 22160 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 22161 * 22162 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 22163 */ 22164 gchar * 22165 flash_dup_status (Flash *object) 22166 { 22167 gchar *value; 22168 g_object_get (G_OBJECT (object), "status", &value, NULL); 22169 return value; 22170 } 22171 22172 /** 22173 * flash_set_status: (skip) 22174 * @object: A #Flash. 22175 * @value: The value to set. 22176 * 22177 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value. 22178 * 22179 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 22180 */ 22181 void 22182 flash_set_status (Flash *object, const gchar *value) 22183 { 22184 g_object_set (G_OBJECT (object), "status", value, NULL); 22185 } 22186 22187 /** 22188 * flash_emit_updated: 22189 * @object: A #Flash. 22190 * 22191 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal. 22192 */ 22193 void 22194 flash_emit_updated ( 22195 Flash *object) 22196 { 22197 g_signal_emit_by_name (object, "updated"); 22198 } 22199 22200 /** 22201 * flash_emit_download: 22202 * @object: A #Flash. 22203 * @arg_url: Argument to pass with the signal. 22204 * @arg_filename: Argument to pass with the signal. 22205 * 22206 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal. 22207 */ 22208 void 22209 flash_emit_download ( 22210 Flash *object, 22211 const gchar *arg_url, 22212 const gchar *arg_filename) 22213 { 22214 g_signal_emit_by_name (object, "download", arg_url, arg_filename); 22215 } 22216 22217 /** 22218 * flash_call_update: 22219 * @proxy: A #FlashProxy. 22220 * @arg_filename: Argument to pass with the method invocation. 22221 * @cancellable: (allow-none): A #GCancellable or %NULL. 22222 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 22223 * @user_data: User data to pass to @callback. 22224 * 22225 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy. 22226 * 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. 22227 * You can then call flash_call_update_finish() to get the result of the operation. 22228 * 22229 * See flash_call_update_sync() for the synchronous, blocking version of this method. 22230 */ 22231 void 22232 flash_call_update ( 22233 Flash *proxy, 22234 const gchar *arg_filename, 22235 GCancellable *cancellable, 22236 GAsyncReadyCallback callback, 22237 gpointer user_data) 22238 { 22239 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 22240 "update", 22241 g_variant_new ("(s)", 22242 arg_filename), 22243 G_DBUS_CALL_FLAGS_NONE, 22244 -1, 22245 cancellable, 22246 callback, 22247 user_data); 22248 } 22249 22250 /** 22251 * flash_call_update_finish: 22252 * @proxy: A #FlashProxy. 22253 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update(). 22254 * @error: Return location for error or %NULL. 22255 * 22256 * Finishes an operation started with flash_call_update(). 22257 * 22258 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22259 */ 22260 gboolean 22261 flash_call_update_finish ( 22262 Flash *proxy, 22263 GAsyncResult *res, 22264 GError **error) 22265 { 22266 GVariant *_ret; 22267 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 22268 if (_ret == NULL) 22269 goto _out; 22270 g_variant_get (_ret, 22271 "()"); 22272 g_variant_unref (_ret); 22273 _out: 22274 return _ret != NULL; 22275 } 22276 22277 /** 22278 * flash_call_update_sync: 22279 * @proxy: A #FlashProxy. 22280 * @arg_filename: Argument to pass with the method invocation. 22281 * @cancellable: (allow-none): A #GCancellable or %NULL. 22282 * @error: Return location for error or %NULL. 22283 * 22284 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 22285 * 22286 * See flash_call_update() for the asynchronous version of this method. 22287 * 22288 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22289 */ 22290 gboolean 22291 flash_call_update_sync ( 22292 Flash *proxy, 22293 const gchar *arg_filename, 22294 GCancellable *cancellable, 22295 GError **error) 22296 { 22297 GVariant *_ret; 22298 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 22299 "update", 22300 g_variant_new ("(s)", 22301 arg_filename), 22302 G_DBUS_CALL_FLAGS_NONE, 22303 -1, 22304 cancellable, 22305 error); 22306 if (_ret == NULL) 22307 goto _out; 22308 g_variant_get (_ret, 22309 "()"); 22310 g_variant_unref (_ret); 22311 _out: 22312 return _ret != NULL; 22313 } 22314 22315 /** 22316 * flash_call_error: 22317 * @proxy: A #FlashProxy. 22318 * @arg_message: Argument to pass with the method invocation. 22319 * @cancellable: (allow-none): A #GCancellable or %NULL. 22320 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 22321 * @user_data: User data to pass to @callback. 22322 * 22323 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy. 22324 * 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. 22325 * You can then call flash_call_error_finish() to get the result of the operation. 22326 * 22327 * See flash_call_error_sync() for the synchronous, blocking version of this method. 22328 */ 22329 void 22330 flash_call_error ( 22331 Flash *proxy, 22332 const gchar *arg_message, 22333 GCancellable *cancellable, 22334 GAsyncReadyCallback callback, 22335 gpointer user_data) 22336 { 22337 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 22338 "error", 22339 g_variant_new ("(s)", 22340 arg_message), 22341 G_DBUS_CALL_FLAGS_NONE, 22342 -1, 22343 cancellable, 22344 callback, 22345 user_data); 22346 } 22347 22348 /** 22349 * flash_call_error_finish: 22350 * @proxy: A #FlashProxy. 22351 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error(). 22352 * @error: Return location for error or %NULL. 22353 * 22354 * Finishes an operation started with flash_call_error(). 22355 * 22356 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22357 */ 22358 gboolean 22359 flash_call_error_finish ( 22360 Flash *proxy, 22361 GAsyncResult *res, 22362 GError **error) 22363 { 22364 GVariant *_ret; 22365 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 22366 if (_ret == NULL) 22367 goto _out; 22368 g_variant_get (_ret, 22369 "()"); 22370 g_variant_unref (_ret); 22371 _out: 22372 return _ret != NULL; 22373 } 22374 22375 /** 22376 * flash_call_error_sync: 22377 * @proxy: A #FlashProxy. 22378 * @arg_message: Argument to pass with the method invocation. 22379 * @cancellable: (allow-none): A #GCancellable or %NULL. 22380 * @error: Return location for error or %NULL. 22381 * 22382 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 22383 * 22384 * See flash_call_error() for the asynchronous version of this method. 22385 * 22386 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22387 */ 22388 gboolean 22389 flash_call_error_sync ( 22390 Flash *proxy, 22391 const gchar *arg_message, 22392 GCancellable *cancellable, 22393 GError **error) 22394 { 22395 GVariant *_ret; 22396 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 22397 "error", 22398 g_variant_new ("(s)", 22399 arg_message), 22400 G_DBUS_CALL_FLAGS_NONE, 22401 -1, 22402 cancellable, 22403 error); 22404 if (_ret == NULL) 22405 goto _out; 22406 g_variant_get (_ret, 22407 "()"); 22408 g_variant_unref (_ret); 22409 _out: 22410 return _ret != NULL; 22411 } 22412 22413 /** 22414 * flash_call_done: 22415 * @proxy: A #FlashProxy. 22416 * @cancellable: (allow-none): A #GCancellable or %NULL. 22417 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 22418 * @user_data: User data to pass to @callback. 22419 * 22420 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy. 22421 * 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. 22422 * You can then call flash_call_done_finish() to get the result of the operation. 22423 * 22424 * See flash_call_done_sync() for the synchronous, blocking version of this method. 22425 */ 22426 void 22427 flash_call_done ( 22428 Flash *proxy, 22429 GCancellable *cancellable, 22430 GAsyncReadyCallback callback, 22431 gpointer user_data) 22432 { 22433 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 22434 "done", 22435 g_variant_new ("()"), 22436 G_DBUS_CALL_FLAGS_NONE, 22437 -1, 22438 cancellable, 22439 callback, 22440 user_data); 22441 } 22442 22443 /** 22444 * flash_call_done_finish: 22445 * @proxy: A #FlashProxy. 22446 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done(). 22447 * @error: Return location for error or %NULL. 22448 * 22449 * Finishes an operation started with flash_call_done(). 22450 * 22451 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22452 */ 22453 gboolean 22454 flash_call_done_finish ( 22455 Flash *proxy, 22456 GAsyncResult *res, 22457 GError **error) 22458 { 22459 GVariant *_ret; 22460 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 22461 if (_ret == NULL) 22462 goto _out; 22463 g_variant_get (_ret, 22464 "()"); 22465 g_variant_unref (_ret); 22466 _out: 22467 return _ret != NULL; 22468 } 22469 22470 /** 22471 * flash_call_done_sync: 22472 * @proxy: A #FlashProxy. 22473 * @cancellable: (allow-none): A #GCancellable or %NULL. 22474 * @error: Return location for error or %NULL. 22475 * 22476 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 22477 * 22478 * See flash_call_done() for the asynchronous version of this method. 22479 * 22480 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22481 */ 22482 gboolean 22483 flash_call_done_sync ( 22484 Flash *proxy, 22485 GCancellable *cancellable, 22486 GError **error) 22487 { 22488 GVariant *_ret; 22489 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 22490 "done", 22491 g_variant_new ("()"), 22492 G_DBUS_CALL_FLAGS_NONE, 22493 -1, 22494 cancellable, 22495 error); 22496 if (_ret == NULL) 22497 goto _out; 22498 g_variant_get (_ret, 22499 "()"); 22500 g_variant_unref (_ret); 22501 _out: 22502 return _ret != NULL; 22503 } 22504 22505 /** 22506 * flash_call_update_via_tftp: 22507 * @proxy: A #FlashProxy. 22508 * @arg_url: Argument to pass with the method invocation. 22509 * @arg_filename: Argument to pass with the method invocation. 22510 * @cancellable: (allow-none): A #GCancellable or %NULL. 22511 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 22512 * @user_data: User data to pass to @callback. 22513 * 22514 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. 22515 * 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. 22516 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation. 22517 * 22518 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method. 22519 */ 22520 void 22521 flash_call_update_via_tftp ( 22522 Flash *proxy, 22523 const gchar *arg_url, 22524 const gchar *arg_filename, 22525 GCancellable *cancellable, 22526 GAsyncReadyCallback callback, 22527 gpointer user_data) 22528 { 22529 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 22530 "updateViaTftp", 22531 g_variant_new ("(ss)", 22532 arg_url, 22533 arg_filename), 22534 G_DBUS_CALL_FLAGS_NONE, 22535 -1, 22536 cancellable, 22537 callback, 22538 user_data); 22539 } 22540 22541 /** 22542 * flash_call_update_via_tftp_finish: 22543 * @proxy: A #FlashProxy. 22544 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp(). 22545 * @error: Return location for error or %NULL. 22546 * 22547 * Finishes an operation started with flash_call_update_via_tftp(). 22548 * 22549 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22550 */ 22551 gboolean 22552 flash_call_update_via_tftp_finish ( 22553 Flash *proxy, 22554 GAsyncResult *res, 22555 GError **error) 22556 { 22557 GVariant *_ret; 22558 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 22559 if (_ret == NULL) 22560 goto _out; 22561 g_variant_get (_ret, 22562 "()"); 22563 g_variant_unref (_ret); 22564 _out: 22565 return _ret != NULL; 22566 } 22567 22568 /** 22569 * flash_call_update_via_tftp_sync: 22570 * @proxy: A #FlashProxy. 22571 * @arg_url: Argument to pass with the method invocation. 22572 * @arg_filename: Argument to pass with the method invocation. 22573 * @cancellable: (allow-none): A #GCancellable or %NULL. 22574 * @error: Return location for error or %NULL. 22575 * 22576 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 22577 * 22578 * See flash_call_update_via_tftp() for the asynchronous version of this method. 22579 * 22580 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22581 */ 22582 gboolean 22583 flash_call_update_via_tftp_sync ( 22584 Flash *proxy, 22585 const gchar *arg_url, 22586 const gchar *arg_filename, 22587 GCancellable *cancellable, 22588 GError **error) 22589 { 22590 GVariant *_ret; 22591 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 22592 "updateViaTftp", 22593 g_variant_new ("(ss)", 22594 arg_url, 22595 arg_filename), 22596 G_DBUS_CALL_FLAGS_NONE, 22597 -1, 22598 cancellable, 22599 error); 22600 if (_ret == NULL) 22601 goto _out; 22602 g_variant_get (_ret, 22603 "()"); 22604 g_variant_unref (_ret); 22605 _out: 22606 return _ret != NULL; 22607 } 22608 22609 /** 22610 * flash_call_init: 22611 * @proxy: A #FlashProxy. 22612 * @cancellable: (allow-none): A #GCancellable or %NULL. 22613 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 22614 * @user_data: User data to pass to @callback. 22615 * 22616 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. 22617 * 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. 22618 * You can then call flash_call_init_finish() to get the result of the operation. 22619 * 22620 * See flash_call_init_sync() for the synchronous, blocking version of this method. 22621 */ 22622 void 22623 flash_call_init ( 22624 Flash *proxy, 22625 GCancellable *cancellable, 22626 GAsyncReadyCallback callback, 22627 gpointer user_data) 22628 { 22629 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 22630 "init", 22631 g_variant_new ("()"), 22632 G_DBUS_CALL_FLAGS_NONE, 22633 -1, 22634 cancellable, 22635 callback, 22636 user_data); 22637 } 22638 22639 /** 22640 * flash_call_init_finish: 22641 * @proxy: A #FlashProxy. 22642 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init(). 22643 * @error: Return location for error or %NULL. 22644 * 22645 * Finishes an operation started with flash_call_init(). 22646 * 22647 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22648 */ 22649 gboolean 22650 flash_call_init_finish ( 22651 Flash *proxy, 22652 GAsyncResult *res, 22653 GError **error) 22654 { 22655 GVariant *_ret; 22656 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 22657 if (_ret == NULL) 22658 goto _out; 22659 g_variant_get (_ret, 22660 "()"); 22661 g_variant_unref (_ret); 22662 _out: 22663 return _ret != NULL; 22664 } 22665 22666 /** 22667 * flash_call_init_sync: 22668 * @proxy: A #FlashProxy. 22669 * @cancellable: (allow-none): A #GCancellable or %NULL. 22670 * @error: Return location for error or %NULL. 22671 * 22672 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 22673 * 22674 * See flash_call_init() for the asynchronous version of this method. 22675 * 22676 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 22677 */ 22678 gboolean 22679 flash_call_init_sync ( 22680 Flash *proxy, 22681 GCancellable *cancellable, 22682 GError **error) 22683 { 22684 GVariant *_ret; 22685 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 22686 "init", 22687 g_variant_new ("()"), 22688 G_DBUS_CALL_FLAGS_NONE, 22689 -1, 22690 cancellable, 22691 error); 22692 if (_ret == NULL) 22693 goto _out; 22694 g_variant_get (_ret, 22695 "()"); 22696 g_variant_unref (_ret); 22697 _out: 22698 return _ret != NULL; 22699 } 22700 22701 /** 22702 * flash_complete_update: 22703 * @object: A #Flash. 22704 * @invocation: (transfer full): A #GDBusMethodInvocation. 22705 * 22706 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 22707 * 22708 * This method will free @invocation, you cannot use it afterwards. 22709 */ 22710 void 22711 flash_complete_update ( 22712 Flash *object, 22713 GDBusMethodInvocation *invocation) 22714 { 22715 g_dbus_method_invocation_return_value (invocation, 22716 g_variant_new ("()")); 22717 } 22718 22719 /** 22720 * flash_complete_error: 22721 * @object: A #Flash. 22722 * @invocation: (transfer full): A #GDBusMethodInvocation. 22723 * 22724 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</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. 22725 * 22726 * This method will free @invocation, you cannot use it afterwards. 22727 */ 22728 void 22729 flash_complete_error ( 22730 Flash *object, 22731 GDBusMethodInvocation *invocation) 22732 { 22733 g_dbus_method_invocation_return_value (invocation, 22734 g_variant_new ("()")); 22735 } 22736 22737 /** 22738 * flash_complete_done: 22739 * @object: A #Flash. 22740 * @invocation: (transfer full): A #GDBusMethodInvocation. 22741 * 22742 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</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. 22743 * 22744 * This method will free @invocation, you cannot use it afterwards. 22745 */ 22746 void 22747 flash_complete_done ( 22748 Flash *object, 22749 GDBusMethodInvocation *invocation) 22750 { 22751 g_dbus_method_invocation_return_value (invocation, 22752 g_variant_new ("()")); 22753 } 22754 22755 /** 22756 * flash_complete_update_via_tftp: 22757 * @object: A #Flash. 22758 * @invocation: (transfer full): A #GDBusMethodInvocation. 22759 * 22760 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 22761 * 22762 * This method will free @invocation, you cannot use it afterwards. 22763 */ 22764 void 22765 flash_complete_update_via_tftp ( 22766 Flash *object, 22767 GDBusMethodInvocation *invocation) 22768 { 22769 g_dbus_method_invocation_return_value (invocation, 22770 g_variant_new ("()")); 22771 } 22772 22773 /** 22774 * flash_complete_init: 22775 * @object: A #Flash. 22776 * @invocation: (transfer full): A #GDBusMethodInvocation. 22777 * 22778 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 22779 * 22780 * This method will free @invocation, you cannot use it afterwards. 22781 */ 22782 void 22783 flash_complete_init ( 22784 Flash *object, 22785 GDBusMethodInvocation *invocation) 22786 { 22787 g_dbus_method_invocation_return_value (invocation, 22788 g_variant_new ("()")); 22789 } 22790 22791 /* ------------------------------------------------------------------------ */ 22792 22793 /** 22794 * FlashProxy: 22795 * 22796 * The #FlashProxy structure contains only private data and should only be accessed using the provided API. 22797 */ 22798 22799 /** 22800 * FlashProxyClass: 22801 * @parent_class: The parent class. 22802 * 22803 * Class structure for #FlashProxy. 22804 */ 22805 22806 struct _FlashProxyPrivate 22807 { 22808 GData *qdata; 22809 }; 22810 22811 static void flash_proxy_iface_init (FlashIface *iface); 22812 22813 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 22814 G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, 22815 G_ADD_PRIVATE (FlashProxy) 22816 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); 22817 22818 #else 22819 G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY, 22820 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init)); 22821 22822 #endif 22823 static void 22824 flash_proxy_finalize (GObject *object) 22825 { 22826 FlashProxy *proxy = FLASH_PROXY (object); 22827 g_datalist_clear (&proxy->priv->qdata); 22828 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object); 22829 } 22830 22831 static void 22832 flash_proxy_get_property (GObject *object, 22833 guint prop_id, 22834 GValue *value, 22835 GParamSpec *pspec G_GNUC_UNUSED) 22836 { 22837 const _ExtendedGDBusPropertyInfo *info; 22838 GVariant *variant; 22839 g_assert (prop_id != 0 && prop_id - 1 < 5); 22840 info = _flash_property_info_pointers[prop_id - 1]; 22841 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 22842 if (info->use_gvariant) 22843 { 22844 g_value_set_variant (value, variant); 22845 } 22846 else 22847 { 22848 if (variant != NULL) 22849 g_dbus_gvariant_to_gvalue (variant, value); 22850 } 22851 if (variant != NULL) 22852 g_variant_unref (variant); 22853 } 22854 22855 static void 22856 flash_proxy_set_property_cb (GDBusProxy *proxy, 22857 GAsyncResult *res, 22858 gpointer user_data) 22859 { 22860 const _ExtendedGDBusPropertyInfo *info = user_data; 22861 GError *error; 22862 GVariant *_ret; 22863 error = NULL; 22864 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 22865 if (!_ret) 22866 { 22867 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)", 22868 info->parent_struct.name, 22869 error->message, g_quark_to_string (error->domain), error->code); 22870 g_error_free (error); 22871 } 22872 else 22873 { 22874 g_variant_unref (_ret); 22875 } 22876 } 22877 22878 static void 22879 flash_proxy_set_property (GObject *object, 22880 guint prop_id, 22881 const GValue *value, 22882 GParamSpec *pspec G_GNUC_UNUSED) 22883 { 22884 const _ExtendedGDBusPropertyInfo *info; 22885 GVariant *variant; 22886 g_assert (prop_id != 0 && prop_id - 1 < 5); 22887 info = _flash_property_info_pointers[prop_id - 1]; 22888 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 22889 g_dbus_proxy_call (G_DBUS_PROXY (object), 22890 "org.freedesktop.DBus.Properties.Set", 22891 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant), 22892 G_DBUS_CALL_FLAGS_NONE, 22893 -1, 22894 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 22895 g_variant_unref (variant); 22896 } 22897 22898 static void 22899 flash_proxy_g_signal (GDBusProxy *proxy, 22900 const gchar *sender_name G_GNUC_UNUSED, 22901 const gchar *signal_name, 22902 GVariant *parameters) 22903 { 22904 _ExtendedGDBusSignalInfo *info; 22905 GVariantIter iter; 22906 GVariant *child; 22907 GValue *paramv; 22908 guint num_params; 22909 guint n; 22910 guint signal_id; 22911 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name); 22912 if (info == NULL) 22913 return; 22914 num_params = g_variant_n_children (parameters); 22915 paramv = g_new0 (GValue, num_params + 1); 22916 g_value_init (¶mv[0], TYPE_FLASH); 22917 g_value_set_object (¶mv[0], proxy); 22918 g_variant_iter_init (&iter, parameters); 22919 n = 1; 22920 while ((child = g_variant_iter_next_value (&iter)) != NULL) 22921 { 22922 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 22923 if (arg_info->use_gvariant) 22924 { 22925 g_value_init (¶mv[n], G_TYPE_VARIANT); 22926 g_value_set_variant (¶mv[n], child); 22927 n++; 22928 } 22929 else 22930 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 22931 g_variant_unref (child); 22932 } 22933 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); 22934 g_signal_emitv (paramv, signal_id, 0, NULL); 22935 for (n = 0; n < num_params + 1; n++) 22936 g_value_unset (¶mv[n]); 22937 g_free (paramv); 22938 } 22939 22940 static void 22941 flash_proxy_g_properties_changed (GDBusProxy *_proxy, 22942 GVariant *changed_properties, 22943 const gchar *const *invalidated_properties) 22944 { 22945 FlashProxy *proxy = FLASH_PROXY (_proxy); 22946 guint n; 22947 const gchar *key; 22948 GVariantIter *iter; 22949 _ExtendedGDBusPropertyInfo *info; 22950 g_variant_get (changed_properties, "a{sv}", &iter); 22951 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 22952 { 22953 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key); 22954 g_datalist_remove_data (&proxy->priv->qdata, key); 22955 if (info != NULL) 22956 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 22957 } 22958 g_variant_iter_free (iter); 22959 for (n = 0; invalidated_properties[n] != NULL; n++) 22960 { 22961 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]); 22962 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 22963 if (info != NULL) 22964 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 22965 } 22966 } 22967 22968 static const gchar * 22969 flash_proxy_get_filename (Flash *object) 22970 { 22971 FlashProxy *proxy = FLASH_PROXY (object); 22972 GVariant *variant; 22973 const gchar *value = NULL; 22974 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename"); 22975 if (variant != NULL) 22976 { 22977 value = g_variant_get_string (variant, NULL); 22978 g_variant_unref (variant); 22979 } 22980 return value; 22981 } 22982 22983 static const gchar * 22984 flash_proxy_get_flasher_path (Flash *object) 22985 { 22986 FlashProxy *proxy = FLASH_PROXY (object); 22987 GVariant *variant; 22988 const gchar *value = NULL; 22989 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path"); 22990 if (variant != NULL) 22991 { 22992 value = g_variant_get_string (variant, NULL); 22993 g_variant_unref (variant); 22994 } 22995 return value; 22996 } 22997 22998 static const gchar * 22999 flash_proxy_get_flasher_name (Flash *object) 23000 { 23001 FlashProxy *proxy = FLASH_PROXY (object); 23002 GVariant *variant; 23003 const gchar *value = NULL; 23004 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name"); 23005 if (variant != NULL) 23006 { 23007 value = g_variant_get_string (variant, NULL); 23008 g_variant_unref (variant); 23009 } 23010 return value; 23011 } 23012 23013 static const gchar * 23014 flash_proxy_get_flasher_instance (Flash *object) 23015 { 23016 FlashProxy *proxy = FLASH_PROXY (object); 23017 GVariant *variant; 23018 const gchar *value = NULL; 23019 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance"); 23020 if (variant != NULL) 23021 { 23022 value = g_variant_get_string (variant, NULL); 23023 g_variant_unref (variant); 23024 } 23025 return value; 23026 } 23027 23028 static const gchar * 23029 flash_proxy_get_status (Flash *object) 23030 { 23031 FlashProxy *proxy = FLASH_PROXY (object); 23032 GVariant *variant; 23033 const gchar *value = NULL; 23034 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status"); 23035 if (variant != NULL) 23036 { 23037 value = g_variant_get_string (variant, NULL); 23038 g_variant_unref (variant); 23039 } 23040 return value; 23041 } 23042 23043 static void 23044 flash_proxy_init (FlashProxy *proxy) 23045 { 23046 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 23047 proxy->priv = flash_proxy_get_instance_private (proxy); 23048 #else 23049 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate); 23050 #endif 23051 23052 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ()); 23053 } 23054 23055 static void 23056 flash_proxy_class_init (FlashProxyClass *klass) 23057 { 23058 GObjectClass *gobject_class; 23059 GDBusProxyClass *proxy_class; 23060 23061 gobject_class = G_OBJECT_CLASS (klass); 23062 gobject_class->finalize = flash_proxy_finalize; 23063 gobject_class->get_property = flash_proxy_get_property; 23064 gobject_class->set_property = flash_proxy_set_property; 23065 23066 proxy_class = G_DBUS_PROXY_CLASS (klass); 23067 proxy_class->g_signal = flash_proxy_g_signal; 23068 proxy_class->g_properties_changed = flash_proxy_g_properties_changed; 23069 23070 flash_override_properties (gobject_class, 1); 23071 23072 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 23073 g_type_class_add_private (klass, sizeof (FlashProxyPrivate)); 23074 #endif 23075 } 23076 23077 static void 23078 flash_proxy_iface_init (FlashIface *iface) 23079 { 23080 iface->get_filename = flash_proxy_get_filename; 23081 iface->get_flasher_path = flash_proxy_get_flasher_path; 23082 iface->get_flasher_name = flash_proxy_get_flasher_name; 23083 iface->get_flasher_instance = flash_proxy_get_flasher_instance; 23084 iface->get_status = flash_proxy_get_status; 23085 } 23086 23087 /** 23088 * flash_proxy_new: 23089 * @connection: A #GDBusConnection. 23090 * @flags: Flags from the #GDBusProxyFlags enumeration. 23091 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 23092 * @object_path: An object path. 23093 * @cancellable: (allow-none): A #GCancellable or %NULL. 23094 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 23095 * @user_data: User data to pass to @callback. 23096 * 23097 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new() for more details. 23098 * 23099 * 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. 23100 * You can then call flash_proxy_new_finish() to get the result of the operation. 23101 * 23102 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor. 23103 */ 23104 void 23105 flash_proxy_new ( 23106 GDBusConnection *connection, 23107 GDBusProxyFlags flags, 23108 const gchar *name, 23109 const gchar *object_path, 23110 GCancellable *cancellable, 23111 GAsyncReadyCallback callback, 23112 gpointer user_data) 23113 { 23114 g_async_initable_new_async (TYPE_FLASH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL); 23115 } 23116 23117 /** 23118 * flash_proxy_new_finish: 23119 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new(). 23120 * @error: Return location for error or %NULL 23121 * 23122 * Finishes an operation started with flash_proxy_new(). 23123 * 23124 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. 23125 */ 23126 Flash * 23127 flash_proxy_new_finish ( 23128 GAsyncResult *res, 23129 GError **error) 23130 { 23131 GObject *ret; 23132 GObject *source_object; 23133 source_object = g_async_result_get_source_object (res); 23134 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 23135 g_object_unref (source_object); 23136 if (ret != NULL) 23137 return FLASH (ret); 23138 else 23139 return NULL; 23140 } 23141 23142 /** 23143 * flash_proxy_new_sync: 23144 * @connection: A #GDBusConnection. 23145 * @flags: Flags from the #GDBusProxyFlags enumeration. 23146 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 23147 * @object_path: An object path. 23148 * @cancellable: (allow-none): A #GCancellable or %NULL. 23149 * @error: Return location for error or %NULL 23150 * 23151 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new_sync() for more details. 23152 * 23153 * The calling thread is blocked until a reply is received. 23154 * 23155 * See flash_proxy_new() for the asynchronous version of this constructor. 23156 * 23157 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. 23158 */ 23159 Flash * 23160 flash_proxy_new_sync ( 23161 GDBusConnection *connection, 23162 GDBusProxyFlags flags, 23163 const gchar *name, 23164 const gchar *object_path, 23165 GCancellable *cancellable, 23166 GError **error) 23167 { 23168 GInitable *ret; 23169 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL); 23170 if (ret != NULL) 23171 return FLASH (ret); 23172 else 23173 return NULL; 23174 } 23175 23176 23177 /** 23178 * flash_proxy_new_for_bus: 23179 * @bus_type: A #GBusType. 23180 * @flags: Flags from the #GDBusProxyFlags enumeration. 23181 * @name: A bus name (well-known or unique). 23182 * @object_path: An object path. 23183 * @cancellable: (allow-none): A #GCancellable or %NULL. 23184 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 23185 * @user_data: User data to pass to @callback. 23186 * 23187 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 23188 * 23189 * 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. 23190 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation. 23191 * 23192 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 23193 */ 23194 void 23195 flash_proxy_new_for_bus ( 23196 GBusType bus_type, 23197 GDBusProxyFlags flags, 23198 const gchar *name, 23199 const gchar *object_path, 23200 GCancellable *cancellable, 23201 GAsyncReadyCallback callback, 23202 gpointer user_data) 23203 { 23204 g_async_initable_new_async (TYPE_FLASH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL); 23205 } 23206 23207 /** 23208 * flash_proxy_new_for_bus_finish: 23209 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus(). 23210 * @error: Return location for error or %NULL 23211 * 23212 * Finishes an operation started with flash_proxy_new_for_bus(). 23213 * 23214 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. 23215 */ 23216 Flash * 23217 flash_proxy_new_for_bus_finish ( 23218 GAsyncResult *res, 23219 GError **error) 23220 { 23221 GObject *ret; 23222 GObject *source_object; 23223 source_object = g_async_result_get_source_object (res); 23224 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 23225 g_object_unref (source_object); 23226 if (ret != NULL) 23227 return FLASH (ret); 23228 else 23229 return NULL; 23230 } 23231 23232 /** 23233 * flash_proxy_new_for_bus_sync: 23234 * @bus_type: A #GBusType. 23235 * @flags: Flags from the #GDBusProxyFlags enumeration. 23236 * @name: A bus name (well-known or unique). 23237 * @object_path: An object path. 23238 * @cancellable: (allow-none): A #GCancellable or %NULL. 23239 * @error: Return location for error or %NULL 23240 * 23241 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 23242 * 23243 * The calling thread is blocked until a reply is received. 23244 * 23245 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor. 23246 * 23247 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set. 23248 */ 23249 Flash * 23250 flash_proxy_new_for_bus_sync ( 23251 GBusType bus_type, 23252 GDBusProxyFlags flags, 23253 const gchar *name, 23254 const gchar *object_path, 23255 GCancellable *cancellable, 23256 GError **error) 23257 { 23258 GInitable *ret; 23259 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL); 23260 if (ret != NULL) 23261 return FLASH (ret); 23262 else 23263 return NULL; 23264 } 23265 23266 23267 /* ------------------------------------------------------------------------ */ 23268 23269 /** 23270 * FlashSkeleton: 23271 * 23272 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API. 23273 */ 23274 23275 /** 23276 * FlashSkeletonClass: 23277 * @parent_class: The parent class. 23278 * 23279 * Class structure for #FlashSkeleton. 23280 */ 23281 23282 struct _FlashSkeletonPrivate 23283 { 23284 GValue *properties; 23285 GList *changed_properties; 23286 GSource *changed_properties_idle_source; 23287 GMainContext *context; 23288 GMutex lock; 23289 }; 23290 23291 static void 23292 _flash_skeleton_handle_method_call ( 23293 GDBusConnection *connection G_GNUC_UNUSED, 23294 const gchar *sender G_GNUC_UNUSED, 23295 const gchar *object_path G_GNUC_UNUSED, 23296 const gchar *interface_name, 23297 const gchar *method_name, 23298 GVariant *parameters, 23299 GDBusMethodInvocation *invocation, 23300 gpointer user_data) 23301 { 23302 FlashSkeleton *skeleton = FLASH_SKELETON (user_data); 23303 _ExtendedGDBusMethodInfo *info; 23304 GVariantIter iter; 23305 GVariant *child; 23306 GValue *paramv; 23307 guint num_params; 23308 guint num_extra; 23309 guint n; 23310 guint signal_id; 23311 GValue return_value = G_VALUE_INIT; 23312 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 23313 g_assert (info != NULL); 23314 num_params = g_variant_n_children (parameters); 23315 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 23316 n = 0; 23317 g_value_init (¶mv[n], TYPE_FLASH); 23318 g_value_set_object (¶mv[n++], skeleton); 23319 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 23320 g_value_set_object (¶mv[n++], invocation); 23321 if (info->pass_fdlist) 23322 { 23323 #ifdef G_OS_UNIX 23324 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 23325 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 23326 #else 23327 g_assert_not_reached (); 23328 #endif 23329 } 23330 g_variant_iter_init (&iter, parameters); 23331 while ((child = g_variant_iter_next_value (&iter)) != NULL) 23332 { 23333 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 23334 if (arg_info->use_gvariant) 23335 { 23336 g_value_init (¶mv[n], G_TYPE_VARIANT); 23337 g_value_set_variant (¶mv[n], child); 23338 n++; 23339 } 23340 else 23341 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 23342 g_variant_unref (child); 23343 } 23344 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH); 23345 g_value_init (&return_value, G_TYPE_BOOLEAN); 23346 g_signal_emitv (paramv, signal_id, 0, &return_value); 23347 if (!g_value_get_boolean (&return_value)) 23348 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); 23349 g_value_unset (&return_value); 23350 for (n = 0; n < num_params + num_extra; n++) 23351 g_value_unset (¶mv[n]); 23352 g_free (paramv); 23353 } 23354 23355 static GVariant * 23356 _flash_skeleton_handle_get_property ( 23357 GDBusConnection *connection G_GNUC_UNUSED, 23358 const gchar *sender G_GNUC_UNUSED, 23359 const gchar *object_path G_GNUC_UNUSED, 23360 const gchar *interface_name G_GNUC_UNUSED, 23361 const gchar *property_name, 23362 GError **error, 23363 gpointer user_data) 23364 { 23365 FlashSkeleton *skeleton = FLASH_SKELETON (user_data); 23366 GValue value = G_VALUE_INIT; 23367 GParamSpec *pspec; 23368 _ExtendedGDBusPropertyInfo *info; 23369 GVariant *ret; 23370 ret = NULL; 23371 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); 23372 g_assert (info != NULL); 23373 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 23374 if (pspec == NULL) 23375 { 23376 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 23377 } 23378 else 23379 { 23380 g_value_init (&value, pspec->value_type); 23381 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 23382 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 23383 g_value_unset (&value); 23384 } 23385 return ret; 23386 } 23387 23388 static gboolean 23389 _flash_skeleton_handle_set_property ( 23390 GDBusConnection *connection G_GNUC_UNUSED, 23391 const gchar *sender G_GNUC_UNUSED, 23392 const gchar *object_path G_GNUC_UNUSED, 23393 const gchar *interface_name G_GNUC_UNUSED, 23394 const gchar *property_name, 23395 GVariant *variant, 23396 GError **error, 23397 gpointer user_data) 23398 { 23399 FlashSkeleton *skeleton = FLASH_SKELETON (user_data); 23400 GValue value = G_VALUE_INIT; 23401 GParamSpec *pspec; 23402 _ExtendedGDBusPropertyInfo *info; 23403 gboolean ret; 23404 ret = FALSE; 23405 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name); 23406 g_assert (info != NULL); 23407 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 23408 if (pspec == NULL) 23409 { 23410 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 23411 } 23412 else 23413 { 23414 if (info->use_gvariant) 23415 g_value_set_variant (&value, variant); 23416 else 23417 g_dbus_gvariant_to_gvalue (variant, &value); 23418 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 23419 g_value_unset (&value); 23420 ret = TRUE; 23421 } 23422 return ret; 23423 } 23424 23425 static const GDBusInterfaceVTable _flash_skeleton_vtable = 23426 { 23427 _flash_skeleton_handle_method_call, 23428 _flash_skeleton_handle_get_property, 23429 _flash_skeleton_handle_set_property, 23430 {NULL} 23431 }; 23432 23433 static GDBusInterfaceInfo * 23434 flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 23435 { 23436 return flash_interface_info (); 23437 } 23438 23439 static GDBusInterfaceVTable * 23440 flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 23441 { 23442 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable; 23443 } 23444 23445 static GVariant * 23446 flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 23447 { 23448 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); 23449 23450 GVariantBuilder builder; 23451 guint n; 23452 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 23453 if (_flash_interface_info.parent_struct.properties == NULL) 23454 goto out; 23455 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++) 23456 { 23457 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n]; 23458 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 23459 { 23460 GVariant *value; 23461 value = _flash_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", info->name, NULL, skeleton); 23462 if (value != NULL) 23463 { 23464 g_variant_take_ref (value); 23465 g_variant_builder_add (&builder, "{sv}", info->name, value); 23466 g_variant_unref (value); 23467 } 23468 } 23469 } 23470 out: 23471 return g_variant_builder_end (&builder); 23472 } 23473 23474 static gboolean _flash_emit_changed (gpointer user_data); 23475 23476 static void 23477 flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 23478 { 23479 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton); 23480 gboolean emit_changed = FALSE; 23481 23482 g_mutex_lock (&skeleton->priv->lock); 23483 if (skeleton->priv->changed_properties_idle_source != NULL) 23484 { 23485 g_source_destroy (skeleton->priv->changed_properties_idle_source); 23486 skeleton->priv->changed_properties_idle_source = NULL; 23487 emit_changed = TRUE; 23488 } 23489 g_mutex_unlock (&skeleton->priv->lock); 23490 23491 if (emit_changed) 23492 _flash_emit_changed (skeleton); 23493 } 23494 23495 static void 23496 _flash_on_signal_updated ( 23497 Flash *object) 23498 { 23499 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23500 23501 GList *connections, *l; 23502 GVariant *signal_variant; 23503 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 23504 23505 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 23506 for (l = connections; l != NULL; l = l->next) 23507 { 23508 GDBusConnection *connection = l->data; 23509 g_dbus_connection_emit_signal (connection, 23510 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated", 23511 signal_variant, NULL); 23512 } 23513 g_variant_unref (signal_variant); 23514 g_list_free_full (connections, g_object_unref); 23515 } 23516 23517 static void 23518 _flash_on_signal_download ( 23519 Flash *object, 23520 const gchar *arg_url, 23521 const gchar *arg_filename) 23522 { 23523 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23524 23525 GList *connections, *l; 23526 GVariant *signal_variant; 23527 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 23528 23529 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)", 23530 arg_url, 23531 arg_filename)); 23532 for (l = connections; l != NULL; l = l->next) 23533 { 23534 GDBusConnection *connection = l->data; 23535 g_dbus_connection_emit_signal (connection, 23536 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download", 23537 signal_variant, NULL); 23538 } 23539 g_variant_unref (signal_variant); 23540 g_list_free_full (connections, g_object_unref); 23541 } 23542 23543 static void flash_skeleton_iface_init (FlashIface *iface); 23544 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 23545 G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 23546 G_ADD_PRIVATE (FlashSkeleton) 23547 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); 23548 23549 #else 23550 G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 23551 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init)); 23552 23553 #endif 23554 static void 23555 flash_skeleton_finalize (GObject *object) 23556 { 23557 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23558 guint n; 23559 for (n = 0; n < 5; n++) 23560 g_value_unset (&skeleton->priv->properties[n]); 23561 g_free (skeleton->priv->properties); 23562 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 23563 if (skeleton->priv->changed_properties_idle_source != NULL) 23564 g_source_destroy (skeleton->priv->changed_properties_idle_source); 23565 g_main_context_unref (skeleton->priv->context); 23566 g_mutex_clear (&skeleton->priv->lock); 23567 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object); 23568 } 23569 23570 static void 23571 flash_skeleton_get_property (GObject *object, 23572 guint prop_id, 23573 GValue *value, 23574 GParamSpec *pspec G_GNUC_UNUSED) 23575 { 23576 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23577 g_assert (prop_id != 0 && prop_id - 1 < 5); 23578 g_mutex_lock (&skeleton->priv->lock); 23579 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 23580 g_mutex_unlock (&skeleton->priv->lock); 23581 } 23582 23583 static gboolean 23584 _flash_emit_changed (gpointer user_data) 23585 { 23586 FlashSkeleton *skeleton = FLASH_SKELETON (user_data); 23587 GList *l; 23588 GVariantBuilder builder; 23589 GVariantBuilder invalidated_builder; 23590 guint num_changes; 23591 23592 g_mutex_lock (&skeleton->priv->lock); 23593 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 23594 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 23595 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 23596 { 23597 ChangedProperty *cp = l->data; 23598 GVariant *variant; 23599 const GValue *cur_value; 23600 23601 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 23602 if (!_g_value_equal (cur_value, &cp->orig_value)) 23603 { 23604 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 23605 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 23606 g_variant_unref (variant); 23607 num_changes++; 23608 } 23609 } 23610 if (num_changes > 0) 23611 { 23612 GList *connections, *ll; 23613 GVariant *signal_variant; 23614 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash", 23615 &builder, &invalidated_builder)); 23616 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 23617 for (ll = connections; ll != NULL; ll = ll->next) 23618 { 23619 GDBusConnection *connection = ll->data; 23620 23621 g_dbus_connection_emit_signal (connection, 23622 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 23623 "org.freedesktop.DBus.Properties", 23624 "PropertiesChanged", 23625 signal_variant, 23626 NULL); 23627 } 23628 g_variant_unref (signal_variant); 23629 g_list_free_full (connections, g_object_unref); 23630 } 23631 else 23632 { 23633 g_variant_builder_clear (&builder); 23634 g_variant_builder_clear (&invalidated_builder); 23635 } 23636 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 23637 skeleton->priv->changed_properties = NULL; 23638 skeleton->priv->changed_properties_idle_source = NULL; 23639 g_mutex_unlock (&skeleton->priv->lock); 23640 return FALSE; 23641 } 23642 23643 static void 23644 _flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 23645 { 23646 ChangedProperty *cp; 23647 GList *l; 23648 cp = NULL; 23649 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 23650 { 23651 ChangedProperty *i_cp = l->data; 23652 if (i_cp->info == info) 23653 { 23654 cp = i_cp; 23655 break; 23656 } 23657 } 23658 if (cp == NULL) 23659 { 23660 cp = g_new0 (ChangedProperty, 1); 23661 cp->prop_id = prop_id; 23662 cp->info = info; 23663 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 23664 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 23665 g_value_copy (orig_value, &cp->orig_value); 23666 } 23667 } 23668 23669 static void 23670 flash_skeleton_notify (GObject *object, 23671 GParamSpec *pspec G_GNUC_UNUSED) 23672 { 23673 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23674 g_mutex_lock (&skeleton->priv->lock); 23675 if (skeleton->priv->changed_properties != NULL && 23676 skeleton->priv->changed_properties_idle_source == NULL) 23677 { 23678 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 23679 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 23680 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 23681 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_emit_changed"); 23682 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 23683 g_source_unref (skeleton->priv->changed_properties_idle_source); 23684 } 23685 g_mutex_unlock (&skeleton->priv->lock); 23686 } 23687 23688 static void 23689 flash_skeleton_set_property (GObject *object, 23690 guint prop_id, 23691 const GValue *value, 23692 GParamSpec *pspec) 23693 { 23694 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23695 g_assert (prop_id != 0 && prop_id - 1 < 5); 23696 g_mutex_lock (&skeleton->priv->lock); 23697 g_object_freeze_notify (object); 23698 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 23699 { 23700 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 23701 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 23702 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 23703 g_object_notify_by_pspec (object, pspec); 23704 } 23705 g_mutex_unlock (&skeleton->priv->lock); 23706 g_object_thaw_notify (object); 23707 } 23708 23709 static void 23710 flash_skeleton_init (FlashSkeleton *skeleton) 23711 { 23712 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 23713 skeleton->priv = flash_skeleton_get_instance_private (skeleton); 23714 #else 23715 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate); 23716 #endif 23717 23718 g_mutex_init (&skeleton->priv->lock); 23719 skeleton->priv->context = g_main_context_ref_thread_default (); 23720 skeleton->priv->properties = g_new0 (GValue, 5); 23721 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); 23722 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); 23723 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); 23724 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING); 23725 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING); 23726 } 23727 23728 static const gchar * 23729 flash_skeleton_get_filename (Flash *object) 23730 { 23731 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23732 const gchar *value; 23733 g_mutex_lock (&skeleton->priv->lock); 23734 value = g_value_get_string (&(skeleton->priv->properties[0])); 23735 g_mutex_unlock (&skeleton->priv->lock); 23736 return value; 23737 } 23738 23739 static const gchar * 23740 flash_skeleton_get_flasher_path (Flash *object) 23741 { 23742 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23743 const gchar *value; 23744 g_mutex_lock (&skeleton->priv->lock); 23745 value = g_value_get_string (&(skeleton->priv->properties[1])); 23746 g_mutex_unlock (&skeleton->priv->lock); 23747 return value; 23748 } 23749 23750 static const gchar * 23751 flash_skeleton_get_flasher_name (Flash *object) 23752 { 23753 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23754 const gchar *value; 23755 g_mutex_lock (&skeleton->priv->lock); 23756 value = g_value_get_string (&(skeleton->priv->properties[2])); 23757 g_mutex_unlock (&skeleton->priv->lock); 23758 return value; 23759 } 23760 23761 static const gchar * 23762 flash_skeleton_get_flasher_instance (Flash *object) 23763 { 23764 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23765 const gchar *value; 23766 g_mutex_lock (&skeleton->priv->lock); 23767 value = g_value_get_string (&(skeleton->priv->properties[3])); 23768 g_mutex_unlock (&skeleton->priv->lock); 23769 return value; 23770 } 23771 23772 static const gchar * 23773 flash_skeleton_get_status (Flash *object) 23774 { 23775 FlashSkeleton *skeleton = FLASH_SKELETON (object); 23776 const gchar *value; 23777 g_mutex_lock (&skeleton->priv->lock); 23778 value = g_value_get_string (&(skeleton->priv->properties[4])); 23779 g_mutex_unlock (&skeleton->priv->lock); 23780 return value; 23781 } 23782 23783 static void 23784 flash_skeleton_class_init (FlashSkeletonClass *klass) 23785 { 23786 GObjectClass *gobject_class; 23787 GDBusInterfaceSkeletonClass *skeleton_class; 23788 23789 gobject_class = G_OBJECT_CLASS (klass); 23790 gobject_class->finalize = flash_skeleton_finalize; 23791 gobject_class->get_property = flash_skeleton_get_property; 23792 gobject_class->set_property = flash_skeleton_set_property; 23793 gobject_class->notify = flash_skeleton_notify; 23794 23795 23796 flash_override_properties (gobject_class, 1); 23797 23798 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 23799 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info; 23800 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties; 23801 skeleton_class->flush = flash_skeleton_dbus_interface_flush; 23802 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable; 23803 23804 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 23805 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate)); 23806 #endif 23807 } 23808 23809 static void 23810 flash_skeleton_iface_init (FlashIface *iface) 23811 { 23812 iface->updated = _flash_on_signal_updated; 23813 iface->download = _flash_on_signal_download; 23814 iface->get_filename = flash_skeleton_get_filename; 23815 iface->get_flasher_path = flash_skeleton_get_flasher_path; 23816 iface->get_flasher_name = flash_skeleton_get_flasher_name; 23817 iface->get_flasher_instance = flash_skeleton_get_flasher_instance; 23818 iface->get_status = flash_skeleton_get_status; 23819 } 23820 23821 /** 23822 * flash_skeleton_new: 23823 * 23824 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. 23825 * 23826 * Returns: (transfer full) (type FlashSkeleton): The skeleton object. 23827 */ 23828 Flash * 23829 flash_skeleton_new (void) 23830 { 23831 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL)); 23832 } 23833 23834 /* ------------------------------------------------------------------------ 23835 * Code for interface org.openbmc.FlashControl 23836 * ------------------------------------------------------------------------ 23837 */ 23838 23839 /** 23840 * SECTION:FlashControl 23841 * @title: FlashControl 23842 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface 23843 * 23844 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface in C. 23845 */ 23846 23847 /* ---- Introspection data for org.openbmc.FlashControl ---- */ 23848 23849 static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type = 23850 { 23851 { 23852 -1, 23853 (gchar *) "type", 23854 (gchar *) "s", 23855 NULL 23856 }, 23857 FALSE 23858 }; 23859 23860 static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename = 23861 { 23862 { 23863 -1, 23864 (gchar *) "filename", 23865 (gchar *) "s", 23866 NULL 23867 }, 23868 FALSE 23869 }; 23870 23871 static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] = 23872 { 23873 &_flash_control_method_info_flash_IN_ARG_type, 23874 &_flash_control_method_info_flash_IN_ARG_filename, 23875 NULL 23876 }; 23877 23878 static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash = 23879 { 23880 { 23881 -1, 23882 (gchar *) "flash", 23883 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers, 23884 NULL, 23885 NULL 23886 }, 23887 "handle-flash", 23888 FALSE 23889 }; 23890 23891 static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] = 23892 { 23893 &_flash_control_method_info_flash, 23894 NULL 23895 }; 23896 23897 static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename = 23898 { 23899 { 23900 -1, 23901 (gchar *) "filename", 23902 (gchar *) "s", 23903 NULL 23904 }, 23905 FALSE 23906 }; 23907 23908 static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] = 23909 { 23910 &_flash_control_signal_info_done_ARG_filename, 23911 NULL 23912 }; 23913 23914 static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done = 23915 { 23916 { 23917 -1, 23918 (gchar *) "Done", 23919 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers, 23920 NULL 23921 }, 23922 "done" 23923 }; 23924 23925 static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename = 23926 { 23927 { 23928 -1, 23929 (gchar *) "filename", 23930 (gchar *) "s", 23931 NULL 23932 }, 23933 FALSE 23934 }; 23935 23936 static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] = 23937 { 23938 &_flash_control_signal_info_error_ARG_filename, 23939 NULL 23940 }; 23941 23942 static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error = 23943 { 23944 { 23945 -1, 23946 (gchar *) "Error", 23947 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers, 23948 NULL 23949 }, 23950 "error" 23951 }; 23952 23953 static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename = 23954 { 23955 { 23956 -1, 23957 (gchar *) "filename", 23958 (gchar *) "s", 23959 NULL 23960 }, 23961 FALSE 23962 }; 23963 23964 static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress = 23965 { 23966 { 23967 -1, 23968 (gchar *) "progress", 23969 (gchar *) "y", 23970 NULL 23971 }, 23972 FALSE 23973 }; 23974 23975 static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] = 23976 { 23977 &_flash_control_signal_info_progress_ARG_filename, 23978 &_flash_control_signal_info_progress_ARG_progress, 23979 NULL 23980 }; 23981 23982 static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress = 23983 { 23984 { 23985 -1, 23986 (gchar *) "Progress", 23987 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers, 23988 NULL 23989 }, 23990 "progress" 23991 }; 23992 23993 static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] = 23994 { 23995 &_flash_control_signal_info_done, 23996 &_flash_control_signal_info_error, 23997 &_flash_control_signal_info_progress, 23998 NULL 23999 }; 24000 24001 static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename = 24002 { 24003 { 24004 -1, 24005 (gchar *) "filename", 24006 (gchar *) "s", 24007 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 24008 NULL 24009 }, 24010 "filename", 24011 FALSE 24012 }; 24013 24014 static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ = 24015 { 24016 { 24017 -1, 24018 (gchar *) "type", 24019 (gchar *) "s", 24020 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 24021 NULL 24022 }, 24023 "type", 24024 FALSE 24025 }; 24026 24027 static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] = 24028 { 24029 &_flash_control_property_info_filename, 24030 &_flash_control_property_info_type_, 24031 NULL 24032 }; 24033 24034 static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info = 24035 { 24036 { 24037 -1, 24038 (gchar *) "org.openbmc.FlashControl", 24039 (GDBusMethodInfo **) &_flash_control_method_info_pointers, 24040 (GDBusSignalInfo **) &_flash_control_signal_info_pointers, 24041 (GDBusPropertyInfo **) &_flash_control_property_info_pointers, 24042 NULL 24043 }, 24044 "flash-control", 24045 }; 24046 24047 24048 /** 24049 * flash_control_interface_info: 24050 * 24051 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface. 24052 * 24053 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 24054 */ 24055 GDBusInterfaceInfo * 24056 flash_control_interface_info (void) 24057 { 24058 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct; 24059 } 24060 24061 /** 24062 * flash_control_override_properties: 24063 * @klass: The class structure for a #GObject<!-- -->-derived class. 24064 * @property_id_begin: The property id to assign to the first overridden property. 24065 * 24066 * Overrides all #GObject properties in the #FlashControl interface for a concrete class. 24067 * The properties are overridden in the order they are defined. 24068 * 24069 * Returns: The last property id. 24070 */ 24071 guint 24072 flash_control_override_properties (GObjectClass *klass, guint property_id_begin) 24073 { 24074 g_object_class_override_property (klass, property_id_begin++, "filename"); 24075 g_object_class_override_property (klass, property_id_begin++, "type"); 24076 return property_id_begin - 1; 24077 } 24078 24079 24080 24081 /** 24082 * FlashControl: 24083 * 24084 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. 24085 */ 24086 24087 /** 24088 * FlashControlIface: 24089 * @parent_iface: The parent interface. 24090 * @handle_flash: Handler for the #FlashControl::handle-flash signal. 24091 * @get_filename: Getter for the #FlashControl:filename property. 24092 * @get_type_: Getter for the #FlashControl:type property. 24093 * @done: Handler for the #FlashControl::done signal. 24094 * @error: Handler for the #FlashControl::error signal. 24095 * @progress: Handler for the #FlashControl::progress signal. 24096 * 24097 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. 24098 */ 24099 24100 typedef FlashControlIface FlashControlInterface; 24101 G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT); 24102 24103 static void 24104 flash_control_default_init (FlashControlIface *iface) 24105 { 24106 /* GObject signals for incoming D-Bus method calls: */ 24107 /** 24108 * FlashControl::handle-flash: 24109 * @object: A #FlashControl. 24110 * @invocation: A #GDBusMethodInvocation. 24111 * @arg_type: Argument passed by remote caller. 24112 * @arg_filename: Argument passed by remote caller. 24113 * 24114 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method. 24115 * 24116 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_control_complete_flash() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 24117 * 24118 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 24119 */ 24120 g_signal_new ("handle-flash", 24121 G_TYPE_FROM_INTERFACE (iface), 24122 G_SIGNAL_RUN_LAST, 24123 G_STRUCT_OFFSET (FlashControlIface, handle_flash), 24124 g_signal_accumulator_true_handled, 24125 NULL, 24126 g_cclosure_marshal_generic, 24127 G_TYPE_BOOLEAN, 24128 3, 24129 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); 24130 24131 /* GObject signals for received D-Bus signals: */ 24132 /** 24133 * FlashControl::done: 24134 * @object: A #FlashControl. 24135 * @arg_filename: Argument. 24136 * 24137 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> is received. 24138 * 24139 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 24140 */ 24141 g_signal_new ("done", 24142 G_TYPE_FROM_INTERFACE (iface), 24143 G_SIGNAL_RUN_LAST, 24144 G_STRUCT_OFFSET (FlashControlIface, done), 24145 NULL, 24146 NULL, 24147 g_cclosure_marshal_generic, 24148 G_TYPE_NONE, 24149 1, G_TYPE_STRING); 24150 24151 /** 24152 * FlashControl::error: 24153 * @object: A #FlashControl. 24154 * @arg_filename: Argument. 24155 * 24156 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> is received. 24157 * 24158 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 24159 */ 24160 g_signal_new ("error", 24161 G_TYPE_FROM_INTERFACE (iface), 24162 G_SIGNAL_RUN_LAST, 24163 G_STRUCT_OFFSET (FlashControlIface, error), 24164 NULL, 24165 NULL, 24166 g_cclosure_marshal_generic, 24167 G_TYPE_NONE, 24168 1, G_TYPE_STRING); 24169 24170 /** 24171 * FlashControl::progress: 24172 * @object: A #FlashControl. 24173 * @arg_filename: Argument. 24174 * @arg_progress: Argument. 24175 * 24176 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> is received. 24177 * 24178 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 24179 */ 24180 g_signal_new ("progress", 24181 G_TYPE_FROM_INTERFACE (iface), 24182 G_SIGNAL_RUN_LAST, 24183 G_STRUCT_OFFSET (FlashControlIface, progress), 24184 NULL, 24185 NULL, 24186 g_cclosure_marshal_generic, 24187 G_TYPE_NONE, 24188 2, G_TYPE_STRING, G_TYPE_UCHAR); 24189 24190 /* GObject properties for D-Bus properties: */ 24191 /** 24192 * FlashControl:filename: 24193 * 24194 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>. 24195 * 24196 * 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. 24197 */ 24198 g_object_interface_install_property (iface, 24199 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 24200 /** 24201 * FlashControl:type: 24202 * 24203 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>. 24204 * 24205 * 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. 24206 */ 24207 g_object_interface_install_property (iface, 24208 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 24209 } 24210 24211 /** 24212 * flash_control_get_filename: (skip) 24213 * @object: A #FlashControl. 24214 * 24215 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property. 24216 * 24217 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 24218 * 24219 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_control_dup_filename() if on another thread.</warning> 24220 * 24221 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 24222 */ 24223 const gchar * 24224 flash_control_get_filename (FlashControl *object) 24225 { 24226 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object); 24227 } 24228 24229 /** 24230 * flash_control_dup_filename: (skip) 24231 * @object: A #FlashControl. 24232 * 24233 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property. 24234 * 24235 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 24236 * 24237 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 24238 */ 24239 gchar * 24240 flash_control_dup_filename (FlashControl *object) 24241 { 24242 gchar *value; 24243 g_object_get (G_OBJECT (object), "filename", &value, NULL); 24244 return value; 24245 } 24246 24247 /** 24248 * flash_control_set_filename: (skip) 24249 * @object: A #FlashControl. 24250 * @value: The value to set. 24251 * 24252 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value. 24253 * 24254 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 24255 */ 24256 void 24257 flash_control_set_filename (FlashControl *object, const gchar *value) 24258 { 24259 g_object_set (G_OBJECT (object), "filename", value, NULL); 24260 } 24261 24262 /** 24263 * flash_control_get_type_: (skip) 24264 * @object: A #FlashControl. 24265 * 24266 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property. 24267 * 24268 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 24269 * 24270 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_control_dup_type_() if on another thread.</warning> 24271 * 24272 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 24273 */ 24274 const gchar * 24275 flash_control_get_type_ (FlashControl *object) 24276 { 24277 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object); 24278 } 24279 24280 /** 24281 * flash_control_dup_type_: (skip) 24282 * @object: A #FlashControl. 24283 * 24284 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property. 24285 * 24286 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 24287 * 24288 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 24289 */ 24290 gchar * 24291 flash_control_dup_type_ (FlashControl *object) 24292 { 24293 gchar *value; 24294 g_object_get (G_OBJECT (object), "type", &value, NULL); 24295 return value; 24296 } 24297 24298 /** 24299 * flash_control_set_type_: (skip) 24300 * @object: A #FlashControl. 24301 * @value: The value to set. 24302 * 24303 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value. 24304 * 24305 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 24306 */ 24307 void 24308 flash_control_set_type_ (FlashControl *object, const gchar *value) 24309 { 24310 g_object_set (G_OBJECT (object), "type", value, NULL); 24311 } 24312 24313 /** 24314 * flash_control_emit_done: 24315 * @object: A #FlashControl. 24316 * @arg_filename: Argument to pass with the signal. 24317 * 24318 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal. 24319 */ 24320 void 24321 flash_control_emit_done ( 24322 FlashControl *object, 24323 const gchar *arg_filename) 24324 { 24325 g_signal_emit_by_name (object, "done", arg_filename); 24326 } 24327 24328 /** 24329 * flash_control_emit_error: 24330 * @object: A #FlashControl. 24331 * @arg_filename: Argument to pass with the signal. 24332 * 24333 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal. 24334 */ 24335 void 24336 flash_control_emit_error ( 24337 FlashControl *object, 24338 const gchar *arg_filename) 24339 { 24340 g_signal_emit_by_name (object, "error", arg_filename); 24341 } 24342 24343 /** 24344 * flash_control_emit_progress: 24345 * @object: A #FlashControl. 24346 * @arg_filename: Argument to pass with the signal. 24347 * @arg_progress: Argument to pass with the signal. 24348 * 24349 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal. 24350 */ 24351 void 24352 flash_control_emit_progress ( 24353 FlashControl *object, 24354 const gchar *arg_filename, 24355 guchar arg_progress) 24356 { 24357 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress); 24358 } 24359 24360 /** 24361 * flash_control_call_flash: 24362 * @proxy: A #FlashControlProxy. 24363 * @arg_type: Argument to pass with the method invocation. 24364 * @arg_filename: Argument to pass with the method invocation. 24365 * @cancellable: (allow-none): A #GCancellable or %NULL. 24366 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 24367 * @user_data: User data to pass to @callback. 24368 * 24369 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. 24370 * 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. 24371 * You can then call flash_control_call_flash_finish() to get the result of the operation. 24372 * 24373 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method. 24374 */ 24375 void 24376 flash_control_call_flash ( 24377 FlashControl *proxy, 24378 const gchar *arg_type, 24379 const gchar *arg_filename, 24380 GCancellable *cancellable, 24381 GAsyncReadyCallback callback, 24382 gpointer user_data) 24383 { 24384 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 24385 "flash", 24386 g_variant_new ("(ss)", 24387 arg_type, 24388 arg_filename), 24389 G_DBUS_CALL_FLAGS_NONE, 24390 -1, 24391 cancellable, 24392 callback, 24393 user_data); 24394 } 24395 24396 /** 24397 * flash_control_call_flash_finish: 24398 * @proxy: A #FlashControlProxy. 24399 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash(). 24400 * @error: Return location for error or %NULL. 24401 * 24402 * Finishes an operation started with flash_control_call_flash(). 24403 * 24404 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 24405 */ 24406 gboolean 24407 flash_control_call_flash_finish ( 24408 FlashControl *proxy, 24409 GAsyncResult *res, 24410 GError **error) 24411 { 24412 GVariant *_ret; 24413 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 24414 if (_ret == NULL) 24415 goto _out; 24416 g_variant_get (_ret, 24417 "()"); 24418 g_variant_unref (_ret); 24419 _out: 24420 return _ret != NULL; 24421 } 24422 24423 /** 24424 * flash_control_call_flash_sync: 24425 * @proxy: A #FlashControlProxy. 24426 * @arg_type: Argument to pass with the method invocation. 24427 * @arg_filename: Argument to pass with the method invocation. 24428 * @cancellable: (allow-none): A #GCancellable or %NULL. 24429 * @error: Return location for error or %NULL. 24430 * 24431 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 24432 * 24433 * See flash_control_call_flash() for the asynchronous version of this method. 24434 * 24435 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 24436 */ 24437 gboolean 24438 flash_control_call_flash_sync ( 24439 FlashControl *proxy, 24440 const gchar *arg_type, 24441 const gchar *arg_filename, 24442 GCancellable *cancellable, 24443 GError **error) 24444 { 24445 GVariant *_ret; 24446 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 24447 "flash", 24448 g_variant_new ("(ss)", 24449 arg_type, 24450 arg_filename), 24451 G_DBUS_CALL_FLAGS_NONE, 24452 -1, 24453 cancellable, 24454 error); 24455 if (_ret == NULL) 24456 goto _out; 24457 g_variant_get (_ret, 24458 "()"); 24459 g_variant_unref (_ret); 24460 _out: 24461 return _ret != NULL; 24462 } 24463 24464 /** 24465 * flash_control_complete_flash: 24466 * @object: A #FlashControl. 24467 * @invocation: (transfer full): A #GDBusMethodInvocation. 24468 * 24469 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 24470 * 24471 * This method will free @invocation, you cannot use it afterwards. 24472 */ 24473 void 24474 flash_control_complete_flash ( 24475 FlashControl *object, 24476 GDBusMethodInvocation *invocation) 24477 { 24478 g_dbus_method_invocation_return_value (invocation, 24479 g_variant_new ("()")); 24480 } 24481 24482 /* ------------------------------------------------------------------------ */ 24483 24484 /** 24485 * FlashControlProxy: 24486 * 24487 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API. 24488 */ 24489 24490 /** 24491 * FlashControlProxyClass: 24492 * @parent_class: The parent class. 24493 * 24494 * Class structure for #FlashControlProxy. 24495 */ 24496 24497 struct _FlashControlProxyPrivate 24498 { 24499 GData *qdata; 24500 }; 24501 24502 static void flash_control_proxy_iface_init (FlashControlIface *iface); 24503 24504 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 24505 G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY, 24506 G_ADD_PRIVATE (FlashControlProxy) 24507 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init)); 24508 24509 #else 24510 G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY, 24511 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init)); 24512 24513 #endif 24514 static void 24515 flash_control_proxy_finalize (GObject *object) 24516 { 24517 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); 24518 g_datalist_clear (&proxy->priv->qdata); 24519 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object); 24520 } 24521 24522 static void 24523 flash_control_proxy_get_property (GObject *object, 24524 guint prop_id, 24525 GValue *value, 24526 GParamSpec *pspec G_GNUC_UNUSED) 24527 { 24528 const _ExtendedGDBusPropertyInfo *info; 24529 GVariant *variant; 24530 g_assert (prop_id != 0 && prop_id - 1 < 2); 24531 info = _flash_control_property_info_pointers[prop_id - 1]; 24532 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 24533 if (info->use_gvariant) 24534 { 24535 g_value_set_variant (value, variant); 24536 } 24537 else 24538 { 24539 if (variant != NULL) 24540 g_dbus_gvariant_to_gvalue (variant, value); 24541 } 24542 if (variant != NULL) 24543 g_variant_unref (variant); 24544 } 24545 24546 static void 24547 flash_control_proxy_set_property_cb (GDBusProxy *proxy, 24548 GAsyncResult *res, 24549 gpointer user_data) 24550 { 24551 const _ExtendedGDBusPropertyInfo *info = user_data; 24552 GError *error; 24553 GVariant *_ret; 24554 error = NULL; 24555 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 24556 if (!_ret) 24557 { 24558 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)", 24559 info->parent_struct.name, 24560 error->message, g_quark_to_string (error->domain), error->code); 24561 g_error_free (error); 24562 } 24563 else 24564 { 24565 g_variant_unref (_ret); 24566 } 24567 } 24568 24569 static void 24570 flash_control_proxy_set_property (GObject *object, 24571 guint prop_id, 24572 const GValue *value, 24573 GParamSpec *pspec G_GNUC_UNUSED) 24574 { 24575 const _ExtendedGDBusPropertyInfo *info; 24576 GVariant *variant; 24577 g_assert (prop_id != 0 && prop_id - 1 < 2); 24578 info = _flash_control_property_info_pointers[prop_id - 1]; 24579 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 24580 g_dbus_proxy_call (G_DBUS_PROXY (object), 24581 "org.freedesktop.DBus.Properties.Set", 24582 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant), 24583 G_DBUS_CALL_FLAGS_NONE, 24584 -1, 24585 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 24586 g_variant_unref (variant); 24587 } 24588 24589 static void 24590 flash_control_proxy_g_signal (GDBusProxy *proxy, 24591 const gchar *sender_name G_GNUC_UNUSED, 24592 const gchar *signal_name, 24593 GVariant *parameters) 24594 { 24595 _ExtendedGDBusSignalInfo *info; 24596 GVariantIter iter; 24597 GVariant *child; 24598 GValue *paramv; 24599 guint num_params; 24600 guint n; 24601 guint signal_id; 24602 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name); 24603 if (info == NULL) 24604 return; 24605 num_params = g_variant_n_children (parameters); 24606 paramv = g_new0 (GValue, num_params + 1); 24607 g_value_init (¶mv[0], TYPE_FLASH_CONTROL); 24608 g_value_set_object (¶mv[0], proxy); 24609 g_variant_iter_init (&iter, parameters); 24610 n = 1; 24611 while ((child = g_variant_iter_next_value (&iter)) != NULL) 24612 { 24613 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 24614 if (arg_info->use_gvariant) 24615 { 24616 g_value_init (¶mv[n], G_TYPE_VARIANT); 24617 g_value_set_variant (¶mv[n], child); 24618 n++; 24619 } 24620 else 24621 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 24622 g_variant_unref (child); 24623 } 24624 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL); 24625 g_signal_emitv (paramv, signal_id, 0, NULL); 24626 for (n = 0; n < num_params + 1; n++) 24627 g_value_unset (¶mv[n]); 24628 g_free (paramv); 24629 } 24630 24631 static void 24632 flash_control_proxy_g_properties_changed (GDBusProxy *_proxy, 24633 GVariant *changed_properties, 24634 const gchar *const *invalidated_properties) 24635 { 24636 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy); 24637 guint n; 24638 const gchar *key; 24639 GVariantIter *iter; 24640 _ExtendedGDBusPropertyInfo *info; 24641 g_variant_get (changed_properties, "a{sv}", &iter); 24642 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 24643 { 24644 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key); 24645 g_datalist_remove_data (&proxy->priv->qdata, key); 24646 if (info != NULL) 24647 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 24648 } 24649 g_variant_iter_free (iter); 24650 for (n = 0; invalidated_properties[n] != NULL; n++) 24651 { 24652 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]); 24653 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 24654 if (info != NULL) 24655 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 24656 } 24657 } 24658 24659 static const gchar * 24660 flash_control_proxy_get_filename (FlashControl *object) 24661 { 24662 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); 24663 GVariant *variant; 24664 const gchar *value = NULL; 24665 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename"); 24666 if (variant != NULL) 24667 { 24668 value = g_variant_get_string (variant, NULL); 24669 g_variant_unref (variant); 24670 } 24671 return value; 24672 } 24673 24674 static const gchar * 24675 flash_control_proxy_get_type_ (FlashControl *object) 24676 { 24677 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object); 24678 GVariant *variant; 24679 const gchar *value = NULL; 24680 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type"); 24681 if (variant != NULL) 24682 { 24683 value = g_variant_get_string (variant, NULL); 24684 g_variant_unref (variant); 24685 } 24686 return value; 24687 } 24688 24689 static void 24690 flash_control_proxy_init (FlashControlProxy *proxy) 24691 { 24692 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 24693 proxy->priv = flash_control_proxy_get_instance_private (proxy); 24694 #else 24695 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate); 24696 #endif 24697 24698 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ()); 24699 } 24700 24701 static void 24702 flash_control_proxy_class_init (FlashControlProxyClass *klass) 24703 { 24704 GObjectClass *gobject_class; 24705 GDBusProxyClass *proxy_class; 24706 24707 gobject_class = G_OBJECT_CLASS (klass); 24708 gobject_class->finalize = flash_control_proxy_finalize; 24709 gobject_class->get_property = flash_control_proxy_get_property; 24710 gobject_class->set_property = flash_control_proxy_set_property; 24711 24712 proxy_class = G_DBUS_PROXY_CLASS (klass); 24713 proxy_class->g_signal = flash_control_proxy_g_signal; 24714 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed; 24715 24716 flash_control_override_properties (gobject_class, 1); 24717 24718 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 24719 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate)); 24720 #endif 24721 } 24722 24723 static void 24724 flash_control_proxy_iface_init (FlashControlIface *iface) 24725 { 24726 iface->get_filename = flash_control_proxy_get_filename; 24727 iface->get_type_ = flash_control_proxy_get_type_; 24728 } 24729 24730 /** 24731 * flash_control_proxy_new: 24732 * @connection: A #GDBusConnection. 24733 * @flags: Flags from the #GDBusProxyFlags enumeration. 24734 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 24735 * @object_path: An object path. 24736 * @cancellable: (allow-none): A #GCancellable or %NULL. 24737 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 24738 * @user_data: User data to pass to @callback. 24739 * 24740 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new() for more details. 24741 * 24742 * 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. 24743 * You can then call flash_control_proxy_new_finish() to get the result of the operation. 24744 * 24745 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor. 24746 */ 24747 void 24748 flash_control_proxy_new ( 24749 GDBusConnection *connection, 24750 GDBusProxyFlags flags, 24751 const gchar *name, 24752 const gchar *object_path, 24753 GCancellable *cancellable, 24754 GAsyncReadyCallback callback, 24755 gpointer user_data) 24756 { 24757 g_async_initable_new_async (TYPE_FLASH_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL); 24758 } 24759 24760 /** 24761 * flash_control_proxy_new_finish: 24762 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new(). 24763 * @error: Return location for error or %NULL 24764 * 24765 * Finishes an operation started with flash_control_proxy_new(). 24766 * 24767 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. 24768 */ 24769 FlashControl * 24770 flash_control_proxy_new_finish ( 24771 GAsyncResult *res, 24772 GError **error) 24773 { 24774 GObject *ret; 24775 GObject *source_object; 24776 source_object = g_async_result_get_source_object (res); 24777 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 24778 g_object_unref (source_object); 24779 if (ret != NULL) 24780 return FLASH_CONTROL (ret); 24781 else 24782 return NULL; 24783 } 24784 24785 /** 24786 * flash_control_proxy_new_sync: 24787 * @connection: A #GDBusConnection. 24788 * @flags: Flags from the #GDBusProxyFlags enumeration. 24789 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 24790 * @object_path: An object path. 24791 * @cancellable: (allow-none): A #GCancellable or %NULL. 24792 * @error: Return location for error or %NULL 24793 * 24794 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new_sync() for more details. 24795 * 24796 * The calling thread is blocked until a reply is received. 24797 * 24798 * See flash_control_proxy_new() for the asynchronous version of this constructor. 24799 * 24800 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. 24801 */ 24802 FlashControl * 24803 flash_control_proxy_new_sync ( 24804 GDBusConnection *connection, 24805 GDBusProxyFlags flags, 24806 const gchar *name, 24807 const gchar *object_path, 24808 GCancellable *cancellable, 24809 GError **error) 24810 { 24811 GInitable *ret; 24812 ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL); 24813 if (ret != NULL) 24814 return FLASH_CONTROL (ret); 24815 else 24816 return NULL; 24817 } 24818 24819 24820 /** 24821 * flash_control_proxy_new_for_bus: 24822 * @bus_type: A #GBusType. 24823 * @flags: Flags from the #GDBusProxyFlags enumeration. 24824 * @name: A bus name (well-known or unique). 24825 * @object_path: An object path. 24826 * @cancellable: (allow-none): A #GCancellable or %NULL. 24827 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 24828 * @user_data: User data to pass to @callback. 24829 * 24830 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 24831 * 24832 * 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. 24833 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation. 24834 * 24835 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 24836 */ 24837 void 24838 flash_control_proxy_new_for_bus ( 24839 GBusType bus_type, 24840 GDBusProxyFlags flags, 24841 const gchar *name, 24842 const gchar *object_path, 24843 GCancellable *cancellable, 24844 GAsyncReadyCallback callback, 24845 gpointer user_data) 24846 { 24847 g_async_initable_new_async (TYPE_FLASH_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL); 24848 } 24849 24850 /** 24851 * flash_control_proxy_new_for_bus_finish: 24852 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus(). 24853 * @error: Return location for error or %NULL 24854 * 24855 * Finishes an operation started with flash_control_proxy_new_for_bus(). 24856 * 24857 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. 24858 */ 24859 FlashControl * 24860 flash_control_proxy_new_for_bus_finish ( 24861 GAsyncResult *res, 24862 GError **error) 24863 { 24864 GObject *ret; 24865 GObject *source_object; 24866 source_object = g_async_result_get_source_object (res); 24867 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 24868 g_object_unref (source_object); 24869 if (ret != NULL) 24870 return FLASH_CONTROL (ret); 24871 else 24872 return NULL; 24873 } 24874 24875 /** 24876 * flash_control_proxy_new_for_bus_sync: 24877 * @bus_type: A #GBusType. 24878 * @flags: Flags from the #GDBusProxyFlags enumeration. 24879 * @name: A bus name (well-known or unique). 24880 * @object_path: An object path. 24881 * @cancellable: (allow-none): A #GCancellable or %NULL. 24882 * @error: Return location for error or %NULL 24883 * 24884 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 24885 * 24886 * The calling thread is blocked until a reply is received. 24887 * 24888 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor. 24889 * 24890 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set. 24891 */ 24892 FlashControl * 24893 flash_control_proxy_new_for_bus_sync ( 24894 GBusType bus_type, 24895 GDBusProxyFlags flags, 24896 const gchar *name, 24897 const gchar *object_path, 24898 GCancellable *cancellable, 24899 GError **error) 24900 { 24901 GInitable *ret; 24902 ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL); 24903 if (ret != NULL) 24904 return FLASH_CONTROL (ret); 24905 else 24906 return NULL; 24907 } 24908 24909 24910 /* ------------------------------------------------------------------------ */ 24911 24912 /** 24913 * FlashControlSkeleton: 24914 * 24915 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API. 24916 */ 24917 24918 /** 24919 * FlashControlSkeletonClass: 24920 * @parent_class: The parent class. 24921 * 24922 * Class structure for #FlashControlSkeleton. 24923 */ 24924 24925 struct _FlashControlSkeletonPrivate 24926 { 24927 GValue *properties; 24928 GList *changed_properties; 24929 GSource *changed_properties_idle_source; 24930 GMainContext *context; 24931 GMutex lock; 24932 }; 24933 24934 static void 24935 _flash_control_skeleton_handle_method_call ( 24936 GDBusConnection *connection G_GNUC_UNUSED, 24937 const gchar *sender G_GNUC_UNUSED, 24938 const gchar *object_path G_GNUC_UNUSED, 24939 const gchar *interface_name, 24940 const gchar *method_name, 24941 GVariant *parameters, 24942 GDBusMethodInvocation *invocation, 24943 gpointer user_data) 24944 { 24945 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); 24946 _ExtendedGDBusMethodInfo *info; 24947 GVariantIter iter; 24948 GVariant *child; 24949 GValue *paramv; 24950 guint num_params; 24951 guint num_extra; 24952 guint n; 24953 guint signal_id; 24954 GValue return_value = G_VALUE_INIT; 24955 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 24956 g_assert (info != NULL); 24957 num_params = g_variant_n_children (parameters); 24958 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 24959 n = 0; 24960 g_value_init (¶mv[n], TYPE_FLASH_CONTROL); 24961 g_value_set_object (¶mv[n++], skeleton); 24962 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 24963 g_value_set_object (¶mv[n++], invocation); 24964 if (info->pass_fdlist) 24965 { 24966 #ifdef G_OS_UNIX 24967 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 24968 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 24969 #else 24970 g_assert_not_reached (); 24971 #endif 24972 } 24973 g_variant_iter_init (&iter, parameters); 24974 while ((child = g_variant_iter_next_value (&iter)) != NULL) 24975 { 24976 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 24977 if (arg_info->use_gvariant) 24978 { 24979 g_value_init (¶mv[n], G_TYPE_VARIANT); 24980 g_value_set_variant (¶mv[n], child); 24981 n++; 24982 } 24983 else 24984 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 24985 g_variant_unref (child); 24986 } 24987 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL); 24988 g_value_init (&return_value, G_TYPE_BOOLEAN); 24989 g_signal_emitv (paramv, signal_id, 0, &return_value); 24990 if (!g_value_get_boolean (&return_value)) 24991 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); 24992 g_value_unset (&return_value); 24993 for (n = 0; n < num_params + num_extra; n++) 24994 g_value_unset (¶mv[n]); 24995 g_free (paramv); 24996 } 24997 24998 static GVariant * 24999 _flash_control_skeleton_handle_get_property ( 25000 GDBusConnection *connection G_GNUC_UNUSED, 25001 const gchar *sender G_GNUC_UNUSED, 25002 const gchar *object_path G_GNUC_UNUSED, 25003 const gchar *interface_name G_GNUC_UNUSED, 25004 const gchar *property_name, 25005 GError **error, 25006 gpointer user_data) 25007 { 25008 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); 25009 GValue value = G_VALUE_INIT; 25010 GParamSpec *pspec; 25011 _ExtendedGDBusPropertyInfo *info; 25012 GVariant *ret; 25013 ret = NULL; 25014 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name); 25015 g_assert (info != NULL); 25016 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 25017 if (pspec == NULL) 25018 { 25019 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 25020 } 25021 else 25022 { 25023 g_value_init (&value, pspec->value_type); 25024 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 25025 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 25026 g_value_unset (&value); 25027 } 25028 return ret; 25029 } 25030 25031 static gboolean 25032 _flash_control_skeleton_handle_set_property ( 25033 GDBusConnection *connection G_GNUC_UNUSED, 25034 const gchar *sender G_GNUC_UNUSED, 25035 const gchar *object_path G_GNUC_UNUSED, 25036 const gchar *interface_name G_GNUC_UNUSED, 25037 const gchar *property_name, 25038 GVariant *variant, 25039 GError **error, 25040 gpointer user_data) 25041 { 25042 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); 25043 GValue value = G_VALUE_INIT; 25044 GParamSpec *pspec; 25045 _ExtendedGDBusPropertyInfo *info; 25046 gboolean ret; 25047 ret = FALSE; 25048 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name); 25049 g_assert (info != NULL); 25050 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 25051 if (pspec == NULL) 25052 { 25053 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 25054 } 25055 else 25056 { 25057 if (info->use_gvariant) 25058 g_value_set_variant (&value, variant); 25059 else 25060 g_dbus_gvariant_to_gvalue (variant, &value); 25061 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 25062 g_value_unset (&value); 25063 ret = TRUE; 25064 } 25065 return ret; 25066 } 25067 25068 static const GDBusInterfaceVTable _flash_control_skeleton_vtable = 25069 { 25070 _flash_control_skeleton_handle_method_call, 25071 _flash_control_skeleton_handle_get_property, 25072 _flash_control_skeleton_handle_set_property, 25073 {NULL} 25074 }; 25075 25076 static GDBusInterfaceInfo * 25077 flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 25078 { 25079 return flash_control_interface_info (); 25080 } 25081 25082 static GDBusInterfaceVTable * 25083 flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 25084 { 25085 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable; 25086 } 25087 25088 static GVariant * 25089 flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 25090 { 25091 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton); 25092 25093 GVariantBuilder builder; 25094 guint n; 25095 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 25096 if (_flash_control_interface_info.parent_struct.properties == NULL) 25097 goto out; 25098 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++) 25099 { 25100 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n]; 25101 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 25102 { 25103 GVariant *value; 25104 value = _flash_control_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", info->name, NULL, skeleton); 25105 if (value != NULL) 25106 { 25107 g_variant_take_ref (value); 25108 g_variant_builder_add (&builder, "{sv}", info->name, value); 25109 g_variant_unref (value); 25110 } 25111 } 25112 } 25113 out: 25114 return g_variant_builder_end (&builder); 25115 } 25116 25117 static gboolean _flash_control_emit_changed (gpointer user_data); 25118 25119 static void 25120 flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 25121 { 25122 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton); 25123 gboolean emit_changed = FALSE; 25124 25125 g_mutex_lock (&skeleton->priv->lock); 25126 if (skeleton->priv->changed_properties_idle_source != NULL) 25127 { 25128 g_source_destroy (skeleton->priv->changed_properties_idle_source); 25129 skeleton->priv->changed_properties_idle_source = NULL; 25130 emit_changed = TRUE; 25131 } 25132 g_mutex_unlock (&skeleton->priv->lock); 25133 25134 if (emit_changed) 25135 _flash_control_emit_changed (skeleton); 25136 } 25137 25138 static void 25139 _flash_control_on_signal_done ( 25140 FlashControl *object, 25141 const gchar *arg_filename) 25142 { 25143 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25144 25145 GList *connections, *l; 25146 GVariant *signal_variant; 25147 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 25148 25149 signal_variant = g_variant_ref_sink (g_variant_new ("(s)", 25150 arg_filename)); 25151 for (l = connections; l != NULL; l = l->next) 25152 { 25153 GDBusConnection *connection = l->data; 25154 g_dbus_connection_emit_signal (connection, 25155 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done", 25156 signal_variant, NULL); 25157 } 25158 g_variant_unref (signal_variant); 25159 g_list_free_full (connections, g_object_unref); 25160 } 25161 25162 static void 25163 _flash_control_on_signal_error ( 25164 FlashControl *object, 25165 const gchar *arg_filename) 25166 { 25167 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25168 25169 GList *connections, *l; 25170 GVariant *signal_variant; 25171 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 25172 25173 signal_variant = g_variant_ref_sink (g_variant_new ("(s)", 25174 arg_filename)); 25175 for (l = connections; l != NULL; l = l->next) 25176 { 25177 GDBusConnection *connection = l->data; 25178 g_dbus_connection_emit_signal (connection, 25179 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error", 25180 signal_variant, NULL); 25181 } 25182 g_variant_unref (signal_variant); 25183 g_list_free_full (connections, g_object_unref); 25184 } 25185 25186 static void 25187 _flash_control_on_signal_progress ( 25188 FlashControl *object, 25189 const gchar *arg_filename, 25190 guchar arg_progress) 25191 { 25192 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25193 25194 GList *connections, *l; 25195 GVariant *signal_variant; 25196 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 25197 25198 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)", 25199 arg_filename, 25200 arg_progress)); 25201 for (l = connections; l != NULL; l = l->next) 25202 { 25203 GDBusConnection *connection = l->data; 25204 g_dbus_connection_emit_signal (connection, 25205 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress", 25206 signal_variant, NULL); 25207 } 25208 g_variant_unref (signal_variant); 25209 g_list_free_full (connections, g_object_unref); 25210 } 25211 25212 static void flash_control_skeleton_iface_init (FlashControlIface *iface); 25213 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 25214 G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 25215 G_ADD_PRIVATE (FlashControlSkeleton) 25216 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init)); 25217 25218 #else 25219 G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 25220 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init)); 25221 25222 #endif 25223 static void 25224 flash_control_skeleton_finalize (GObject *object) 25225 { 25226 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25227 guint n; 25228 for (n = 0; n < 2; n++) 25229 g_value_unset (&skeleton->priv->properties[n]); 25230 g_free (skeleton->priv->properties); 25231 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 25232 if (skeleton->priv->changed_properties_idle_source != NULL) 25233 g_source_destroy (skeleton->priv->changed_properties_idle_source); 25234 g_main_context_unref (skeleton->priv->context); 25235 g_mutex_clear (&skeleton->priv->lock); 25236 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object); 25237 } 25238 25239 static void 25240 flash_control_skeleton_get_property (GObject *object, 25241 guint prop_id, 25242 GValue *value, 25243 GParamSpec *pspec G_GNUC_UNUSED) 25244 { 25245 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25246 g_assert (prop_id != 0 && prop_id - 1 < 2); 25247 g_mutex_lock (&skeleton->priv->lock); 25248 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 25249 g_mutex_unlock (&skeleton->priv->lock); 25250 } 25251 25252 static gboolean 25253 _flash_control_emit_changed (gpointer user_data) 25254 { 25255 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data); 25256 GList *l; 25257 GVariantBuilder builder; 25258 GVariantBuilder invalidated_builder; 25259 guint num_changes; 25260 25261 g_mutex_lock (&skeleton->priv->lock); 25262 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 25263 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 25264 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 25265 { 25266 ChangedProperty *cp = l->data; 25267 GVariant *variant; 25268 const GValue *cur_value; 25269 25270 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 25271 if (!_g_value_equal (cur_value, &cp->orig_value)) 25272 { 25273 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 25274 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 25275 g_variant_unref (variant); 25276 num_changes++; 25277 } 25278 } 25279 if (num_changes > 0) 25280 { 25281 GList *connections, *ll; 25282 GVariant *signal_variant; 25283 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl", 25284 &builder, &invalidated_builder)); 25285 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 25286 for (ll = connections; ll != NULL; ll = ll->next) 25287 { 25288 GDBusConnection *connection = ll->data; 25289 25290 g_dbus_connection_emit_signal (connection, 25291 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 25292 "org.freedesktop.DBus.Properties", 25293 "PropertiesChanged", 25294 signal_variant, 25295 NULL); 25296 } 25297 g_variant_unref (signal_variant); 25298 g_list_free_full (connections, g_object_unref); 25299 } 25300 else 25301 { 25302 g_variant_builder_clear (&builder); 25303 g_variant_builder_clear (&invalidated_builder); 25304 } 25305 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 25306 skeleton->priv->changed_properties = NULL; 25307 skeleton->priv->changed_properties_idle_source = NULL; 25308 g_mutex_unlock (&skeleton->priv->lock); 25309 return FALSE; 25310 } 25311 25312 static void 25313 _flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 25314 { 25315 ChangedProperty *cp; 25316 GList *l; 25317 cp = NULL; 25318 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 25319 { 25320 ChangedProperty *i_cp = l->data; 25321 if (i_cp->info == info) 25322 { 25323 cp = i_cp; 25324 break; 25325 } 25326 } 25327 if (cp == NULL) 25328 { 25329 cp = g_new0 (ChangedProperty, 1); 25330 cp->prop_id = prop_id; 25331 cp->info = info; 25332 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 25333 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 25334 g_value_copy (orig_value, &cp->orig_value); 25335 } 25336 } 25337 25338 static void 25339 flash_control_skeleton_notify (GObject *object, 25340 GParamSpec *pspec G_GNUC_UNUSED) 25341 { 25342 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25343 g_mutex_lock (&skeleton->priv->lock); 25344 if (skeleton->priv->changed_properties != NULL && 25345 skeleton->priv->changed_properties_idle_source == NULL) 25346 { 25347 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 25348 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 25349 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 25350 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_control_emit_changed"); 25351 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 25352 g_source_unref (skeleton->priv->changed_properties_idle_source); 25353 } 25354 g_mutex_unlock (&skeleton->priv->lock); 25355 } 25356 25357 static void 25358 flash_control_skeleton_set_property (GObject *object, 25359 guint prop_id, 25360 const GValue *value, 25361 GParamSpec *pspec) 25362 { 25363 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25364 g_assert (prop_id != 0 && prop_id - 1 < 2); 25365 g_mutex_lock (&skeleton->priv->lock); 25366 g_object_freeze_notify (object); 25367 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 25368 { 25369 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 25370 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 25371 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 25372 g_object_notify_by_pspec (object, pspec); 25373 } 25374 g_mutex_unlock (&skeleton->priv->lock); 25375 g_object_thaw_notify (object); 25376 } 25377 25378 static void 25379 flash_control_skeleton_init (FlashControlSkeleton *skeleton) 25380 { 25381 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 25382 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton); 25383 #else 25384 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate); 25385 #endif 25386 25387 g_mutex_init (&skeleton->priv->lock); 25388 skeleton->priv->context = g_main_context_ref_thread_default (); 25389 skeleton->priv->properties = g_new0 (GValue, 2); 25390 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); 25391 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); 25392 } 25393 25394 static const gchar * 25395 flash_control_skeleton_get_filename (FlashControl *object) 25396 { 25397 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25398 const gchar *value; 25399 g_mutex_lock (&skeleton->priv->lock); 25400 value = g_value_get_string (&(skeleton->priv->properties[0])); 25401 g_mutex_unlock (&skeleton->priv->lock); 25402 return value; 25403 } 25404 25405 static const gchar * 25406 flash_control_skeleton_get_type_ (FlashControl *object) 25407 { 25408 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object); 25409 const gchar *value; 25410 g_mutex_lock (&skeleton->priv->lock); 25411 value = g_value_get_string (&(skeleton->priv->properties[1])); 25412 g_mutex_unlock (&skeleton->priv->lock); 25413 return value; 25414 } 25415 25416 static void 25417 flash_control_skeleton_class_init (FlashControlSkeletonClass *klass) 25418 { 25419 GObjectClass *gobject_class; 25420 GDBusInterfaceSkeletonClass *skeleton_class; 25421 25422 gobject_class = G_OBJECT_CLASS (klass); 25423 gobject_class->finalize = flash_control_skeleton_finalize; 25424 gobject_class->get_property = flash_control_skeleton_get_property; 25425 gobject_class->set_property = flash_control_skeleton_set_property; 25426 gobject_class->notify = flash_control_skeleton_notify; 25427 25428 25429 flash_control_override_properties (gobject_class, 1); 25430 25431 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 25432 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info; 25433 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties; 25434 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush; 25435 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable; 25436 25437 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 25438 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate)); 25439 #endif 25440 } 25441 25442 static void 25443 flash_control_skeleton_iface_init (FlashControlIface *iface) 25444 { 25445 iface->done = _flash_control_on_signal_done; 25446 iface->error = _flash_control_on_signal_error; 25447 iface->progress = _flash_control_on_signal_progress; 25448 iface->get_filename = flash_control_skeleton_get_filename; 25449 iface->get_type_ = flash_control_skeleton_get_type_; 25450 } 25451 25452 /** 25453 * flash_control_skeleton_new: 25454 * 25455 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. 25456 * 25457 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object. 25458 */ 25459 FlashControl * 25460 flash_control_skeleton_new (void) 25461 { 25462 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL)); 25463 } 25464 25465 /* ------------------------------------------------------------------------ 25466 * Code for interface org.openbmc.Button 25467 * ------------------------------------------------------------------------ 25468 */ 25469 25470 /** 25471 * SECTION:Button 25472 * @title: Button 25473 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface 25474 * 25475 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface in C. 25476 */ 25477 25478 /* ---- Introspection data for org.openbmc.Button ---- */ 25479 25480 static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state = 25481 { 25482 { 25483 -1, 25484 (gchar *) "state", 25485 (gchar *) "b", 25486 NULL 25487 }, 25488 FALSE 25489 }; 25490 25491 static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] = 25492 { 25493 &_button_method_info_is_on_OUT_ARG_state, 25494 NULL 25495 }; 25496 25497 static const _ExtendedGDBusMethodInfo _button_method_info_is_on = 25498 { 25499 { 25500 -1, 25501 (gchar *) "isOn", 25502 NULL, 25503 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers, 25504 NULL 25505 }, 25506 "handle-is-on", 25507 FALSE 25508 }; 25509 25510 static const _ExtendedGDBusMethodInfo _button_method_info_sim_press = 25511 { 25512 { 25513 -1, 25514 (gchar *) "simPress", 25515 NULL, 25516 NULL, 25517 NULL 25518 }, 25519 "handle-sim-press", 25520 FALSE 25521 }; 25522 25523 static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press = 25524 { 25525 { 25526 -1, 25527 (gchar *) "simLongPress", 25528 NULL, 25529 NULL, 25530 NULL 25531 }, 25532 "handle-sim-long-press", 25533 FALSE 25534 }; 25535 25536 static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] = 25537 { 25538 &_button_method_info_is_on, 25539 &_button_method_info_sim_press, 25540 &_button_method_info_sim_long_press, 25541 NULL 25542 }; 25543 25544 static const _ExtendedGDBusSignalInfo _button_signal_info_released = 25545 { 25546 { 25547 -1, 25548 (gchar *) "Released", 25549 NULL, 25550 NULL 25551 }, 25552 "released" 25553 }; 25554 25555 static const _ExtendedGDBusSignalInfo _button_signal_info_pressed = 25556 { 25557 { 25558 -1, 25559 (gchar *) "Pressed", 25560 NULL, 25561 NULL 25562 }, 25563 "pressed" 25564 }; 25565 25566 static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long = 25567 { 25568 { 25569 -1, 25570 (gchar *) "PressedLong", 25571 NULL, 25572 NULL 25573 }, 25574 "pressed-long" 25575 }; 25576 25577 static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] = 25578 { 25579 &_button_signal_info_released, 25580 &_button_signal_info_pressed, 25581 &_button_signal_info_pressed_long, 25582 NULL 25583 }; 25584 25585 static const _ExtendedGDBusPropertyInfo _button_property_info_state = 25586 { 25587 { 25588 -1, 25589 (gchar *) "state", 25590 (gchar *) "b", 25591 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 25592 NULL 25593 }, 25594 "state", 25595 FALSE 25596 }; 25597 25598 static const _ExtendedGDBusPropertyInfo _button_property_info_timer = 25599 { 25600 { 25601 -1, 25602 (gchar *) "timer", 25603 (gchar *) "t", 25604 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 25605 NULL 25606 }, 25607 "timer", 25608 FALSE 25609 }; 25610 25611 static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] = 25612 { 25613 &_button_property_info_state, 25614 &_button_property_info_timer, 25615 NULL 25616 }; 25617 25618 static const _ExtendedGDBusInterfaceInfo _button_interface_info = 25619 { 25620 { 25621 -1, 25622 (gchar *) "org.openbmc.Button", 25623 (GDBusMethodInfo **) &_button_method_info_pointers, 25624 (GDBusSignalInfo **) &_button_signal_info_pointers, 25625 (GDBusPropertyInfo **) &_button_property_info_pointers, 25626 NULL 25627 }, 25628 "button", 25629 }; 25630 25631 25632 /** 25633 * button_interface_info: 25634 * 25635 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface. 25636 * 25637 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 25638 */ 25639 GDBusInterfaceInfo * 25640 button_interface_info (void) 25641 { 25642 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct; 25643 } 25644 25645 /** 25646 * button_override_properties: 25647 * @klass: The class structure for a #GObject<!-- -->-derived class. 25648 * @property_id_begin: The property id to assign to the first overridden property. 25649 * 25650 * Overrides all #GObject properties in the #Button interface for a concrete class. 25651 * The properties are overridden in the order they are defined. 25652 * 25653 * Returns: The last property id. 25654 */ 25655 guint 25656 button_override_properties (GObjectClass *klass, guint property_id_begin) 25657 { 25658 g_object_class_override_property (klass, property_id_begin++, "state"); 25659 g_object_class_override_property (klass, property_id_begin++, "timer"); 25660 return property_id_begin - 1; 25661 } 25662 25663 25664 25665 /** 25666 * Button: 25667 * 25668 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. 25669 */ 25670 25671 /** 25672 * ButtonIface: 25673 * @parent_iface: The parent interface. 25674 * @handle_is_on: Handler for the #Button::handle-is-on signal. 25675 * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal. 25676 * @handle_sim_press: Handler for the #Button::handle-sim-press signal. 25677 * @get_state: Getter for the #Button:state property. 25678 * @get_timer: Getter for the #Button:timer property. 25679 * @pressed: Handler for the #Button::pressed signal. 25680 * @pressed_long: Handler for the #Button::pressed-long signal. 25681 * @released: Handler for the #Button::released signal. 25682 * 25683 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. 25684 */ 25685 25686 typedef ButtonIface ButtonInterface; 25687 G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT); 25688 25689 static void 25690 button_default_init (ButtonIface *iface) 25691 { 25692 /* GObject signals for incoming D-Bus method calls: */ 25693 /** 25694 * Button::handle-is-on: 25695 * @object: A #Button. 25696 * @invocation: A #GDBusMethodInvocation. 25697 * 25698 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method. 25699 * 25700 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_is_on() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 25701 * 25702 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 25703 */ 25704 g_signal_new ("handle-is-on", 25705 G_TYPE_FROM_INTERFACE (iface), 25706 G_SIGNAL_RUN_LAST, 25707 G_STRUCT_OFFSET (ButtonIface, handle_is_on), 25708 g_signal_accumulator_true_handled, 25709 NULL, 25710 g_cclosure_marshal_generic, 25711 G_TYPE_BOOLEAN, 25712 1, 25713 G_TYPE_DBUS_METHOD_INVOCATION); 25714 25715 /** 25716 * Button::handle-sim-press: 25717 * @object: A #Button. 25718 * @invocation: A #GDBusMethodInvocation. 25719 * 25720 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method. 25721 * 25722 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 25723 * 25724 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 25725 */ 25726 g_signal_new ("handle-sim-press", 25727 G_TYPE_FROM_INTERFACE (iface), 25728 G_SIGNAL_RUN_LAST, 25729 G_STRUCT_OFFSET (ButtonIface, handle_sim_press), 25730 g_signal_accumulator_true_handled, 25731 NULL, 25732 g_cclosure_marshal_generic, 25733 G_TYPE_BOOLEAN, 25734 1, 25735 G_TYPE_DBUS_METHOD_INVOCATION); 25736 25737 /** 25738 * Button::handle-sim-long-press: 25739 * @object: A #Button. 25740 * @invocation: A #GDBusMethodInvocation. 25741 * 25742 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method. 25743 * 25744 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_long_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 25745 * 25746 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 25747 */ 25748 g_signal_new ("handle-sim-long-press", 25749 G_TYPE_FROM_INTERFACE (iface), 25750 G_SIGNAL_RUN_LAST, 25751 G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press), 25752 g_signal_accumulator_true_handled, 25753 NULL, 25754 g_cclosure_marshal_generic, 25755 G_TYPE_BOOLEAN, 25756 1, 25757 G_TYPE_DBUS_METHOD_INVOCATION); 25758 25759 /* GObject signals for received D-Bus signals: */ 25760 /** 25761 * Button::released: 25762 * @object: A #Button. 25763 * 25764 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> is received. 25765 * 25766 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 25767 */ 25768 g_signal_new ("released", 25769 G_TYPE_FROM_INTERFACE (iface), 25770 G_SIGNAL_RUN_LAST, 25771 G_STRUCT_OFFSET (ButtonIface, released), 25772 NULL, 25773 NULL, 25774 g_cclosure_marshal_generic, 25775 G_TYPE_NONE, 25776 0); 25777 25778 /** 25779 * Button::pressed: 25780 * @object: A #Button. 25781 * 25782 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> is received. 25783 * 25784 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 25785 */ 25786 g_signal_new ("pressed", 25787 G_TYPE_FROM_INTERFACE (iface), 25788 G_SIGNAL_RUN_LAST, 25789 G_STRUCT_OFFSET (ButtonIface, pressed), 25790 NULL, 25791 NULL, 25792 g_cclosure_marshal_generic, 25793 G_TYPE_NONE, 25794 0); 25795 25796 /** 25797 * Button::pressed-long: 25798 * @object: A #Button. 25799 * 25800 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> is received. 25801 * 25802 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 25803 */ 25804 g_signal_new ("pressed-long", 25805 G_TYPE_FROM_INTERFACE (iface), 25806 G_SIGNAL_RUN_LAST, 25807 G_STRUCT_OFFSET (ButtonIface, pressed_long), 25808 NULL, 25809 NULL, 25810 g_cclosure_marshal_generic, 25811 G_TYPE_NONE, 25812 0); 25813 25814 /* GObject properties for D-Bus properties: */ 25815 /** 25816 * Button:state: 25817 * 25818 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>. 25819 * 25820 * 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. 25821 */ 25822 g_object_interface_install_property (iface, 25823 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 25824 /** 25825 * Button:timer: 25826 * 25827 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>. 25828 * 25829 * 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. 25830 */ 25831 g_object_interface_install_property (iface, 25832 g_param_spec_uint64 ("timer", "timer", "timer", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 25833 } 25834 25835 /** 25836 * button_get_state: (skip) 25837 * @object: A #Button. 25838 * 25839 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property. 25840 * 25841 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 25842 * 25843 * Returns: The property value. 25844 */ 25845 gboolean 25846 button_get_state (Button *object) 25847 { 25848 return BUTTON_GET_IFACE (object)->get_state (object); 25849 } 25850 25851 /** 25852 * button_set_state: (skip) 25853 * @object: A #Button. 25854 * @value: The value to set. 25855 * 25856 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value. 25857 * 25858 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 25859 */ 25860 void 25861 button_set_state (Button *object, gboolean value) 25862 { 25863 g_object_set (G_OBJECT (object), "state", value, NULL); 25864 } 25865 25866 /** 25867 * button_get_timer: (skip) 25868 * @object: A #Button. 25869 * 25870 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property. 25871 * 25872 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 25873 * 25874 * Returns: The property value. 25875 */ 25876 guint64 25877 button_get_timer (Button *object) 25878 { 25879 return BUTTON_GET_IFACE (object)->get_timer (object); 25880 } 25881 25882 /** 25883 * button_set_timer: (skip) 25884 * @object: A #Button. 25885 * @value: The value to set. 25886 * 25887 * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value. 25888 * 25889 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 25890 */ 25891 void 25892 button_set_timer (Button *object, guint64 value) 25893 { 25894 g_object_set (G_OBJECT (object), "timer", value, NULL); 25895 } 25896 25897 /** 25898 * button_emit_released: 25899 * @object: A #Button. 25900 * 25901 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal. 25902 */ 25903 void 25904 button_emit_released ( 25905 Button *object) 25906 { 25907 g_signal_emit_by_name (object, "released"); 25908 } 25909 25910 /** 25911 * button_emit_pressed: 25912 * @object: A #Button. 25913 * 25914 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal. 25915 */ 25916 void 25917 button_emit_pressed ( 25918 Button *object) 25919 { 25920 g_signal_emit_by_name (object, "pressed"); 25921 } 25922 25923 /** 25924 * button_emit_pressed_long: 25925 * @object: A #Button. 25926 * 25927 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal. 25928 */ 25929 void 25930 button_emit_pressed_long ( 25931 Button *object) 25932 { 25933 g_signal_emit_by_name (object, "pressed-long"); 25934 } 25935 25936 /** 25937 * button_call_is_on: 25938 * @proxy: A #ButtonProxy. 25939 * @cancellable: (allow-none): A #GCancellable or %NULL. 25940 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 25941 * @user_data: User data to pass to @callback. 25942 * 25943 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. 25944 * 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. 25945 * You can then call button_call_is_on_finish() to get the result of the operation. 25946 * 25947 * See button_call_is_on_sync() for the synchronous, blocking version of this method. 25948 */ 25949 void 25950 button_call_is_on ( 25951 Button *proxy, 25952 GCancellable *cancellable, 25953 GAsyncReadyCallback callback, 25954 gpointer user_data) 25955 { 25956 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 25957 "isOn", 25958 g_variant_new ("()"), 25959 G_DBUS_CALL_FLAGS_NONE, 25960 -1, 25961 cancellable, 25962 callback, 25963 user_data); 25964 } 25965 25966 /** 25967 * button_call_is_on_finish: 25968 * @proxy: A #ButtonProxy. 25969 * @out_state: (out): Return location for return parameter or %NULL to ignore. 25970 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on(). 25971 * @error: Return location for error or %NULL. 25972 * 25973 * Finishes an operation started with button_call_is_on(). 25974 * 25975 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 25976 */ 25977 gboolean 25978 button_call_is_on_finish ( 25979 Button *proxy, 25980 gboolean *out_state, 25981 GAsyncResult *res, 25982 GError **error) 25983 { 25984 GVariant *_ret; 25985 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 25986 if (_ret == NULL) 25987 goto _out; 25988 g_variant_get (_ret, 25989 "(b)", 25990 out_state); 25991 g_variant_unref (_ret); 25992 _out: 25993 return _ret != NULL; 25994 } 25995 25996 /** 25997 * button_call_is_on_sync: 25998 * @proxy: A #ButtonProxy. 25999 * @out_state: (out): Return location for return parameter or %NULL to ignore. 26000 * @cancellable: (allow-none): A #GCancellable or %NULL. 26001 * @error: Return location for error or %NULL. 26002 * 26003 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 26004 * 26005 * See button_call_is_on() for the asynchronous version of this method. 26006 * 26007 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 26008 */ 26009 gboolean 26010 button_call_is_on_sync ( 26011 Button *proxy, 26012 gboolean *out_state, 26013 GCancellable *cancellable, 26014 GError **error) 26015 { 26016 GVariant *_ret; 26017 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 26018 "isOn", 26019 g_variant_new ("()"), 26020 G_DBUS_CALL_FLAGS_NONE, 26021 -1, 26022 cancellable, 26023 error); 26024 if (_ret == NULL) 26025 goto _out; 26026 g_variant_get (_ret, 26027 "(b)", 26028 out_state); 26029 g_variant_unref (_ret); 26030 _out: 26031 return _ret != NULL; 26032 } 26033 26034 /** 26035 * button_call_sim_press: 26036 * @proxy: A #ButtonProxy. 26037 * @cancellable: (allow-none): A #GCancellable or %NULL. 26038 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 26039 * @user_data: User data to pass to @callback. 26040 * 26041 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy. 26042 * 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. 26043 * You can then call button_call_sim_press_finish() to get the result of the operation. 26044 * 26045 * See button_call_sim_press_sync() for the synchronous, blocking version of this method. 26046 */ 26047 void 26048 button_call_sim_press ( 26049 Button *proxy, 26050 GCancellable *cancellable, 26051 GAsyncReadyCallback callback, 26052 gpointer user_data) 26053 { 26054 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 26055 "simPress", 26056 g_variant_new ("()"), 26057 G_DBUS_CALL_FLAGS_NONE, 26058 -1, 26059 cancellable, 26060 callback, 26061 user_data); 26062 } 26063 26064 /** 26065 * button_call_sim_press_finish: 26066 * @proxy: A #ButtonProxy. 26067 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press(). 26068 * @error: Return location for error or %NULL. 26069 * 26070 * Finishes an operation started with button_call_sim_press(). 26071 * 26072 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 26073 */ 26074 gboolean 26075 button_call_sim_press_finish ( 26076 Button *proxy, 26077 GAsyncResult *res, 26078 GError **error) 26079 { 26080 GVariant *_ret; 26081 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 26082 if (_ret == NULL) 26083 goto _out; 26084 g_variant_get (_ret, 26085 "()"); 26086 g_variant_unref (_ret); 26087 _out: 26088 return _ret != NULL; 26089 } 26090 26091 /** 26092 * button_call_sim_press_sync: 26093 * @proxy: A #ButtonProxy. 26094 * @cancellable: (allow-none): A #GCancellable or %NULL. 26095 * @error: Return location for error or %NULL. 26096 * 26097 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 26098 * 26099 * See button_call_sim_press() for the asynchronous version of this method. 26100 * 26101 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 26102 */ 26103 gboolean 26104 button_call_sim_press_sync ( 26105 Button *proxy, 26106 GCancellable *cancellable, 26107 GError **error) 26108 { 26109 GVariant *_ret; 26110 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 26111 "simPress", 26112 g_variant_new ("()"), 26113 G_DBUS_CALL_FLAGS_NONE, 26114 -1, 26115 cancellable, 26116 error); 26117 if (_ret == NULL) 26118 goto _out; 26119 g_variant_get (_ret, 26120 "()"); 26121 g_variant_unref (_ret); 26122 _out: 26123 return _ret != NULL; 26124 } 26125 26126 /** 26127 * button_call_sim_long_press: 26128 * @proxy: A #ButtonProxy. 26129 * @cancellable: (allow-none): A #GCancellable or %NULL. 26130 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 26131 * @user_data: User data to pass to @callback. 26132 * 26133 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy. 26134 * 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. 26135 * You can then call button_call_sim_long_press_finish() to get the result of the operation. 26136 * 26137 * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method. 26138 */ 26139 void 26140 button_call_sim_long_press ( 26141 Button *proxy, 26142 GCancellable *cancellable, 26143 GAsyncReadyCallback callback, 26144 gpointer user_data) 26145 { 26146 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 26147 "simLongPress", 26148 g_variant_new ("()"), 26149 G_DBUS_CALL_FLAGS_NONE, 26150 -1, 26151 cancellable, 26152 callback, 26153 user_data); 26154 } 26155 26156 /** 26157 * button_call_sim_long_press_finish: 26158 * @proxy: A #ButtonProxy. 26159 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press(). 26160 * @error: Return location for error or %NULL. 26161 * 26162 * Finishes an operation started with button_call_sim_long_press(). 26163 * 26164 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 26165 */ 26166 gboolean 26167 button_call_sim_long_press_finish ( 26168 Button *proxy, 26169 GAsyncResult *res, 26170 GError **error) 26171 { 26172 GVariant *_ret; 26173 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 26174 if (_ret == NULL) 26175 goto _out; 26176 g_variant_get (_ret, 26177 "()"); 26178 g_variant_unref (_ret); 26179 _out: 26180 return _ret != NULL; 26181 } 26182 26183 /** 26184 * button_call_sim_long_press_sync: 26185 * @proxy: A #ButtonProxy. 26186 * @cancellable: (allow-none): A #GCancellable or %NULL. 26187 * @error: Return location for error or %NULL. 26188 * 26189 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 26190 * 26191 * See button_call_sim_long_press() for the asynchronous version of this method. 26192 * 26193 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 26194 */ 26195 gboolean 26196 button_call_sim_long_press_sync ( 26197 Button *proxy, 26198 GCancellable *cancellable, 26199 GError **error) 26200 { 26201 GVariant *_ret; 26202 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 26203 "simLongPress", 26204 g_variant_new ("()"), 26205 G_DBUS_CALL_FLAGS_NONE, 26206 -1, 26207 cancellable, 26208 error); 26209 if (_ret == NULL) 26210 goto _out; 26211 g_variant_get (_ret, 26212 "()"); 26213 g_variant_unref (_ret); 26214 _out: 26215 return _ret != NULL; 26216 } 26217 26218 /** 26219 * button_complete_is_on: 26220 * @object: A #Button. 26221 * @invocation: (transfer full): A #GDBusMethodInvocation. 26222 * @state: Parameter to return. 26223 * 26224 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 26225 * 26226 * This method will free @invocation, you cannot use it afterwards. 26227 */ 26228 void 26229 button_complete_is_on ( 26230 Button *object, 26231 GDBusMethodInvocation *invocation, 26232 gboolean state) 26233 { 26234 g_dbus_method_invocation_return_value (invocation, 26235 g_variant_new ("(b)", 26236 state)); 26237 } 26238 26239 /** 26240 * button_complete_sim_press: 26241 * @object: A #Button. 26242 * @invocation: (transfer full): A #GDBusMethodInvocation. 26243 * 26244 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</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. 26245 * 26246 * This method will free @invocation, you cannot use it afterwards. 26247 */ 26248 void 26249 button_complete_sim_press ( 26250 Button *object, 26251 GDBusMethodInvocation *invocation) 26252 { 26253 g_dbus_method_invocation_return_value (invocation, 26254 g_variant_new ("()")); 26255 } 26256 26257 /** 26258 * button_complete_sim_long_press: 26259 * @object: A #Button. 26260 * @invocation: (transfer full): A #GDBusMethodInvocation. 26261 * 26262 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</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. 26263 * 26264 * This method will free @invocation, you cannot use it afterwards. 26265 */ 26266 void 26267 button_complete_sim_long_press ( 26268 Button *object, 26269 GDBusMethodInvocation *invocation) 26270 { 26271 g_dbus_method_invocation_return_value (invocation, 26272 g_variant_new ("()")); 26273 } 26274 26275 /* ------------------------------------------------------------------------ */ 26276 26277 /** 26278 * ButtonProxy: 26279 * 26280 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API. 26281 */ 26282 26283 /** 26284 * ButtonProxyClass: 26285 * @parent_class: The parent class. 26286 * 26287 * Class structure for #ButtonProxy. 26288 */ 26289 26290 struct _ButtonProxyPrivate 26291 { 26292 GData *qdata; 26293 }; 26294 26295 static void button_proxy_iface_init (ButtonIface *iface); 26296 26297 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 26298 G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, 26299 G_ADD_PRIVATE (ButtonProxy) 26300 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); 26301 26302 #else 26303 G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY, 26304 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init)); 26305 26306 #endif 26307 static void 26308 button_proxy_finalize (GObject *object) 26309 { 26310 ButtonProxy *proxy = BUTTON_PROXY (object); 26311 g_datalist_clear (&proxy->priv->qdata); 26312 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object); 26313 } 26314 26315 static void 26316 button_proxy_get_property (GObject *object, 26317 guint prop_id, 26318 GValue *value, 26319 GParamSpec *pspec G_GNUC_UNUSED) 26320 { 26321 const _ExtendedGDBusPropertyInfo *info; 26322 GVariant *variant; 26323 g_assert (prop_id != 0 && prop_id - 1 < 2); 26324 info = _button_property_info_pointers[prop_id - 1]; 26325 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 26326 if (info->use_gvariant) 26327 { 26328 g_value_set_variant (value, variant); 26329 } 26330 else 26331 { 26332 if (variant != NULL) 26333 g_dbus_gvariant_to_gvalue (variant, value); 26334 } 26335 if (variant != NULL) 26336 g_variant_unref (variant); 26337 } 26338 26339 static void 26340 button_proxy_set_property_cb (GDBusProxy *proxy, 26341 GAsyncResult *res, 26342 gpointer user_data) 26343 { 26344 const _ExtendedGDBusPropertyInfo *info = user_data; 26345 GError *error; 26346 GVariant *_ret; 26347 error = NULL; 26348 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 26349 if (!_ret) 26350 { 26351 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)", 26352 info->parent_struct.name, 26353 error->message, g_quark_to_string (error->domain), error->code); 26354 g_error_free (error); 26355 } 26356 else 26357 { 26358 g_variant_unref (_ret); 26359 } 26360 } 26361 26362 static void 26363 button_proxy_set_property (GObject *object, 26364 guint prop_id, 26365 const GValue *value, 26366 GParamSpec *pspec G_GNUC_UNUSED) 26367 { 26368 const _ExtendedGDBusPropertyInfo *info; 26369 GVariant *variant; 26370 g_assert (prop_id != 0 && prop_id - 1 < 2); 26371 info = _button_property_info_pointers[prop_id - 1]; 26372 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 26373 g_dbus_proxy_call (G_DBUS_PROXY (object), 26374 "org.freedesktop.DBus.Properties.Set", 26375 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant), 26376 G_DBUS_CALL_FLAGS_NONE, 26377 -1, 26378 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 26379 g_variant_unref (variant); 26380 } 26381 26382 static void 26383 button_proxy_g_signal (GDBusProxy *proxy, 26384 const gchar *sender_name G_GNUC_UNUSED, 26385 const gchar *signal_name, 26386 GVariant *parameters) 26387 { 26388 _ExtendedGDBusSignalInfo *info; 26389 GVariantIter iter; 26390 GVariant *child; 26391 GValue *paramv; 26392 guint num_params; 26393 guint n; 26394 guint signal_id; 26395 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name); 26396 if (info == NULL) 26397 return; 26398 num_params = g_variant_n_children (parameters); 26399 paramv = g_new0 (GValue, num_params + 1); 26400 g_value_init (¶mv[0], TYPE_BUTTON); 26401 g_value_set_object (¶mv[0], proxy); 26402 g_variant_iter_init (&iter, parameters); 26403 n = 1; 26404 while ((child = g_variant_iter_next_value (&iter)) != NULL) 26405 { 26406 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 26407 if (arg_info->use_gvariant) 26408 { 26409 g_value_init (¶mv[n], G_TYPE_VARIANT); 26410 g_value_set_variant (¶mv[n], child); 26411 n++; 26412 } 26413 else 26414 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 26415 g_variant_unref (child); 26416 } 26417 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); 26418 g_signal_emitv (paramv, signal_id, 0, NULL); 26419 for (n = 0; n < num_params + 1; n++) 26420 g_value_unset (¶mv[n]); 26421 g_free (paramv); 26422 } 26423 26424 static void 26425 button_proxy_g_properties_changed (GDBusProxy *_proxy, 26426 GVariant *changed_properties, 26427 const gchar *const *invalidated_properties) 26428 { 26429 ButtonProxy *proxy = BUTTON_PROXY (_proxy); 26430 guint n; 26431 const gchar *key; 26432 GVariantIter *iter; 26433 _ExtendedGDBusPropertyInfo *info; 26434 g_variant_get (changed_properties, "a{sv}", &iter); 26435 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 26436 { 26437 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key); 26438 g_datalist_remove_data (&proxy->priv->qdata, key); 26439 if (info != NULL) 26440 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 26441 } 26442 g_variant_iter_free (iter); 26443 for (n = 0; invalidated_properties[n] != NULL; n++) 26444 { 26445 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]); 26446 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 26447 if (info != NULL) 26448 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 26449 } 26450 } 26451 26452 static gboolean 26453 button_proxy_get_state (Button *object) 26454 { 26455 ButtonProxy *proxy = BUTTON_PROXY (object); 26456 GVariant *variant; 26457 gboolean value = 0; 26458 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); 26459 if (variant != NULL) 26460 { 26461 value = g_variant_get_boolean (variant); 26462 g_variant_unref (variant); 26463 } 26464 return value; 26465 } 26466 26467 static guint64 26468 button_proxy_get_timer (Button *object) 26469 { 26470 ButtonProxy *proxy = BUTTON_PROXY (object); 26471 GVariant *variant; 26472 guint64 value = 0; 26473 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer"); 26474 if (variant != NULL) 26475 { 26476 value = g_variant_get_uint64 (variant); 26477 g_variant_unref (variant); 26478 } 26479 return value; 26480 } 26481 26482 static void 26483 button_proxy_init (ButtonProxy *proxy) 26484 { 26485 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 26486 proxy->priv = button_proxy_get_instance_private (proxy); 26487 #else 26488 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate); 26489 #endif 26490 26491 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ()); 26492 } 26493 26494 static void 26495 button_proxy_class_init (ButtonProxyClass *klass) 26496 { 26497 GObjectClass *gobject_class; 26498 GDBusProxyClass *proxy_class; 26499 26500 gobject_class = G_OBJECT_CLASS (klass); 26501 gobject_class->finalize = button_proxy_finalize; 26502 gobject_class->get_property = button_proxy_get_property; 26503 gobject_class->set_property = button_proxy_set_property; 26504 26505 proxy_class = G_DBUS_PROXY_CLASS (klass); 26506 proxy_class->g_signal = button_proxy_g_signal; 26507 proxy_class->g_properties_changed = button_proxy_g_properties_changed; 26508 26509 button_override_properties (gobject_class, 1); 26510 26511 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 26512 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate)); 26513 #endif 26514 } 26515 26516 static void 26517 button_proxy_iface_init (ButtonIface *iface) 26518 { 26519 iface->get_state = button_proxy_get_state; 26520 iface->get_timer = button_proxy_get_timer; 26521 } 26522 26523 /** 26524 * button_proxy_new: 26525 * @connection: A #GDBusConnection. 26526 * @flags: Flags from the #GDBusProxyFlags enumeration. 26527 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 26528 * @object_path: An object path. 26529 * @cancellable: (allow-none): A #GCancellable or %NULL. 26530 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 26531 * @user_data: User data to pass to @callback. 26532 * 26533 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new() for more details. 26534 * 26535 * 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. 26536 * You can then call button_proxy_new_finish() to get the result of the operation. 26537 * 26538 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor. 26539 */ 26540 void 26541 button_proxy_new ( 26542 GDBusConnection *connection, 26543 GDBusProxyFlags flags, 26544 const gchar *name, 26545 const gchar *object_path, 26546 GCancellable *cancellable, 26547 GAsyncReadyCallback callback, 26548 gpointer user_data) 26549 { 26550 g_async_initable_new_async (TYPE_BUTTON_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL); 26551 } 26552 26553 /** 26554 * button_proxy_new_finish: 26555 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new(). 26556 * @error: Return location for error or %NULL 26557 * 26558 * Finishes an operation started with button_proxy_new(). 26559 * 26560 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. 26561 */ 26562 Button * 26563 button_proxy_new_finish ( 26564 GAsyncResult *res, 26565 GError **error) 26566 { 26567 GObject *ret; 26568 GObject *source_object; 26569 source_object = g_async_result_get_source_object (res); 26570 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 26571 g_object_unref (source_object); 26572 if (ret != NULL) 26573 return BUTTON (ret); 26574 else 26575 return NULL; 26576 } 26577 26578 /** 26579 * button_proxy_new_sync: 26580 * @connection: A #GDBusConnection. 26581 * @flags: Flags from the #GDBusProxyFlags enumeration. 26582 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 26583 * @object_path: An object path. 26584 * @cancellable: (allow-none): A #GCancellable or %NULL. 26585 * @error: Return location for error or %NULL 26586 * 26587 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new_sync() for more details. 26588 * 26589 * The calling thread is blocked until a reply is received. 26590 * 26591 * See button_proxy_new() for the asynchronous version of this constructor. 26592 * 26593 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. 26594 */ 26595 Button * 26596 button_proxy_new_sync ( 26597 GDBusConnection *connection, 26598 GDBusProxyFlags flags, 26599 const gchar *name, 26600 const gchar *object_path, 26601 GCancellable *cancellable, 26602 GError **error) 26603 { 26604 GInitable *ret; 26605 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL); 26606 if (ret != NULL) 26607 return BUTTON (ret); 26608 else 26609 return NULL; 26610 } 26611 26612 26613 /** 26614 * button_proxy_new_for_bus: 26615 * @bus_type: A #GBusType. 26616 * @flags: Flags from the #GDBusProxyFlags enumeration. 26617 * @name: A bus name (well-known or unique). 26618 * @object_path: An object path. 26619 * @cancellable: (allow-none): A #GCancellable or %NULL. 26620 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 26621 * @user_data: User data to pass to @callback. 26622 * 26623 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 26624 * 26625 * 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. 26626 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation. 26627 * 26628 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 26629 */ 26630 void 26631 button_proxy_new_for_bus ( 26632 GBusType bus_type, 26633 GDBusProxyFlags flags, 26634 const gchar *name, 26635 const gchar *object_path, 26636 GCancellable *cancellable, 26637 GAsyncReadyCallback callback, 26638 gpointer user_data) 26639 { 26640 g_async_initable_new_async (TYPE_BUTTON_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL); 26641 } 26642 26643 /** 26644 * button_proxy_new_for_bus_finish: 26645 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus(). 26646 * @error: Return location for error or %NULL 26647 * 26648 * Finishes an operation started with button_proxy_new_for_bus(). 26649 * 26650 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. 26651 */ 26652 Button * 26653 button_proxy_new_for_bus_finish ( 26654 GAsyncResult *res, 26655 GError **error) 26656 { 26657 GObject *ret; 26658 GObject *source_object; 26659 source_object = g_async_result_get_source_object (res); 26660 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 26661 g_object_unref (source_object); 26662 if (ret != NULL) 26663 return BUTTON (ret); 26664 else 26665 return NULL; 26666 } 26667 26668 /** 26669 * button_proxy_new_for_bus_sync: 26670 * @bus_type: A #GBusType. 26671 * @flags: Flags from the #GDBusProxyFlags enumeration. 26672 * @name: A bus name (well-known or unique). 26673 * @object_path: An object path. 26674 * @cancellable: (allow-none): A #GCancellable or %NULL. 26675 * @error: Return location for error or %NULL 26676 * 26677 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 26678 * 26679 * The calling thread is blocked until a reply is received. 26680 * 26681 * See button_proxy_new_for_bus() for the asynchronous version of this constructor. 26682 * 26683 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set. 26684 */ 26685 Button * 26686 button_proxy_new_for_bus_sync ( 26687 GBusType bus_type, 26688 GDBusProxyFlags flags, 26689 const gchar *name, 26690 const gchar *object_path, 26691 GCancellable *cancellable, 26692 GError **error) 26693 { 26694 GInitable *ret; 26695 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL); 26696 if (ret != NULL) 26697 return BUTTON (ret); 26698 else 26699 return NULL; 26700 } 26701 26702 26703 /* ------------------------------------------------------------------------ */ 26704 26705 /** 26706 * ButtonSkeleton: 26707 * 26708 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API. 26709 */ 26710 26711 /** 26712 * ButtonSkeletonClass: 26713 * @parent_class: The parent class. 26714 * 26715 * Class structure for #ButtonSkeleton. 26716 */ 26717 26718 struct _ButtonSkeletonPrivate 26719 { 26720 GValue *properties; 26721 GList *changed_properties; 26722 GSource *changed_properties_idle_source; 26723 GMainContext *context; 26724 GMutex lock; 26725 }; 26726 26727 static void 26728 _button_skeleton_handle_method_call ( 26729 GDBusConnection *connection G_GNUC_UNUSED, 26730 const gchar *sender G_GNUC_UNUSED, 26731 const gchar *object_path G_GNUC_UNUSED, 26732 const gchar *interface_name, 26733 const gchar *method_name, 26734 GVariant *parameters, 26735 GDBusMethodInvocation *invocation, 26736 gpointer user_data) 26737 { 26738 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); 26739 _ExtendedGDBusMethodInfo *info; 26740 GVariantIter iter; 26741 GVariant *child; 26742 GValue *paramv; 26743 guint num_params; 26744 guint num_extra; 26745 guint n; 26746 guint signal_id; 26747 GValue return_value = G_VALUE_INIT; 26748 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 26749 g_assert (info != NULL); 26750 num_params = g_variant_n_children (parameters); 26751 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 26752 n = 0; 26753 g_value_init (¶mv[n], TYPE_BUTTON); 26754 g_value_set_object (¶mv[n++], skeleton); 26755 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 26756 g_value_set_object (¶mv[n++], invocation); 26757 if (info->pass_fdlist) 26758 { 26759 #ifdef G_OS_UNIX 26760 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 26761 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 26762 #else 26763 g_assert_not_reached (); 26764 #endif 26765 } 26766 g_variant_iter_init (&iter, parameters); 26767 while ((child = g_variant_iter_next_value (&iter)) != NULL) 26768 { 26769 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 26770 if (arg_info->use_gvariant) 26771 { 26772 g_value_init (¶mv[n], G_TYPE_VARIANT); 26773 g_value_set_variant (¶mv[n], child); 26774 n++; 26775 } 26776 else 26777 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 26778 g_variant_unref (child); 26779 } 26780 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON); 26781 g_value_init (&return_value, G_TYPE_BOOLEAN); 26782 g_signal_emitv (paramv, signal_id, 0, &return_value); 26783 if (!g_value_get_boolean (&return_value)) 26784 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); 26785 g_value_unset (&return_value); 26786 for (n = 0; n < num_params + num_extra; n++) 26787 g_value_unset (¶mv[n]); 26788 g_free (paramv); 26789 } 26790 26791 static GVariant * 26792 _button_skeleton_handle_get_property ( 26793 GDBusConnection *connection G_GNUC_UNUSED, 26794 const gchar *sender G_GNUC_UNUSED, 26795 const gchar *object_path G_GNUC_UNUSED, 26796 const gchar *interface_name G_GNUC_UNUSED, 26797 const gchar *property_name, 26798 GError **error, 26799 gpointer user_data) 26800 { 26801 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); 26802 GValue value = G_VALUE_INIT; 26803 GParamSpec *pspec; 26804 _ExtendedGDBusPropertyInfo *info; 26805 GVariant *ret; 26806 ret = NULL; 26807 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); 26808 g_assert (info != NULL); 26809 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 26810 if (pspec == NULL) 26811 { 26812 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 26813 } 26814 else 26815 { 26816 g_value_init (&value, pspec->value_type); 26817 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 26818 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 26819 g_value_unset (&value); 26820 } 26821 return ret; 26822 } 26823 26824 static gboolean 26825 _button_skeleton_handle_set_property ( 26826 GDBusConnection *connection G_GNUC_UNUSED, 26827 const gchar *sender G_GNUC_UNUSED, 26828 const gchar *object_path G_GNUC_UNUSED, 26829 const gchar *interface_name G_GNUC_UNUSED, 26830 const gchar *property_name, 26831 GVariant *variant, 26832 GError **error, 26833 gpointer user_data) 26834 { 26835 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); 26836 GValue value = G_VALUE_INIT; 26837 GParamSpec *pspec; 26838 _ExtendedGDBusPropertyInfo *info; 26839 gboolean ret; 26840 ret = FALSE; 26841 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name); 26842 g_assert (info != NULL); 26843 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 26844 if (pspec == NULL) 26845 { 26846 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 26847 } 26848 else 26849 { 26850 if (info->use_gvariant) 26851 g_value_set_variant (&value, variant); 26852 else 26853 g_dbus_gvariant_to_gvalue (variant, &value); 26854 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 26855 g_value_unset (&value); 26856 ret = TRUE; 26857 } 26858 return ret; 26859 } 26860 26861 static const GDBusInterfaceVTable _button_skeleton_vtable = 26862 { 26863 _button_skeleton_handle_method_call, 26864 _button_skeleton_handle_get_property, 26865 _button_skeleton_handle_set_property, 26866 {NULL} 26867 }; 26868 26869 static GDBusInterfaceInfo * 26870 button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 26871 { 26872 return button_interface_info (); 26873 } 26874 26875 static GDBusInterfaceVTable * 26876 button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 26877 { 26878 return (GDBusInterfaceVTable *) &_button_skeleton_vtable; 26879 } 26880 26881 static GVariant * 26882 button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 26883 { 26884 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); 26885 26886 GVariantBuilder builder; 26887 guint n; 26888 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 26889 if (_button_interface_info.parent_struct.properties == NULL) 26890 goto out; 26891 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++) 26892 { 26893 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n]; 26894 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 26895 { 26896 GVariant *value; 26897 value = _button_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", info->name, NULL, skeleton); 26898 if (value != NULL) 26899 { 26900 g_variant_take_ref (value); 26901 g_variant_builder_add (&builder, "{sv}", info->name, value); 26902 g_variant_unref (value); 26903 } 26904 } 26905 } 26906 out: 26907 return g_variant_builder_end (&builder); 26908 } 26909 26910 static gboolean _button_emit_changed (gpointer user_data); 26911 26912 static void 26913 button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 26914 { 26915 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton); 26916 gboolean emit_changed = FALSE; 26917 26918 g_mutex_lock (&skeleton->priv->lock); 26919 if (skeleton->priv->changed_properties_idle_source != NULL) 26920 { 26921 g_source_destroy (skeleton->priv->changed_properties_idle_source); 26922 skeleton->priv->changed_properties_idle_source = NULL; 26923 emit_changed = TRUE; 26924 } 26925 g_mutex_unlock (&skeleton->priv->lock); 26926 26927 if (emit_changed) 26928 _button_emit_changed (skeleton); 26929 } 26930 26931 static void 26932 _button_on_signal_released ( 26933 Button *object) 26934 { 26935 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 26936 26937 GList *connections, *l; 26938 GVariant *signal_variant; 26939 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 26940 26941 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 26942 for (l = connections; l != NULL; l = l->next) 26943 { 26944 GDBusConnection *connection = l->data; 26945 g_dbus_connection_emit_signal (connection, 26946 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released", 26947 signal_variant, NULL); 26948 } 26949 g_variant_unref (signal_variant); 26950 g_list_free_full (connections, g_object_unref); 26951 } 26952 26953 static void 26954 _button_on_signal_pressed ( 26955 Button *object) 26956 { 26957 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 26958 26959 GList *connections, *l; 26960 GVariant *signal_variant; 26961 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 26962 26963 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 26964 for (l = connections; l != NULL; l = l->next) 26965 { 26966 GDBusConnection *connection = l->data; 26967 g_dbus_connection_emit_signal (connection, 26968 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed", 26969 signal_variant, NULL); 26970 } 26971 g_variant_unref (signal_variant); 26972 g_list_free_full (connections, g_object_unref); 26973 } 26974 26975 static void 26976 _button_on_signal_pressed_long ( 26977 Button *object) 26978 { 26979 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 26980 26981 GList *connections, *l; 26982 GVariant *signal_variant; 26983 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 26984 26985 signal_variant = g_variant_ref_sink (g_variant_new ("()")); 26986 for (l = connections; l != NULL; l = l->next) 26987 { 26988 GDBusConnection *connection = l->data; 26989 g_dbus_connection_emit_signal (connection, 26990 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong", 26991 signal_variant, NULL); 26992 } 26993 g_variant_unref (signal_variant); 26994 g_list_free_full (connections, g_object_unref); 26995 } 26996 26997 static void button_skeleton_iface_init (ButtonIface *iface); 26998 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 26999 G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 27000 G_ADD_PRIVATE (ButtonSkeleton) 27001 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); 27002 27003 #else 27004 G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 27005 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init)); 27006 27007 #endif 27008 static void 27009 button_skeleton_finalize (GObject *object) 27010 { 27011 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 27012 guint n; 27013 for (n = 0; n < 2; n++) 27014 g_value_unset (&skeleton->priv->properties[n]); 27015 g_free (skeleton->priv->properties); 27016 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 27017 if (skeleton->priv->changed_properties_idle_source != NULL) 27018 g_source_destroy (skeleton->priv->changed_properties_idle_source); 27019 g_main_context_unref (skeleton->priv->context); 27020 g_mutex_clear (&skeleton->priv->lock); 27021 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object); 27022 } 27023 27024 static void 27025 button_skeleton_get_property (GObject *object, 27026 guint prop_id, 27027 GValue *value, 27028 GParamSpec *pspec G_GNUC_UNUSED) 27029 { 27030 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 27031 g_assert (prop_id != 0 && prop_id - 1 < 2); 27032 g_mutex_lock (&skeleton->priv->lock); 27033 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 27034 g_mutex_unlock (&skeleton->priv->lock); 27035 } 27036 27037 static gboolean 27038 _button_emit_changed (gpointer user_data) 27039 { 27040 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data); 27041 GList *l; 27042 GVariantBuilder builder; 27043 GVariantBuilder invalidated_builder; 27044 guint num_changes; 27045 27046 g_mutex_lock (&skeleton->priv->lock); 27047 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 27048 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 27049 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 27050 { 27051 ChangedProperty *cp = l->data; 27052 GVariant *variant; 27053 const GValue *cur_value; 27054 27055 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 27056 if (!_g_value_equal (cur_value, &cp->orig_value)) 27057 { 27058 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 27059 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 27060 g_variant_unref (variant); 27061 num_changes++; 27062 } 27063 } 27064 if (num_changes > 0) 27065 { 27066 GList *connections, *ll; 27067 GVariant *signal_variant; 27068 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button", 27069 &builder, &invalidated_builder)); 27070 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 27071 for (ll = connections; ll != NULL; ll = ll->next) 27072 { 27073 GDBusConnection *connection = ll->data; 27074 27075 g_dbus_connection_emit_signal (connection, 27076 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 27077 "org.freedesktop.DBus.Properties", 27078 "PropertiesChanged", 27079 signal_variant, 27080 NULL); 27081 } 27082 g_variant_unref (signal_variant); 27083 g_list_free_full (connections, g_object_unref); 27084 } 27085 else 27086 { 27087 g_variant_builder_clear (&builder); 27088 g_variant_builder_clear (&invalidated_builder); 27089 } 27090 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 27091 skeleton->priv->changed_properties = NULL; 27092 skeleton->priv->changed_properties_idle_source = NULL; 27093 g_mutex_unlock (&skeleton->priv->lock); 27094 return FALSE; 27095 } 27096 27097 static void 27098 _button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 27099 { 27100 ChangedProperty *cp; 27101 GList *l; 27102 cp = NULL; 27103 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 27104 { 27105 ChangedProperty *i_cp = l->data; 27106 if (i_cp->info == info) 27107 { 27108 cp = i_cp; 27109 break; 27110 } 27111 } 27112 if (cp == NULL) 27113 { 27114 cp = g_new0 (ChangedProperty, 1); 27115 cp->prop_id = prop_id; 27116 cp->info = info; 27117 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 27118 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 27119 g_value_copy (orig_value, &cp->orig_value); 27120 } 27121 } 27122 27123 static void 27124 button_skeleton_notify (GObject *object, 27125 GParamSpec *pspec G_GNUC_UNUSED) 27126 { 27127 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 27128 g_mutex_lock (&skeleton->priv->lock); 27129 if (skeleton->priv->changed_properties != NULL && 27130 skeleton->priv->changed_properties_idle_source == NULL) 27131 { 27132 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 27133 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 27134 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 27135 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _button_emit_changed"); 27136 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 27137 g_source_unref (skeleton->priv->changed_properties_idle_source); 27138 } 27139 g_mutex_unlock (&skeleton->priv->lock); 27140 } 27141 27142 static void 27143 button_skeleton_set_property (GObject *object, 27144 guint prop_id, 27145 const GValue *value, 27146 GParamSpec *pspec) 27147 { 27148 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 27149 g_assert (prop_id != 0 && prop_id - 1 < 2); 27150 g_mutex_lock (&skeleton->priv->lock); 27151 g_object_freeze_notify (object); 27152 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 27153 { 27154 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 27155 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 27156 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 27157 g_object_notify_by_pspec (object, pspec); 27158 } 27159 g_mutex_unlock (&skeleton->priv->lock); 27160 g_object_thaw_notify (object); 27161 } 27162 27163 static void 27164 button_skeleton_init (ButtonSkeleton *skeleton) 27165 { 27166 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 27167 skeleton->priv = button_skeleton_get_instance_private (skeleton); 27168 #else 27169 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate); 27170 #endif 27171 27172 g_mutex_init (&skeleton->priv->lock); 27173 skeleton->priv->context = g_main_context_ref_thread_default (); 27174 skeleton->priv->properties = g_new0 (GValue, 2); 27175 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN); 27176 g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64); 27177 } 27178 27179 static gboolean 27180 button_skeleton_get_state (Button *object) 27181 { 27182 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 27183 gboolean value; 27184 g_mutex_lock (&skeleton->priv->lock); 27185 value = g_value_get_boolean (&(skeleton->priv->properties[0])); 27186 g_mutex_unlock (&skeleton->priv->lock); 27187 return value; 27188 } 27189 27190 static guint64 27191 button_skeleton_get_timer (Button *object) 27192 { 27193 ButtonSkeleton *skeleton = BUTTON_SKELETON (object); 27194 guint64 value; 27195 g_mutex_lock (&skeleton->priv->lock); 27196 value = g_value_get_uint64 (&(skeleton->priv->properties[1])); 27197 g_mutex_unlock (&skeleton->priv->lock); 27198 return value; 27199 } 27200 27201 static void 27202 button_skeleton_class_init (ButtonSkeletonClass *klass) 27203 { 27204 GObjectClass *gobject_class; 27205 GDBusInterfaceSkeletonClass *skeleton_class; 27206 27207 gobject_class = G_OBJECT_CLASS (klass); 27208 gobject_class->finalize = button_skeleton_finalize; 27209 gobject_class->get_property = button_skeleton_get_property; 27210 gobject_class->set_property = button_skeleton_set_property; 27211 gobject_class->notify = button_skeleton_notify; 27212 27213 27214 button_override_properties (gobject_class, 1); 27215 27216 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 27217 skeleton_class->get_info = button_skeleton_dbus_interface_get_info; 27218 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties; 27219 skeleton_class->flush = button_skeleton_dbus_interface_flush; 27220 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable; 27221 27222 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 27223 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate)); 27224 #endif 27225 } 27226 27227 static void 27228 button_skeleton_iface_init (ButtonIface *iface) 27229 { 27230 iface->released = _button_on_signal_released; 27231 iface->pressed = _button_on_signal_pressed; 27232 iface->pressed_long = _button_on_signal_pressed_long; 27233 iface->get_state = button_skeleton_get_state; 27234 iface->get_timer = button_skeleton_get_timer; 27235 } 27236 27237 /** 27238 * button_skeleton_new: 27239 * 27240 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. 27241 * 27242 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object. 27243 */ 27244 Button * 27245 button_skeleton_new (void) 27246 { 27247 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL)); 27248 } 27249 27250 /* ------------------------------------------------------------------------ 27251 * Code for interface org.openbmc.Led 27252 * ------------------------------------------------------------------------ 27253 */ 27254 27255 /** 27256 * SECTION:Led 27257 * @title: Led 27258 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface 27259 * 27260 * 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. 27261 */ 27262 27263 /* ---- Introspection data for org.openbmc.Led ---- */ 27264 27265 static const _ExtendedGDBusMethodInfo _led_method_info_set_on = 27266 { 27267 { 27268 -1, 27269 (gchar *) "setOn", 27270 NULL, 27271 NULL, 27272 NULL 27273 }, 27274 "handle-set-on", 27275 FALSE 27276 }; 27277 27278 static const _ExtendedGDBusMethodInfo _led_method_info_set_off = 27279 { 27280 { 27281 -1, 27282 (gchar *) "setOff", 27283 NULL, 27284 NULL, 27285 NULL 27286 }, 27287 "handle-set-off", 27288 FALSE 27289 }; 27290 27291 static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow = 27292 { 27293 { 27294 -1, 27295 (gchar *) "setBlinkSlow", 27296 NULL, 27297 NULL, 27298 NULL 27299 }, 27300 "handle-set-blink-slow", 27301 FALSE 27302 }; 27303 27304 static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast = 27305 { 27306 { 27307 -1, 27308 (gchar *) "setBlinkFast", 27309 NULL, 27310 NULL, 27311 NULL 27312 }, 27313 "handle-set-blink-fast", 27314 FALSE 27315 }; 27316 27317 static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] = 27318 { 27319 &_led_method_info_set_on, 27320 &_led_method_info_set_off, 27321 &_led_method_info_set_blink_slow, 27322 &_led_method_info_set_blink_fast, 27323 NULL 27324 }; 27325 27326 static const _ExtendedGDBusPropertyInfo _led_property_info_color = 27327 { 27328 { 27329 -1, 27330 (gchar *) "color", 27331 (gchar *) "i", 27332 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 27333 NULL 27334 }, 27335 "color", 27336 FALSE 27337 }; 27338 27339 static const _ExtendedGDBusPropertyInfo _led_property_info_function = 27340 { 27341 { 27342 -1, 27343 (gchar *) "function", 27344 (gchar *) "s", 27345 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 27346 NULL 27347 }, 27348 "function", 27349 FALSE 27350 }; 27351 27352 static const _ExtendedGDBusPropertyInfo _led_property_info_state = 27353 { 27354 { 27355 -1, 27356 (gchar *) "state", 27357 (gchar *) "s", 27358 G_DBUS_PROPERTY_INFO_FLAGS_READABLE, 27359 NULL 27360 }, 27361 "state", 27362 FALSE 27363 }; 27364 27365 static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] = 27366 { 27367 &_led_property_info_color, 27368 &_led_property_info_function, 27369 &_led_property_info_state, 27370 NULL 27371 }; 27372 27373 static const _ExtendedGDBusInterfaceInfo _led_interface_info = 27374 { 27375 { 27376 -1, 27377 (gchar *) "org.openbmc.Led", 27378 (GDBusMethodInfo **) &_led_method_info_pointers, 27379 NULL, 27380 (GDBusPropertyInfo **) &_led_property_info_pointers, 27381 NULL 27382 }, 27383 "led", 27384 }; 27385 27386 27387 /** 27388 * led_interface_info: 27389 * 27390 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface. 27391 * 27392 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 27393 */ 27394 GDBusInterfaceInfo * 27395 led_interface_info (void) 27396 { 27397 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct; 27398 } 27399 27400 /** 27401 * led_override_properties: 27402 * @klass: The class structure for a #GObject<!-- -->-derived class. 27403 * @property_id_begin: The property id to assign to the first overridden property. 27404 * 27405 * Overrides all #GObject properties in the #Led interface for a concrete class. 27406 * The properties are overridden in the order they are defined. 27407 * 27408 * Returns: The last property id. 27409 */ 27410 guint 27411 led_override_properties (GObjectClass *klass, guint property_id_begin) 27412 { 27413 g_object_class_override_property (klass, property_id_begin++, "color"); 27414 g_object_class_override_property (klass, property_id_begin++, "function"); 27415 g_object_class_override_property (klass, property_id_begin++, "state"); 27416 return property_id_begin - 1; 27417 } 27418 27419 27420 27421 /** 27422 * Led: 27423 * 27424 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. 27425 */ 27426 27427 /** 27428 * LedIface: 27429 * @parent_iface: The parent interface. 27430 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal. 27431 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal. 27432 * @handle_set_off: Handler for the #Led::handle-set-off signal. 27433 * @handle_set_on: Handler for the #Led::handle-set-on signal. 27434 * @get_color: Getter for the #Led:color property. 27435 * @get_function: Getter for the #Led:function property. 27436 * @get_state: Getter for the #Led:state property. 27437 * 27438 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. 27439 */ 27440 27441 typedef LedIface LedInterface; 27442 G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT); 27443 27444 static void 27445 led_default_init (LedIface *iface) 27446 { 27447 /* GObject signals for incoming D-Bus method calls: */ 27448 /** 27449 * Led::handle-set-on: 27450 * @object: A #Led. 27451 * @invocation: A #GDBusMethodInvocation. 27452 * 27453 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method. 27454 * 27455 * 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. 27456 * 27457 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 27458 */ 27459 g_signal_new ("handle-set-on", 27460 G_TYPE_FROM_INTERFACE (iface), 27461 G_SIGNAL_RUN_LAST, 27462 G_STRUCT_OFFSET (LedIface, handle_set_on), 27463 g_signal_accumulator_true_handled, 27464 NULL, 27465 g_cclosure_marshal_generic, 27466 G_TYPE_BOOLEAN, 27467 1, 27468 G_TYPE_DBUS_METHOD_INVOCATION); 27469 27470 /** 27471 * Led::handle-set-off: 27472 * @object: A #Led. 27473 * @invocation: A #GDBusMethodInvocation. 27474 * 27475 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method. 27476 * 27477 * 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. 27478 * 27479 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 27480 */ 27481 g_signal_new ("handle-set-off", 27482 G_TYPE_FROM_INTERFACE (iface), 27483 G_SIGNAL_RUN_LAST, 27484 G_STRUCT_OFFSET (LedIface, handle_set_off), 27485 g_signal_accumulator_true_handled, 27486 NULL, 27487 g_cclosure_marshal_generic, 27488 G_TYPE_BOOLEAN, 27489 1, 27490 G_TYPE_DBUS_METHOD_INVOCATION); 27491 27492 /** 27493 * Led::handle-set-blink-slow: 27494 * @object: A #Led. 27495 * @invocation: A #GDBusMethodInvocation. 27496 * 27497 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method. 27498 * 27499 * 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. 27500 * 27501 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 27502 */ 27503 g_signal_new ("handle-set-blink-slow", 27504 G_TYPE_FROM_INTERFACE (iface), 27505 G_SIGNAL_RUN_LAST, 27506 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow), 27507 g_signal_accumulator_true_handled, 27508 NULL, 27509 g_cclosure_marshal_generic, 27510 G_TYPE_BOOLEAN, 27511 1, 27512 G_TYPE_DBUS_METHOD_INVOCATION); 27513 27514 /** 27515 * Led::handle-set-blink-fast: 27516 * @object: A #Led. 27517 * @invocation: A #GDBusMethodInvocation. 27518 * 27519 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method. 27520 * 27521 * 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. 27522 * 27523 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 27524 */ 27525 g_signal_new ("handle-set-blink-fast", 27526 G_TYPE_FROM_INTERFACE (iface), 27527 G_SIGNAL_RUN_LAST, 27528 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast), 27529 g_signal_accumulator_true_handled, 27530 NULL, 27531 g_cclosure_marshal_generic, 27532 G_TYPE_BOOLEAN, 27533 1, 27534 G_TYPE_DBUS_METHOD_INVOCATION); 27535 27536 /* GObject properties for D-Bus properties: */ 27537 /** 27538 * Led:color: 27539 * 27540 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>. 27541 * 27542 * 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. 27543 */ 27544 g_object_interface_install_property (iface, 27545 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 27546 /** 27547 * Led:function: 27548 * 27549 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>. 27550 * 27551 * 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. 27552 */ 27553 g_object_interface_install_property (iface, 27554 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 27555 /** 27556 * Led:state: 27557 * 27558 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>. 27559 * 27560 * 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. 27561 */ 27562 g_object_interface_install_property (iface, 27563 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 27564 } 27565 27566 /** 27567 * led_get_color: (skip) 27568 * @object: A #Led. 27569 * 27570 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property. 27571 * 27572 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 27573 * 27574 * Returns: The property value. 27575 */ 27576 gint 27577 led_get_color (Led *object) 27578 { 27579 return LED_GET_IFACE (object)->get_color (object); 27580 } 27581 27582 /** 27583 * led_set_color: (skip) 27584 * @object: A #Led. 27585 * @value: The value to set. 27586 * 27587 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value. 27588 * 27589 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 27590 */ 27591 void 27592 led_set_color (Led *object, gint value) 27593 { 27594 g_object_set (G_OBJECT (object), "color", value, NULL); 27595 } 27596 27597 /** 27598 * led_get_function: (skip) 27599 * @object: A #Led. 27600 * 27601 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. 27602 * 27603 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 27604 * 27605 * <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> 27606 * 27607 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 27608 */ 27609 const gchar * 27610 led_get_function (Led *object) 27611 { 27612 return LED_GET_IFACE (object)->get_function (object); 27613 } 27614 27615 /** 27616 * led_dup_function: (skip) 27617 * @object: A #Led. 27618 * 27619 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property. 27620 * 27621 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 27622 * 27623 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 27624 */ 27625 gchar * 27626 led_dup_function (Led *object) 27627 { 27628 gchar *value; 27629 g_object_get (G_OBJECT (object), "function", &value, NULL); 27630 return value; 27631 } 27632 27633 /** 27634 * led_set_function: (skip) 27635 * @object: A #Led. 27636 * @value: The value to set. 27637 * 27638 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value. 27639 * 27640 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 27641 */ 27642 void 27643 led_set_function (Led *object, const gchar *value) 27644 { 27645 g_object_set (G_OBJECT (object), "function", value, NULL); 27646 } 27647 27648 /** 27649 * led_get_state: (skip) 27650 * @object: A #Led. 27651 * 27652 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property. 27653 * 27654 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 27655 * 27656 * <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_state() if on another thread.</warning> 27657 * 27658 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. 27659 */ 27660 const gchar * 27661 led_get_state (Led *object) 27662 { 27663 return LED_GET_IFACE (object)->get_state (object); 27664 } 27665 27666 /** 27667 * led_dup_state: (skip) 27668 * @object: A #Led. 27669 * 27670 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property. 27671 * 27672 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. 27673 * 27674 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). 27675 */ 27676 gchar * 27677 led_dup_state (Led *object) 27678 { 27679 gchar *value; 27680 g_object_get (G_OBJECT (object), "state", &value, NULL); 27681 return value; 27682 } 27683 27684 /** 27685 * led_set_state: (skip) 27686 * @object: A #Led. 27687 * @value: The value to set. 27688 * 27689 * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value. 27690 * 27691 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. 27692 */ 27693 void 27694 led_set_state (Led *object, const gchar *value) 27695 { 27696 g_object_set (G_OBJECT (object), "state", value, NULL); 27697 } 27698 27699 /** 27700 * led_call_set_on: 27701 * @proxy: A #LedProxy. 27702 * @cancellable: (allow-none): A #GCancellable or %NULL. 27703 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 27704 * @user_data: User data to pass to @callback. 27705 * 27706 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. 27707 * 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. 27708 * You can then call led_call_set_on_finish() to get the result of the operation. 27709 * 27710 * See led_call_set_on_sync() for the synchronous, blocking version of this method. 27711 */ 27712 void 27713 led_call_set_on ( 27714 Led *proxy, 27715 GCancellable *cancellable, 27716 GAsyncReadyCallback callback, 27717 gpointer user_data) 27718 { 27719 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 27720 "setOn", 27721 g_variant_new ("()"), 27722 G_DBUS_CALL_FLAGS_NONE, 27723 -1, 27724 cancellable, 27725 callback, 27726 user_data); 27727 } 27728 27729 /** 27730 * led_call_set_on_finish: 27731 * @proxy: A #LedProxy. 27732 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on(). 27733 * @error: Return location for error or %NULL. 27734 * 27735 * Finishes an operation started with led_call_set_on(). 27736 * 27737 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 27738 */ 27739 gboolean 27740 led_call_set_on_finish ( 27741 Led *proxy, 27742 GAsyncResult *res, 27743 GError **error) 27744 { 27745 GVariant *_ret; 27746 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 27747 if (_ret == NULL) 27748 goto _out; 27749 g_variant_get (_ret, 27750 "()"); 27751 g_variant_unref (_ret); 27752 _out: 27753 return _ret != NULL; 27754 } 27755 27756 /** 27757 * led_call_set_on_sync: 27758 * @proxy: A #LedProxy. 27759 * @cancellable: (allow-none): A #GCancellable or %NULL. 27760 * @error: Return location for error or %NULL. 27761 * 27762 * 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. 27763 * 27764 * See led_call_set_on() for the asynchronous version of this method. 27765 * 27766 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 27767 */ 27768 gboolean 27769 led_call_set_on_sync ( 27770 Led *proxy, 27771 GCancellable *cancellable, 27772 GError **error) 27773 { 27774 GVariant *_ret; 27775 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 27776 "setOn", 27777 g_variant_new ("()"), 27778 G_DBUS_CALL_FLAGS_NONE, 27779 -1, 27780 cancellable, 27781 error); 27782 if (_ret == NULL) 27783 goto _out; 27784 g_variant_get (_ret, 27785 "()"); 27786 g_variant_unref (_ret); 27787 _out: 27788 return _ret != NULL; 27789 } 27790 27791 /** 27792 * led_call_set_off: 27793 * @proxy: A #LedProxy. 27794 * @cancellable: (allow-none): A #GCancellable or %NULL. 27795 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 27796 * @user_data: User data to pass to @callback. 27797 * 27798 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. 27799 * 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. 27800 * You can then call led_call_set_off_finish() to get the result of the operation. 27801 * 27802 * See led_call_set_off_sync() for the synchronous, blocking version of this method. 27803 */ 27804 void 27805 led_call_set_off ( 27806 Led *proxy, 27807 GCancellable *cancellable, 27808 GAsyncReadyCallback callback, 27809 gpointer user_data) 27810 { 27811 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 27812 "setOff", 27813 g_variant_new ("()"), 27814 G_DBUS_CALL_FLAGS_NONE, 27815 -1, 27816 cancellable, 27817 callback, 27818 user_data); 27819 } 27820 27821 /** 27822 * led_call_set_off_finish: 27823 * @proxy: A #LedProxy. 27824 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off(). 27825 * @error: Return location for error or %NULL. 27826 * 27827 * Finishes an operation started with led_call_set_off(). 27828 * 27829 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 27830 */ 27831 gboolean 27832 led_call_set_off_finish ( 27833 Led *proxy, 27834 GAsyncResult *res, 27835 GError **error) 27836 { 27837 GVariant *_ret; 27838 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 27839 if (_ret == NULL) 27840 goto _out; 27841 g_variant_get (_ret, 27842 "()"); 27843 g_variant_unref (_ret); 27844 _out: 27845 return _ret != NULL; 27846 } 27847 27848 /** 27849 * led_call_set_off_sync: 27850 * @proxy: A #LedProxy. 27851 * @cancellable: (allow-none): A #GCancellable or %NULL. 27852 * @error: Return location for error or %NULL. 27853 * 27854 * 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. 27855 * 27856 * See led_call_set_off() for the asynchronous version of this method. 27857 * 27858 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 27859 */ 27860 gboolean 27861 led_call_set_off_sync ( 27862 Led *proxy, 27863 GCancellable *cancellable, 27864 GError **error) 27865 { 27866 GVariant *_ret; 27867 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 27868 "setOff", 27869 g_variant_new ("()"), 27870 G_DBUS_CALL_FLAGS_NONE, 27871 -1, 27872 cancellable, 27873 error); 27874 if (_ret == NULL) 27875 goto _out; 27876 g_variant_get (_ret, 27877 "()"); 27878 g_variant_unref (_ret); 27879 _out: 27880 return _ret != NULL; 27881 } 27882 27883 /** 27884 * led_call_set_blink_slow: 27885 * @proxy: A #LedProxy. 27886 * @cancellable: (allow-none): A #GCancellable or %NULL. 27887 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 27888 * @user_data: User data to pass to @callback. 27889 * 27890 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. 27891 * 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. 27892 * You can then call led_call_set_blink_slow_finish() to get the result of the operation. 27893 * 27894 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method. 27895 */ 27896 void 27897 led_call_set_blink_slow ( 27898 Led *proxy, 27899 GCancellable *cancellable, 27900 GAsyncReadyCallback callback, 27901 gpointer user_data) 27902 { 27903 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 27904 "setBlinkSlow", 27905 g_variant_new ("()"), 27906 G_DBUS_CALL_FLAGS_NONE, 27907 -1, 27908 cancellable, 27909 callback, 27910 user_data); 27911 } 27912 27913 /** 27914 * led_call_set_blink_slow_finish: 27915 * @proxy: A #LedProxy. 27916 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow(). 27917 * @error: Return location for error or %NULL. 27918 * 27919 * Finishes an operation started with led_call_set_blink_slow(). 27920 * 27921 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 27922 */ 27923 gboolean 27924 led_call_set_blink_slow_finish ( 27925 Led *proxy, 27926 GAsyncResult *res, 27927 GError **error) 27928 { 27929 GVariant *_ret; 27930 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 27931 if (_ret == NULL) 27932 goto _out; 27933 g_variant_get (_ret, 27934 "()"); 27935 g_variant_unref (_ret); 27936 _out: 27937 return _ret != NULL; 27938 } 27939 27940 /** 27941 * led_call_set_blink_slow_sync: 27942 * @proxy: A #LedProxy. 27943 * @cancellable: (allow-none): A #GCancellable or %NULL. 27944 * @error: Return location for error or %NULL. 27945 * 27946 * 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. 27947 * 27948 * See led_call_set_blink_slow() for the asynchronous version of this method. 27949 * 27950 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 27951 */ 27952 gboolean 27953 led_call_set_blink_slow_sync ( 27954 Led *proxy, 27955 GCancellable *cancellable, 27956 GError **error) 27957 { 27958 GVariant *_ret; 27959 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 27960 "setBlinkSlow", 27961 g_variant_new ("()"), 27962 G_DBUS_CALL_FLAGS_NONE, 27963 -1, 27964 cancellable, 27965 error); 27966 if (_ret == NULL) 27967 goto _out; 27968 g_variant_get (_ret, 27969 "()"); 27970 g_variant_unref (_ret); 27971 _out: 27972 return _ret != NULL; 27973 } 27974 27975 /** 27976 * led_call_set_blink_fast: 27977 * @proxy: A #LedProxy. 27978 * @cancellable: (allow-none): A #GCancellable or %NULL. 27979 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 27980 * @user_data: User data to pass to @callback. 27981 * 27982 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. 27983 * 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. 27984 * You can then call led_call_set_blink_fast_finish() to get the result of the operation. 27985 * 27986 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method. 27987 */ 27988 void 27989 led_call_set_blink_fast ( 27990 Led *proxy, 27991 GCancellable *cancellable, 27992 GAsyncReadyCallback callback, 27993 gpointer user_data) 27994 { 27995 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 27996 "setBlinkFast", 27997 g_variant_new ("()"), 27998 G_DBUS_CALL_FLAGS_NONE, 27999 -1, 28000 cancellable, 28001 callback, 28002 user_data); 28003 } 28004 28005 /** 28006 * led_call_set_blink_fast_finish: 28007 * @proxy: A #LedProxy. 28008 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast(). 28009 * @error: Return location for error or %NULL. 28010 * 28011 * Finishes an operation started with led_call_set_blink_fast(). 28012 * 28013 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 28014 */ 28015 gboolean 28016 led_call_set_blink_fast_finish ( 28017 Led *proxy, 28018 GAsyncResult *res, 28019 GError **error) 28020 { 28021 GVariant *_ret; 28022 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 28023 if (_ret == NULL) 28024 goto _out; 28025 g_variant_get (_ret, 28026 "()"); 28027 g_variant_unref (_ret); 28028 _out: 28029 return _ret != NULL; 28030 } 28031 28032 /** 28033 * led_call_set_blink_fast_sync: 28034 * @proxy: A #LedProxy. 28035 * @cancellable: (allow-none): A #GCancellable or %NULL. 28036 * @error: Return location for error or %NULL. 28037 * 28038 * 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. 28039 * 28040 * See led_call_set_blink_fast() for the asynchronous version of this method. 28041 * 28042 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 28043 */ 28044 gboolean 28045 led_call_set_blink_fast_sync ( 28046 Led *proxy, 28047 GCancellable *cancellable, 28048 GError **error) 28049 { 28050 GVariant *_ret; 28051 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 28052 "setBlinkFast", 28053 g_variant_new ("()"), 28054 G_DBUS_CALL_FLAGS_NONE, 28055 -1, 28056 cancellable, 28057 error); 28058 if (_ret == NULL) 28059 goto _out; 28060 g_variant_get (_ret, 28061 "()"); 28062 g_variant_unref (_ret); 28063 _out: 28064 return _ret != NULL; 28065 } 28066 28067 /** 28068 * led_complete_set_on: 28069 * @object: A #Led. 28070 * @invocation: (transfer full): A #GDBusMethodInvocation. 28071 * 28072 * 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. 28073 * 28074 * This method will free @invocation, you cannot use it afterwards. 28075 */ 28076 void 28077 led_complete_set_on ( 28078 Led *object, 28079 GDBusMethodInvocation *invocation) 28080 { 28081 g_dbus_method_invocation_return_value (invocation, 28082 g_variant_new ("()")); 28083 } 28084 28085 /** 28086 * led_complete_set_off: 28087 * @object: A #Led. 28088 * @invocation: (transfer full): A #GDBusMethodInvocation. 28089 * 28090 * 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. 28091 * 28092 * This method will free @invocation, you cannot use it afterwards. 28093 */ 28094 void 28095 led_complete_set_off ( 28096 Led *object, 28097 GDBusMethodInvocation *invocation) 28098 { 28099 g_dbus_method_invocation_return_value (invocation, 28100 g_variant_new ("()")); 28101 } 28102 28103 /** 28104 * led_complete_set_blink_slow: 28105 * @object: A #Led. 28106 * @invocation: (transfer full): A #GDBusMethodInvocation. 28107 * 28108 * 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. 28109 * 28110 * This method will free @invocation, you cannot use it afterwards. 28111 */ 28112 void 28113 led_complete_set_blink_slow ( 28114 Led *object, 28115 GDBusMethodInvocation *invocation) 28116 { 28117 g_dbus_method_invocation_return_value (invocation, 28118 g_variant_new ("()")); 28119 } 28120 28121 /** 28122 * led_complete_set_blink_fast: 28123 * @object: A #Led. 28124 * @invocation: (transfer full): A #GDBusMethodInvocation. 28125 * 28126 * 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. 28127 * 28128 * This method will free @invocation, you cannot use it afterwards. 28129 */ 28130 void 28131 led_complete_set_blink_fast ( 28132 Led *object, 28133 GDBusMethodInvocation *invocation) 28134 { 28135 g_dbus_method_invocation_return_value (invocation, 28136 g_variant_new ("()")); 28137 } 28138 28139 /* ------------------------------------------------------------------------ */ 28140 28141 /** 28142 * LedProxy: 28143 * 28144 * The #LedProxy structure contains only private data and should only be accessed using the provided API. 28145 */ 28146 28147 /** 28148 * LedProxyClass: 28149 * @parent_class: The parent class. 28150 * 28151 * Class structure for #LedProxy. 28152 */ 28153 28154 struct _LedProxyPrivate 28155 { 28156 GData *qdata; 28157 }; 28158 28159 static void led_proxy_iface_init (LedIface *iface); 28160 28161 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 28162 G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, 28163 G_ADD_PRIVATE (LedProxy) 28164 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); 28165 28166 #else 28167 G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY, 28168 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init)); 28169 28170 #endif 28171 static void 28172 led_proxy_finalize (GObject *object) 28173 { 28174 LedProxy *proxy = LED_PROXY (object); 28175 g_datalist_clear (&proxy->priv->qdata); 28176 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object); 28177 } 28178 28179 static void 28180 led_proxy_get_property (GObject *object, 28181 guint prop_id, 28182 GValue *value, 28183 GParamSpec *pspec G_GNUC_UNUSED) 28184 { 28185 const _ExtendedGDBusPropertyInfo *info; 28186 GVariant *variant; 28187 g_assert (prop_id != 0 && prop_id - 1 < 3); 28188 info = _led_property_info_pointers[prop_id - 1]; 28189 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); 28190 if (info->use_gvariant) 28191 { 28192 g_value_set_variant (value, variant); 28193 } 28194 else 28195 { 28196 if (variant != NULL) 28197 g_dbus_gvariant_to_gvalue (variant, value); 28198 } 28199 if (variant != NULL) 28200 g_variant_unref (variant); 28201 } 28202 28203 static void 28204 led_proxy_set_property_cb (GDBusProxy *proxy, 28205 GAsyncResult *res, 28206 gpointer user_data) 28207 { 28208 const _ExtendedGDBusPropertyInfo *info = user_data; 28209 GError *error; 28210 GVariant *_ret; 28211 error = NULL; 28212 _ret = g_dbus_proxy_call_finish (proxy, res, &error); 28213 if (!_ret) 28214 { 28215 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)", 28216 info->parent_struct.name, 28217 error->message, g_quark_to_string (error->domain), error->code); 28218 g_error_free (error); 28219 } 28220 else 28221 { 28222 g_variant_unref (_ret); 28223 } 28224 } 28225 28226 static void 28227 led_proxy_set_property (GObject *object, 28228 guint prop_id, 28229 const GValue *value, 28230 GParamSpec *pspec G_GNUC_UNUSED) 28231 { 28232 const _ExtendedGDBusPropertyInfo *info; 28233 GVariant *variant; 28234 g_assert (prop_id != 0 && prop_id - 1 < 3); 28235 info = _led_property_info_pointers[prop_id - 1]; 28236 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); 28237 g_dbus_proxy_call (G_DBUS_PROXY (object), 28238 "org.freedesktop.DBus.Properties.Set", 28239 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant), 28240 G_DBUS_CALL_FLAGS_NONE, 28241 -1, 28242 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); 28243 g_variant_unref (variant); 28244 } 28245 28246 static void 28247 led_proxy_g_signal (GDBusProxy *proxy, 28248 const gchar *sender_name G_GNUC_UNUSED, 28249 const gchar *signal_name, 28250 GVariant *parameters) 28251 { 28252 _ExtendedGDBusSignalInfo *info; 28253 GVariantIter iter; 28254 GVariant *child; 28255 GValue *paramv; 28256 guint num_params; 28257 guint n; 28258 guint signal_id; 28259 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name); 28260 if (info == NULL) 28261 return; 28262 num_params = g_variant_n_children (parameters); 28263 paramv = g_new0 (GValue, num_params + 1); 28264 g_value_init (¶mv[0], TYPE_LED); 28265 g_value_set_object (¶mv[0], proxy); 28266 g_variant_iter_init (&iter, parameters); 28267 n = 1; 28268 while ((child = g_variant_iter_next_value (&iter)) != NULL) 28269 { 28270 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 28271 if (arg_info->use_gvariant) 28272 { 28273 g_value_init (¶mv[n], G_TYPE_VARIANT); 28274 g_value_set_variant (¶mv[n], child); 28275 n++; 28276 } 28277 else 28278 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 28279 g_variant_unref (child); 28280 } 28281 signal_id = g_signal_lookup (info->signal_name, TYPE_LED); 28282 g_signal_emitv (paramv, signal_id, 0, NULL); 28283 for (n = 0; n < num_params + 1; n++) 28284 g_value_unset (¶mv[n]); 28285 g_free (paramv); 28286 } 28287 28288 static void 28289 led_proxy_g_properties_changed (GDBusProxy *_proxy, 28290 GVariant *changed_properties, 28291 const gchar *const *invalidated_properties) 28292 { 28293 LedProxy *proxy = LED_PROXY (_proxy); 28294 guint n; 28295 const gchar *key; 28296 GVariantIter *iter; 28297 _ExtendedGDBusPropertyInfo *info; 28298 g_variant_get (changed_properties, "a{sv}", &iter); 28299 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 28300 { 28301 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key); 28302 g_datalist_remove_data (&proxy->priv->qdata, key); 28303 if (info != NULL) 28304 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 28305 } 28306 g_variant_iter_free (iter); 28307 for (n = 0; invalidated_properties[n] != NULL; n++) 28308 { 28309 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]); 28310 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 28311 if (info != NULL) 28312 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 28313 } 28314 } 28315 28316 static gint 28317 led_proxy_get_color (Led *object) 28318 { 28319 LedProxy *proxy = LED_PROXY (object); 28320 GVariant *variant; 28321 gint value = 0; 28322 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color"); 28323 if (variant != NULL) 28324 { 28325 value = g_variant_get_int32 (variant); 28326 g_variant_unref (variant); 28327 } 28328 return value; 28329 } 28330 28331 static const gchar * 28332 led_proxy_get_function (Led *object) 28333 { 28334 LedProxy *proxy = LED_PROXY (object); 28335 GVariant *variant; 28336 const gchar *value = NULL; 28337 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function"); 28338 if (variant != NULL) 28339 { 28340 value = g_variant_get_string (variant, NULL); 28341 g_variant_unref (variant); 28342 } 28343 return value; 28344 } 28345 28346 static const gchar * 28347 led_proxy_get_state (Led *object) 28348 { 28349 LedProxy *proxy = LED_PROXY (object); 28350 GVariant *variant; 28351 const gchar *value = NULL; 28352 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); 28353 if (variant != NULL) 28354 { 28355 value = g_variant_get_string (variant, NULL); 28356 g_variant_unref (variant); 28357 } 28358 return value; 28359 } 28360 28361 static void 28362 led_proxy_init (LedProxy *proxy) 28363 { 28364 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 28365 proxy->priv = led_proxy_get_instance_private (proxy); 28366 #else 28367 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate); 28368 #endif 28369 28370 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ()); 28371 } 28372 28373 static void 28374 led_proxy_class_init (LedProxyClass *klass) 28375 { 28376 GObjectClass *gobject_class; 28377 GDBusProxyClass *proxy_class; 28378 28379 gobject_class = G_OBJECT_CLASS (klass); 28380 gobject_class->finalize = led_proxy_finalize; 28381 gobject_class->get_property = led_proxy_get_property; 28382 gobject_class->set_property = led_proxy_set_property; 28383 28384 proxy_class = G_DBUS_PROXY_CLASS (klass); 28385 proxy_class->g_signal = led_proxy_g_signal; 28386 proxy_class->g_properties_changed = led_proxy_g_properties_changed; 28387 28388 led_override_properties (gobject_class, 1); 28389 28390 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 28391 g_type_class_add_private (klass, sizeof (LedProxyPrivate)); 28392 #endif 28393 } 28394 28395 static void 28396 led_proxy_iface_init (LedIface *iface) 28397 { 28398 iface->get_color = led_proxy_get_color; 28399 iface->get_function = led_proxy_get_function; 28400 iface->get_state = led_proxy_get_state; 28401 } 28402 28403 /** 28404 * led_proxy_new: 28405 * @connection: A #GDBusConnection. 28406 * @flags: Flags from the #GDBusProxyFlags enumeration. 28407 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 28408 * @object_path: An object path. 28409 * @cancellable: (allow-none): A #GCancellable or %NULL. 28410 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 28411 * @user_data: User data to pass to @callback. 28412 * 28413 * 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. 28414 * 28415 * 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. 28416 * You can then call led_proxy_new_finish() to get the result of the operation. 28417 * 28418 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor. 28419 */ 28420 void 28421 led_proxy_new ( 28422 GDBusConnection *connection, 28423 GDBusProxyFlags flags, 28424 const gchar *name, 28425 const gchar *object_path, 28426 GCancellable *cancellable, 28427 GAsyncReadyCallback callback, 28428 gpointer user_data) 28429 { 28430 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); 28431 } 28432 28433 /** 28434 * led_proxy_new_finish: 28435 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new(). 28436 * @error: Return location for error or %NULL 28437 * 28438 * Finishes an operation started with led_proxy_new(). 28439 * 28440 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. 28441 */ 28442 Led * 28443 led_proxy_new_finish ( 28444 GAsyncResult *res, 28445 GError **error) 28446 { 28447 GObject *ret; 28448 GObject *source_object; 28449 source_object = g_async_result_get_source_object (res); 28450 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 28451 g_object_unref (source_object); 28452 if (ret != NULL) 28453 return LED (ret); 28454 else 28455 return NULL; 28456 } 28457 28458 /** 28459 * led_proxy_new_sync: 28460 * @connection: A #GDBusConnection. 28461 * @flags: Flags from the #GDBusProxyFlags enumeration. 28462 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 28463 * @object_path: An object path. 28464 * @cancellable: (allow-none): A #GCancellable or %NULL. 28465 * @error: Return location for error or %NULL 28466 * 28467 * 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. 28468 * 28469 * The calling thread is blocked until a reply is received. 28470 * 28471 * See led_proxy_new() for the asynchronous version of this constructor. 28472 * 28473 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. 28474 */ 28475 Led * 28476 led_proxy_new_sync ( 28477 GDBusConnection *connection, 28478 GDBusProxyFlags flags, 28479 const gchar *name, 28480 const gchar *object_path, 28481 GCancellable *cancellable, 28482 GError **error) 28483 { 28484 GInitable *ret; 28485 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); 28486 if (ret != NULL) 28487 return LED (ret); 28488 else 28489 return NULL; 28490 } 28491 28492 28493 /** 28494 * led_proxy_new_for_bus: 28495 * @bus_type: A #GBusType. 28496 * @flags: Flags from the #GDBusProxyFlags enumeration. 28497 * @name: A bus name (well-known or unique). 28498 * @object_path: An object path. 28499 * @cancellable: (allow-none): A #GCancellable or %NULL. 28500 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 28501 * @user_data: User data to pass to @callback. 28502 * 28503 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 28504 * 28505 * 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. 28506 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation. 28507 * 28508 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 28509 */ 28510 void 28511 led_proxy_new_for_bus ( 28512 GBusType bus_type, 28513 GDBusProxyFlags flags, 28514 const gchar *name, 28515 const gchar *object_path, 28516 GCancellable *cancellable, 28517 GAsyncReadyCallback callback, 28518 gpointer user_data) 28519 { 28520 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); 28521 } 28522 28523 /** 28524 * led_proxy_new_for_bus_finish: 28525 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus(). 28526 * @error: Return location for error or %NULL 28527 * 28528 * Finishes an operation started with led_proxy_new_for_bus(). 28529 * 28530 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. 28531 */ 28532 Led * 28533 led_proxy_new_for_bus_finish ( 28534 GAsyncResult *res, 28535 GError **error) 28536 { 28537 GObject *ret; 28538 GObject *source_object; 28539 source_object = g_async_result_get_source_object (res); 28540 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 28541 g_object_unref (source_object); 28542 if (ret != NULL) 28543 return LED (ret); 28544 else 28545 return NULL; 28546 } 28547 28548 /** 28549 * led_proxy_new_for_bus_sync: 28550 * @bus_type: A #GBusType. 28551 * @flags: Flags from the #GDBusProxyFlags enumeration. 28552 * @name: A bus name (well-known or unique). 28553 * @object_path: An object path. 28554 * @cancellable: (allow-none): A #GCancellable or %NULL. 28555 * @error: Return location for error or %NULL 28556 * 28557 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 28558 * 28559 * The calling thread is blocked until a reply is received. 28560 * 28561 * See led_proxy_new_for_bus() for the asynchronous version of this constructor. 28562 * 28563 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set. 28564 */ 28565 Led * 28566 led_proxy_new_for_bus_sync ( 28567 GBusType bus_type, 28568 GDBusProxyFlags flags, 28569 const gchar *name, 28570 const gchar *object_path, 28571 GCancellable *cancellable, 28572 GError **error) 28573 { 28574 GInitable *ret; 28575 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); 28576 if (ret != NULL) 28577 return LED (ret); 28578 else 28579 return NULL; 28580 } 28581 28582 28583 /* ------------------------------------------------------------------------ */ 28584 28585 /** 28586 * LedSkeleton: 28587 * 28588 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API. 28589 */ 28590 28591 /** 28592 * LedSkeletonClass: 28593 * @parent_class: The parent class. 28594 * 28595 * Class structure for #LedSkeleton. 28596 */ 28597 28598 struct _LedSkeletonPrivate 28599 { 28600 GValue *properties; 28601 GList *changed_properties; 28602 GSource *changed_properties_idle_source; 28603 GMainContext *context; 28604 GMutex lock; 28605 }; 28606 28607 static void 28608 _led_skeleton_handle_method_call ( 28609 GDBusConnection *connection G_GNUC_UNUSED, 28610 const gchar *sender G_GNUC_UNUSED, 28611 const gchar *object_path G_GNUC_UNUSED, 28612 const gchar *interface_name, 28613 const gchar *method_name, 28614 GVariant *parameters, 28615 GDBusMethodInvocation *invocation, 28616 gpointer user_data) 28617 { 28618 LedSkeleton *skeleton = LED_SKELETON (user_data); 28619 _ExtendedGDBusMethodInfo *info; 28620 GVariantIter iter; 28621 GVariant *child; 28622 GValue *paramv; 28623 guint num_params; 28624 guint num_extra; 28625 guint n; 28626 guint signal_id; 28627 GValue return_value = G_VALUE_INIT; 28628 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 28629 g_assert (info != NULL); 28630 num_params = g_variant_n_children (parameters); 28631 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 28632 n = 0; 28633 g_value_init (¶mv[n], TYPE_LED); 28634 g_value_set_object (¶mv[n++], skeleton); 28635 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 28636 g_value_set_object (¶mv[n++], invocation); 28637 if (info->pass_fdlist) 28638 { 28639 #ifdef G_OS_UNIX 28640 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 28641 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 28642 #else 28643 g_assert_not_reached (); 28644 #endif 28645 } 28646 g_variant_iter_init (&iter, parameters); 28647 while ((child = g_variant_iter_next_value (&iter)) != NULL) 28648 { 28649 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 28650 if (arg_info->use_gvariant) 28651 { 28652 g_value_init (¶mv[n], G_TYPE_VARIANT); 28653 g_value_set_variant (¶mv[n], child); 28654 n++; 28655 } 28656 else 28657 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 28658 g_variant_unref (child); 28659 } 28660 signal_id = g_signal_lookup (info->signal_name, TYPE_LED); 28661 g_value_init (&return_value, G_TYPE_BOOLEAN); 28662 g_signal_emitv (paramv, signal_id, 0, &return_value); 28663 if (!g_value_get_boolean (&return_value)) 28664 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); 28665 g_value_unset (&return_value); 28666 for (n = 0; n < num_params + num_extra; n++) 28667 g_value_unset (¶mv[n]); 28668 g_free (paramv); 28669 } 28670 28671 static GVariant * 28672 _led_skeleton_handle_get_property ( 28673 GDBusConnection *connection G_GNUC_UNUSED, 28674 const gchar *sender G_GNUC_UNUSED, 28675 const gchar *object_path G_GNUC_UNUSED, 28676 const gchar *interface_name G_GNUC_UNUSED, 28677 const gchar *property_name, 28678 GError **error, 28679 gpointer user_data) 28680 { 28681 LedSkeleton *skeleton = LED_SKELETON (user_data); 28682 GValue value = G_VALUE_INIT; 28683 GParamSpec *pspec; 28684 _ExtendedGDBusPropertyInfo *info; 28685 GVariant *ret; 28686 ret = NULL; 28687 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); 28688 g_assert (info != NULL); 28689 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 28690 if (pspec == NULL) 28691 { 28692 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 28693 } 28694 else 28695 { 28696 g_value_init (&value, pspec->value_type); 28697 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 28698 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 28699 g_value_unset (&value); 28700 } 28701 return ret; 28702 } 28703 28704 static gboolean 28705 _led_skeleton_handle_set_property ( 28706 GDBusConnection *connection G_GNUC_UNUSED, 28707 const gchar *sender G_GNUC_UNUSED, 28708 const gchar *object_path G_GNUC_UNUSED, 28709 const gchar *interface_name G_GNUC_UNUSED, 28710 const gchar *property_name, 28711 GVariant *variant, 28712 GError **error, 28713 gpointer user_data) 28714 { 28715 LedSkeleton *skeleton = LED_SKELETON (user_data); 28716 GValue value = G_VALUE_INIT; 28717 GParamSpec *pspec; 28718 _ExtendedGDBusPropertyInfo *info; 28719 gboolean ret; 28720 ret = FALSE; 28721 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name); 28722 g_assert (info != NULL); 28723 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 28724 if (pspec == NULL) 28725 { 28726 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 28727 } 28728 else 28729 { 28730 if (info->use_gvariant) 28731 g_value_set_variant (&value, variant); 28732 else 28733 g_dbus_gvariant_to_gvalue (variant, &value); 28734 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 28735 g_value_unset (&value); 28736 ret = TRUE; 28737 } 28738 return ret; 28739 } 28740 28741 static const GDBusInterfaceVTable _led_skeleton_vtable = 28742 { 28743 _led_skeleton_handle_method_call, 28744 _led_skeleton_handle_get_property, 28745 _led_skeleton_handle_set_property, 28746 {NULL} 28747 }; 28748 28749 static GDBusInterfaceInfo * 28750 led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 28751 { 28752 return led_interface_info (); 28753 } 28754 28755 static GDBusInterfaceVTable * 28756 led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 28757 { 28758 return (GDBusInterfaceVTable *) &_led_skeleton_vtable; 28759 } 28760 28761 static GVariant * 28762 led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 28763 { 28764 LedSkeleton *skeleton = LED_SKELETON (_skeleton); 28765 28766 GVariantBuilder builder; 28767 guint n; 28768 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 28769 if (_led_interface_info.parent_struct.properties == NULL) 28770 goto out; 28771 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++) 28772 { 28773 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n]; 28774 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 28775 { 28776 GVariant *value; 28777 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); 28778 if (value != NULL) 28779 { 28780 g_variant_take_ref (value); 28781 g_variant_builder_add (&builder, "{sv}", info->name, value); 28782 g_variant_unref (value); 28783 } 28784 } 28785 } 28786 out: 28787 return g_variant_builder_end (&builder); 28788 } 28789 28790 static gboolean _led_emit_changed (gpointer user_data); 28791 28792 static void 28793 led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 28794 { 28795 LedSkeleton *skeleton = LED_SKELETON (_skeleton); 28796 gboolean emit_changed = FALSE; 28797 28798 g_mutex_lock (&skeleton->priv->lock); 28799 if (skeleton->priv->changed_properties_idle_source != NULL) 28800 { 28801 g_source_destroy (skeleton->priv->changed_properties_idle_source); 28802 skeleton->priv->changed_properties_idle_source = NULL; 28803 emit_changed = TRUE; 28804 } 28805 g_mutex_unlock (&skeleton->priv->lock); 28806 28807 if (emit_changed) 28808 _led_emit_changed (skeleton); 28809 } 28810 28811 static void led_skeleton_iface_init (LedIface *iface); 28812 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 28813 G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 28814 G_ADD_PRIVATE (LedSkeleton) 28815 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); 28816 28817 #else 28818 G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 28819 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init)); 28820 28821 #endif 28822 static void 28823 led_skeleton_finalize (GObject *object) 28824 { 28825 LedSkeleton *skeleton = LED_SKELETON (object); 28826 guint n; 28827 for (n = 0; n < 3; n++) 28828 g_value_unset (&skeleton->priv->properties[n]); 28829 g_free (skeleton->priv->properties); 28830 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 28831 if (skeleton->priv->changed_properties_idle_source != NULL) 28832 g_source_destroy (skeleton->priv->changed_properties_idle_source); 28833 g_main_context_unref (skeleton->priv->context); 28834 g_mutex_clear (&skeleton->priv->lock); 28835 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object); 28836 } 28837 28838 static void 28839 led_skeleton_get_property (GObject *object, 28840 guint prop_id, 28841 GValue *value, 28842 GParamSpec *pspec G_GNUC_UNUSED) 28843 { 28844 LedSkeleton *skeleton = LED_SKELETON (object); 28845 g_assert (prop_id != 0 && prop_id - 1 < 3); 28846 g_mutex_lock (&skeleton->priv->lock); 28847 g_value_copy (&skeleton->priv->properties[prop_id - 1], value); 28848 g_mutex_unlock (&skeleton->priv->lock); 28849 } 28850 28851 static gboolean 28852 _led_emit_changed (gpointer user_data) 28853 { 28854 LedSkeleton *skeleton = LED_SKELETON (user_data); 28855 GList *l; 28856 GVariantBuilder builder; 28857 GVariantBuilder invalidated_builder; 28858 guint num_changes; 28859 28860 g_mutex_lock (&skeleton->priv->lock); 28861 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 28862 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); 28863 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) 28864 { 28865 ChangedProperty *cp = l->data; 28866 GVariant *variant; 28867 const GValue *cur_value; 28868 28869 cur_value = &skeleton->priv->properties[cp->prop_id - 1]; 28870 if (!_g_value_equal (cur_value, &cp->orig_value)) 28871 { 28872 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); 28873 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); 28874 g_variant_unref (variant); 28875 num_changes++; 28876 } 28877 } 28878 if (num_changes > 0) 28879 { 28880 GList *connections, *ll; 28881 GVariant *signal_variant; 28882 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led", 28883 &builder, &invalidated_builder)); 28884 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 28885 for (ll = connections; ll != NULL; ll = ll->next) 28886 { 28887 GDBusConnection *connection = ll->data; 28888 28889 g_dbus_connection_emit_signal (connection, 28890 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), 28891 "org.freedesktop.DBus.Properties", 28892 "PropertiesChanged", 28893 signal_variant, 28894 NULL); 28895 } 28896 g_variant_unref (signal_variant); 28897 g_list_free_full (connections, g_object_unref); 28898 } 28899 else 28900 { 28901 g_variant_builder_clear (&builder); 28902 g_variant_builder_clear (&invalidated_builder); 28903 } 28904 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 28905 skeleton->priv->changed_properties = NULL; 28906 skeleton->priv->changed_properties_idle_source = NULL; 28907 g_mutex_unlock (&skeleton->priv->lock); 28908 return FALSE; 28909 } 28910 28911 static void 28912 _led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) 28913 { 28914 ChangedProperty *cp; 28915 GList *l; 28916 cp = NULL; 28917 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) 28918 { 28919 ChangedProperty *i_cp = l->data; 28920 if (i_cp->info == info) 28921 { 28922 cp = i_cp; 28923 break; 28924 } 28925 } 28926 if (cp == NULL) 28927 { 28928 cp = g_new0 (ChangedProperty, 1); 28929 cp->prop_id = prop_id; 28930 cp->info = info; 28931 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); 28932 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); 28933 g_value_copy (orig_value, &cp->orig_value); 28934 } 28935 } 28936 28937 static void 28938 led_skeleton_notify (GObject *object, 28939 GParamSpec *pspec G_GNUC_UNUSED) 28940 { 28941 LedSkeleton *skeleton = LED_SKELETON (object); 28942 g_mutex_lock (&skeleton->priv->lock); 28943 if (skeleton->priv->changed_properties != NULL && 28944 skeleton->priv->changed_properties_idle_source == NULL) 28945 { 28946 skeleton->priv->changed_properties_idle_source = g_idle_source_new (); 28947 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); 28948 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); 28949 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _led_emit_changed"); 28950 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); 28951 g_source_unref (skeleton->priv->changed_properties_idle_source); 28952 } 28953 g_mutex_unlock (&skeleton->priv->lock); 28954 } 28955 28956 static void 28957 led_skeleton_set_property (GObject *object, 28958 guint prop_id, 28959 const GValue *value, 28960 GParamSpec *pspec) 28961 { 28962 LedSkeleton *skeleton = LED_SKELETON (object); 28963 g_assert (prop_id != 0 && prop_id - 1 < 3); 28964 g_mutex_lock (&skeleton->priv->lock); 28965 g_object_freeze_notify (object); 28966 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) 28967 { 28968 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) 28969 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); 28970 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); 28971 g_object_notify_by_pspec (object, pspec); 28972 } 28973 g_mutex_unlock (&skeleton->priv->lock); 28974 g_object_thaw_notify (object); 28975 } 28976 28977 static void 28978 led_skeleton_init (LedSkeleton *skeleton) 28979 { 28980 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 28981 skeleton->priv = led_skeleton_get_instance_private (skeleton); 28982 #else 28983 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate); 28984 #endif 28985 28986 g_mutex_init (&skeleton->priv->lock); 28987 skeleton->priv->context = g_main_context_ref_thread_default (); 28988 skeleton->priv->properties = g_new0 (GValue, 3); 28989 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); 28990 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); 28991 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); 28992 } 28993 28994 static gint 28995 led_skeleton_get_color (Led *object) 28996 { 28997 LedSkeleton *skeleton = LED_SKELETON (object); 28998 gint value; 28999 g_mutex_lock (&skeleton->priv->lock); 29000 value = g_value_get_int (&(skeleton->priv->properties[0])); 29001 g_mutex_unlock (&skeleton->priv->lock); 29002 return value; 29003 } 29004 29005 static const gchar * 29006 led_skeleton_get_function (Led *object) 29007 { 29008 LedSkeleton *skeleton = LED_SKELETON (object); 29009 const gchar *value; 29010 g_mutex_lock (&skeleton->priv->lock); 29011 value = g_value_get_string (&(skeleton->priv->properties[1])); 29012 g_mutex_unlock (&skeleton->priv->lock); 29013 return value; 29014 } 29015 29016 static const gchar * 29017 led_skeleton_get_state (Led *object) 29018 { 29019 LedSkeleton *skeleton = LED_SKELETON (object); 29020 const gchar *value; 29021 g_mutex_lock (&skeleton->priv->lock); 29022 value = g_value_get_string (&(skeleton->priv->properties[2])); 29023 g_mutex_unlock (&skeleton->priv->lock); 29024 return value; 29025 } 29026 29027 static void 29028 led_skeleton_class_init (LedSkeletonClass *klass) 29029 { 29030 GObjectClass *gobject_class; 29031 GDBusInterfaceSkeletonClass *skeleton_class; 29032 29033 gobject_class = G_OBJECT_CLASS (klass); 29034 gobject_class->finalize = led_skeleton_finalize; 29035 gobject_class->get_property = led_skeleton_get_property; 29036 gobject_class->set_property = led_skeleton_set_property; 29037 gobject_class->notify = led_skeleton_notify; 29038 29039 29040 led_override_properties (gobject_class, 1); 29041 29042 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 29043 skeleton_class->get_info = led_skeleton_dbus_interface_get_info; 29044 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties; 29045 skeleton_class->flush = led_skeleton_dbus_interface_flush; 29046 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable; 29047 29048 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 29049 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate)); 29050 #endif 29051 } 29052 29053 static void 29054 led_skeleton_iface_init (LedIface *iface) 29055 { 29056 iface->get_color = led_skeleton_get_color; 29057 iface->get_function = led_skeleton_get_function; 29058 iface->get_state = led_skeleton_get_state; 29059 } 29060 29061 /** 29062 * led_skeleton_new: 29063 * 29064 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. 29065 * 29066 * Returns: (transfer full) (type LedSkeleton): The skeleton object. 29067 */ 29068 Led * 29069 led_skeleton_new (void) 29070 { 29071 return LED (g_object_new (TYPE_LED_SKELETON, NULL)); 29072 } 29073 29074 /* ------------------------------------------------------------------------ 29075 * Code for interface org.openbmc.HostIpmi 29076 * ------------------------------------------------------------------------ 29077 */ 29078 29079 /** 29080 * SECTION:HostIpmi 29081 * @title: HostIpmi 29082 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface 29083 * 29084 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface in C. 29085 */ 29086 29087 /* ---- Introspection data for org.openbmc.HostIpmi ---- */ 29088 29089 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq = 29090 { 29091 { 29092 -1, 29093 (gchar *) "seq", 29094 (gchar *) "y", 29095 NULL 29096 }, 29097 FALSE 29098 }; 29099 29100 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn = 29101 { 29102 { 29103 -1, 29104 (gchar *) "netfn", 29105 (gchar *) "y", 29106 NULL 29107 }, 29108 FALSE 29109 }; 29110 29111 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd = 29112 { 29113 { 29114 -1, 29115 (gchar *) "cmd", 29116 (gchar *) "y", 29117 NULL 29118 }, 29119 FALSE 29120 }; 29121 29122 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data = 29123 { 29124 { 29125 -1, 29126 (gchar *) "data", 29127 (gchar *) "ay", 29128 NULL 29129 }, 29130 FALSE 29131 }; 29132 29133 static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] = 29134 { 29135 &_host_ipmi_method_info_send_message_IN_ARG_seq, 29136 &_host_ipmi_method_info_send_message_IN_ARG_netfn, 29137 &_host_ipmi_method_info_send_message_IN_ARG_cmd, 29138 &_host_ipmi_method_info_send_message_IN_ARG_data, 29139 NULL 29140 }; 29141 29142 static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 = 29143 { 29144 { 29145 -1, 29146 (gchar *) "unnamed_arg4", 29147 (gchar *) "x", 29148 NULL 29149 }, 29150 FALSE 29151 }; 29152 29153 static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] = 29154 { 29155 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4, 29156 NULL 29157 }; 29158 29159 static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message = 29160 { 29161 { 29162 -1, 29163 (gchar *) "sendMessage", 29164 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers, 29165 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers, 29166 NULL 29167 }, 29168 "handle-send-message", 29169 FALSE 29170 }; 29171 29172 static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] = 29173 { 29174 &_host_ipmi_method_info_send_message, 29175 NULL 29176 }; 29177 29178 static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq = 29179 { 29180 { 29181 -1, 29182 (gchar *) "seq", 29183 (gchar *) "y", 29184 NULL 29185 }, 29186 FALSE 29187 }; 29188 29189 static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn = 29190 { 29191 { 29192 -1, 29193 (gchar *) "netfn", 29194 (gchar *) "y", 29195 NULL 29196 }, 29197 FALSE 29198 }; 29199 29200 static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd = 29201 { 29202 { 29203 -1, 29204 (gchar *) "cmd", 29205 (gchar *) "y", 29206 NULL 29207 }, 29208 FALSE 29209 }; 29210 29211 static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data = 29212 { 29213 { 29214 -1, 29215 (gchar *) "data", 29216 (gchar *) "ay", 29217 NULL 29218 }, 29219 FALSE 29220 }; 29221 29222 static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] = 29223 { 29224 &_host_ipmi_signal_info_received_message_ARG_seq, 29225 &_host_ipmi_signal_info_received_message_ARG_netfn, 29226 &_host_ipmi_signal_info_received_message_ARG_cmd, 29227 &_host_ipmi_signal_info_received_message_ARG_data, 29228 NULL 29229 }; 29230 29231 static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message = 29232 { 29233 { 29234 -1, 29235 (gchar *) "ReceivedMessage", 29236 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers, 29237 NULL 29238 }, 29239 "received-message" 29240 }; 29241 29242 static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] = 29243 { 29244 &_host_ipmi_signal_info_received_message, 29245 NULL 29246 }; 29247 29248 static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info = 29249 { 29250 { 29251 -1, 29252 (gchar *) "org.openbmc.HostIpmi", 29253 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers, 29254 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers, 29255 NULL, 29256 NULL 29257 }, 29258 "host-ipmi", 29259 }; 29260 29261 29262 /** 29263 * host_ipmi_interface_info: 29264 * 29265 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface. 29266 * 29267 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. 29268 */ 29269 GDBusInterfaceInfo * 29270 host_ipmi_interface_info (void) 29271 { 29272 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct; 29273 } 29274 29275 /** 29276 * host_ipmi_override_properties: 29277 * @klass: The class structure for a #GObject<!-- -->-derived class. 29278 * @property_id_begin: The property id to assign to the first overridden property. 29279 * 29280 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class. 29281 * The properties are overridden in the order they are defined. 29282 * 29283 * Returns: The last property id. 29284 */ 29285 guint 29286 host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin) 29287 { 29288 return property_id_begin - 1; 29289 } 29290 29291 29292 29293 /** 29294 * HostIpmi: 29295 * 29296 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. 29297 */ 29298 29299 /** 29300 * HostIpmiIface: 29301 * @parent_iface: The parent interface. 29302 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal. 29303 * @received_message: Handler for the #HostIpmi::received-message signal. 29304 * 29305 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. 29306 */ 29307 29308 typedef HostIpmiIface HostIpmiInterface; 29309 G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT); 29310 29311 static void 29312 host_ipmi_default_init (HostIpmiIface *iface) 29313 { 29314 /* GObject signals for incoming D-Bus method calls: */ 29315 /** 29316 * HostIpmi::handle-send-message: 29317 * @object: A #HostIpmi. 29318 * @invocation: A #GDBusMethodInvocation. 29319 * @arg_seq: Argument passed by remote caller. 29320 * @arg_netfn: Argument passed by remote caller. 29321 * @arg_cmd: Argument passed by remote caller. 29322 * @arg_data: Argument passed by remote caller. 29323 * 29324 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method. 29325 * 29326 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call host_ipmi_complete_send_message() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. 29327 * 29328 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. 29329 */ 29330 g_signal_new ("handle-send-message", 29331 G_TYPE_FROM_INTERFACE (iface), 29332 G_SIGNAL_RUN_LAST, 29333 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message), 29334 g_signal_accumulator_true_handled, 29335 NULL, 29336 g_cclosure_marshal_generic, 29337 G_TYPE_BOOLEAN, 29338 5, 29339 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING); 29340 29341 /* GObject signals for received D-Bus signals: */ 29342 /** 29343 * HostIpmi::received-message: 29344 * @object: A #HostIpmi. 29345 * @arg_seq: Argument. 29346 * @arg_netfn: Argument. 29347 * @arg_cmd: Argument. 29348 * @arg_data: Argument. 29349 * 29350 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> is received. 29351 * 29352 * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. 29353 */ 29354 g_signal_new ("received-message", 29355 G_TYPE_FROM_INTERFACE (iface), 29356 G_SIGNAL_RUN_LAST, 29357 G_STRUCT_OFFSET (HostIpmiIface, received_message), 29358 NULL, 29359 NULL, 29360 g_cclosure_marshal_generic, 29361 G_TYPE_NONE, 29362 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING); 29363 29364 } 29365 29366 /** 29367 * host_ipmi_emit_received_message: 29368 * @object: A #HostIpmi. 29369 * @arg_seq: Argument to pass with the signal. 29370 * @arg_netfn: Argument to pass with the signal. 29371 * @arg_cmd: Argument to pass with the signal. 29372 * @arg_data: Argument to pass with the signal. 29373 * 29374 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal. 29375 */ 29376 void 29377 host_ipmi_emit_received_message ( 29378 HostIpmi *object, 29379 guchar arg_seq, 29380 guchar arg_netfn, 29381 guchar arg_cmd, 29382 const gchar *arg_data) 29383 { 29384 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data); 29385 } 29386 29387 /** 29388 * host_ipmi_call_send_message: 29389 * @proxy: A #HostIpmiProxy. 29390 * @arg_seq: Argument to pass with the method invocation. 29391 * @arg_netfn: Argument to pass with the method invocation. 29392 * @arg_cmd: Argument to pass with the method invocation. 29393 * @arg_data: Argument to pass with the method invocation. 29394 * @cancellable: (allow-none): A #GCancellable or %NULL. 29395 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. 29396 * @user_data: User data to pass to @callback. 29397 * 29398 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. 29399 * 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. 29400 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation. 29401 * 29402 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method. 29403 */ 29404 void 29405 host_ipmi_call_send_message ( 29406 HostIpmi *proxy, 29407 guchar arg_seq, 29408 guchar arg_netfn, 29409 guchar arg_cmd, 29410 const gchar *arg_data, 29411 GCancellable *cancellable, 29412 GAsyncReadyCallback callback, 29413 gpointer user_data) 29414 { 29415 g_dbus_proxy_call (G_DBUS_PROXY (proxy), 29416 "sendMessage", 29417 g_variant_new ("(yyy^ay)", 29418 arg_seq, 29419 arg_netfn, 29420 arg_cmd, 29421 arg_data), 29422 G_DBUS_CALL_FLAGS_NONE, 29423 -1, 29424 cancellable, 29425 callback, 29426 user_data); 29427 } 29428 29429 /** 29430 * host_ipmi_call_send_message_finish: 29431 * @proxy: A #HostIpmiProxy. 29432 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore. 29433 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message(). 29434 * @error: Return location for error or %NULL. 29435 * 29436 * Finishes an operation started with host_ipmi_call_send_message(). 29437 * 29438 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 29439 */ 29440 gboolean 29441 host_ipmi_call_send_message_finish ( 29442 HostIpmi *proxy, 29443 gint64 *out_unnamed_arg4, 29444 GAsyncResult *res, 29445 GError **error) 29446 { 29447 GVariant *_ret; 29448 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); 29449 if (_ret == NULL) 29450 goto _out; 29451 g_variant_get (_ret, 29452 "(x)", 29453 out_unnamed_arg4); 29454 g_variant_unref (_ret); 29455 _out: 29456 return _ret != NULL; 29457 } 29458 29459 /** 29460 * host_ipmi_call_send_message_sync: 29461 * @proxy: A #HostIpmiProxy. 29462 * @arg_seq: Argument to pass with the method invocation. 29463 * @arg_netfn: Argument to pass with the method invocation. 29464 * @arg_cmd: Argument to pass with the method invocation. 29465 * @arg_data: Argument to pass with the method invocation. 29466 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore. 29467 * @cancellable: (allow-none): A #GCancellable or %NULL. 29468 * @error: Return location for error or %NULL. 29469 * 29470 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. 29471 * 29472 * See host_ipmi_call_send_message() for the asynchronous version of this method. 29473 * 29474 * Returns: (skip): %TRUE if the call succeeded, %FALSE if @error is set. 29475 */ 29476 gboolean 29477 host_ipmi_call_send_message_sync ( 29478 HostIpmi *proxy, 29479 guchar arg_seq, 29480 guchar arg_netfn, 29481 guchar arg_cmd, 29482 const gchar *arg_data, 29483 gint64 *out_unnamed_arg4, 29484 GCancellable *cancellable, 29485 GError **error) 29486 { 29487 GVariant *_ret; 29488 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), 29489 "sendMessage", 29490 g_variant_new ("(yyy^ay)", 29491 arg_seq, 29492 arg_netfn, 29493 arg_cmd, 29494 arg_data), 29495 G_DBUS_CALL_FLAGS_NONE, 29496 -1, 29497 cancellable, 29498 error); 29499 if (_ret == NULL) 29500 goto _out; 29501 g_variant_get (_ret, 29502 "(x)", 29503 out_unnamed_arg4); 29504 g_variant_unref (_ret); 29505 _out: 29506 return _ret != NULL; 29507 } 29508 29509 /** 29510 * host_ipmi_complete_send_message: 29511 * @object: A #HostIpmi. 29512 * @invocation: (transfer full): A #GDBusMethodInvocation. 29513 * @unnamed_arg4: Parameter to return. 29514 * 29515 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. 29516 * 29517 * This method will free @invocation, you cannot use it afterwards. 29518 */ 29519 void 29520 host_ipmi_complete_send_message ( 29521 HostIpmi *object, 29522 GDBusMethodInvocation *invocation, 29523 gint64 unnamed_arg4) 29524 { 29525 g_dbus_method_invocation_return_value (invocation, 29526 g_variant_new ("(x)", 29527 unnamed_arg4)); 29528 } 29529 29530 /* ------------------------------------------------------------------------ */ 29531 29532 /** 29533 * HostIpmiProxy: 29534 * 29535 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API. 29536 */ 29537 29538 /** 29539 * HostIpmiProxyClass: 29540 * @parent_class: The parent class. 29541 * 29542 * Class structure for #HostIpmiProxy. 29543 */ 29544 29545 struct _HostIpmiProxyPrivate 29546 { 29547 GData *qdata; 29548 }; 29549 29550 static void host_ipmi_proxy_iface_init (HostIpmiIface *iface); 29551 29552 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 29553 G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY, 29554 G_ADD_PRIVATE (HostIpmiProxy) 29555 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init)); 29556 29557 #else 29558 G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY, 29559 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init)); 29560 29561 #endif 29562 static void 29563 host_ipmi_proxy_finalize (GObject *object) 29564 { 29565 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object); 29566 g_datalist_clear (&proxy->priv->qdata); 29567 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object); 29568 } 29569 29570 static void 29571 host_ipmi_proxy_get_property (GObject *object, 29572 guint prop_id, 29573 GValue *value, 29574 GParamSpec *pspec G_GNUC_UNUSED) 29575 { 29576 } 29577 29578 static void 29579 host_ipmi_proxy_set_property (GObject *object, 29580 guint prop_id, 29581 const GValue *value, 29582 GParamSpec *pspec G_GNUC_UNUSED) 29583 { 29584 } 29585 29586 static void 29587 host_ipmi_proxy_g_signal (GDBusProxy *proxy, 29588 const gchar *sender_name G_GNUC_UNUSED, 29589 const gchar *signal_name, 29590 GVariant *parameters) 29591 { 29592 _ExtendedGDBusSignalInfo *info; 29593 GVariantIter iter; 29594 GVariant *child; 29595 GValue *paramv; 29596 guint num_params; 29597 guint n; 29598 guint signal_id; 29599 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name); 29600 if (info == NULL) 29601 return; 29602 num_params = g_variant_n_children (parameters); 29603 paramv = g_new0 (GValue, num_params + 1); 29604 g_value_init (¶mv[0], TYPE_HOST_IPMI); 29605 g_value_set_object (¶mv[0], proxy); 29606 g_variant_iter_init (&iter, parameters); 29607 n = 1; 29608 while ((child = g_variant_iter_next_value (&iter)) != NULL) 29609 { 29610 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; 29611 if (arg_info->use_gvariant) 29612 { 29613 g_value_init (¶mv[n], G_TYPE_VARIANT); 29614 g_value_set_variant (¶mv[n], child); 29615 n++; 29616 } 29617 else 29618 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 29619 g_variant_unref (child); 29620 } 29621 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI); 29622 g_signal_emitv (paramv, signal_id, 0, NULL); 29623 for (n = 0; n < num_params + 1; n++) 29624 g_value_unset (¶mv[n]); 29625 g_free (paramv); 29626 } 29627 29628 static void 29629 host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy, 29630 GVariant *changed_properties, 29631 const gchar *const *invalidated_properties) 29632 { 29633 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy); 29634 guint n; 29635 const gchar *key; 29636 GVariantIter *iter; 29637 _ExtendedGDBusPropertyInfo *info; 29638 g_variant_get (changed_properties, "a{sv}", &iter); 29639 while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) 29640 { 29641 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key); 29642 g_datalist_remove_data (&proxy->priv->qdata, key); 29643 if (info != NULL) 29644 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 29645 } 29646 g_variant_iter_free (iter); 29647 for (n = 0; invalidated_properties[n] != NULL; n++) 29648 { 29649 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]); 29650 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); 29651 if (info != NULL) 29652 g_object_notify (G_OBJECT (proxy), info->hyphen_name); 29653 } 29654 } 29655 29656 static void 29657 host_ipmi_proxy_init (HostIpmiProxy *proxy) 29658 { 29659 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 29660 proxy->priv = host_ipmi_proxy_get_instance_private (proxy); 29661 #else 29662 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate); 29663 #endif 29664 29665 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ()); 29666 } 29667 29668 static void 29669 host_ipmi_proxy_class_init (HostIpmiProxyClass *klass) 29670 { 29671 GObjectClass *gobject_class; 29672 GDBusProxyClass *proxy_class; 29673 29674 gobject_class = G_OBJECT_CLASS (klass); 29675 gobject_class->finalize = host_ipmi_proxy_finalize; 29676 gobject_class->get_property = host_ipmi_proxy_get_property; 29677 gobject_class->set_property = host_ipmi_proxy_set_property; 29678 29679 proxy_class = G_DBUS_PROXY_CLASS (klass); 29680 proxy_class->g_signal = host_ipmi_proxy_g_signal; 29681 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed; 29682 29683 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 29684 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate)); 29685 #endif 29686 } 29687 29688 static void 29689 host_ipmi_proxy_iface_init (HostIpmiIface *iface) 29690 { 29691 } 29692 29693 /** 29694 * host_ipmi_proxy_new: 29695 * @connection: A #GDBusConnection. 29696 * @flags: Flags from the #GDBusProxyFlags enumeration. 29697 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 29698 * @object_path: An object path. 29699 * @cancellable: (allow-none): A #GCancellable or %NULL. 29700 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 29701 * @user_data: User data to pass to @callback. 29702 * 29703 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new() for more details. 29704 * 29705 * 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. 29706 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation. 29707 * 29708 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor. 29709 */ 29710 void 29711 host_ipmi_proxy_new ( 29712 GDBusConnection *connection, 29713 GDBusProxyFlags flags, 29714 const gchar *name, 29715 const gchar *object_path, 29716 GCancellable *cancellable, 29717 GAsyncReadyCallback callback, 29718 gpointer user_data) 29719 { 29720 g_async_initable_new_async (TYPE_HOST_IPMI_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL); 29721 } 29722 29723 /** 29724 * host_ipmi_proxy_new_finish: 29725 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new(). 29726 * @error: Return location for error or %NULL 29727 * 29728 * Finishes an operation started with host_ipmi_proxy_new(). 29729 * 29730 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. 29731 */ 29732 HostIpmi * 29733 host_ipmi_proxy_new_finish ( 29734 GAsyncResult *res, 29735 GError **error) 29736 { 29737 GObject *ret; 29738 GObject *source_object; 29739 source_object = g_async_result_get_source_object (res); 29740 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 29741 g_object_unref (source_object); 29742 if (ret != NULL) 29743 return HOST_IPMI (ret); 29744 else 29745 return NULL; 29746 } 29747 29748 /** 29749 * host_ipmi_proxy_new_sync: 29750 * @connection: A #GDBusConnection. 29751 * @flags: Flags from the #GDBusProxyFlags enumeration. 29752 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 29753 * @object_path: An object path. 29754 * @cancellable: (allow-none): A #GCancellable or %NULL. 29755 * @error: Return location for error or %NULL 29756 * 29757 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new_sync() for more details. 29758 * 29759 * The calling thread is blocked until a reply is received. 29760 * 29761 * See host_ipmi_proxy_new() for the asynchronous version of this constructor. 29762 * 29763 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. 29764 */ 29765 HostIpmi * 29766 host_ipmi_proxy_new_sync ( 29767 GDBusConnection *connection, 29768 GDBusProxyFlags flags, 29769 const gchar *name, 29770 const gchar *object_path, 29771 GCancellable *cancellable, 29772 GError **error) 29773 { 29774 GInitable *ret; 29775 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL); 29776 if (ret != NULL) 29777 return HOST_IPMI (ret); 29778 else 29779 return NULL; 29780 } 29781 29782 29783 /** 29784 * host_ipmi_proxy_new_for_bus: 29785 * @bus_type: A #GBusType. 29786 * @flags: Flags from the #GDBusProxyFlags enumeration. 29787 * @name: A bus name (well-known or unique). 29788 * @object_path: An object path. 29789 * @cancellable: (allow-none): A #GCancellable or %NULL. 29790 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 29791 * @user_data: User data to pass to @callback. 29792 * 29793 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection. 29794 * 29795 * 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. 29796 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation. 29797 * 29798 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. 29799 */ 29800 void 29801 host_ipmi_proxy_new_for_bus ( 29802 GBusType bus_type, 29803 GDBusProxyFlags flags, 29804 const gchar *name, 29805 const gchar *object_path, 29806 GCancellable *cancellable, 29807 GAsyncReadyCallback callback, 29808 gpointer user_data) 29809 { 29810 g_async_initable_new_async (TYPE_HOST_IPMI_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL); 29811 } 29812 29813 /** 29814 * host_ipmi_proxy_new_for_bus_finish: 29815 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus(). 29816 * @error: Return location for error or %NULL 29817 * 29818 * Finishes an operation started with host_ipmi_proxy_new_for_bus(). 29819 * 29820 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. 29821 */ 29822 HostIpmi * 29823 host_ipmi_proxy_new_for_bus_finish ( 29824 GAsyncResult *res, 29825 GError **error) 29826 { 29827 GObject *ret; 29828 GObject *source_object; 29829 source_object = g_async_result_get_source_object (res); 29830 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 29831 g_object_unref (source_object); 29832 if (ret != NULL) 29833 return HOST_IPMI (ret); 29834 else 29835 return NULL; 29836 } 29837 29838 /** 29839 * host_ipmi_proxy_new_for_bus_sync: 29840 * @bus_type: A #GBusType. 29841 * @flags: Flags from the #GDBusProxyFlags enumeration. 29842 * @name: A bus name (well-known or unique). 29843 * @object_path: An object path. 29844 * @cancellable: (allow-none): A #GCancellable or %NULL. 29845 * @error: Return location for error or %NULL 29846 * 29847 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. 29848 * 29849 * The calling thread is blocked until a reply is received. 29850 * 29851 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor. 29852 * 29853 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set. 29854 */ 29855 HostIpmi * 29856 host_ipmi_proxy_new_for_bus_sync ( 29857 GBusType bus_type, 29858 GDBusProxyFlags flags, 29859 const gchar *name, 29860 const gchar *object_path, 29861 GCancellable *cancellable, 29862 GError **error) 29863 { 29864 GInitable *ret; 29865 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL); 29866 if (ret != NULL) 29867 return HOST_IPMI (ret); 29868 else 29869 return NULL; 29870 } 29871 29872 29873 /* ------------------------------------------------------------------------ */ 29874 29875 /** 29876 * HostIpmiSkeleton: 29877 * 29878 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API. 29879 */ 29880 29881 /** 29882 * HostIpmiSkeletonClass: 29883 * @parent_class: The parent class. 29884 * 29885 * Class structure for #HostIpmiSkeleton. 29886 */ 29887 29888 struct _HostIpmiSkeletonPrivate 29889 { 29890 GValue *properties; 29891 GList *changed_properties; 29892 GSource *changed_properties_idle_source; 29893 GMainContext *context; 29894 GMutex lock; 29895 }; 29896 29897 static void 29898 _host_ipmi_skeleton_handle_method_call ( 29899 GDBusConnection *connection G_GNUC_UNUSED, 29900 const gchar *sender G_GNUC_UNUSED, 29901 const gchar *object_path G_GNUC_UNUSED, 29902 const gchar *interface_name, 29903 const gchar *method_name, 29904 GVariant *parameters, 29905 GDBusMethodInvocation *invocation, 29906 gpointer user_data) 29907 { 29908 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); 29909 _ExtendedGDBusMethodInfo *info; 29910 GVariantIter iter; 29911 GVariant *child; 29912 GValue *paramv; 29913 guint num_params; 29914 guint num_extra; 29915 guint n; 29916 guint signal_id; 29917 GValue return_value = G_VALUE_INIT; 29918 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); 29919 g_assert (info != NULL); 29920 num_params = g_variant_n_children (parameters); 29921 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); 29922 n = 0; 29923 g_value_init (¶mv[n], TYPE_HOST_IPMI); 29924 g_value_set_object (¶mv[n++], skeleton); 29925 g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); 29926 g_value_set_object (¶mv[n++], invocation); 29927 if (info->pass_fdlist) 29928 { 29929 #ifdef G_OS_UNIX 29930 g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); 29931 g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); 29932 #else 29933 g_assert_not_reached (); 29934 #endif 29935 } 29936 g_variant_iter_init (&iter, parameters); 29937 while ((child = g_variant_iter_next_value (&iter)) != NULL) 29938 { 29939 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; 29940 if (arg_info->use_gvariant) 29941 { 29942 g_value_init (¶mv[n], G_TYPE_VARIANT); 29943 g_value_set_variant (¶mv[n], child); 29944 n++; 29945 } 29946 else 29947 g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); 29948 g_variant_unref (child); 29949 } 29950 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI); 29951 g_value_init (&return_value, G_TYPE_BOOLEAN); 29952 g_signal_emitv (paramv, signal_id, 0, &return_value); 29953 if (!g_value_get_boolean (&return_value)) 29954 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); 29955 g_value_unset (&return_value); 29956 for (n = 0; n < num_params + num_extra; n++) 29957 g_value_unset (¶mv[n]); 29958 g_free (paramv); 29959 } 29960 29961 static GVariant * 29962 _host_ipmi_skeleton_handle_get_property ( 29963 GDBusConnection *connection G_GNUC_UNUSED, 29964 const gchar *sender G_GNUC_UNUSED, 29965 const gchar *object_path G_GNUC_UNUSED, 29966 const gchar *interface_name G_GNUC_UNUSED, 29967 const gchar *property_name, 29968 GError **error, 29969 gpointer user_data) 29970 { 29971 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); 29972 GValue value = G_VALUE_INIT; 29973 GParamSpec *pspec; 29974 _ExtendedGDBusPropertyInfo *info; 29975 GVariant *ret; 29976 ret = NULL; 29977 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name); 29978 g_assert (info != NULL); 29979 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 29980 if (pspec == NULL) 29981 { 29982 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 29983 } 29984 else 29985 { 29986 g_value_init (&value, pspec->value_type); 29987 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); 29988 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); 29989 g_value_unset (&value); 29990 } 29991 return ret; 29992 } 29993 29994 static gboolean 29995 _host_ipmi_skeleton_handle_set_property ( 29996 GDBusConnection *connection G_GNUC_UNUSED, 29997 const gchar *sender G_GNUC_UNUSED, 29998 const gchar *object_path G_GNUC_UNUSED, 29999 const gchar *interface_name G_GNUC_UNUSED, 30000 const gchar *property_name, 30001 GVariant *variant, 30002 GError **error, 30003 gpointer user_data) 30004 { 30005 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data); 30006 GValue value = G_VALUE_INIT; 30007 GParamSpec *pspec; 30008 _ExtendedGDBusPropertyInfo *info; 30009 gboolean ret; 30010 ret = FALSE; 30011 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name); 30012 g_assert (info != NULL); 30013 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); 30014 if (pspec == NULL) 30015 { 30016 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); 30017 } 30018 else 30019 { 30020 if (info->use_gvariant) 30021 g_value_set_variant (&value, variant); 30022 else 30023 g_dbus_gvariant_to_gvalue (variant, &value); 30024 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); 30025 g_value_unset (&value); 30026 ret = TRUE; 30027 } 30028 return ret; 30029 } 30030 30031 static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable = 30032 { 30033 _host_ipmi_skeleton_handle_method_call, 30034 _host_ipmi_skeleton_handle_get_property, 30035 _host_ipmi_skeleton_handle_set_property, 30036 {NULL} 30037 }; 30038 30039 static GDBusInterfaceInfo * 30040 host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 30041 { 30042 return host_ipmi_interface_info (); 30043 } 30044 30045 static GDBusInterfaceVTable * 30046 host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) 30047 { 30048 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable; 30049 } 30050 30051 static GVariant * 30052 host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) 30053 { 30054 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton); 30055 30056 GVariantBuilder builder; 30057 guint n; 30058 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); 30059 if (_host_ipmi_interface_info.parent_struct.properties == NULL) 30060 goto out; 30061 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++) 30062 { 30063 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n]; 30064 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) 30065 { 30066 GVariant *value; 30067 value = _host_ipmi_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", info->name, NULL, skeleton); 30068 if (value != NULL) 30069 { 30070 g_variant_take_ref (value); 30071 g_variant_builder_add (&builder, "{sv}", info->name, value); 30072 g_variant_unref (value); 30073 } 30074 } 30075 } 30076 out: 30077 return g_variant_builder_end (&builder); 30078 } 30079 30080 static void 30081 host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) 30082 { 30083 } 30084 30085 static void 30086 _host_ipmi_on_signal_received_message ( 30087 HostIpmi *object, 30088 guchar arg_seq, 30089 guchar arg_netfn, 30090 guchar arg_cmd, 30091 const gchar *arg_data) 30092 { 30093 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object); 30094 30095 GList *connections, *l; 30096 GVariant *signal_variant; 30097 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); 30098 30099 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)", 30100 arg_seq, 30101 arg_netfn, 30102 arg_cmd, 30103 arg_data)); 30104 for (l = connections; l != NULL; l = l->next) 30105 { 30106 GDBusConnection *connection = l->data; 30107 g_dbus_connection_emit_signal (connection, 30108 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage", 30109 signal_variant, NULL); 30110 } 30111 g_variant_unref (signal_variant); 30112 g_list_free_full (connections, g_object_unref); 30113 } 30114 30115 static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface); 30116 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 30117 G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 30118 G_ADD_PRIVATE (HostIpmiSkeleton) 30119 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init)); 30120 30121 #else 30122 G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, 30123 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init)); 30124 30125 #endif 30126 static void 30127 host_ipmi_skeleton_finalize (GObject *object) 30128 { 30129 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object); 30130 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); 30131 if (skeleton->priv->changed_properties_idle_source != NULL) 30132 g_source_destroy (skeleton->priv->changed_properties_idle_source); 30133 g_main_context_unref (skeleton->priv->context); 30134 g_mutex_clear (&skeleton->priv->lock); 30135 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object); 30136 } 30137 30138 static void 30139 host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton) 30140 { 30141 #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 30142 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton); 30143 #else 30144 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate); 30145 #endif 30146 30147 g_mutex_init (&skeleton->priv->lock); 30148 skeleton->priv->context = g_main_context_ref_thread_default (); 30149 } 30150 30151 static void 30152 host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass) 30153 { 30154 GObjectClass *gobject_class; 30155 GDBusInterfaceSkeletonClass *skeleton_class; 30156 30157 gobject_class = G_OBJECT_CLASS (klass); 30158 gobject_class->finalize = host_ipmi_skeleton_finalize; 30159 30160 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); 30161 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info; 30162 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties; 30163 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush; 30164 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable; 30165 30166 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 30167 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate)); 30168 #endif 30169 } 30170 30171 static void 30172 host_ipmi_skeleton_iface_init (HostIpmiIface *iface) 30173 { 30174 iface->received_message = _host_ipmi_on_signal_received_message; 30175 } 30176 30177 /** 30178 * host_ipmi_skeleton_new: 30179 * 30180 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. 30181 * 30182 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object. 30183 */ 30184 HostIpmi * 30185 host_ipmi_skeleton_new (void) 30186 { 30187 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL)); 30188 } 30189 30190 /* ------------------------------------------------------------------------ 30191 * Code for Object, ObjectProxy and ObjectSkeleton 30192 * ------------------------------------------------------------------------ 30193 */ 30194 30195 /** 30196 * SECTION:Object 30197 * @title: Object 30198 * @short_description: Specialized GDBusObject types 30199 * 30200 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. 30201 */ 30202 30203 /** 30204 * Object: 30205 * 30206 * The #Object type is a specialized container of interfaces. 30207 */ 30208 30209 /** 30210 * ObjectIface: 30211 * @parent_iface: The parent interface. 30212 * 30213 * Virtual table for the #Object interface. 30214 */ 30215 30216 typedef ObjectIface ObjectInterface; 30217 G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); 30218 30219 static void 30220 object_default_init (ObjectIface *iface) 30221 { 30222 /** 30223 * Object:hwmon: 30224 * 30225 * The #Hwmon instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>, if any. 30226 * 30227 * Connect to the #GObject::notify signal to get informed of property changes. 30228 */ 30229 g_object_interface_install_property (iface, g_param_spec_object ("hwmon", "hwmon", "hwmon", TYPE_HWMON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30230 30231 /** 30232 * Object:fan: 30233 * 30234 * The #Fan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>, if any. 30235 * 30236 * Connect to the #GObject::notify signal to get informed of property changes. 30237 */ 30238 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30239 30240 /** 30241 * Object:sensor-value: 30242 * 30243 * The #SensorValue instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>, if any. 30244 * 30245 * Connect to the #GObject::notify signal to get informed of property changes. 30246 */ 30247 g_object_interface_install_property (iface, g_param_spec_object ("sensor-value", "sensor-value", "sensor-value", TYPE_SENSOR_VALUE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30248 30249 /** 30250 * Object:sensor-threshold: 30251 * 30252 * The #SensorThreshold instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>, if any. 30253 * 30254 * Connect to the #GObject::notify signal to get informed of property changes. 30255 */ 30256 g_object_interface_install_property (iface, g_param_spec_object ("sensor-threshold", "sensor-threshold", "sensor-threshold", TYPE_SENSOR_THRESHOLD, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30257 30258 /** 30259 * Object:sensor-i2c: 30260 * 30261 * The #SensorI2c instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>, if any. 30262 * 30263 * Connect to the #GObject::notify signal to get informed of property changes. 30264 */ 30265 g_object_interface_install_property (iface, g_param_spec_object ("sensor-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30266 30267 /** 30268 * Object:sensor-match: 30269 * 30270 * The #SensorMatch instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>, if any. 30271 * 30272 * Connect to the #GObject::notify signal to get informed of property changes. 30273 */ 30274 g_object_interface_install_property (iface, g_param_spec_object ("sensor-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30275 30276 /** 30277 * Object:process: 30278 * 30279 * The #Process instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>, if any. 30280 * 30281 * Connect to the #GObject::notify signal to get informed of property changes. 30282 */ 30283 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30284 30285 /** 30286 * Object:shared-resource: 30287 * 30288 * The #SharedResource instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>, if any. 30289 * 30290 * Connect to the #GObject::notify signal to get informed of property changes. 30291 */ 30292 g_object_interface_install_property (iface, g_param_spec_object ("shared-resource", "shared-resource", "shared-resource", TYPE_SHARED_RESOURCE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30293 30294 /** 30295 * Object:control: 30296 * 30297 * The #Control instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>, if any. 30298 * 30299 * Connect to the #GObject::notify signal to get informed of property changes. 30300 */ 30301 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30302 30303 /** 30304 * Object:control-bmc: 30305 * 30306 * The #ControlBmc instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>, if any. 30307 * 30308 * Connect to the #GObject::notify signal to get informed of property changes. 30309 */ 30310 g_object_interface_install_property (iface, g_param_spec_object ("control-bmc", "control-bmc", "control-bmc", TYPE_CONTROL_BMC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30311 30312 /** 30313 * Object:control-host: 30314 * 30315 * The #ControlHost instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>, if any. 30316 * 30317 * Connect to the #GObject::notify signal to get informed of property changes. 30318 */ 30319 g_object_interface_install_property (iface, g_param_spec_object ("control-host", "control-host", "control-host", TYPE_CONTROL_HOST, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30320 30321 /** 30322 * Object:control-power: 30323 * 30324 * The #ControlPower instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>, if any. 30325 * 30326 * Connect to the #GObject::notify signal to get informed of property changes. 30327 */ 30328 g_object_interface_install_property (iface, g_param_spec_object ("control-power", "control-power", "control-power", TYPE_CONTROL_POWER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30329 30330 /** 30331 * Object:control-checkstop: 30332 * 30333 * The #ControlCheckstop instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>, if any. 30334 * 30335 * Connect to the #GObject::notify signal to get informed of property changes. 30336 */ 30337 g_object_interface_install_property (iface, g_param_spec_object ("control-checkstop", "control-checkstop", "control-checkstop", TYPE_CONTROL_CHECKSTOP, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30338 30339 /** 30340 * Object:watchdog: 30341 * 30342 * The #Watchdog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>, if any. 30343 * 30344 * Connect to the #GObject::notify signal to get informed of property changes. 30345 */ 30346 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30347 30348 /** 30349 * Object:event-log: 30350 * 30351 * The #EventLog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>, if any. 30352 * 30353 * Connect to the #GObject::notify signal to get informed of property changes. 30354 */ 30355 g_object_interface_install_property (iface, g_param_spec_object ("event-log", "event-log", "event-log", TYPE_EVENT_LOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30356 30357 /** 30358 * Object:flash: 30359 * 30360 * The #Flash instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>, if any. 30361 * 30362 * Connect to the #GObject::notify signal to get informed of property changes. 30363 */ 30364 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30365 30366 /** 30367 * Object:flash-control: 30368 * 30369 * The #FlashControl instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>, if any. 30370 * 30371 * Connect to the #GObject::notify signal to get informed of property changes. 30372 */ 30373 g_object_interface_install_property (iface, g_param_spec_object ("flash-control", "flash-control", "flash-control", TYPE_FLASH_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30374 30375 /** 30376 * Object:button: 30377 * 30378 * The #Button instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>, if any. 30379 * 30380 * Connect to the #GObject::notify signal to get informed of property changes. 30381 */ 30382 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30383 30384 /** 30385 * Object:led: 30386 * 30387 * 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. 30388 * 30389 * Connect to the #GObject::notify signal to get informed of property changes. 30390 */ 30391 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30392 30393 /** 30394 * Object:host-ipmi: 30395 * 30396 * The #HostIpmi instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>, if any. 30397 * 30398 * Connect to the #GObject::notify signal to get informed of property changes. 30399 */ 30400 g_object_interface_install_property (iface, g_param_spec_object ("host-ipmi", "host-ipmi", "host-ipmi", TYPE_HOST_IPMI, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); 30401 30402 } 30403 30404 /** 30405 * object_get_hwmon: 30406 * @object: A #Object. 30407 * 30408 * Gets the #Hwmon instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> on @object, if any. 30409 * 30410 * Returns: (transfer full): A #Hwmon that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30411 */ 30412 Hwmon *object_get_hwmon (Object *object) 30413 { 30414 GDBusInterface *ret; 30415 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon"); 30416 if (ret == NULL) 30417 return NULL; 30418 return HWMON (ret); 30419 } 30420 30421 /** 30422 * object_get_fan: 30423 * @object: A #Object. 30424 * 30425 * Gets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object, if any. 30426 * 30427 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30428 */ 30429 Fan *object_get_fan (Object *object) 30430 { 30431 GDBusInterface *ret; 30432 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); 30433 if (ret == NULL) 30434 return NULL; 30435 return FAN (ret); 30436 } 30437 30438 /** 30439 * object_get_sensor_value: 30440 * @object: A #Object. 30441 * 30442 * Gets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object, if any. 30443 * 30444 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30445 */ 30446 SensorValue *object_get_sensor_value (Object *object) 30447 { 30448 GDBusInterface *ret; 30449 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); 30450 if (ret == NULL) 30451 return NULL; 30452 return SENSOR_VALUE (ret); 30453 } 30454 30455 /** 30456 * object_get_sensor_threshold: 30457 * @object: A #Object. 30458 * 30459 * Gets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object, if any. 30460 * 30461 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30462 */ 30463 SensorThreshold *object_get_sensor_threshold (Object *object) 30464 { 30465 GDBusInterface *ret; 30466 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); 30467 if (ret == NULL) 30468 return NULL; 30469 return SENSOR_THRESHOLD (ret); 30470 } 30471 30472 /** 30473 * object_get_sensor_i2c: 30474 * @object: A #Object. 30475 * 30476 * Gets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object, if any. 30477 * 30478 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30479 */ 30480 SensorI2c *object_get_sensor_i2c (Object *object) 30481 { 30482 GDBusInterface *ret; 30483 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); 30484 if (ret == NULL) 30485 return NULL; 30486 return SENSOR_I2C (ret); 30487 } 30488 30489 /** 30490 * object_get_sensor_match: 30491 * @object: A #Object. 30492 * 30493 * Gets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object, if any. 30494 * 30495 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30496 */ 30497 SensorMatch *object_get_sensor_match (Object *object) 30498 { 30499 GDBusInterface *ret; 30500 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); 30501 if (ret == NULL) 30502 return NULL; 30503 return SENSOR_MATCH (ret); 30504 } 30505 30506 /** 30507 * object_get_process: 30508 * @object: A #Object. 30509 * 30510 * Gets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object, if any. 30511 * 30512 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30513 */ 30514 Process *object_get_process (Object *object) 30515 { 30516 GDBusInterface *ret; 30517 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); 30518 if (ret == NULL) 30519 return NULL; 30520 return PROCESS (ret); 30521 } 30522 30523 /** 30524 * object_get_shared_resource: 30525 * @object: A #Object. 30526 * 30527 * Gets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object, if any. 30528 * 30529 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30530 */ 30531 SharedResource *object_get_shared_resource (Object *object) 30532 { 30533 GDBusInterface *ret; 30534 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); 30535 if (ret == NULL) 30536 return NULL; 30537 return SHARED_RESOURCE (ret); 30538 } 30539 30540 /** 30541 * object_get_control: 30542 * @object: A #Object. 30543 * 30544 * Gets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object, if any. 30545 * 30546 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30547 */ 30548 Control *object_get_control (Object *object) 30549 { 30550 GDBusInterface *ret; 30551 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); 30552 if (ret == NULL) 30553 return NULL; 30554 return CONTROL (ret); 30555 } 30556 30557 /** 30558 * object_get_control_bmc: 30559 * @object: A #Object. 30560 * 30561 * Gets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object, if any. 30562 * 30563 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30564 */ 30565 ControlBmc *object_get_control_bmc (Object *object) 30566 { 30567 GDBusInterface *ret; 30568 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); 30569 if (ret == NULL) 30570 return NULL; 30571 return CONTROL_BMC (ret); 30572 } 30573 30574 /** 30575 * object_get_control_host: 30576 * @object: A #Object. 30577 * 30578 * Gets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object, if any. 30579 * 30580 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30581 */ 30582 ControlHost *object_get_control_host (Object *object) 30583 { 30584 GDBusInterface *ret; 30585 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); 30586 if (ret == NULL) 30587 return NULL; 30588 return CONTROL_HOST (ret); 30589 } 30590 30591 /** 30592 * object_get_control_power: 30593 * @object: A #Object. 30594 * 30595 * Gets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object, if any. 30596 * 30597 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30598 */ 30599 ControlPower *object_get_control_power (Object *object) 30600 { 30601 GDBusInterface *ret; 30602 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); 30603 if (ret == NULL) 30604 return NULL; 30605 return CONTROL_POWER (ret); 30606 } 30607 30608 /** 30609 * object_get_control_checkstop: 30610 * @object: A #Object. 30611 * 30612 * Gets the #ControlCheckstop instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> on @object, if any. 30613 * 30614 * Returns: (transfer full): A #ControlCheckstop that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30615 */ 30616 ControlCheckstop *object_get_control_checkstop (Object *object) 30617 { 30618 GDBusInterface *ret; 30619 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop"); 30620 if (ret == NULL) 30621 return NULL; 30622 return CONTROL_CHECKSTOP (ret); 30623 } 30624 30625 /** 30626 * object_get_watchdog: 30627 * @object: A #Object. 30628 * 30629 * Gets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object, if any. 30630 * 30631 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30632 */ 30633 Watchdog *object_get_watchdog (Object *object) 30634 { 30635 GDBusInterface *ret; 30636 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); 30637 if (ret == NULL) 30638 return NULL; 30639 return WATCHDOG (ret); 30640 } 30641 30642 /** 30643 * object_get_event_log: 30644 * @object: A #Object. 30645 * 30646 * Gets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object, if any. 30647 * 30648 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30649 */ 30650 EventLog *object_get_event_log (Object *object) 30651 { 30652 GDBusInterface *ret; 30653 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); 30654 if (ret == NULL) 30655 return NULL; 30656 return EVENT_LOG (ret); 30657 } 30658 30659 /** 30660 * object_get_flash: 30661 * @object: A #Object. 30662 * 30663 * Gets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object, if any. 30664 * 30665 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30666 */ 30667 Flash *object_get_flash (Object *object) 30668 { 30669 GDBusInterface *ret; 30670 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); 30671 if (ret == NULL) 30672 return NULL; 30673 return FLASH (ret); 30674 } 30675 30676 /** 30677 * object_get_flash_control: 30678 * @object: A #Object. 30679 * 30680 * Gets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object, if any. 30681 * 30682 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30683 */ 30684 FlashControl *object_get_flash_control (Object *object) 30685 { 30686 GDBusInterface *ret; 30687 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); 30688 if (ret == NULL) 30689 return NULL; 30690 return FLASH_CONTROL (ret); 30691 } 30692 30693 /** 30694 * object_get_button: 30695 * @object: A #Object. 30696 * 30697 * Gets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object, if any. 30698 * 30699 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30700 */ 30701 Button *object_get_button (Object *object) 30702 { 30703 GDBusInterface *ret; 30704 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); 30705 if (ret == NULL) 30706 return NULL; 30707 return BUTTON (ret); 30708 } 30709 30710 /** 30711 * object_get_led: 30712 * @object: A #Object. 30713 * 30714 * 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. 30715 * 30716 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30717 */ 30718 Led *object_get_led (Object *object) 30719 { 30720 GDBusInterface *ret; 30721 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); 30722 if (ret == NULL) 30723 return NULL; 30724 return LED (ret); 30725 } 30726 30727 /** 30728 * object_get_host_ipmi: 30729 * @object: A #Object. 30730 * 30731 * Gets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object, if any. 30732 * 30733 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface. 30734 */ 30735 HostIpmi *object_get_host_ipmi (Object *object) 30736 { 30737 GDBusInterface *ret; 30738 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); 30739 if (ret == NULL) 30740 return NULL; 30741 return HOST_IPMI (ret); 30742 } 30743 30744 30745 /** 30746 * object_peek_hwmon: (skip) 30747 * @object: A #Object. 30748 * 30749 * Like object_get_hwmon() but doesn't increase the reference count on the returned object. 30750 * 30751 * <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> 30752 * 30753 * Returns: (transfer none): A #Hwmon or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30754 */ 30755 Hwmon *object_peek_hwmon (Object *object) 30756 { 30757 GDBusInterface *ret; 30758 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon"); 30759 if (ret == NULL) 30760 return NULL; 30761 g_object_unref (ret); 30762 return HWMON (ret); 30763 } 30764 30765 /** 30766 * object_peek_fan: (skip) 30767 * @object: A #Object. 30768 * 30769 * Like object_get_fan() but doesn't increase the reference count on the returned object. 30770 * 30771 * <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> 30772 * 30773 * Returns: (transfer none): A #Fan or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30774 */ 30775 Fan *object_peek_fan (Object *object) 30776 { 30777 GDBusInterface *ret; 30778 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); 30779 if (ret == NULL) 30780 return NULL; 30781 g_object_unref (ret); 30782 return FAN (ret); 30783 } 30784 30785 /** 30786 * object_peek_sensor_value: (skip) 30787 * @object: A #Object. 30788 * 30789 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object. 30790 * 30791 * <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> 30792 * 30793 * Returns: (transfer none): A #SensorValue or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30794 */ 30795 SensorValue *object_peek_sensor_value (Object *object) 30796 { 30797 GDBusInterface *ret; 30798 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); 30799 if (ret == NULL) 30800 return NULL; 30801 g_object_unref (ret); 30802 return SENSOR_VALUE (ret); 30803 } 30804 30805 /** 30806 * object_peek_sensor_threshold: (skip) 30807 * @object: A #Object. 30808 * 30809 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object. 30810 * 30811 * <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> 30812 * 30813 * Returns: (transfer none): A #SensorThreshold or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30814 */ 30815 SensorThreshold *object_peek_sensor_threshold (Object *object) 30816 { 30817 GDBusInterface *ret; 30818 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); 30819 if (ret == NULL) 30820 return NULL; 30821 g_object_unref (ret); 30822 return SENSOR_THRESHOLD (ret); 30823 } 30824 30825 /** 30826 * object_peek_sensor_i2c: (skip) 30827 * @object: A #Object. 30828 * 30829 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object. 30830 * 30831 * <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> 30832 * 30833 * Returns: (transfer none): A #SensorI2c or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30834 */ 30835 SensorI2c *object_peek_sensor_i2c (Object *object) 30836 { 30837 GDBusInterface *ret; 30838 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); 30839 if (ret == NULL) 30840 return NULL; 30841 g_object_unref (ret); 30842 return SENSOR_I2C (ret); 30843 } 30844 30845 /** 30846 * object_peek_sensor_match: (skip) 30847 * @object: A #Object. 30848 * 30849 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object. 30850 * 30851 * <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> 30852 * 30853 * Returns: (transfer none): A #SensorMatch or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30854 */ 30855 SensorMatch *object_peek_sensor_match (Object *object) 30856 { 30857 GDBusInterface *ret; 30858 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); 30859 if (ret == NULL) 30860 return NULL; 30861 g_object_unref (ret); 30862 return SENSOR_MATCH (ret); 30863 } 30864 30865 /** 30866 * object_peek_process: (skip) 30867 * @object: A #Object. 30868 * 30869 * Like object_get_process() but doesn't increase the reference count on the returned object. 30870 * 30871 * <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> 30872 * 30873 * Returns: (transfer none): A #Process or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30874 */ 30875 Process *object_peek_process (Object *object) 30876 { 30877 GDBusInterface *ret; 30878 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); 30879 if (ret == NULL) 30880 return NULL; 30881 g_object_unref (ret); 30882 return PROCESS (ret); 30883 } 30884 30885 /** 30886 * object_peek_shared_resource: (skip) 30887 * @object: A #Object. 30888 * 30889 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object. 30890 * 30891 * <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> 30892 * 30893 * Returns: (transfer none): A #SharedResource or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30894 */ 30895 SharedResource *object_peek_shared_resource (Object *object) 30896 { 30897 GDBusInterface *ret; 30898 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); 30899 if (ret == NULL) 30900 return NULL; 30901 g_object_unref (ret); 30902 return SHARED_RESOURCE (ret); 30903 } 30904 30905 /** 30906 * object_peek_control: (skip) 30907 * @object: A #Object. 30908 * 30909 * Like object_get_control() but doesn't increase the reference count on the returned object. 30910 * 30911 * <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> 30912 * 30913 * Returns: (transfer none): A #Control or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30914 */ 30915 Control *object_peek_control (Object *object) 30916 { 30917 GDBusInterface *ret; 30918 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); 30919 if (ret == NULL) 30920 return NULL; 30921 g_object_unref (ret); 30922 return CONTROL (ret); 30923 } 30924 30925 /** 30926 * object_peek_control_bmc: (skip) 30927 * @object: A #Object. 30928 * 30929 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object. 30930 * 30931 * <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> 30932 * 30933 * Returns: (transfer none): A #ControlBmc or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30934 */ 30935 ControlBmc *object_peek_control_bmc (Object *object) 30936 { 30937 GDBusInterface *ret; 30938 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); 30939 if (ret == NULL) 30940 return NULL; 30941 g_object_unref (ret); 30942 return CONTROL_BMC (ret); 30943 } 30944 30945 /** 30946 * object_peek_control_host: (skip) 30947 * @object: A #Object. 30948 * 30949 * Like object_get_control_host() but doesn't increase the reference count on the returned object. 30950 * 30951 * <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> 30952 * 30953 * Returns: (transfer none): A #ControlHost or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30954 */ 30955 ControlHost *object_peek_control_host (Object *object) 30956 { 30957 GDBusInterface *ret; 30958 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); 30959 if (ret == NULL) 30960 return NULL; 30961 g_object_unref (ret); 30962 return CONTROL_HOST (ret); 30963 } 30964 30965 /** 30966 * object_peek_control_power: (skip) 30967 * @object: A #Object. 30968 * 30969 * Like object_get_control_power() but doesn't increase the reference count on the returned object. 30970 * 30971 * <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> 30972 * 30973 * Returns: (transfer none): A #ControlPower or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30974 */ 30975 ControlPower *object_peek_control_power (Object *object) 30976 { 30977 GDBusInterface *ret; 30978 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); 30979 if (ret == NULL) 30980 return NULL; 30981 g_object_unref (ret); 30982 return CONTROL_POWER (ret); 30983 } 30984 30985 /** 30986 * object_peek_control_checkstop: (skip) 30987 * @object: A #Object. 30988 * 30989 * Like object_get_control_checkstop() but doesn't increase the reference count on the returned object. 30990 * 30991 * <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> 30992 * 30993 * Returns: (transfer none): A #ControlCheckstop or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 30994 */ 30995 ControlCheckstop *object_peek_control_checkstop (Object *object) 30996 { 30997 GDBusInterface *ret; 30998 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop"); 30999 if (ret == NULL) 31000 return NULL; 31001 g_object_unref (ret); 31002 return CONTROL_CHECKSTOP (ret); 31003 } 31004 31005 /** 31006 * object_peek_watchdog: (skip) 31007 * @object: A #Object. 31008 * 31009 * Like object_get_watchdog() but doesn't increase the reference count on the returned object. 31010 * 31011 * <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> 31012 * 31013 * Returns: (transfer none): A #Watchdog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 31014 */ 31015 Watchdog *object_peek_watchdog (Object *object) 31016 { 31017 GDBusInterface *ret; 31018 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); 31019 if (ret == NULL) 31020 return NULL; 31021 g_object_unref (ret); 31022 return WATCHDOG (ret); 31023 } 31024 31025 /** 31026 * object_peek_event_log: (skip) 31027 * @object: A #Object. 31028 * 31029 * Like object_get_event_log() but doesn't increase the reference count on the returned object. 31030 * 31031 * <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> 31032 * 31033 * Returns: (transfer none): A #EventLog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 31034 */ 31035 EventLog *object_peek_event_log (Object *object) 31036 { 31037 GDBusInterface *ret; 31038 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); 31039 if (ret == NULL) 31040 return NULL; 31041 g_object_unref (ret); 31042 return EVENT_LOG (ret); 31043 } 31044 31045 /** 31046 * object_peek_flash: (skip) 31047 * @object: A #Object. 31048 * 31049 * Like object_get_flash() but doesn't increase the reference count on the returned object. 31050 * 31051 * <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> 31052 * 31053 * Returns: (transfer none): A #Flash or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 31054 */ 31055 Flash *object_peek_flash (Object *object) 31056 { 31057 GDBusInterface *ret; 31058 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); 31059 if (ret == NULL) 31060 return NULL; 31061 g_object_unref (ret); 31062 return FLASH (ret); 31063 } 31064 31065 /** 31066 * object_peek_flash_control: (skip) 31067 * @object: A #Object. 31068 * 31069 * Like object_get_flash_control() but doesn't increase the reference count on the returned object. 31070 * 31071 * <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> 31072 * 31073 * Returns: (transfer none): A #FlashControl or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 31074 */ 31075 FlashControl *object_peek_flash_control (Object *object) 31076 { 31077 GDBusInterface *ret; 31078 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); 31079 if (ret == NULL) 31080 return NULL; 31081 g_object_unref (ret); 31082 return FLASH_CONTROL (ret); 31083 } 31084 31085 /** 31086 * object_peek_button: (skip) 31087 * @object: A #Object. 31088 * 31089 * Like object_get_button() but doesn't increase the reference count on the returned object. 31090 * 31091 * <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> 31092 * 31093 * Returns: (transfer none): A #Button or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 31094 */ 31095 Button *object_peek_button (Object *object) 31096 { 31097 GDBusInterface *ret; 31098 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); 31099 if (ret == NULL) 31100 return NULL; 31101 g_object_unref (ret); 31102 return BUTTON (ret); 31103 } 31104 31105 /** 31106 * object_peek_led: (skip) 31107 * @object: A #Object. 31108 * 31109 * Like object_get_led() but doesn't increase the reference count on the returned object. 31110 * 31111 * <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> 31112 * 31113 * 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. 31114 */ 31115 Led *object_peek_led (Object *object) 31116 { 31117 GDBusInterface *ret; 31118 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); 31119 if (ret == NULL) 31120 return NULL; 31121 g_object_unref (ret); 31122 return LED (ret); 31123 } 31124 31125 /** 31126 * object_peek_host_ipmi: (skip) 31127 * @object: A #Object. 31128 * 31129 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object. 31130 * 31131 * <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> 31132 * 31133 * Returns: (transfer none): A #HostIpmi or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. 31134 */ 31135 HostIpmi *object_peek_host_ipmi (Object *object) 31136 { 31137 GDBusInterface *ret; 31138 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); 31139 if (ret == NULL) 31140 return NULL; 31141 g_object_unref (ret); 31142 return HOST_IPMI (ret); 31143 } 31144 31145 31146 static void 31147 object_notify (GDBusObject *object, GDBusInterface *interface) 31148 { 31149 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); 31150 /* info can be NULL if the other end is using a D-Bus interface we don't know 31151 * anything about, for example old generated code in this process talking to 31152 * newer generated code in the other process. */ 31153 if (info != NULL) 31154 g_object_notify (G_OBJECT (object), info->hyphen_name); 31155 } 31156 31157 /** 31158 * ObjectProxy: 31159 * 31160 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. 31161 */ 31162 31163 /** 31164 * ObjectProxyClass: 31165 * @parent_class: The parent class. 31166 * 31167 * Class structure for #ObjectProxy. 31168 */ 31169 31170 static void 31171 object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) 31172 { 31173 } 31174 31175 static void 31176 object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) 31177 { 31178 iface->interface_added = object_notify; 31179 iface->interface_removed = object_notify; 31180 } 31181 31182 31183 G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, 31184 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) 31185 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); 31186 31187 static void 31188 object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) 31189 { 31190 } 31191 31192 static void 31193 object_proxy_set_property (GObject *gobject, 31194 guint prop_id, 31195 const GValue *value G_GNUC_UNUSED, 31196 GParamSpec *pspec) 31197 { 31198 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); 31199 } 31200 31201 static void 31202 object_proxy_get_property (GObject *gobject, 31203 guint prop_id, 31204 GValue *value, 31205 GParamSpec *pspec) 31206 { 31207 ObjectProxy *object = OBJECT_PROXY (gobject); 31208 GDBusInterface *interface; 31209 31210 switch (prop_id) 31211 { 31212 case 1: 31213 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon"); 31214 g_value_take_object (value, interface); 31215 break; 31216 31217 case 2: 31218 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); 31219 g_value_take_object (value, interface); 31220 break; 31221 31222 case 3: 31223 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); 31224 g_value_take_object (value, interface); 31225 break; 31226 31227 case 4: 31228 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); 31229 g_value_take_object (value, interface); 31230 break; 31231 31232 case 5: 31233 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); 31234 g_value_take_object (value, interface); 31235 break; 31236 31237 case 6: 31238 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); 31239 g_value_take_object (value, interface); 31240 break; 31241 31242 case 7: 31243 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); 31244 g_value_take_object (value, interface); 31245 break; 31246 31247 case 8: 31248 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); 31249 g_value_take_object (value, interface); 31250 break; 31251 31252 case 9: 31253 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); 31254 g_value_take_object (value, interface); 31255 break; 31256 31257 case 10: 31258 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); 31259 g_value_take_object (value, interface); 31260 break; 31261 31262 case 11: 31263 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); 31264 g_value_take_object (value, interface); 31265 break; 31266 31267 case 12: 31268 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); 31269 g_value_take_object (value, interface); 31270 break; 31271 31272 case 13: 31273 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop"); 31274 g_value_take_object (value, interface); 31275 break; 31276 31277 case 14: 31278 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); 31279 g_value_take_object (value, interface); 31280 break; 31281 31282 case 15: 31283 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); 31284 g_value_take_object (value, interface); 31285 break; 31286 31287 case 16: 31288 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); 31289 g_value_take_object (value, interface); 31290 break; 31291 31292 case 17: 31293 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); 31294 g_value_take_object (value, interface); 31295 break; 31296 31297 case 18: 31298 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); 31299 g_value_take_object (value, interface); 31300 break; 31301 31302 case 19: 31303 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); 31304 g_value_take_object (value, interface); 31305 break; 31306 31307 case 20: 31308 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); 31309 g_value_take_object (value, interface); 31310 break; 31311 31312 default: 31313 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); 31314 break; 31315 } 31316 } 31317 31318 static void 31319 object_proxy_class_init (ObjectProxyClass *klass) 31320 { 31321 GObjectClass *gobject_class = G_OBJECT_CLASS (klass); 31322 31323 gobject_class->set_property = object_proxy_set_property; 31324 gobject_class->get_property = object_proxy_get_property; 31325 31326 g_object_class_override_property (gobject_class, 1, "hwmon"); 31327 g_object_class_override_property (gobject_class, 2, "fan"); 31328 g_object_class_override_property (gobject_class, 3, "sensor-value"); 31329 g_object_class_override_property (gobject_class, 4, "sensor-threshold"); 31330 g_object_class_override_property (gobject_class, 5, "sensor-i2c"); 31331 g_object_class_override_property (gobject_class, 6, "sensor-match"); 31332 g_object_class_override_property (gobject_class, 7, "process"); 31333 g_object_class_override_property (gobject_class, 8, "shared-resource"); 31334 g_object_class_override_property (gobject_class, 9, "control"); 31335 g_object_class_override_property (gobject_class, 10, "control-bmc"); 31336 g_object_class_override_property (gobject_class, 11, "control-host"); 31337 g_object_class_override_property (gobject_class, 12, "control-power"); 31338 g_object_class_override_property (gobject_class, 13, "control-checkstop"); 31339 g_object_class_override_property (gobject_class, 14, "watchdog"); 31340 g_object_class_override_property (gobject_class, 15, "event-log"); 31341 g_object_class_override_property (gobject_class, 16, "flash"); 31342 g_object_class_override_property (gobject_class, 17, "flash-control"); 31343 g_object_class_override_property (gobject_class, 18, "button"); 31344 g_object_class_override_property (gobject_class, 19, "led"); 31345 g_object_class_override_property (gobject_class, 20, "host-ipmi"); 31346 } 31347 31348 /** 31349 * object_proxy_new: 31350 * @connection: A #GDBusConnection. 31351 * @object_path: An object path. 31352 * 31353 * Creates a new proxy object. 31354 * 31355 * Returns: (transfer full): The proxy object. 31356 */ 31357 ObjectProxy * 31358 object_proxy_new (GDBusConnection *connection, 31359 const gchar *object_path) 31360 { 31361 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); 31362 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); 31363 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); 31364 } 31365 31366 /** 31367 * ObjectSkeleton: 31368 * 31369 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. 31370 */ 31371 31372 /** 31373 * ObjectSkeletonClass: 31374 * @parent_class: The parent class. 31375 * 31376 * Class structure for #ObjectSkeleton. 31377 */ 31378 31379 static void 31380 object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) 31381 { 31382 } 31383 31384 31385 static void 31386 object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) 31387 { 31388 iface->interface_added = object_notify; 31389 iface->interface_removed = object_notify; 31390 } 31391 31392 G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, 31393 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) 31394 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); 31395 31396 static void 31397 object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) 31398 { 31399 } 31400 31401 static void 31402 object_skeleton_set_property (GObject *gobject, 31403 guint prop_id, 31404 const GValue *value, 31405 GParamSpec *pspec) 31406 { 31407 ObjectSkeleton *object = OBJECT_SKELETON (gobject); 31408 GDBusInterfaceSkeleton *interface; 31409 31410 switch (prop_id) 31411 { 31412 case 1: 31413 interface = g_value_get_object (value); 31414 if (interface != NULL) 31415 { 31416 g_warn_if_fail (IS_HWMON (interface)); 31417 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31418 } 31419 else 31420 { 31421 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Hwmon"); 31422 } 31423 break; 31424 31425 case 2: 31426 interface = g_value_get_object (value); 31427 if (interface != NULL) 31428 { 31429 g_warn_if_fail (IS_FAN (interface)); 31430 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31431 } 31432 else 31433 { 31434 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan"); 31435 } 31436 break; 31437 31438 case 3: 31439 interface = g_value_get_object (value); 31440 if (interface != NULL) 31441 { 31442 g_warn_if_fail (IS_SENSOR_VALUE (interface)); 31443 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31444 } 31445 else 31446 { 31447 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue"); 31448 } 31449 break; 31450 31451 case 4: 31452 interface = g_value_get_object (value); 31453 if (interface != NULL) 31454 { 31455 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface)); 31456 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31457 } 31458 else 31459 { 31460 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold"); 31461 } 31462 break; 31463 31464 case 5: 31465 interface = g_value_get_object (value); 31466 if (interface != NULL) 31467 { 31468 g_warn_if_fail (IS_SENSOR_I2C (interface)); 31469 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31470 } 31471 else 31472 { 31473 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c"); 31474 } 31475 break; 31476 31477 case 6: 31478 interface = g_value_get_object (value); 31479 if (interface != NULL) 31480 { 31481 g_warn_if_fail (IS_SENSOR_MATCH (interface)); 31482 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31483 } 31484 else 31485 { 31486 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch"); 31487 } 31488 break; 31489 31490 case 7: 31491 interface = g_value_get_object (value); 31492 if (interface != NULL) 31493 { 31494 g_warn_if_fail (IS_PROCESS (interface)); 31495 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31496 } 31497 else 31498 { 31499 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process"); 31500 } 31501 break; 31502 31503 case 8: 31504 interface = g_value_get_object (value); 31505 if (interface != NULL) 31506 { 31507 g_warn_if_fail (IS_SHARED_RESOURCE (interface)); 31508 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31509 } 31510 else 31511 { 31512 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource"); 31513 } 31514 break; 31515 31516 case 9: 31517 interface = g_value_get_object (value); 31518 if (interface != NULL) 31519 { 31520 g_warn_if_fail (IS_CONTROL (interface)); 31521 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31522 } 31523 else 31524 { 31525 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control"); 31526 } 31527 break; 31528 31529 case 10: 31530 interface = g_value_get_object (value); 31531 if (interface != NULL) 31532 { 31533 g_warn_if_fail (IS_CONTROL_BMC (interface)); 31534 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31535 } 31536 else 31537 { 31538 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc"); 31539 } 31540 break; 31541 31542 case 11: 31543 interface = g_value_get_object (value); 31544 if (interface != NULL) 31545 { 31546 g_warn_if_fail (IS_CONTROL_HOST (interface)); 31547 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31548 } 31549 else 31550 { 31551 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host"); 31552 } 31553 break; 31554 31555 case 12: 31556 interface = g_value_get_object (value); 31557 if (interface != NULL) 31558 { 31559 g_warn_if_fail (IS_CONTROL_POWER (interface)); 31560 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31561 } 31562 else 31563 { 31564 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power"); 31565 } 31566 break; 31567 31568 case 13: 31569 interface = g_value_get_object (value); 31570 if (interface != NULL) 31571 { 31572 g_warn_if_fail (IS_CONTROL_CHECKSTOP (interface)); 31573 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31574 } 31575 else 31576 { 31577 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Checkstop"); 31578 } 31579 break; 31580 31581 case 14: 31582 interface = g_value_get_object (value); 31583 if (interface != NULL) 31584 { 31585 g_warn_if_fail (IS_WATCHDOG (interface)); 31586 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31587 } 31588 else 31589 { 31590 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog"); 31591 } 31592 break; 31593 31594 case 15: 31595 interface = g_value_get_object (value); 31596 if (interface != NULL) 31597 { 31598 g_warn_if_fail (IS_EVENT_LOG (interface)); 31599 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31600 } 31601 else 31602 { 31603 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog"); 31604 } 31605 break; 31606 31607 case 16: 31608 interface = g_value_get_object (value); 31609 if (interface != NULL) 31610 { 31611 g_warn_if_fail (IS_FLASH (interface)); 31612 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31613 } 31614 else 31615 { 31616 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash"); 31617 } 31618 break; 31619 31620 case 17: 31621 interface = g_value_get_object (value); 31622 if (interface != NULL) 31623 { 31624 g_warn_if_fail (IS_FLASH_CONTROL (interface)); 31625 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31626 } 31627 else 31628 { 31629 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl"); 31630 } 31631 break; 31632 31633 case 18: 31634 interface = g_value_get_object (value); 31635 if (interface != NULL) 31636 { 31637 g_warn_if_fail (IS_BUTTON (interface)); 31638 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31639 } 31640 else 31641 { 31642 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button"); 31643 } 31644 break; 31645 31646 case 19: 31647 interface = g_value_get_object (value); 31648 if (interface != NULL) 31649 { 31650 g_warn_if_fail (IS_LED (interface)); 31651 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31652 } 31653 else 31654 { 31655 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led"); 31656 } 31657 break; 31658 31659 case 20: 31660 interface = g_value_get_object (value); 31661 if (interface != NULL) 31662 { 31663 g_warn_if_fail (IS_HOST_IPMI (interface)); 31664 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); 31665 } 31666 else 31667 { 31668 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi"); 31669 } 31670 break; 31671 31672 default: 31673 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); 31674 break; 31675 } 31676 } 31677 31678 static void 31679 object_skeleton_get_property (GObject *gobject, 31680 guint prop_id, 31681 GValue *value, 31682 GParamSpec *pspec) 31683 { 31684 ObjectSkeleton *object = OBJECT_SKELETON (gobject); 31685 GDBusInterface *interface; 31686 31687 switch (prop_id) 31688 { 31689 case 1: 31690 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon"); 31691 g_value_take_object (value, interface); 31692 break; 31693 31694 case 2: 31695 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan"); 31696 g_value_take_object (value, interface); 31697 break; 31698 31699 case 3: 31700 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue"); 31701 g_value_take_object (value, interface); 31702 break; 31703 31704 case 4: 31705 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold"); 31706 g_value_take_object (value, interface); 31707 break; 31708 31709 case 5: 31710 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c"); 31711 g_value_take_object (value, interface); 31712 break; 31713 31714 case 6: 31715 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); 31716 g_value_take_object (value, interface); 31717 break; 31718 31719 case 7: 31720 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process"); 31721 g_value_take_object (value, interface); 31722 break; 31723 31724 case 8: 31725 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource"); 31726 g_value_take_object (value, interface); 31727 break; 31728 31729 case 9: 31730 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control"); 31731 g_value_take_object (value, interface); 31732 break; 31733 31734 case 10: 31735 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc"); 31736 g_value_take_object (value, interface); 31737 break; 31738 31739 case 11: 31740 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host"); 31741 g_value_take_object (value, interface); 31742 break; 31743 31744 case 12: 31745 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power"); 31746 g_value_take_object (value, interface); 31747 break; 31748 31749 case 13: 31750 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop"); 31751 g_value_take_object (value, interface); 31752 break; 31753 31754 case 14: 31755 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); 31756 g_value_take_object (value, interface); 31757 break; 31758 31759 case 15: 31760 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog"); 31761 g_value_take_object (value, interface); 31762 break; 31763 31764 case 16: 31765 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash"); 31766 g_value_take_object (value, interface); 31767 break; 31768 31769 case 17: 31770 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl"); 31771 g_value_take_object (value, interface); 31772 break; 31773 31774 case 18: 31775 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button"); 31776 g_value_take_object (value, interface); 31777 break; 31778 31779 case 19: 31780 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led"); 31781 g_value_take_object (value, interface); 31782 break; 31783 31784 case 20: 31785 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi"); 31786 g_value_take_object (value, interface); 31787 break; 31788 31789 default: 31790 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); 31791 break; 31792 } 31793 } 31794 31795 static void 31796 object_skeleton_class_init (ObjectSkeletonClass *klass) 31797 { 31798 GObjectClass *gobject_class = G_OBJECT_CLASS (klass); 31799 31800 gobject_class->set_property = object_skeleton_set_property; 31801 gobject_class->get_property = object_skeleton_get_property; 31802 31803 g_object_class_override_property (gobject_class, 1, "hwmon"); 31804 g_object_class_override_property (gobject_class, 2, "fan"); 31805 g_object_class_override_property (gobject_class, 3, "sensor-value"); 31806 g_object_class_override_property (gobject_class, 4, "sensor-threshold"); 31807 g_object_class_override_property (gobject_class, 5, "sensor-i2c"); 31808 g_object_class_override_property (gobject_class, 6, "sensor-match"); 31809 g_object_class_override_property (gobject_class, 7, "process"); 31810 g_object_class_override_property (gobject_class, 8, "shared-resource"); 31811 g_object_class_override_property (gobject_class, 9, "control"); 31812 g_object_class_override_property (gobject_class, 10, "control-bmc"); 31813 g_object_class_override_property (gobject_class, 11, "control-host"); 31814 g_object_class_override_property (gobject_class, 12, "control-power"); 31815 g_object_class_override_property (gobject_class, 13, "control-checkstop"); 31816 g_object_class_override_property (gobject_class, 14, "watchdog"); 31817 g_object_class_override_property (gobject_class, 15, "event-log"); 31818 g_object_class_override_property (gobject_class, 16, "flash"); 31819 g_object_class_override_property (gobject_class, 17, "flash-control"); 31820 g_object_class_override_property (gobject_class, 18, "button"); 31821 g_object_class_override_property (gobject_class, 19, "led"); 31822 g_object_class_override_property (gobject_class, 20, "host-ipmi"); 31823 } 31824 31825 /** 31826 * object_skeleton_new: 31827 * @object_path: An object path. 31828 * 31829 * Creates a new skeleton object. 31830 * 31831 * Returns: (transfer full): The skeleton object. 31832 */ 31833 ObjectSkeleton * 31834 object_skeleton_new (const gchar *object_path) 31835 { 31836 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); 31837 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); 31838 } 31839 31840 /** 31841 * object_skeleton_set_hwmon: 31842 * @object: A #ObjectSkeleton. 31843 * @interface_: (allow-none): A #Hwmon or %NULL to clear the interface. 31844 * 31845 * Sets the #Hwmon instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> on @object. 31846 */ 31847 void object_skeleton_set_hwmon (ObjectSkeleton *object, Hwmon *interface_) 31848 { 31849 g_object_set (G_OBJECT (object), "hwmon", interface_, NULL); 31850 } 31851 31852 /** 31853 * object_skeleton_set_fan: 31854 * @object: A #ObjectSkeleton. 31855 * @interface_: (allow-none): A #Fan or %NULL to clear the interface. 31856 * 31857 * Sets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object. 31858 */ 31859 void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_) 31860 { 31861 g_object_set (G_OBJECT (object), "fan", interface_, NULL); 31862 } 31863 31864 /** 31865 * object_skeleton_set_sensor_value: 31866 * @object: A #ObjectSkeleton. 31867 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface. 31868 * 31869 * Sets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object. 31870 */ 31871 void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_) 31872 { 31873 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL); 31874 } 31875 31876 /** 31877 * object_skeleton_set_sensor_threshold: 31878 * @object: A #ObjectSkeleton. 31879 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface. 31880 * 31881 * Sets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object. 31882 */ 31883 void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_) 31884 { 31885 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL); 31886 } 31887 31888 /** 31889 * object_skeleton_set_sensor_i2c: 31890 * @object: A #ObjectSkeleton. 31891 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface. 31892 * 31893 * Sets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object. 31894 */ 31895 void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_) 31896 { 31897 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL); 31898 } 31899 31900 /** 31901 * object_skeleton_set_sensor_match: 31902 * @object: A #ObjectSkeleton. 31903 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface. 31904 * 31905 * Sets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object. 31906 */ 31907 void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_) 31908 { 31909 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL); 31910 } 31911 31912 /** 31913 * object_skeleton_set_process: 31914 * @object: A #ObjectSkeleton. 31915 * @interface_: (allow-none): A #Process or %NULL to clear the interface. 31916 * 31917 * Sets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object. 31918 */ 31919 void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_) 31920 { 31921 g_object_set (G_OBJECT (object), "process", interface_, NULL); 31922 } 31923 31924 /** 31925 * object_skeleton_set_shared_resource: 31926 * @object: A #ObjectSkeleton. 31927 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface. 31928 * 31929 * Sets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object. 31930 */ 31931 void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_) 31932 { 31933 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL); 31934 } 31935 31936 /** 31937 * object_skeleton_set_control: 31938 * @object: A #ObjectSkeleton. 31939 * @interface_: (allow-none): A #Control or %NULL to clear the interface. 31940 * 31941 * Sets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object. 31942 */ 31943 void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_) 31944 { 31945 g_object_set (G_OBJECT (object), "control", interface_, NULL); 31946 } 31947 31948 /** 31949 * object_skeleton_set_control_bmc: 31950 * @object: A #ObjectSkeleton. 31951 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface. 31952 * 31953 * Sets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object. 31954 */ 31955 void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_) 31956 { 31957 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL); 31958 } 31959 31960 /** 31961 * object_skeleton_set_control_host: 31962 * @object: A #ObjectSkeleton. 31963 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface. 31964 * 31965 * Sets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object. 31966 */ 31967 void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_) 31968 { 31969 g_object_set (G_OBJECT (object), "control-host", interface_, NULL); 31970 } 31971 31972 /** 31973 * object_skeleton_set_control_power: 31974 * @object: A #ObjectSkeleton. 31975 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface. 31976 * 31977 * Sets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object. 31978 */ 31979 void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_) 31980 { 31981 g_object_set (G_OBJECT (object), "control-power", interface_, NULL); 31982 } 31983 31984 /** 31985 * object_skeleton_set_control_checkstop: 31986 * @object: A #ObjectSkeleton. 31987 * @interface_: (allow-none): A #ControlCheckstop or %NULL to clear the interface. 31988 * 31989 * Sets the #ControlCheckstop instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> on @object. 31990 */ 31991 void object_skeleton_set_control_checkstop (ObjectSkeleton *object, ControlCheckstop *interface_) 31992 { 31993 g_object_set (G_OBJECT (object), "control-checkstop", interface_, NULL); 31994 } 31995 31996 /** 31997 * object_skeleton_set_watchdog: 31998 * @object: A #ObjectSkeleton. 31999 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface. 32000 * 32001 * Sets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object. 32002 */ 32003 void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_) 32004 { 32005 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL); 32006 } 32007 32008 /** 32009 * object_skeleton_set_event_log: 32010 * @object: A #ObjectSkeleton. 32011 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface. 32012 * 32013 * Sets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object. 32014 */ 32015 void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_) 32016 { 32017 g_object_set (G_OBJECT (object), "event-log", interface_, NULL); 32018 } 32019 32020 /** 32021 * object_skeleton_set_flash: 32022 * @object: A #ObjectSkeleton. 32023 * @interface_: (allow-none): A #Flash or %NULL to clear the interface. 32024 * 32025 * Sets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object. 32026 */ 32027 void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_) 32028 { 32029 g_object_set (G_OBJECT (object), "flash", interface_, NULL); 32030 } 32031 32032 /** 32033 * object_skeleton_set_flash_control: 32034 * @object: A #ObjectSkeleton. 32035 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface. 32036 * 32037 * Sets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object. 32038 */ 32039 void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_) 32040 { 32041 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL); 32042 } 32043 32044 /** 32045 * object_skeleton_set_button: 32046 * @object: A #ObjectSkeleton. 32047 * @interface_: (allow-none): A #Button or %NULL to clear the interface. 32048 * 32049 * Sets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object. 32050 */ 32051 void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_) 32052 { 32053 g_object_set (G_OBJECT (object), "button", interface_, NULL); 32054 } 32055 32056 /** 32057 * object_skeleton_set_led: 32058 * @object: A #ObjectSkeleton. 32059 * @interface_: (allow-none): A #Led or %NULL to clear the interface. 32060 * 32061 * 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. 32062 */ 32063 void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_) 32064 { 32065 g_object_set (G_OBJECT (object), "led", interface_, NULL); 32066 } 32067 32068 /** 32069 * object_skeleton_set_host_ipmi: 32070 * @object: A #ObjectSkeleton. 32071 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface. 32072 * 32073 * Sets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object. 32074 */ 32075 void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_) 32076 { 32077 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL); 32078 } 32079 32080 32081 /* ------------------------------------------------------------------------ 32082 * Code for ObjectManager client 32083 * ------------------------------------------------------------------------ 32084 */ 32085 32086 /** 32087 * SECTION:ObjectManagerClient 32088 * @title: ObjectManagerClient 32089 * @short_description: Generated GDBusObjectManagerClient type 32090 * 32091 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. 32092 */ 32093 32094 /** 32095 * ObjectManagerClient: 32096 * 32097 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. 32098 */ 32099 32100 /** 32101 * ObjectManagerClientClass: 32102 * @parent_class: The parent class. 32103 * 32104 * Class structure for #ObjectManagerClient. 32105 */ 32106 32107 G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); 32108 32109 static void 32110 object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) 32111 { 32112 } 32113 32114 static void 32115 object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) 32116 { 32117 } 32118 32119 /** 32120 * object_manager_client_get_proxy_type: 32121 * @manager: A #GDBusObjectManagerClient. 32122 * @object_path: The object path of the remote object (unused). 32123 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. 32124 * @user_data: User data (unused). 32125 * 32126 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. 32127 * 32128 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. 32129 */ 32130 GType 32131 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) 32132 { 32133 static gsize once_init_value = 0; 32134 static GHashTable *lookup_hash; 32135 GType ret; 32136 32137 if (interface_name == NULL) 32138 return TYPE_OBJECT_PROXY; 32139 if (g_once_init_enter (&once_init_value)) 32140 { 32141 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); 32142 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Hwmon", GSIZE_TO_POINTER (TYPE_HWMON_PROXY)); 32143 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY)); 32144 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY)); 32145 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY)); 32146 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY)); 32147 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY)); 32148 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY)); 32149 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY)); 32150 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY)); 32151 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY)); 32152 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY)); 32153 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY)); 32154 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Checkstop", GSIZE_TO_POINTER (TYPE_CONTROL_CHECKSTOP_PROXY)); 32155 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY)); 32156 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY)); 32157 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY)); 32158 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY)); 32159 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY)); 32160 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY)); 32161 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY)); 32162 g_once_init_leave (&once_init_value, 1); 32163 } 32164 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); 32165 if (ret == (GType) 0) 32166 ret = G_TYPE_DBUS_PROXY; 32167 return ret; 32168 } 32169 32170 /** 32171 * object_manager_client_new: 32172 * @connection: A #GDBusConnection. 32173 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. 32174 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 32175 * @object_path: An object path. 32176 * @cancellable: (allow-none): A #GCancellable or %NULL. 32177 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 32178 * @user_data: User data to pass to @callback. 32179 * 32180 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. 32181 * 32182 * 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. 32183 * You can then call object_manager_client_new_finish() to get the result of the operation. 32184 * 32185 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. 32186 */ 32187 void 32188 object_manager_client_new ( 32189 GDBusConnection *connection, 32190 GDBusObjectManagerClientFlags flags, 32191 const gchar *name, 32192 const gchar *object_path, 32193 GCancellable *cancellable, 32194 GAsyncReadyCallback callback, 32195 gpointer user_data) 32196 { 32197 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); 32198 } 32199 32200 /** 32201 * object_manager_client_new_finish: 32202 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). 32203 * @error: Return location for error or %NULL 32204 * 32205 * Finishes an operation started with object_manager_client_new(). 32206 * 32207 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. 32208 */ 32209 GDBusObjectManager * 32210 object_manager_client_new_finish ( 32211 GAsyncResult *res, 32212 GError **error) 32213 { 32214 GObject *ret; 32215 GObject *source_object; 32216 source_object = g_async_result_get_source_object (res); 32217 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 32218 g_object_unref (source_object); 32219 if (ret != NULL) 32220 return G_DBUS_OBJECT_MANAGER (ret); 32221 else 32222 return NULL; 32223 } 32224 32225 /** 32226 * object_manager_client_new_sync: 32227 * @connection: A #GDBusConnection. 32228 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. 32229 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. 32230 * @object_path: An object path. 32231 * @cancellable: (allow-none): A #GCancellable or %NULL. 32232 * @error: Return location for error or %NULL 32233 * 32234 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. 32235 * 32236 * The calling thread is blocked until a reply is received. 32237 * 32238 * See object_manager_client_new() for the asynchronous version of this constructor. 32239 * 32240 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. 32241 */ 32242 GDBusObjectManager * 32243 object_manager_client_new_sync ( 32244 GDBusConnection *connection, 32245 GDBusObjectManagerClientFlags flags, 32246 const gchar *name, 32247 const gchar *object_path, 32248 GCancellable *cancellable, 32249 GError **error) 32250 { 32251 GInitable *ret; 32252 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); 32253 if (ret != NULL) 32254 return G_DBUS_OBJECT_MANAGER (ret); 32255 else 32256 return NULL; 32257 } 32258 32259 32260 /** 32261 * object_manager_client_new_for_bus: 32262 * @bus_type: A #GBusType. 32263 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. 32264 * @name: A bus name (well-known or unique). 32265 * @object_path: An object path. 32266 * @cancellable: (allow-none): A #GCancellable or %NULL. 32267 * @callback: A #GAsyncReadyCallback to call when the request is satisfied. 32268 * @user_data: User data to pass to @callback. 32269 * 32270 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. 32271 * 32272 * 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. 32273 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. 32274 * 32275 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. 32276 */ 32277 void 32278 object_manager_client_new_for_bus ( 32279 GBusType bus_type, 32280 GDBusObjectManagerClientFlags flags, 32281 const gchar *name, 32282 const gchar *object_path, 32283 GCancellable *cancellable, 32284 GAsyncReadyCallback callback, 32285 gpointer user_data) 32286 { 32287 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); 32288 } 32289 32290 /** 32291 * object_manager_client_new_for_bus_finish: 32292 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). 32293 * @error: Return location for error or %NULL 32294 * 32295 * Finishes an operation started with object_manager_client_new_for_bus(). 32296 * 32297 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. 32298 */ 32299 GDBusObjectManager * 32300 object_manager_client_new_for_bus_finish ( 32301 GAsyncResult *res, 32302 GError **error) 32303 { 32304 GObject *ret; 32305 GObject *source_object; 32306 source_object = g_async_result_get_source_object (res); 32307 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); 32308 g_object_unref (source_object); 32309 if (ret != NULL) 32310 return G_DBUS_OBJECT_MANAGER (ret); 32311 else 32312 return NULL; 32313 } 32314 32315 /** 32316 * object_manager_client_new_for_bus_sync: 32317 * @bus_type: A #GBusType. 32318 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. 32319 * @name: A bus name (well-known or unique). 32320 * @object_path: An object path. 32321 * @cancellable: (allow-none): A #GCancellable or %NULL. 32322 * @error: Return location for error or %NULL 32323 * 32324 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. 32325 * 32326 * The calling thread is blocked until a reply is received. 32327 * 32328 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. 32329 * 32330 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. 32331 */ 32332 GDBusObjectManager * 32333 object_manager_client_new_for_bus_sync ( 32334 GBusType bus_type, 32335 GDBusObjectManagerClientFlags flags, 32336 const gchar *name, 32337 const gchar *object_path, 32338 GCancellable *cancellable, 32339 GError **error) 32340 { 32341 GInitable *ret; 32342 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); 32343 if (ret != NULL) 32344 return G_DBUS_OBJECT_MANAGER (ret); 32345 else 32346 return NULL; 32347 } 32348 32349 32350